@pixerate/editor-react 0.143.0 → 0.144.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -69,6 +69,7 @@ __export(src_exports, {
69
69
  JobProgress: () => JobProgress,
70
70
  LayerEffectsPanel: () => LayerEffectsPanel,
71
71
  LayersPanel: () => LayersPanel,
72
+ MaskEdgeCheck: () => MaskEdgeCheck,
72
73
  MergePreview: () => MergePreview,
73
74
  NameManager: () => NameManager,
74
75
  OutlinePanel: () => OutlinePanel,
@@ -2210,17 +2211,17 @@ var SpreadsheetValidationDialog = ({ prompt, onResolve }) => {
2210
2211
  style === "warning" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mt-2", children: "Continue?" })
2211
2212
  ] })
2212
2213
  ] }),
2213
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "mt-4 flex justify-end gap-2", children: buttons.map((button5, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2214
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "mt-4 flex justify-end gap-2", children: buttons.map((button6, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2214
2215
  "button",
2215
2216
  {
2216
2217
  ref: i === 0 ? firstButton : void 0,
2217
2218
  type: "button",
2218
- "data-action": button5.action,
2219
+ "data-action": button6.action,
2219
2220
  className: `rounded border border-border px-3 py-1 ${i === 0 ? "bg-primary text-primary-foreground" : "hover:bg-muted"}`,
2220
- onClick: () => onResolve(button5.action),
2221
- children: button5.label
2221
+ onClick: () => onResolve(button6.action),
2222
+ children: button6.label
2222
2223
  },
2223
- button5.action
2224
+ button6.action
2224
2225
  )) })
2225
2226
  ]
2226
2227
  }
@@ -4043,8 +4044,8 @@ function useImageEffectsTools(registry, controller, options = {}) {
4043
4044
  }
4044
4045
 
4045
4046
  // src/image-editor/ImageEditor.tsx
4046
- var import_react70 = __toESM(require("react"), 1);
4047
- var import_image_editor23 = require("@pixerate/editor/image-editor");
4047
+ var import_react71 = __toESM(require("react"), 1);
4048
+ var import_image_editor24 = require("@pixerate/editor/image-editor");
4048
4049
 
4049
4050
  // src/image-editor/ImageEditorCanvas.tsx
4050
4051
  var import_react41 = require("react");
@@ -9376,20 +9377,69 @@ var SelectionOptionsBar = ({
9376
9377
  };
9377
9378
 
9378
9379
  // src/image-editor/RefineEdgePanel.tsx
9379
- var import_react64 = require("react");
9380
+ var import_react65 = require("react");
9381
+ var import_image_editor18 = require("@pixerate/editor/image-editor");
9382
+
9383
+ // src/image-editor/MaskEdgeCheck.tsx
9384
+ var import_react64 = __toESM(require("react"), 1);
9380
9385
  var import_image_editor17 = require("@pixerate/editor/image-editor");
9381
9386
  var import_jsx_runtime44 = require("react/jsx-runtime");
9382
- var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
9383
9387
  var button4 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
9384
- var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
9385
- const [params, setParams] = (0, import_react64.useState)(DEFAULT_PARAMS);
9386
- const [busy, setBusy] = (0, import_react64.useState)(false);
9388
+ var MaskEdgeCheck = ({ controller, selection, target = "selection", layerId, className = "" }) => {
9389
+ const sel = selection === void 0 ? controller.getSelection() : selection;
9390
+ const [result, setResult] = (0, import_react64.useState)(null);
9387
9391
  const [error, setError] = (0, import_react64.useState)(null);
9388
- const [layerId, setLayerId] = (0, import_react64.useState)("");
9389
- const [newKind, setNewKind] = (0, import_react64.useState)("hueSaturation");
9390
- const [output, setOutput] = (0, import_react64.useState)("selection");
9391
- const [decontaminate, setDecontaminate] = (0, import_react64.useState)(0);
9392
- const [objectAware, setObjectAware] = (0, import_react64.useState)(false);
9392
+ const report = result && (target !== "selection" || result.for === sel) ? result.report : null;
9393
+ const check = () => {
9394
+ setError(null);
9395
+ try {
9396
+ setResult({ report: controller.inspectMaskEdge(target, { layerId }), for: sel });
9397
+ } catch (err) {
9398
+ setResult(null);
9399
+ setError(err instanceof Error ? err.message : String(err));
9400
+ }
9401
+ };
9402
+ const T = import_image_editor17.MASK_EDGE_THRESHOLDS;
9403
+ const rows = report ? [
9404
+ { label: "Halo", value: report.haloScore, bad: report.haloScore >= T.halo },
9405
+ { label: "Edge alignment", value: report.edgeAlignment, bad: report.edgeAlignment < T.alignment },
9406
+ { label: "Jaggedness", value: report.jaggedness, bad: report.jaggedness >= T.jaggedness },
9407
+ { label: "Soft edge", value: report.softFraction, bad: report.softFraction >= T.soft }
9408
+ ] : [];
9409
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { "data-testid": "mask-edge-check", className: `flex flex-col gap-1.5 text-xs ${className}`, children: [
9410
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("button", { type: "button", className: `${button4} self-start`, disabled: target === "selection" && !sel, onClick: check, children: "Check Edge" }),
9411
+ report && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
9412
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("dl", { className: "grid grid-cols-[1fr_auto] gap-x-2 gap-y-0.5", children: [
9413
+ rows.map((r) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_react64.default.Fragment, { children: [
9414
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("dt", { className: "text-muted-foreground", children: r.label }),
9415
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("dd", { className: `font-mono text-right ${r.bad ? "text-destructive" : "text-foreground"}`, children: r.value })
9416
+ ] }, r.label)),
9417
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("dt", { className: "text-muted-foreground", children: "Holes / islands" }),
9418
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("dd", { className: `font-mono text-right ${report.holes.count || report.islands.count ? "text-destructive" : "text-foreground"}`, children: [
9419
+ report.holes.count,
9420
+ " / ",
9421
+ report.islands.count
9422
+ ] })
9423
+ ] }),
9424
+ report.issues.length ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("ul", { "data-testid": "mask-edge-issues", className: "list-disc pl-4 flex flex-col gap-1 text-foreground", children: report.issues.map((s) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("li", { children: s }, s)) }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { className: "text-muted-foreground", children: "The edge looks clean." })
9425
+ ] }),
9426
+ error && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { role: "alert", className: "text-destructive", children: error })
9427
+ ] });
9428
+ };
9429
+
9430
+ // src/image-editor/RefineEdgePanel.tsx
9431
+ var import_jsx_runtime45 = require("react/jsx-runtime");
9432
+ var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
9433
+ var button5 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
9434
+ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
9435
+ const [params, setParams] = (0, import_react65.useState)(DEFAULT_PARAMS);
9436
+ const [busy, setBusy] = (0, import_react65.useState)(false);
9437
+ const [error, setError] = (0, import_react65.useState)(null);
9438
+ const [layerId, setLayerId] = (0, import_react65.useState)("");
9439
+ const [newKind, setNewKind] = (0, import_react65.useState)("hueSaturation");
9440
+ const [output, setOutput] = (0, import_react65.useState)("selection");
9441
+ const [decontaminate, setDecontaminate] = (0, import_react65.useState)(0);
9442
+ const [objectAware, setObjectAware] = (0, import_react65.useState)(false);
9393
9443
  const canObject = Boolean(controller.segmentationProvider);
9394
9444
  const toLayer = output !== "selection" && output !== "layer-mask";
9395
9445
  const sel = selection === void 0 ? controller.getSelection() : selection;
@@ -9409,17 +9459,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
9409
9459
  setBusy(false);
9410
9460
  }
9411
9461
  };
9412
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
9413
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
9414
- import_image_editor17.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "flex flex-col gap-1", children: [
9415
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
9416
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { children: c.label }),
9417
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "font-mono", children: [
9462
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
9463
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
9464
+ import_image_editor18.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("label", { className: "flex flex-col gap-1", children: [
9465
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
9466
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { children: c.label }),
9467
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { className: "font-mono", children: [
9418
9468
  params[c.id],
9419
9469
  c.unit
9420
9470
  ] })
9421
9471
  ] }),
9422
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
9472
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
9423
9473
  "input",
9424
9474
  {
9425
9475
  type: "range",
@@ -9433,39 +9483,39 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
9433
9483
  }
9434
9484
  )
9435
9485
  ] }, c.id)),
9436
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
9437
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
9486
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
9487
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
9438
9488
  "Smart Radius"
9439
9489
  ] }),
9440
- canObject && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
9441
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
9490
+ canObject && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
9491
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
9442
9492
  "Object aware (segmentation model)"
9443
9493
  ] }),
9444
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
9494
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
9445
9495
  "Output to",
9446
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
9496
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
9447
9497
  "select",
9448
9498
  {
9449
9499
  "aria-label": "Refine output",
9450
9500
  value: output,
9451
9501
  onChange: (e) => setOutput(e.target.value),
9452
9502
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
9453
- children: import_image_editor17.REFINE_OUTPUTS.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("option", { value: o.id, children: o.label }, o.id))
9503
+ children: import_image_editor18.REFINE_OUTPUTS.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("option", { value: o.id, children: o.label }, o.id))
9454
9504
  }
9455
9505
  )
9456
9506
  ] }),
9457
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "flex flex-col gap-1", children: [
9458
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
9459
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { children: [
9507
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("label", { className: "flex flex-col gap-1", children: [
9508
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
9509
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { children: [
9460
9510
  "Decontaminate colors",
9461
9511
  toLayer ? "" : " (new layer or document outputs)"
9462
9512
  ] }),
9463
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "font-mono", children: [
9513
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { className: "font-mono", children: [
9464
9514
  decontaminate,
9465
9515
  "%"
9466
9516
  ] })
9467
9517
  ] }),
9468
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
9518
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
9469
9519
  "input",
9470
9520
  {
9471
9521
  type: "range",
@@ -9480,63 +9530,64 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
9480
9530
  }
9481
9531
  )
9482
9532
  ] }),
9483
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex gap-1", children: [
9484
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("button", { type: "button", className: button4, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
9485
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("button", { type: "button", className: button4, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
9533
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex gap-1", children: [
9534
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("button", { type: "button", className: button5, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
9535
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("button", { type: "button", className: button5, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
9486
9536
  ] }),
9487
- error && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
9488
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
9489
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex gap-1 items-center", children: [
9490
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
9537
+ error && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
9538
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(MaskEdgeCheck, { controller, selection: sel }),
9539
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
9540
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex gap-1 items-center", children: [
9541
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
9491
9542
  "select",
9492
9543
  {
9493
9544
  "aria-label": "New masked layer kind",
9494
9545
  value: newKind,
9495
9546
  onChange: (e) => setNewKind(e.target.value),
9496
9547
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
9497
- children: import_image_editor17.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("option", { value: k.kind, children: k.label }, k.kind))
9548
+ children: import_image_editor18.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("option", { value: k.kind, children: k.label }, k.kind))
9498
9549
  }
9499
9550
  ),
9500
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
9551
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
9501
9552
  "button",
9502
9553
  {
9503
9554
  type: "button",
9504
- className: button4,
9555
+ className: button5,
9505
9556
  disabled: !sel,
9506
- onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: (0, import_image_editor17.layerMaskFromSelection)(sel) })),
9557
+ onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: (0, import_image_editor18.layerMaskFromSelection)(sel) })),
9507
9558
  children: "New Masked Layer"
9508
9559
  }
9509
9560
  )
9510
9561
  ] }),
9511
- list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex flex-col gap-2", children: [
9512
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
9562
+ list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex flex-col gap-2", children: [
9563
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
9513
9564
  "select",
9514
9565
  {
9515
9566
  "aria-label": "Mask layer",
9516
9567
  value: target.id,
9517
9568
  onChange: (e) => setLayerId(e.target.value),
9518
9569
  className: "bg-background border border-border rounded px-1 py-1 text-foreground",
9519
- children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("option", { value: l.id, children: [
9520
- l.name || (0, import_image_editor17.adjustmentKindLabel)(l.kind),
9570
+ children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("option", { value: l.id, children: [
9571
+ l.name || (0, import_image_editor18.adjustmentKindLabel)(l.kind),
9521
9572
  l.mask ? " (masked)" : ""
9522
9573
  ] }, l.id))
9523
9574
  }
9524
9575
  ),
9525
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
9526
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("button", { type: "button", className: button4, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
9527
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("button", { type: "button", className: button4, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
9528
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("button", { type: "button", className: button4, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
9576
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
9577
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("button", { type: "button", className: button5, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
9578
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("button", { type: "button", className: button5, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
9579
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("button", { type: "button", className: button5, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
9529
9580
  ] }),
9530
- target.mask && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
9531
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "flex flex-col gap-1", children: [
9532
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
9533
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { children: "Density" }),
9534
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "font-mono", children: [
9581
+ target.mask && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
9582
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("label", { className: "flex flex-col gap-1", children: [
9583
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
9584
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { children: "Density" }),
9585
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { className: "font-mono", children: [
9535
9586
  Math.round((target.mask.density ?? 1) * 100),
9536
9587
  "%"
9537
9588
  ] })
9538
9589
  ] }),
9539
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
9590
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
9540
9591
  "input",
9541
9592
  {
9542
9593
  type: "range",
@@ -9550,15 +9601,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
9550
9601
  }
9551
9602
  )
9552
9603
  ] }),
9553
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "flex flex-col gap-1", children: [
9554
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
9555
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { children: "Mask Feather" }),
9556
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "font-mono", children: [
9604
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("label", { className: "flex flex-col gap-1", children: [
9605
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
9606
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { children: "Mask Feather" }),
9607
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { className: "font-mono", children: [
9557
9608
  target.mask.feather ?? 0,
9558
9609
  "px"
9559
9610
  ] })
9560
9611
  ] }),
9561
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
9612
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
9562
9613
  "input",
9563
9614
  {
9564
9615
  type: "range",
@@ -9578,32 +9629,32 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
9578
9629
  };
9579
9630
 
9580
9631
  // src/image-editor/ChannelsPanel.tsx
9581
- var import_react65 = require("react");
9582
- var import_image_editor18 = require("@pixerate/editor/image-editor");
9583
- var import_jsx_runtime45 = require("react/jsx-runtime");
9632
+ var import_react66 = require("react");
9633
+ var import_image_editor19 = require("@pixerate/editor/image-editor");
9634
+ var import_jsx_runtime46 = require("react/jsx-runtime");
9584
9635
  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"}`;
9585
9636
  var ChannelThumb = ({ channel, size }) => {
9586
- const ref = (0, import_react65.useRef)(null);
9587
- (0, import_react65.useEffect)(() => {
9637
+ const ref = (0, import_react66.useRef)(null);
9638
+ (0, import_react66.useEffect)(() => {
9588
9639
  const canvas = ref.current;
9589
9640
  const ctx = canvas?.getContext("2d");
9590
9641
  if (!canvas || !ctx || typeof ctx.createImageData !== "function") return;
9591
- const px = (0, import_image_editor18.channelThumbnail)(channel, 64);
9642
+ const px = (0, import_image_editor19.channelThumbnail)(channel, 64);
9592
9643
  canvas.width = px.width;
9593
9644
  canvas.height = px.height;
9594
9645
  const img = ctx.createImageData(px.width, px.height);
9595
9646
  img.data.set(px.data);
9596
9647
  ctx.putImageData(img, 0, 0);
9597
9648
  }, [channel.mask]);
9598
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
9649
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
9599
9650
  };
9600
9651
  var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9601
- const [, setTick] = (0, import_react65.useState)(0);
9602
- (0, import_react65.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
9603
- const [activeId, setActiveId] = (0, import_react65.useState)(null);
9604
- const [renaming, setRenaming] = (0, import_react65.useState)(null);
9605
- const [error, setError] = (0, import_react65.useState)(null);
9606
- const fileInput = (0, import_react65.useRef)(null);
9652
+ const [, setTick] = (0, import_react66.useState)(0);
9653
+ (0, import_react66.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
9654
+ const [activeId, setActiveId] = (0, import_react66.useState)(null);
9655
+ const [renaming, setRenaming] = (0, import_react66.useState)(null);
9656
+ const [error, setError] = (0, import_react66.useState)(null);
9657
+ const fileInput = (0, import_react66.useRef)(null);
9607
9658
  const channels = controller.getChannels();
9608
9659
  const active = channels.find((c) => c.id === activeId) ?? null;
9609
9660
  const hasSelection = Boolean(controller.getSelection());
@@ -9620,18 +9671,18 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9620
9671
  if (!file) return;
9621
9672
  setError(null);
9622
9673
  try {
9623
- setActiveId((await (0, import_image_editor18.openMaskFile)(controller, file)).id);
9674
+ setActiveId((await (0, import_image_editor19.openMaskFile)(controller, file)).id);
9624
9675
  } catch (err) {
9625
9676
  setError(err instanceof Error ? err.message : String(err));
9626
9677
  }
9627
9678
  };
9628
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
9629
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex items-center justify-between", children: [
9630
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: imageSectionTitleClass, children: "Channels" }),
9631
- /* @__PURE__ */ (0, import_jsx_runtime45.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" })
9679
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
9680
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex items-center justify-between", children: [
9681
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: imageSectionTitleClass, children: "Channels" }),
9682
+ /* @__PURE__ */ (0, import_jsx_runtime46.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" })
9632
9683
  ] }),
9633
- channels.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
9634
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
9684
+ channels.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
9685
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
9635
9686
  "li",
9636
9687
  {
9637
9688
  "data-testid": "channel-row",
@@ -9639,11 +9690,11 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9639
9690
  className: `flex items-center gap-1.5 px-1.5 py-1 rounded cursor-pointer select-none ${c.id === activeId ? "bg-primary/30 ring-1 ring-primary" : "hover:bg-muted"}`,
9640
9691
  onClick: (e) => {
9641
9692
  setActiveId(c.id);
9642
- attempt(() => controller.loadSelectionFromChannel(c.id, { mode: (0, import_image_editor18.selectionModeFromModifiers)(e, "replace") }));
9693
+ attempt(() => controller.loadSelectionFromChannel(c.id, { mode: (0, import_image_editor19.selectionModeFromModifiers)(e, "replace") }));
9643
9694
  },
9644
9695
  onDoubleClick: () => setRenaming(c.id),
9645
9696
  children: [
9646
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
9697
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9647
9698
  "button",
9648
9699
  {
9649
9700
  type: "button",
@@ -9657,8 +9708,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9657
9708
  children: c.visible ? "\u25CF" : "\u25CB"
9658
9709
  }
9659
9710
  ),
9660
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(ChannelThumb, { channel: c, size: thumbnailSize }),
9661
- renaming === c.id ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
9711
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ChannelThumb, { channel: c, size: thumbnailSize }),
9712
+ renaming === c.id ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9662
9713
  "input",
9663
9714
  {
9664
9715
  autoFocus: true,
@@ -9675,16 +9726,16 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9675
9726
  if (e.key === "Escape") setRenaming(null);
9676
9727
  }
9677
9728
  }
9678
- ) : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "min-w-0 flex-1 truncate", children: c.name })
9729
+ ) : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "min-w-0 flex-1 truncate", children: c.name })
9679
9730
  ]
9680
9731
  },
9681
9732
  c.id
9682
9733
  )) }),
9683
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
9684
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
9685
- /* @__PURE__ */ (0, import_jsx_runtime45.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" }),
9686
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
9687
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
9734
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
9735
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
9736
+ /* @__PURE__ */ (0, import_jsx_runtime46.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" }),
9737
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
9738
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9688
9739
  "button",
9689
9740
  {
9690
9741
  type: "button",
@@ -9697,24 +9748,24 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9697
9748
  children: "Delete"
9698
9749
  }
9699
9750
  ),
9700
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
9701
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
9751
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
9752
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9702
9753
  "button",
9703
9754
  {
9704
9755
  type: "button",
9705
9756
  className: btn2(),
9706
9757
  disabled: !active && !hasSelection,
9707
9758
  title: active ? "Save the channel as a greyscale PNG" : "Save the selection as a greyscale PNG",
9708
- onClick: () => attempt(() => (0, import_image_editor18.downloadMaskImage)(controller, active ? { channelId: active.id } : "selection", active?.name ?? "selection")),
9759
+ onClick: () => attempt(() => (0, import_image_editor19.downloadMaskImage)(controller, active ? { channelId: active.id } : "selection", active?.name ?? "selection")),
9709
9760
  children: "Export PNG"
9710
9761
  }
9711
9762
  ),
9712
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
9763
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9713
9764
  "input",
9714
9765
  {
9715
9766
  ref: fileInput,
9716
9767
  type: "file",
9717
- accept: import_image_editor18.MASK_FILE_ACCEPT,
9768
+ accept: import_image_editor19.MASK_FILE_ACCEPT,
9718
9769
  hidden: true,
9719
9770
  "data-testid": "channel-import-input",
9720
9771
  onChange: (e) => {
@@ -9724,22 +9775,22 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9724
9775
  }
9725
9776
  )
9726
9777
  ] }),
9727
- error && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { role: "alert", className: "text-destructive", children: error })
9778
+ error && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { role: "alert", className: "text-destructive", children: error })
9728
9779
  ] });
9729
9780
  };
9730
9781
 
9731
9782
  // src/image-editor/PathsPanel.tsx
9732
- var import_react66 = require("react");
9733
- var import_image_editor19 = require("@pixerate/editor/image-editor");
9734
- var import_jsx_runtime46 = require("react/jsx-runtime");
9783
+ var import_react67 = require("react");
9784
+ var import_image_editor20 = require("@pixerate/editor/image-editor");
9785
+ var import_jsx_runtime47 = require("react/jsx-runtime");
9735
9786
  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"}`;
9736
9787
  var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9737
- const [, setTick] = (0, import_react66.useState)(0);
9738
- (0, import_react66.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
9739
- const [renaming, setRenaming] = (0, import_react66.useState)(null);
9740
- const [color, setColor] = (0, import_react66.useState)("#000000");
9741
- const [width, setWidth] = (0, import_react66.useState)(2);
9742
- const [error, setError] = (0, import_react66.useState)(null);
9788
+ const [, setTick] = (0, import_react67.useState)(0);
9789
+ (0, import_react67.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
9790
+ const [renaming, setRenaming] = (0, import_react67.useState)(null);
9791
+ const [color, setColor] = (0, import_react67.useState)("#000000");
9792
+ const [width, setWidth] = (0, import_react67.useState)(2);
9793
+ const [error, setError] = (0, import_react67.useState)(null);
9743
9794
  const paths = controller.getPaths();
9744
9795
  const activeId = controller.getState().activePathId ?? null;
9745
9796
  const active = paths.find((p) => p.id === activeId) ?? null;
@@ -9755,10 +9806,10 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9755
9806
  };
9756
9807
  return (
9757
9808
  // Clicking the panel's empty space deselects the path (the path tools then edit the active layer).
9758
- /* @__PURE__ */ (0, import_jsx_runtime46.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: [
9759
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: imageSectionTitleClass, children: "Paths" }),
9760
- paths.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
9761
- /* @__PURE__ */ (0, import_jsx_runtime46.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_runtime46.jsxs)(
9809
+ /* @__PURE__ */ (0, import_jsx_runtime47.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: [
9810
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: imageSectionTitleClass, children: "Paths" }),
9811
+ paths.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
9812
+ /* @__PURE__ */ (0, import_jsx_runtime47.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_runtime47.jsxs)(
9762
9813
  "li",
9763
9814
  {
9764
9815
  "data-testid": "path-row",
@@ -9767,8 +9818,8 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9767
9818
  onClick: () => attempt(() => controller.setActivePath(p.id)),
9768
9819
  onDoubleClick: () => setRenaming(p.id),
9769
9820
  children: [
9770
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("svg", { "aria-hidden": "true", viewBox: `0 0 ${w || 1} ${h || 1}`, style: { width: thumbnailSize, height: thumbnailSize }, className: "shrink-0 rounded ring-1 ring-border bg-background", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("path", { d: (0, import_image_editor19.pathSvgData)(p), fill: "currentColor", fillOpacity: 0.25, stroke: "currentColor", strokeWidth: Math.max(w, h) / 64, fillRule: p.fillRule ?? "nonzero" }) }),
9771
- renaming === p.id ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9821
+ /* @__PURE__ */ (0, import_jsx_runtime47.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_runtime47.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" }) }),
9822
+ renaming === p.id ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9772
9823
  "input",
9773
9824
  {
9774
9825
  autoFocus: true,
@@ -9787,32 +9838,32 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9787
9838
  if (e.key === "Escape") setRenaming(null);
9788
9839
  }
9789
9840
  }
9790
- ) : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
9841
+ ) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
9791
9842
  ]
9792
9843
  },
9793
9844
  p.id
9794
9845
  )) }),
9795
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
9796
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9846
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
9847
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9797
9848
  "button",
9798
9849
  {
9799
9850
  type: "button",
9800
9851
  className: btn3(),
9801
9852
  disabled: !active,
9802
9853
  title: "Load the path as the selection (Shift adds, Alt subtracts)",
9803
- onClick: (e) => attempt(() => controller.loadPathAsSelection(active.id, { mode: (0, import_image_editor19.selectionModeFromModifiers)(e, "replace") })),
9854
+ onClick: (e) => attempt(() => controller.loadPathAsSelection(active.id, { mode: (0, import_image_editor20.selectionModeFromModifiers)(e, "replace") })),
9804
9855
  children: "Load as Selection"
9805
9856
  }
9806
9857
  ),
9807
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
9808
- active?.work && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
9809
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
9858
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
9859
+ active?.work && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
9860
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
9810
9861
  ] }),
9811
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
9812
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("input", { type: "color", "aria-label": "Path paint colour", value: color, onChange: (e) => setColor(e.target.value), className: "h-6 w-8 bg-background border border-border rounded" }),
9813
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
9814
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
9815
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9862
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
9863
+ /* @__PURE__ */ (0, import_jsx_runtime47.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" }),
9864
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
9865
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
9866
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9816
9867
  "input",
9817
9868
  {
9818
9869
  type: "number",
@@ -9827,25 +9878,25 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9827
9878
  ),
9828
9879
  "px"
9829
9880
  ] }),
9830
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
9881
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
9831
9882
  ] }),
9832
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
9833
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
9834
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
9883
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
9884
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
9885
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
9835
9886
  ] }),
9836
- error && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { role: "alert", className: "text-destructive", children: error })
9887
+ error && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { role: "alert", className: "text-destructive", children: error })
9837
9888
  ] })
9838
9889
  );
9839
9890
  };
9840
9891
 
9841
9892
  // src/image-editor/FreeTransformOptionsBar.tsx
9842
- var import_react67 = require("react");
9843
- var import_image_editor20 = require("@pixerate/editor/image-editor");
9844
- var import_jsx_runtime47 = require("react/jsx-runtime");
9893
+ var import_react68 = require("react");
9894
+ var import_image_editor21 = require("@pixerate/editor/image-editor");
9895
+ var import_jsx_runtime48 = require("react/jsx-runtime");
9845
9896
  var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
9846
9897
  var FreeTransformOptionsBar = ({ tool, className }) => {
9847
- const [, setTick] = (0, import_react67.useState)(0);
9848
- (0, import_react67.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
9898
+ const [, setTick] = (0, import_react68.useState)(0);
9899
+ (0, import_react68.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
9849
9900
  const bar = tool.bar();
9850
9901
  if (!tool.active || !bar) return null;
9851
9902
  const warp = tool.warpBar();
@@ -9857,17 +9908,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
9857
9908
  const v = Number(raw);
9858
9909
  if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
9859
9910
  };
9860
- return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: `flex flex-wrap items-center gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "free-transform-options", role: "toolbar", "aria-label": "Free Transform options", children: [
9861
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor20.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { type: "button", title: m.title, "aria-pressed": tool.mode === m.id, className: imageChipClass(tool.mode === m.id), onClick: () => tool.setMode(m.id), children: m.label }, m.id)) }),
9862
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor20.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { type: "button", "aria-label": `Reference point ${a}`, title: `Reference point: ${a}`, className: "h-2.5 w-2.5 rounded-sm bg-accent hover:bg-primary/90", onClick: () => tool.setReference(a) }, a)) }),
9863
- tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
9864
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1", children: [
9865
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
9866
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: import_image_editor20.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("option", { value: o.id, children: o.label }, o.id)) })
9911
+ return /* @__PURE__ */ (0, import_jsx_runtime48.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: [
9912
+ /* @__PURE__ */ (0, import_jsx_runtime48.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_runtime48.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)) }),
9913
+ /* @__PURE__ */ (0, import_jsx_runtime48.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_runtime48.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)) }),
9914
+ tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
9915
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-1", children: [
9916
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
9917
+ /* @__PURE__ */ (0, import_jsx_runtime48.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_runtime48.jsx)("option", { value: o.id, children: o.label }, o.id)) })
9867
9918
  ] }),
9868
- ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1", children: [
9869
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
9870
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9919
+ ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-1", children: [
9920
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
9921
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
9871
9922
  "input",
9872
9923
  {
9873
9924
  type: "number",
@@ -9888,9 +9939,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
9888
9939
  },
9889
9940
  `${k}:${warp[k]}`
9890
9941
  ),
9891
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-muted-foreground", children: "%" })
9942
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "text-muted-foreground", children: "%" })
9892
9943
  ] }, k)),
9893
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9944
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
9894
9945
  "button",
9895
9946
  {
9896
9947
  type: "button",
@@ -9902,26 +9953,26 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
9902
9953
  children: "Vertical"
9903
9954
  }
9904
9955
  ),
9905
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1", children: [
9906
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
9907
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9956
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-1", children: [
9957
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
9958
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
9908
9959
  "select",
9909
9960
  {
9910
9961
  "aria-label": "Warp grid",
9911
- value: import_image_editor20.WARP_GRID_OPTIONS.find((g) => g.columns === warp.columns && g.rows === warp.rows)?.id ?? "1x1",
9962
+ value: import_image_editor21.WARP_GRID_OPTIONS.find((g) => g.columns === warp.columns && g.rows === warp.rows)?.id ?? "1x1",
9912
9963
  onChange: (e) => {
9913
- const g = import_image_editor20.WARP_GRID_OPTIONS.find((o) => o.id === e.target.value);
9964
+ const g = import_image_editor21.WARP_GRID_OPTIONS.find((o) => o.id === e.target.value);
9914
9965
  tool.setWarp({ columns: g.columns, rows: g.rows });
9915
9966
  },
9916
9967
  className: imageFieldClass,
9917
- children: import_image_editor20.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("option", { value: g.id, children: g.label }, g.id))
9968
+ children: import_image_editor21.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("option", { value: g.id, children: g.label }, g.id))
9918
9969
  }
9919
9970
  )
9920
9971
  ] })
9921
9972
  ] }),
9922
- tool.mode !== "warp" && import_image_editor20.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
9923
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-muted-foreground", children: f.label }),
9924
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9973
+ tool.mode !== "warp" && import_image_editor21.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
9974
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "text-muted-foreground", children: f.label }),
9975
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
9925
9976
  "input",
9926
9977
  {
9927
9978
  type: "number",
@@ -9941,8 +9992,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
9941
9992
  },
9942
9993
  `${f.id}:${round(bar[f.id], f.unit)}`
9943
9994
  ),
9944
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
9945
- f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9995
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
9996
+ f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
9946
9997
  "button",
9947
9998
  {
9948
9999
  type: "button",
@@ -9957,33 +10008,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
9957
10008
  }
9958
10009
  )
9959
10010
  ] }, f.id)),
9960
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1", children: [
9961
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
9962
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
10011
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-1", children: [
10012
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
10013
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
9963
10014
  "select",
9964
10015
  {
9965
10016
  "aria-label": "Interpolation",
9966
10017
  value: tool.interpolation,
9967
10018
  onChange: (e) => tool.setInterpolation(e.target.value),
9968
10019
  className: imageFieldClass,
9969
- children: import_image_editor20.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
10020
+ children: import_image_editor21.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
9970
10021
  }
9971
10022
  )
9972
10023
  ] }),
9973
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { type: "button", title: "Commit (Enter)", className: "px-2 py-1 rounded bg-primary text-primary-foreground hover:bg-primary/90", onClick: () => tool.commit(), children: "Commit" }),
9974
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
9975
- tool.error && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
10024
+ /* @__PURE__ */ (0, import_jsx_runtime48.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" }),
10025
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
10026
+ tool.error && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
9976
10027
  ] });
9977
10028
  };
9978
10029
 
9979
10030
  // src/image-editor/ShapeOptionsBar.tsx
9980
- var import_react68 = require("react");
9981
- var import_image_editor21 = require("@pixerate/editor/image-editor");
9982
- var import_jsx_runtime48 = require("react/jsx-runtime");
10031
+ var import_react69 = require("react");
10032
+ var import_image_editor22 = require("@pixerate/editor/image-editor");
10033
+ var import_jsx_runtime49 = require("react/jsx-runtime");
9983
10034
  var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
9984
- const [, setTick] = (0, import_react68.useState)(0);
9985
- (0, import_react68.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
9986
- const [error, setError] = (0, import_react68.useState)(null);
10035
+ const [, setTick] = (0, import_react69.useState)(0);
10036
+ (0, import_react69.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
10037
+ const [error, setError] = (0, import_react69.useState)(null);
9987
10038
  const active = controller.getActiveLayer();
9988
10039
  const shapeId = active?.type === "shape" ? active.id : null;
9989
10040
  const set = (change) => {
@@ -9991,28 +10042,28 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
9991
10042
  if (!shapeId) return;
9992
10043
  try {
9993
10044
  setError(null);
9994
- (0, import_image_editor21.applyShapeOptions)(controller, shapeId, change);
10045
+ (0, import_image_editor22.applyShapeOptions)(controller, shapeId, change);
9995
10046
  } catch (e) {
9996
10047
  setError(e instanceof Error ? e.message : String(e));
9997
10048
  }
9998
10049
  };
9999
10050
  const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
10000
- return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
10001
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor21.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor21.SHAPE_KIND_LABELS[k] }, k)) }),
10002
- /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
10003
- /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-1", children: [
10004
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
10051
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
10052
+ /* @__PURE__ */ (0, import_jsx_runtime49.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_runtime49.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)) }),
10053
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
10054
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex items-center gap-1", children: [
10055
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
10005
10056
  "Fill",
10006
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
10057
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
10007
10058
  ] }),
10008
- /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-1", children: [
10009
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
10059
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex items-center gap-1", children: [
10060
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
10010
10061
  "Stroke",
10011
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
10062
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
10012
10063
  ] }),
10013
- /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-1", children: [
10064
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex items-center gap-1", children: [
10014
10065
  "Width",
10015
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
10066
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10016
10067
  "input",
10017
10068
  {
10018
10069
  type: "number",
@@ -10026,52 +10077,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
10026
10077
  )
10027
10078
  ] })
10028
10079
  ] }),
10029
- /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
10030
- options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-1", children: [
10080
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
10081
+ options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex items-center gap-1", children: [
10031
10082
  "Radius",
10032
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("input", { type: "number", "aria-label": "Corner radius", min: 0, max: 1e3, value: options.radius, onChange: (e) => set({ radius: num(e.target.value, 0, 1e3) }), className: `w-14 ${imageFieldClass}` })
10083
+ /* @__PURE__ */ (0, import_jsx_runtime49.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}` })
10033
10084
  ] }),
10034
- options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-1", children: [
10085
+ options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex items-center gap-1", children: [
10035
10086
  "Sides",
10036
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("input", { type: "number", "aria-label": "Sides", min: 3, max: 100, value: options.sides, onChange: (e) => set({ sides: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
10087
+ /* @__PURE__ */ (0, import_jsx_runtime49.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}` })
10037
10088
  ] }),
10038
- options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
10039
- /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-1", children: [
10089
+ options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
10090
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex items-center gap-1", children: [
10040
10091
  "Points",
10041
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("input", { type: "number", "aria-label": "Points", min: 3, max: 100, value: options.points, onChange: (e) => set({ points: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
10092
+ /* @__PURE__ */ (0, import_jsx_runtime49.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}` })
10042
10093
  ] }),
10043
- /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-1", children: [
10094
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex items-center gap-1", children: [
10044
10095
  "Inner",
10045
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
10096
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
10046
10097
  ] })
10047
10098
  ] }),
10048
- options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
10049
- /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-1", children: [
10099
+ options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
10100
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex items-center gap-1", children: [
10050
10101
  "Weight",
10051
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("input", { type: "number", "aria-label": "Line weight", min: 1, max: 200, value: options.weight, onChange: (e) => set({ weight: num(e.target.value, 1, 200) }), className: `w-14 ${imageFieldClass}` })
10102
+ /* @__PURE__ */ (0, import_jsx_runtime49.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}` })
10052
10103
  ] }),
10053
- /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-1", children: [
10054
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
10104
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex items-center gap-1", children: [
10105
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
10055
10106
  "Arrowhead"
10056
10107
  ] })
10057
10108
  ] })
10058
10109
  ] }),
10059
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Drag on the image to draw. Shift: square, circle or 45\xB0 line. Alt: from the centre." }),
10060
- error && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { role: "alert", className: "text-destructive", children: error })
10110
+ /* @__PURE__ */ (0, import_jsx_runtime49.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." }),
10111
+ error && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { role: "alert", className: "text-destructive", children: error })
10061
10112
  ] });
10062
10113
  };
10063
10114
 
10064
10115
  // src/image-editor/TypeOptionsBar.tsx
10065
- var import_react69 = require("react");
10066
- var import_image_editor22 = require("@pixerate/editor/image-editor");
10067
- var import_jsx_runtime49 = require("react/jsx-runtime");
10116
+ var import_react70 = require("react");
10117
+ var import_image_editor23 = require("@pixerate/editor/image-editor");
10118
+ var import_jsx_runtime50 = require("react/jsx-runtime");
10068
10119
  var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
10069
10120
  var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
10070
10121
  var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
10071
- const [, setTick] = (0, import_react69.useState)(0);
10072
- (0, import_react69.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
10073
- (0, import_react69.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
10074
- const [error, setError] = (0, import_react69.useState)(null);
10122
+ const [, setTick] = (0, import_react70.useState)(0);
10123
+ (0, import_react70.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
10124
+ (0, import_react70.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
10125
+ const [error, setError] = (0, import_react70.useState)(null);
10075
10126
  const active = controller.getActiveLayer();
10076
10127
  const typeId = !session && active?.type === "type" ? active.id : null;
10077
10128
  const here = session?.alive ? session.styleHere() : {};
@@ -10124,11 +10175,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
10124
10175
  setError(e instanceof Error ? e.message : String(e));
10125
10176
  }
10126
10177
  };
10127
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
10128
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
10129
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex items-center gap-1", children: [
10178
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
10179
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
10180
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("label", { className: "flex items-center gap-1", children: [
10130
10181
  "Font",
10131
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10182
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10132
10183
  "input",
10133
10184
  {
10134
10185
  list: "pixerate-type-fonts",
@@ -10138,11 +10189,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
10138
10189
  className: "w-32 rounded border border-border bg-background px-1 py-0.5"
10139
10190
  }
10140
10191
  ),
10141
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("option", { value: f }, f)) })
10192
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("option", { value: f }, f)) })
10142
10193
  ] }),
10143
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex items-center gap-1", children: [
10194
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("label", { className: "flex items-center gap-1", children: [
10144
10195
  "Size",
10145
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10196
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10146
10197
  "input",
10147
10198
  {
10148
10199
  type: "number",
@@ -10155,14 +10206,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
10155
10206
  }
10156
10207
  )
10157
10208
  ] }),
10158
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", "aria-pressed": shown.fontWeight >= 600, className: `${imageChipClass(shown.fontWeight >= 600)} font-bold`, onClick: () => style({ fontWeight: shown.fontWeight >= 600 ? 400 : 700 }), children: "B" }),
10159
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
10160
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
10209
+ /* @__PURE__ */ (0, import_jsx_runtime50.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" }),
10210
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
10211
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
10161
10212
  ] }),
10162
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor22.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
10163
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
10164
- import_image_editor22.TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
10165
- orientation === "vertical" && editedId && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10213
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor23.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
10214
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
10215
+ import_image_editor23.TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
10216
+ orientation === "vertical" && editedId && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10166
10217
  "button",
10167
10218
  {
10168
10219
  type: "button",
@@ -10174,19 +10225,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
10174
10225
  }
10175
10226
  )
10176
10227
  ] }),
10177
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text (vertical: a column down from the click), drag for a paragraph box, click text to edit it. Esc finishes." }),
10178
- missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
10228
+ /* @__PURE__ */ (0, import_jsx_runtime50.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." }),
10229
+ missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
10179
10230
  "Missing ",
10180
10231
  missing.length === 1 ? "font" : "fonts",
10181
10232
  ": ",
10182
10233
  missing.join(", ")
10183
10234
  ] }),
10184
- error && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { role: "alert", className: "text-destructive", children: error })
10235
+ error && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { role: "alert", className: "text-destructive", children: error })
10185
10236
  ] });
10186
10237
  };
10187
10238
 
10188
10239
  // src/image-editor/ImageEditor.tsx
10189
- var import_jsx_runtime50 = require("react/jsx-runtime");
10240
+ var import_jsx_runtime51 = require("react/jsx-runtime");
10190
10241
  var ImageEditor = ({
10191
10242
  editor: externalEditor,
10192
10243
  src,
@@ -10210,51 +10261,51 @@ var ImageEditor = ({
10210
10261
  const effectsShown = !!controller.effectsProvider || state.layers.some(function has(l) {
10211
10262
  return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
10212
10263
  });
10213
- const legacyProcess = (0, import_image_editor23.normalizeProcessVersion)(state.adjustments.process) < import_image_editor23.LATEST_PROCESS_VERSION;
10214
- const [activeTab, setActiveTab] = (0, import_react70.useState)("crop");
10215
- const rootRef = (0, import_react70.useRef)(null);
10264
+ const legacyProcess = (0, import_image_editor24.normalizeProcessVersion)(state.adjustments.process) < import_image_editor24.LATEST_PROCESS_VERSION;
10265
+ const [activeTab, setActiveTab] = (0, import_react71.useState)("crop");
10266
+ const rootRef = (0, import_react71.useRef)(null);
10216
10267
  const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
10217
- const activeTabRef = (0, import_react70.useRef)(activeTab);
10268
+ const activeTabRef = (0, import_react71.useRef)(activeTab);
10218
10269
  activeTabRef.current = activeTab;
10219
10270
  const openPanel = async (ref) => {
10220
10271
  if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
10221
10272
  rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
10222
10273
  await new Promise((resolve) => setTimeout(resolve, 60));
10223
10274
  };
10224
- const [activeCropRatio, setActiveCropRatio] = (0, import_react70.useState)(null);
10225
- const [selectionOptions, setSelectionOptions] = (0, import_react70.useState)(import_image_editor23.DEFAULT_SELECTION_TOOL_OPTIONS);
10226
- const [shapeOptions, setShapeOptions] = (0, import_react70.useState)(import_image_editor23.DEFAULT_SHAPE_TOOL_OPTIONS);
10227
- const [typeOptions, setTypeOptions] = (0, import_react70.useState)(import_image_editor23.DEFAULT_TYPE_TOOL_OPTIONS);
10228
- const [typeSession, setTypeSession] = (0, import_react70.useState)(null);
10229
- const [selectionError, setSelectionError] = (0, import_react70.useState)(null);
10230
- const [paintError, setPaintError] = (0, import_react70.useState)(null);
10231
- const [shapeTypeError, setShapeTypeError] = (0, import_react70.useState)(null);
10275
+ const [activeCropRatio, setActiveCropRatio] = (0, import_react71.useState)(null);
10276
+ const [selectionOptions, setSelectionOptions] = (0, import_react71.useState)(import_image_editor24.DEFAULT_SELECTION_TOOL_OPTIONS);
10277
+ const [shapeOptions, setShapeOptions] = (0, import_react71.useState)(import_image_editor24.DEFAULT_SHAPE_TOOL_OPTIONS);
10278
+ const [typeOptions, setTypeOptions] = (0, import_react71.useState)(import_image_editor24.DEFAULT_TYPE_TOOL_OPTIONS);
10279
+ const [typeSession, setTypeSession] = (0, import_react71.useState)(null);
10280
+ const [selectionError, setSelectionError] = (0, import_react71.useState)(null);
10281
+ const [paintError, setPaintError] = (0, import_react71.useState)(null);
10282
+ const [shapeTypeError, setShapeTypeError] = (0, import_react71.useState)(null);
10232
10283
  const handleCanvasError = (source, message2) => {
10233
10284
  if (source === "paint") setPaintError(message2);
10234
10285
  else if (source === "select") setSelectionError(message2);
10235
10286
  else setShapeTypeError(message2);
10236
10287
  };
10237
10288
  const finishTyping = () => setTypeSession(null);
10238
- const transformToolRef = (0, import_react70.useRef)(null);
10239
- const transformControllerRef = (0, import_react70.useRef)(controller);
10289
+ const transformToolRef = (0, import_react71.useRef)(null);
10290
+ const transformControllerRef = (0, import_react71.useRef)(controller);
10240
10291
  if (!transformToolRef.current || transformControllerRef.current !== controller) {
10241
10292
  transformToolRef.current?.cancel();
10242
- transformToolRef.current = new import_image_editor23.FreeTransformTool(controller, {
10293
+ transformToolRef.current = new import_image_editor24.FreeTransformTool(controller, {
10243
10294
  schedule: (run) => typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame(run) : run()
10244
10295
  });
10245
10296
  transformControllerRef.current = controller;
10246
10297
  }
10247
10298
  const transformTool = transformToolRef.current;
10248
- const [, setTransformTick] = (0, import_react70.useState)(0);
10249
- (0, import_react70.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
10250
- (0, import_react70.useEffect)(() => () => transformToolRef.current?.cancel(), []);
10251
- const [inpaintPrompt, setInpaintPrompt] = (0, import_react70.useState)("");
10252
- const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react70.useState)("annotations");
10253
- const [isRemovingBg, setIsRemovingBg] = (0, import_react70.useState)(false);
10254
- const [isInpainting, setIsInpainting] = (0, import_react70.useState)(false);
10255
- const [aiError, setAiError] = (0, import_react70.useState)(null);
10256
- const [aiSuccess, setAiSuccess] = (0, import_react70.useState)(null);
10257
- const [aiTarget, setAiTarget] = (0, import_react70.useState)("auto");
10299
+ const [, setTransformTick] = (0, import_react71.useState)(0);
10300
+ (0, import_react71.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
10301
+ (0, import_react71.useEffect)(() => () => transformToolRef.current?.cancel(), []);
10302
+ const [inpaintPrompt, setInpaintPrompt] = (0, import_react71.useState)("");
10303
+ const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react71.useState)("annotations");
10304
+ const [isRemovingBg, setIsRemovingBg] = (0, import_react71.useState)(false);
10305
+ const [isInpainting, setIsInpainting] = (0, import_react71.useState)(false);
10306
+ const [aiError, setAiError] = (0, import_react71.useState)(null);
10307
+ const [aiSuccess, setAiSuccess] = (0, import_react71.useState)(null);
10308
+ const [aiTarget, setAiTarget] = (0, import_react71.useState)("auto");
10258
10309
  const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
10259
10310
  const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
10260
10311
  const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
@@ -10317,11 +10368,11 @@ var ImageEditor = ({
10317
10368
  setIsInpainting(false);
10318
10369
  }
10319
10370
  };
10320
- const [activeColor, setActiveColor] = (0, import_react70.useState)("#ef4444");
10321
- const [strokeWidth, setStrokeWidth] = (0, import_react70.useState)(3);
10322
- const [fontSize, setFontSize] = (0, import_react70.useState)(24);
10323
- const [textInput, setTextInput] = (0, import_react70.useState)("");
10324
- (0, import_react70.useEffect)(() => {
10371
+ const [activeColor, setActiveColor] = (0, import_react71.useState)("#ef4444");
10372
+ const [strokeWidth, setStrokeWidth] = (0, import_react71.useState)(3);
10373
+ const [fontSize, setFontSize] = (0, import_react71.useState)(24);
10374
+ const [textInput, setTextInput] = (0, import_react71.useState)("");
10375
+ (0, import_react71.useEffect)(() => {
10325
10376
  if (activeTab === "crop" && editor.state.activeTool !== "crop") {
10326
10377
  editor.setTool("crop");
10327
10378
  }
@@ -10349,16 +10400,16 @@ var ImageEditor = ({
10349
10400
  link.click();
10350
10401
  }
10351
10402
  };
10352
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
10403
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
10353
10404
  "div",
10354
10405
  {
10355
10406
  ref: rootRef,
10356
10407
  className: `${imageEditorFrameClass} ${className}`,
10357
10408
  style,
10358
10409
  children: [
10359
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: imageEditorHeaderClass, children: [
10360
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
10361
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10410
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: imageEditorHeaderClass, children: [
10411
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
10412
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10362
10413
  "button",
10363
10414
  {
10364
10415
  type: "button",
@@ -10373,7 +10424,7 @@ var ImageEditor = ({
10373
10424
  children: "Transform & Crop"
10374
10425
  }
10375
10426
  ),
10376
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10427
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10377
10428
  "button",
10378
10429
  {
10379
10430
  type: "button",
@@ -10388,7 +10439,7 @@ var ImageEditor = ({
10388
10439
  children: "Adjustments"
10389
10440
  }
10390
10441
  ),
10391
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10442
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10392
10443
  "button",
10393
10444
  {
10394
10445
  type: "button",
@@ -10403,7 +10454,7 @@ var ImageEditor = ({
10403
10454
  children: "Layers"
10404
10455
  }
10405
10456
  ),
10406
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10457
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10407
10458
  "button",
10408
10459
  {
10409
10460
  type: "button",
@@ -10418,7 +10469,7 @@ var ImageEditor = ({
10418
10469
  children: "Paint"
10419
10470
  }
10420
10471
  ),
10421
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10472
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10422
10473
  "button",
10423
10474
  {
10424
10475
  type: "button",
@@ -10433,7 +10484,7 @@ var ImageEditor = ({
10433
10484
  children: "Select & Mask"
10434
10485
  }
10435
10486
  ),
10436
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10487
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10437
10488
  "button",
10438
10489
  {
10439
10490
  type: "button",
@@ -10448,7 +10499,7 @@ var ImageEditor = ({
10448
10499
  children: "Annotations"
10449
10500
  }
10450
10501
  ),
10451
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10502
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10452
10503
  "button",
10453
10504
  {
10454
10505
  type: "button",
@@ -10463,7 +10514,7 @@ var ImageEditor = ({
10463
10514
  children: "Depth Mask"
10464
10515
  }
10465
10516
  ),
10466
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
10517
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
10467
10518
  "button",
10468
10519
  {
10469
10520
  type: "button",
@@ -10476,14 +10527,14 @@ var ImageEditor = ({
10476
10527
  "aria-selected": activeTab === "ai",
10477
10528
  className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
10478
10529
  children: [
10479
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
10530
+ /* @__PURE__ */ (0, import_jsx_runtime51.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_runtime51.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" }) }),
10480
10531
  "AI Tools"
10481
10532
  ]
10482
10533
  }
10483
10534
  )
10484
10535
  ] }),
10485
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
10486
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10536
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
10537
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10487
10538
  "button",
10488
10539
  {
10489
10540
  type: "button",
@@ -10494,7 +10545,7 @@ var ImageEditor = ({
10494
10545
  children: "\u21A9"
10495
10546
  }
10496
10547
  ),
10497
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10548
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10498
10549
  "button",
10499
10550
  {
10500
10551
  type: "button",
@@ -10505,7 +10556,7 @@ var ImageEditor = ({
10505
10556
  children: "\u21AA"
10506
10557
  }
10507
10558
  ),
10508
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10559
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10509
10560
  "button",
10510
10561
  {
10511
10562
  type: "button",
@@ -10514,8 +10565,8 @@ var ImageEditor = ({
10514
10565
  children: "Reset"
10515
10566
  }
10516
10567
  ),
10517
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
10518
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10568
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
10569
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10519
10570
  "button",
10520
10571
  {
10521
10572
  type: "button",
@@ -10525,11 +10576,11 @@ var ImageEditor = ({
10525
10576
  children: "-"
10526
10577
  }
10527
10578
  ),
10528
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
10579
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
10529
10580
  Math.round(state.zoom * 100),
10530
10581
  "%"
10531
10582
  ] }),
10532
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10583
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10533
10584
  "button",
10534
10585
  {
10535
10586
  type: "button",
@@ -10539,8 +10590,8 @@ var ImageEditor = ({
10539
10590
  children: "+"
10540
10591
  }
10541
10592
  ),
10542
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
10543
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10593
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
10594
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10544
10595
  "button",
10545
10596
  {
10546
10597
  type: "button",
@@ -10551,7 +10602,7 @@ var ImageEditor = ({
10551
10602
  children: "Hold Compare"
10552
10603
  }
10553
10604
  ),
10554
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10605
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10555
10606
  "button",
10556
10607
  {
10557
10608
  type: "button",
@@ -10562,10 +10613,10 @@ var ImageEditor = ({
10562
10613
  )
10563
10614
  ] })
10564
10615
  ] }),
10565
- transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
10566
- !transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
10567
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
10568
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10616
+ transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
10617
+ !transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
10618
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
10619
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10569
10620
  ImageEditorCanvas,
10570
10621
  {
10571
10622
  editor,
@@ -10589,11 +10640,11 @@ var ImageEditor = ({
10589
10640
  className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
10590
10641
  }
10591
10642
  ),
10592
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: imageSidebarClass, children: [
10593
- activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
10594
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
10595
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
10596
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10643
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: imageSidebarClass, children: [
10644
+ activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
10645
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
10646
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
10647
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10597
10648
  "button",
10598
10649
  {
10599
10650
  type: "button",
@@ -10605,7 +10656,7 @@ var ImageEditor = ({
10605
10656
  children: "Freeform"
10606
10657
  }
10607
10658
  ),
10608
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10659
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10609
10660
  "button",
10610
10661
  {
10611
10662
  type: "button",
@@ -10617,7 +10668,7 @@ var ImageEditor = ({
10617
10668
  children: "1:1 Square"
10618
10669
  }
10619
10670
  ),
10620
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10671
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10621
10672
  "button",
10622
10673
  {
10623
10674
  type: "button",
@@ -10629,7 +10680,7 @@ var ImageEditor = ({
10629
10680
  children: "4:3 Standard"
10630
10681
  }
10631
10682
  ),
10632
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10683
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10633
10684
  "button",
10634
10685
  {
10635
10686
  type: "button",
@@ -10641,7 +10692,7 @@ var ImageEditor = ({
10641
10692
  children: "16:9 Wide"
10642
10693
  }
10643
10694
  ),
10644
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10695
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10645
10696
  "button",
10646
10697
  {
10647
10698
  type: "button",
@@ -10653,7 +10704,7 @@ var ImageEditor = ({
10653
10704
  children: "3:2 Photo"
10654
10705
  }
10655
10706
  ),
10656
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10707
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10657
10708
  "button",
10658
10709
  {
10659
10710
  type: "button",
@@ -10666,10 +10717,10 @@ var ImageEditor = ({
10666
10717
  }
10667
10718
  )
10668
10719
  ] }),
10669
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: imageDividerClass }),
10670
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
10671
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
10672
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10720
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: imageDividerClass }),
10721
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
10722
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
10723
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10673
10724
  "button",
10674
10725
  {
10675
10726
  type: "button",
@@ -10678,7 +10729,7 @@ var ImageEditor = ({
10678
10729
  children: "Rotate -90\xB0"
10679
10730
  }
10680
10731
  ),
10681
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10732
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10682
10733
  "button",
10683
10734
  {
10684
10735
  type: "button",
@@ -10687,7 +10738,7 @@ var ImageEditor = ({
10687
10738
  children: "Rotate +90\xB0"
10688
10739
  }
10689
10740
  ),
10690
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10741
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10691
10742
  "button",
10692
10743
  {
10693
10744
  type: "button",
@@ -10696,7 +10747,7 @@ var ImageEditor = ({
10696
10747
  children: "Flip Horizontal"
10697
10748
  }
10698
10749
  ),
10699
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10750
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10700
10751
  "button",
10701
10752
  {
10702
10753
  type: "button",
@@ -10707,10 +10758,10 @@ var ImageEditor = ({
10707
10758
  )
10708
10759
  ] })
10709
10760
  ] }),
10710
- activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
10711
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center justify-between", children: [
10712
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
10713
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10761
+ activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
10762
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex items-center justify-between", children: [
10763
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
10764
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10714
10765
  "button",
10715
10766
  {
10716
10767
  type: "button",
@@ -10720,25 +10771,25 @@ var ImageEditor = ({
10720
10771
  }
10721
10772
  )
10722
10773
  ] }),
10723
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Histogram, { histogram: editor.histogram }),
10724
- import_image_editor23.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_react70.default.Fragment, { children: [
10725
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10774
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Histogram, { histogram: editor.histogram }),
10775
+ import_image_editor24.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_react71.default.Fragment, { children: [
10776
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10726
10777
  ControlSlider,
10727
10778
  {
10728
10779
  spec,
10729
- value: (0, import_image_editor23.readAdjustmentControls)(state.adjustments)[spec.id],
10780
+ value: (0, import_image_editor24.readAdjustmentControls)(state.adjustments)[spec.id],
10730
10781
  disabled: spec.requiresProcess !== void 0 && legacyProcess,
10731
10782
  onChange: (v) => editor.setAdjustments({ [spec.id]: v })
10732
10783
  }
10733
10784
  ),
10734
- spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
10785
+ spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
10735
10786
  "div",
10736
10787
  {
10737
10788
  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",
10738
10789
  "data-testid": "image-editor-process-notice",
10739
10790
  children: [
10740
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
10741
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10791
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
10792
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10742
10793
  "button",
10743
10794
  {
10744
10795
  type: "button",
@@ -10751,7 +10802,7 @@ var ImageEditor = ({
10751
10802
  }
10752
10803
  )
10753
10804
  ] }, spec.id)),
10754
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10805
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10755
10806
  AdjustmentLayersPanel,
10756
10807
  {
10757
10808
  controller,
@@ -10760,9 +10811,9 @@ var ImageEditor = ({
10760
10811
  }
10761
10812
  ) })
10762
10813
  ] }),
10763
- activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
10764
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
10765
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10814
+ activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
10815
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
10816
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10766
10817
  "button",
10767
10818
  {
10768
10819
  type: "button",
@@ -10773,15 +10824,15 @@ var ImageEditor = ({
10773
10824
  children: "Free Transform"
10774
10825
  }
10775
10826
  ),
10776
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(LayersPanel, { controller }),
10777
- effectsShown && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
10778
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
10779
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ColorProfilePanel, { controller })
10827
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(LayersPanel, { controller }),
10828
+ effectsShown && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
10829
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
10830
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ColorProfilePanel, { controller })
10780
10831
  ] }),
10781
- activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
10782
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
10783
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(BrushOptionsBar, { controller }),
10784
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10832
+ activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
10833
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
10834
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(BrushOptionsBar, { controller }),
10835
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10785
10836
  "button",
10786
10837
  {
10787
10838
  type: "button",
@@ -10792,29 +10843,29 @@ var ImageEditor = ({
10792
10843
  children: "Free Transform"
10793
10844
  }
10794
10845
  ),
10795
- paintError && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
10796
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(LayersPanel, { controller }) })
10846
+ paintError && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
10847
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(LayersPanel, { controller }) })
10797
10848
  ] }),
10798
- activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
10799
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers, Paths" }),
10800
- /* @__PURE__ */ (0, import_jsx_runtime50.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_runtime50.jsx)(
10849
+ activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
10850
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers, Paths" }),
10851
+ /* @__PURE__ */ (0, import_jsx_runtime51.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_runtime51.jsx)(
10801
10852
  "button",
10802
10853
  {
10803
10854
  type: "button",
10804
10855
  "aria-pressed": state.activeTool === t,
10805
10856
  onClick: () => editor.setTool(t),
10806
10857
  className: `py-1.5 px-2 rounded-lg font-medium border transition-colors ${state.activeTool === t ? "bg-primary border-primary text-primary-foreground" : "bg-muted border-border text-foreground hover:bg-accent"}`,
10807
- children: (0, import_image_editor23.imageToolLabel)(t)
10858
+ children: (0, import_image_editor24.imageToolLabel)(t)
10808
10859
  },
10809
10860
  t
10810
10861
  )) }),
10811
- state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
10812
- state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
10813
- state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("button", { type: "button", onClick: finishTyping, className: "self-start rounded bg-muted px-2 py-1 text-[11px] text-foreground hover:bg-accent", children: "Done editing text" }),
10814
- shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
10815
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: imageDividerClass }),
10816
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
10817
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10862
+ state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
10863
+ state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
10864
+ state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime51.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" }),
10865
+ shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
10866
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: imageDividerClass }),
10867
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
10868
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10818
10869
  "button",
10819
10870
  {
10820
10871
  type: "button",
@@ -10824,18 +10875,18 @@ var ImageEditor = ({
10824
10875
  },
10825
10876
  t
10826
10877
  )) }),
10827
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
10828
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
10829
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
10830
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex-1 ml-2", children: [
10831
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
10832
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: "Width:" }),
10833
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("span", { className: "font-mono", children: [
10878
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
10879
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
10880
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
10881
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex-1 ml-2", children: [
10882
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
10883
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { children: "Width:" }),
10884
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("span", { className: "font-mono", children: [
10834
10885
  strokeWidth,
10835
10886
  "px"
10836
10887
  ] })
10837
10888
  ] }),
10838
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10889
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10839
10890
  "input",
10840
10891
  {
10841
10892
  type: "range",
@@ -10848,10 +10899,10 @@ var ImageEditor = ({
10848
10899
  )
10849
10900
  ] })
10850
10901
  ] }),
10851
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: imageDividerClass }),
10852
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
10853
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex gap-2", children: [
10854
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10902
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: imageDividerClass }),
10903
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
10904
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex gap-2", children: [
10905
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10855
10906
  "input",
10856
10907
  {
10857
10908
  type: "text",
@@ -10862,7 +10913,7 @@ var ImageEditor = ({
10862
10913
  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"
10863
10914
  }
10864
10915
  ),
10865
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10916
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10866
10917
  "button",
10867
10918
  {
10868
10919
  type: "button",
@@ -10872,14 +10923,14 @@ var ImageEditor = ({
10872
10923
  }
10873
10924
  )
10874
10925
  ] }),
10875
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
10876
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: "Font Size:" }),
10877
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("span", { className: "font-mono", children: [
10926
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
10927
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { children: "Font Size:" }),
10928
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("span", { className: "font-mono", children: [
10878
10929
  fontSize,
10879
10930
  "px"
10880
10931
  ] })
10881
10932
  ] }),
10882
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10933
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10883
10934
  "input",
10884
10935
  {
10885
10936
  type: "range",
@@ -10890,14 +10941,14 @@ var ImageEditor = ({
10890
10941
  className: imageRangeClass
10891
10942
  }
10892
10943
  ),
10893
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: imageDividerClass }),
10894
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center justify-between", children: [
10895
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("span", { className: "text-muted-foreground", children: [
10944
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: imageDividerClass }),
10945
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex items-center justify-between", children: [
10946
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("span", { className: "text-muted-foreground", children: [
10896
10947
  "Layers (",
10897
10948
  state.annotations.length,
10898
10949
  ")"
10899
10950
  ] }),
10900
- state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10951
+ state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10901
10952
  "button",
10902
10953
  {
10903
10954
  type: "button",
@@ -10906,7 +10957,7 @@ var ImageEditor = ({
10906
10957
  children: "Delete Selected"
10907
10958
  }
10908
10959
  ),
10909
- state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10960
+ state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10910
10961
  "button",
10911
10962
  {
10912
10963
  type: "button",
@@ -10917,10 +10968,10 @@ var ImageEditor = ({
10917
10968
  )
10918
10969
  ] })
10919
10970
  ] }),
10920
- activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
10921
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center justify-between", children: [
10922
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
10923
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10971
+ activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
10972
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex items-center justify-between", children: [
10973
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
10974
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10924
10975
  "button",
10925
10976
  {
10926
10977
  type: "button",
@@ -10930,8 +10981,8 @@ var ImageEditor = ({
10930
10981
  }
10931
10982
  )
10932
10983
  ] }),
10933
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
10934
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10984
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
10985
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10935
10986
  "input",
10936
10987
  {
10937
10988
  type: "checkbox",
@@ -10940,12 +10991,12 @@ var ImageEditor = ({
10940
10991
  className: "rounded accent-primary"
10941
10992
  }
10942
10993
  ),
10943
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: "Enable Depth / Alpha Mask" })
10994
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { children: "Enable Depth / Alpha Mask" })
10944
10995
  ] }),
10945
- state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
10946
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { children: [
10947
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
10948
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10996
+ state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
10997
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { children: [
10998
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
10999
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10949
11000
  "input",
10950
11001
  {
10951
11002
  type: "text",
@@ -10956,8 +11007,8 @@ var ImageEditor = ({
10956
11007
  }
10957
11008
  )
10958
11009
  ] }),
10959
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex gap-2", children: [
10960
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11010
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex gap-2", children: [
11011
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10961
11012
  "button",
10962
11013
  {
10963
11014
  type: "button",
@@ -10966,7 +11017,7 @@ var ImageEditor = ({
10966
11017
  children: "Threshold Mode"
10967
11018
  }
10968
11019
  ),
10969
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11020
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10970
11021
  "button",
10971
11022
  {
10972
11023
  type: "button",
@@ -10976,12 +11027,12 @@ var ImageEditor = ({
10976
11027
  }
10977
11028
  )
10978
11029
  ] }),
10979
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { children: [
10980
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
10981
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: "Depth Start (Lower):" }),
10982
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
11030
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { children: [
11031
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
11032
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { children: "Depth Start (Lower):" }),
11033
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
10983
11034
  ] }),
10984
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11035
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10985
11036
  "input",
10986
11037
  {
10987
11038
  type: "range",
@@ -10995,12 +11046,12 @@ var ImageEditor = ({
10995
11046
  }
10996
11047
  )
10997
11048
  ] }),
10998
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { children: [
10999
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
11000
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: "Depth Stop (Upper):" }),
11001
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
11049
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { children: [
11050
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
11051
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { children: "Depth Stop (Upper):" }),
11052
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
11002
11053
  ] }),
11003
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11054
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11004
11055
  "input",
11005
11056
  {
11006
11057
  type: "range",
@@ -11014,12 +11065,12 @@ var ImageEditor = ({
11014
11065
  }
11015
11066
  )
11016
11067
  ] }),
11017
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { children: [
11018
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
11019
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: "Softness:" }),
11020
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
11068
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { children: [
11069
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
11070
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { children: "Softness:" }),
11071
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
11021
11072
  ] }),
11022
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11073
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11023
11074
  "input",
11024
11075
  {
11025
11076
  type: "range",
@@ -11031,8 +11082,8 @@ var ImageEditor = ({
11031
11082
  }
11032
11083
  )
11033
11084
  ] }),
11034
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
11035
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11085
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
11086
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11036
11087
  "input",
11037
11088
  {
11038
11089
  type: "checkbox",
@@ -11041,12 +11092,12 @@ var ImageEditor = ({
11041
11092
  className: "rounded accent-primary"
11042
11093
  }
11043
11094
  ),
11044
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: "Invert Mask" })
11095
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { children: "Invert Mask" })
11045
11096
  ] })
11046
11097
  ] })
11047
11098
  ] }),
11048
- activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
11049
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11099
+ activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
11100
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11050
11101
  SelectionOptionsBar,
11051
11102
  {
11052
11103
  controller,
@@ -11057,9 +11108,9 @@ var ImageEditor = ({
11057
11108
  selectionDisplay: state.selectionDisplay
11058
11109
  }
11059
11110
  ),
11060
- selectionError && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
11061
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex gap-1", children: [
11062
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11111
+ selectionError && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
11112
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex gap-1", children: [
11113
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11063
11114
  "button",
11064
11115
  {
11065
11116
  type: "button",
@@ -11070,7 +11121,7 @@ var ImageEditor = ({
11070
11121
  children: "Transform Selection"
11071
11122
  }
11072
11123
  ),
11073
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11124
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11074
11125
  "button",
11075
11126
  {
11076
11127
  type: "button",
@@ -11082,14 +11133,14 @@ var ImageEditor = ({
11082
11133
  }
11083
11134
  )
11084
11135
  ] }),
11085
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
11086
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ChannelsPanel, { controller }),
11087
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(PathsPanel, { controller })
11136
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
11137
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ChannelsPanel, { controller }),
11138
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(PathsPanel, { controller })
11088
11139
  ] }),
11089
- activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
11090
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
11091
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: "Results go to" }),
11092
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
11140
+ activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
11141
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
11142
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { children: "Results go to" }),
11143
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
11093
11144
  "select",
11094
11145
  {
11095
11146
  "aria-label": "AI result target",
@@ -11097,54 +11148,54 @@ var ImageEditor = ({
11097
11148
  onChange: (e) => setAiTarget(e.target.value),
11098
11149
  className: imageSelectClass,
11099
11150
  children: [
11100
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
11101
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
11102
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("option", { value: "replace", children: "Replace image" })
11151
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
11152
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
11153
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("option", { value: "replace", children: "Replace image" })
11103
11154
  ]
11104
11155
  }
11105
11156
  )
11106
11157
  ] }),
11107
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
11108
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center justify-between", children: [
11109
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
11110
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("path", { d: "M6 3v12M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z" }) }),
11158
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
11159
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex items-center justify-between", children: [
11160
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
11161
+ /* @__PURE__ */ (0, import_jsx_runtime51.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_runtime51.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" }) }),
11111
11162
  "Background Removal"
11112
11163
  ] }),
11113
- isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Removing..." })
11164
+ isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime51.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..." })
11114
11165
  ] }),
11115
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
11116
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11166
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
11167
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11117
11168
  "button",
11118
11169
  {
11119
11170
  type: "button",
11120
11171
  onClick: handleRemoveBackground,
11121
11172
  disabled: isRemovingBg || isInpainting,
11122
11173
  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",
11123
- children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
11124
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: imageSpinnerClass }),
11174
+ children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
11175
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: imageSpinnerClass }),
11125
11176
  "Removing Background..."
11126
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
11127
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
11177
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
11178
+ /* @__PURE__ */ (0, import_jsx_runtime51.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_runtime51.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" }) }),
11128
11179
  "Remove Background"
11129
11180
  ] })
11130
11181
  }
11131
11182
  )
11132
11183
  ] }),
11133
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
11134
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center justify-between", children: [
11135
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
11136
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
11137
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("path", { d: "m21.64 3.64-1.28-1.28a1.2 1.2 0 0 0-1.7 0l-9.72 9.72-1.94 4.86 4.86-1.94 9.72-9.72a1.2 1.2 0 0 0 .06-1.64z" }),
11138
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("path", { d: "m14 7 3 3" })
11184
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
11185
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex items-center justify-between", children: [
11186
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
11187
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
11188
+ /* @__PURE__ */ (0, import_jsx_runtime51.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" }),
11189
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("path", { d: "m14 7 3 3" })
11139
11190
  ] }),
11140
11191
  "Generative Inpainting"
11141
11192
  ] }),
11142
- isInpainting && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Inpainting..." })
11193
+ isInpainting && /* @__PURE__ */ (0, import_jsx_runtime51.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..." })
11143
11194
  ] }),
11144
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
11145
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col gap-1", children: [
11146
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
11147
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11195
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
11196
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex flex-col gap-1", children: [
11197
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
11198
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11148
11199
  "textarea",
11149
11200
  {
11150
11201
  id: "ai-inpaint-prompt-react",
@@ -11156,10 +11207,10 @@ var ImageEditor = ({
11156
11207
  }
11157
11208
  )
11158
11209
  ] }),
11159
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col gap-1", children: [
11160
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
11161
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
11162
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
11210
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex flex-col gap-1", children: [
11211
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
11212
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
11213
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
11163
11214
  "button",
11164
11215
  {
11165
11216
  type: "button",
@@ -11172,7 +11223,7 @@ var ImageEditor = ({
11172
11223
  ]
11173
11224
  }
11174
11225
  ),
11175
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
11226
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
11176
11227
  "button",
11177
11228
  {
11178
11229
  type: "button",
@@ -11187,25 +11238,25 @@ var ImageEditor = ({
11187
11238
  )
11188
11239
  ] })
11189
11240
  ] }),
11190
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11241
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11191
11242
  "button",
11192
11243
  {
11193
11244
  type: "button",
11194
11245
  onClick: handleInpaint,
11195
11246
  disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
11196
11247
  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",
11197
- children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
11198
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: imageSpinnerClass }),
11248
+ children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
11249
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: imageSpinnerClass }),
11199
11250
  "Generating Inpaint..."
11200
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
11201
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
11251
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
11252
+ /* @__PURE__ */ (0, import_jsx_runtime51.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_runtime51.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" }) }),
11202
11253
  "Apply Inpainting"
11203
11254
  ] })
11204
11255
  }
11205
11256
  )
11206
11257
  ] }),
11207
- aiError && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
11208
- aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
11258
+ aiError && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
11259
+ aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
11209
11260
  ] })
11210
11261
  ] })
11211
11262
  ] })
@@ -11215,7 +11266,7 @@ var ImageEditor = ({
11215
11266
  };
11216
11267
 
11217
11268
  // src/review/useReview.ts
11218
- var import_react71 = require("react");
11269
+ var import_react72 = require("react");
11219
11270
  var import_editor13 = require("@pixerate/editor");
11220
11271
  var EMPTY_COMMENTS = Object.freeze({
11221
11272
  threads: [],
@@ -11234,23 +11285,23 @@ function isCommentStore(value) {
11234
11285
  }
11235
11286
  function useComments(source) {
11236
11287
  const store = isCommentStore(source) ? source : (0, import_editor13.getCommentStore)(source);
11237
- const subscribe = (0, import_react71.useCallback)(
11288
+ const subscribe = (0, import_react72.useCallback)(
11238
11289
  (onChange) => store ? store.subscribe(() => onChange()) : noopUnsubscribe,
11239
11290
  [store]
11240
11291
  );
11241
11292
  const getSnapshot2 = () => store?.getSnapshot() ?? EMPTY_COMMENTS;
11242
- const snapshot = (0, import_react71.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
11243
- return (0, import_react71.useMemo)(() => ({ ...snapshot, store }), [snapshot, store]);
11293
+ const snapshot = (0, import_react72.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
11294
+ return (0, import_react72.useMemo)(() => ({ ...snapshot, store }), [snapshot, store]);
11244
11295
  }
11245
11296
  function useTrackChanges(editor) {
11246
11297
  const store = (0, import_editor13.getTrackChangesStore)(editor ?? null);
11247
- const subscribe = (0, import_react71.useCallback)(
11298
+ const subscribe = (0, import_react72.useCallback)(
11248
11299
  (onChange) => store ? store.subscribe(() => onChange()) : noopUnsubscribe,
11249
11300
  [store]
11250
11301
  );
11251
11302
  const getSnapshot2 = () => store?.getSnapshot() ?? EMPTY_TRACK_CHANGES;
11252
- const snapshot = (0, import_react71.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
11253
- return (0, import_react71.useMemo)(() => {
11303
+ const snapshot = (0, import_react72.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
11304
+ return (0, import_react72.useMemo)(() => {
11254
11305
  const run = (fn) => () => {
11255
11306
  if (editor && !editor.isDestroyed) fn(editor);
11256
11307
  };
@@ -11273,9 +11324,9 @@ function useTrackChanges(editor) {
11273
11324
  }
11274
11325
 
11275
11326
  // src/review/CommentsPanel.tsx
11276
- var import_react72 = require("react");
11327
+ var import_react73 = require("react");
11277
11328
  var import_editor14 = require("@pixerate/editor");
11278
- var import_jsx_runtime51 = require("react/jsx-runtime");
11329
+ var import_jsx_runtime52 = require("react/jsx-runtime");
11279
11330
  var buttonClass2 = "rounded px-2 py-1 text-xs text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-50";
11280
11331
  var primaryButtonClass = "rounded px-2 py-1 text-xs bg-primary/10 text-primary hover:bg-primary/20 disabled:opacity-50";
11281
11332
  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";
@@ -11289,18 +11340,18 @@ var CommentsPanel = ({
11289
11340
  emptyMessage = "No comments yet. Select text and add a comment."
11290
11341
  }) => {
11291
11342
  const { threads, activeThreadId, store } = useComments(storeProp ?? editor);
11292
- const [showResolved, setShowResolved] = (0, import_react72.useState)(showResolvedInitial);
11343
+ const [showResolved, setShowResolved] = (0, import_react73.useState)(showResolvedInitial);
11293
11344
  const author = authorProp ?? (0, import_editor14.getCommentAuthor)(editor) ?? { id: "anonymous", name: "Anonymous" };
11294
11345
  const visible = threads.filter((t) => showResolved || !t.resolved);
11295
11346
  const resolvedCount = threads.filter((t) => t.resolved).length;
11296
- return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("aside", { className, "aria-label": "Comments", children: [
11297
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
11298
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("span", { className: "text-xs font-medium text-muted-foreground", children: [
11347
+ return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("aside", { className, "aria-label": "Comments", children: [
11348
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
11349
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { className: "text-xs font-medium text-muted-foreground", children: [
11299
11350
  threads.length - resolvedCount,
11300
11351
  " open",
11301
11352
  resolvedCount > 0 ? ` \xB7 ${resolvedCount} resolved` : ""
11302
11353
  ] }),
11303
- resolvedCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11354
+ resolvedCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
11304
11355
  "button",
11305
11356
  {
11306
11357
  type: "button",
@@ -11311,7 +11362,7 @@ var CommentsPanel = ({
11311
11362
  }
11312
11363
  )
11313
11364
  ] }),
11314
- visible.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "text-xs text-muted-foreground", children: emptyMessage }) : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("ul", { className: "flex flex-col gap-2", role: "list", children: visible.map((thread) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11365
+ visible.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { className: "text-xs text-muted-foreground", children: emptyMessage }) : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("ul", { className: "flex flex-col gap-2", role: "list", children: visible.map((thread) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
11315
11366
  CommentThreadCard,
11316
11367
  {
11317
11368
  thread,
@@ -11333,7 +11384,7 @@ var CommentThreadCard = ({
11333
11384
  author,
11334
11385
  formatTime
11335
11386
  }) => {
11336
- const [draft, setDraft] = (0, import_react72.useState)("");
11387
+ const [draft, setDraft] = (0, import_react73.useState)("");
11337
11388
  const isDraft = thread.body === "";
11338
11389
  const quote = thread.anchor?.quote ?? thread.lastQuote ?? "";
11339
11390
  const live = editor && !editor.isDestroyed ? editor : null;
@@ -11359,7 +11410,7 @@ var CommentThreadCard = ({
11359
11410
  setDraft("");
11360
11411
  };
11361
11412
  const stop = (e) => e.stopPropagation();
11362
- return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
11413
+ return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
11363
11414
  "li",
11364
11415
  {
11365
11416
  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" : ""}`,
@@ -11375,24 +11426,24 @@ var CommentThreadCard = ({
11375
11426
  }
11376
11427
  },
11377
11428
  children: [
11378
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex items-baseline justify-between gap-2", children: [
11379
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "font-medium", children: thread.author.name }),
11380
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-xs text-muted-foreground", children: formatTime(thread.createdAt) })
11429
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex items-baseline justify-between gap-2", children: [
11430
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "font-medium", children: thread.author.name }),
11431
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "text-xs text-muted-foreground", children: formatTime(thread.createdAt) })
11381
11432
  ] }),
11382
- quote && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("blockquote", { className: "border-l-2 border-border pl-2 text-xs text-muted-foreground line-clamp-2", children: quote }),
11383
- thread.orphaned && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-xs text-destructive", children: "The commented text was deleted." }),
11384
- thread.resolved && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-xs text-muted-foreground", children: "Resolved" }),
11385
- !isDraft && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "whitespace-pre-wrap break-words", children: thread.body }),
11386
- thread.replies.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("ul", { className: "flex flex-col gap-2 border-l border-border pl-3", role: "list", children: thread.replies.map((reply) => /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("li", { className: "flex flex-col gap-0.5", "data-reply-id": reply.id, children: [
11387
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("span", { className: "text-xs", children: [
11388
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "font-medium", children: reply.author.name }),
11433
+ quote && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("blockquote", { className: "border-l-2 border-border pl-2 text-xs text-muted-foreground line-clamp-2", children: quote }),
11434
+ thread.orphaned && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "text-xs text-destructive", children: "The commented text was deleted." }),
11435
+ thread.resolved && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "text-xs text-muted-foreground", children: "Resolved" }),
11436
+ !isDraft && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { className: "whitespace-pre-wrap break-words", children: thread.body }),
11437
+ thread.replies.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime52.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_runtime52.jsxs)("li", { className: "flex flex-col gap-0.5", "data-reply-id": reply.id, children: [
11438
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { className: "text-xs", children: [
11439
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "font-medium", children: reply.author.name }),
11389
11440
  " ",
11390
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-muted-foreground", children: formatTime(reply.createdAt) })
11441
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "text-muted-foreground", children: formatTime(reply.createdAt) })
11391
11442
  ] }),
11392
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "whitespace-pre-wrap break-words", children: reply.body })
11443
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { className: "whitespace-pre-wrap break-words", children: reply.body })
11393
11444
  ] }, reply.id)) }),
11394
- (active || isDraft) && !thread.resolved && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex flex-col gap-1", onClick: stop, children: [
11395
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11445
+ (active || isDraft) && !thread.resolved && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex flex-col gap-1", onClick: stop, children: [
11446
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
11396
11447
  "textarea",
11397
11448
  {
11398
11449
  className: textareaClass,
@@ -11410,9 +11461,9 @@ var CommentThreadCard = ({
11410
11461
  }
11411
11462
  }
11412
11463
  ),
11413
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex justify-end gap-1", children: [
11414
- isDraft && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("button", { type: "button", className: buttonClass2, onClick: remove, children: "Cancel" }),
11415
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11464
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex justify-end gap-1", children: [
11465
+ isDraft && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("button", { type: "button", className: buttonClass2, onClick: remove, children: "Cancel" }),
11466
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
11416
11467
  "button",
11417
11468
  {
11418
11469
  type: "button",
@@ -11424,9 +11475,9 @@ var CommentThreadCard = ({
11424
11475
  )
11425
11476
  ] })
11426
11477
  ] }),
11427
- !isDraft && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex justify-end gap-1", onClick: stop, children: [
11428
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("button", { type: "button", className: buttonClass2, onClick: () => setResolved(!thread.resolved), children: thread.resolved ? "Reopen" : "Resolve" }),
11429
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11478
+ !isDraft && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex justify-end gap-1", onClick: stop, children: [
11479
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("button", { type: "button", className: buttonClass2, onClick: () => setResolved(!thread.resolved), children: thread.resolved ? "Reopen" : "Resolve" }),
11480
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
11430
11481
  "button",
11431
11482
  {
11432
11483
  type: "button",
@@ -11442,7 +11493,7 @@ var CommentThreadCard = ({
11442
11493
  };
11443
11494
 
11444
11495
  // src/review/ReviewToolbar.tsx
11445
- var import_jsx_runtime52 = require("react/jsx-runtime");
11496
+ var import_jsx_runtime53 = require("react/jsx-runtime");
11446
11497
  var defaultDescriptionClass = "max-w-[16rem] truncate px-1 text-xs text-muted-foreground";
11447
11498
  var buttonClass3 = "rounded px-2 py-1 text-xs text-foreground hover:bg-muted disabled:opacity-40 disabled:hover:bg-transparent";
11448
11499
  var ReviewToolbar = ({
@@ -11455,8 +11506,8 @@ var ReviewToolbar = ({
11455
11506
  const count = review.changes.length;
11456
11507
  const current = review.currentChange;
11457
11508
  const index = current ? review.changes.findIndex((c) => c.id === current.id) + 1 : 0;
11458
- return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className, role: "toolbar", "aria-label": "Review", children: [
11459
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
11509
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className, role: "toolbar", "aria-label": "Review", children: [
11510
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11460
11511
  "button",
11461
11512
  {
11462
11513
  type: "button",
@@ -11467,8 +11518,8 @@ var ReviewToolbar = ({
11467
11518
  children: review.enabled ? "Tracking on" : "Track changes"
11468
11519
  }
11469
11520
  ),
11470
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "mx-1 h-4 w-px bg-border", "aria-hidden": "true" }),
11471
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
11521
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "mx-1 h-4 w-px bg-border", "aria-hidden": "true" }),
11522
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11472
11523
  "button",
11473
11524
  {
11474
11525
  type: "button",
@@ -11479,8 +11530,8 @@ var ReviewToolbar = ({
11479
11530
  children: "\u2039"
11480
11531
  }
11481
11532
  ),
11482
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "min-w-[4rem] text-center text-xs text-muted-foreground", "aria-live": "polite", children: count === 0 ? "No changes" : current ? `${index} of ${count}` : `${count} changes` }),
11483
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
11533
+ /* @__PURE__ */ (0, import_jsx_runtime53.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` }),
11534
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11484
11535
  "button",
11485
11536
  {
11486
11537
  type: "button",
@@ -11491,7 +11542,7 @@ var ReviewToolbar = ({
11491
11542
  children: "\u203A"
11492
11543
  }
11493
11544
  ),
11494
- showDescription && current && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
11545
+ showDescription && current && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
11495
11546
  "span",
11496
11547
  {
11497
11548
  className: descriptionClassName,
@@ -11503,8 +11554,8 @@ var ReviewToolbar = ({
11503
11554
  ]
11504
11555
  }
11505
11556
  ),
11506
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "mx-1 h-4 w-px bg-border", "aria-hidden": "true" }),
11507
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
11557
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "mx-1 h-4 w-px bg-border", "aria-hidden": "true" }),
11558
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11508
11559
  "button",
11509
11560
  {
11510
11561
  type: "button",
@@ -11514,7 +11565,7 @@ var ReviewToolbar = ({
11514
11565
  children: "Accept"
11515
11566
  }
11516
11567
  ),
11517
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
11568
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11518
11569
  "button",
11519
11570
  {
11520
11571
  type: "button",
@@ -11524,18 +11575,18 @@ var ReviewToolbar = ({
11524
11575
  children: "Reject"
11525
11576
  }
11526
11577
  ),
11527
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("button", { type: "button", className: buttonClass3, disabled: count === 0, onClick: review.acceptAll, children: "Accept all" }),
11528
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("button", { type: "button", className: buttonClass3, disabled: count === 0, onClick: review.rejectAll, children: "Reject all" })
11578
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("button", { type: "button", className: buttonClass3, disabled: count === 0, onClick: review.acceptAll, children: "Accept all" }),
11579
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("button", { type: "button", className: buttonClass3, disabled: count === 0, onClick: review.rejectAll, children: "Reject all" })
11529
11580
  ] });
11530
11581
  };
11531
11582
 
11532
11583
  // src/review/CommentButton.tsx
11533
- var import_jsx_runtime53 = require("react/jsx-runtime");
11584
+ var import_jsx_runtime54 = require("react/jsx-runtime");
11534
11585
  var CommentButton = ({
11535
11586
  editor,
11536
11587
  className = "rounded px-2 py-1 text-xs text-popover-foreground hover:bg-muted",
11537
11588
  children = "Comment"
11538
- }) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11589
+ }) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11539
11590
  "button",
11540
11591
  {
11541
11592
  type: "button",
@@ -11547,13 +11598,13 @@ var CommentButton = ({
11547
11598
  );
11548
11599
 
11549
11600
  // src/review/useDocumentCompare.ts
11550
- var import_react73 = require("react");
11601
+ var import_react74 = require("react");
11551
11602
  var import_editor15 = require("@pixerate/editor");
11552
11603
  function useDocumentCompare(editor, options) {
11553
- const [summary, setSummary] = (0, import_react73.useState)(null);
11554
- const defaults = (0, import_react73.useRef)(options);
11604
+ const [summary, setSummary] = (0, import_react74.useState)(null);
11605
+ const defaults = (0, import_react74.useRef)(options);
11555
11606
  defaults.current = options;
11556
- const compare = (0, import_react73.useCallback)(
11607
+ const compare = (0, import_react74.useCallback)(
11557
11608
  (original, revised, overrides) => {
11558
11609
  if (!editor || editor.isDestroyed) return null;
11559
11610
  const result = (0, import_editor15.applyDocumentComparison)(editor, original, revised, {
@@ -11565,13 +11616,13 @@ function useDocumentCompare(editor, options) {
11565
11616
  },
11566
11617
  [editor]
11567
11618
  );
11568
- const clear = (0, import_react73.useCallback)(() => setSummary(null), []);
11569
- return (0, import_react73.useMemo)(() => ({ summary, compare, clear }), [summary, compare, clear]);
11619
+ const clear = (0, import_react74.useCallback)(() => setSummary(null), []);
11620
+ return (0, import_react74.useMemo)(() => ({ summary, compare, clear }), [summary, compare, clear]);
11570
11621
  }
11571
11622
 
11572
11623
  // src/review/TrackedChangesList.tsx
11573
11624
  var import_editor16 = require("@pixerate/editor");
11574
- var import_jsx_runtime54 = require("react/jsx-runtime");
11625
+ var import_jsx_runtime55 = require("react/jsx-runtime");
11575
11626
  var buttonClass4 = "rounded px-1.5 py-0.5 text-xs text-foreground hover:bg-muted disabled:opacity-40";
11576
11627
  var TrackedChangesList = ({
11577
11628
  editor,
@@ -11582,18 +11633,18 @@ var TrackedChangesList = ({
11582
11633
  }) => {
11583
11634
  const review = useTrackChanges(editor);
11584
11635
  if (review.changes.length === 0) {
11585
- return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className, "data-tracked-changes-list": "", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "pixerate-changes-empty text-xs text-muted-foreground", children: emptyState }) });
11636
+ return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className, "data-tracked-changes-list": "", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "pixerate-changes-empty text-xs text-muted-foreground", children: emptyState }) });
11586
11637
  }
11587
- return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("ul", { className, role: "list", "aria-label": "Tracked changes", "data-tracked-changes-list": "", children: review.changes.map((change) => {
11638
+ return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("ul", { className, role: "list", "aria-label": "Tracked changes", "data-tracked-changes-list": "", children: review.changes.map((change) => {
11588
11639
  const active = change.id === review.currentChangeId;
11589
- return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
11640
+ return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
11590
11641
  "li",
11591
11642
  {
11592
11643
  className: active ? `${itemClassName} ${activeItemClassName}` : itemClassName,
11593
11644
  "data-change-type": change.type,
11594
11645
  "data-change-id": change.id,
11595
11646
  children: [
11596
- /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
11647
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
11597
11648
  "button",
11598
11649
  {
11599
11650
  type: "button",
@@ -11601,14 +11652,14 @@ var TrackedChangesList = ({
11601
11652
  title: `${change.author.name}: ${change.description}`,
11602
11653
  onClick: () => review.select(change.id),
11603
11654
  children: [
11604
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "font-medium", children: (0, import_editor16.trackedChangeLabel)(change) }),
11655
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "font-medium", children: (0, import_editor16.trackedChangeLabel)(change) }),
11605
11656
  change.author.name ? ` \xB7 ${change.author.name}` : "",
11606
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "block truncate text-muted-foreground", children: change.description })
11657
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "block truncate text-muted-foreground", children: change.description })
11607
11658
  ]
11608
11659
  }
11609
11660
  ),
11610
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("button", { type: "button", className: buttonClass4, onClick: () => review.accept(change.id), children: "Accept" }),
11611
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("button", { type: "button", className: buttonClass4, onClick: () => review.reject(change.id), children: "Reject" })
11661
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("button", { type: "button", className: buttonClass4, onClick: () => review.accept(change.id), children: "Accept" }),
11662
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("button", { type: "button", className: buttonClass4, onClick: () => review.reject(change.id), children: "Reject" })
11612
11663
  ]
11613
11664
  },
11614
11665
  `${change.type}:${change.id}`
@@ -11617,12 +11668,12 @@ var TrackedChangesList = ({
11617
11668
  };
11618
11669
 
11619
11670
  // src/commands/useCommandPalette.ts
11620
- var import_react74 = require("react");
11671
+ var import_react75 = require("react");
11621
11672
  var import_commands2 = require("@pixerate/editor/commands");
11622
11673
  function useCommandPalette(registry, options = {}) {
11623
- const optionsRef = (0, import_react74.useRef)(options);
11674
+ const optionsRef = (0, import_react75.useRef)(options);
11624
11675
  optionsRef.current = options;
11625
- const controller = (0, import_react74.useMemo)(
11676
+ const controller = (0, import_react75.useMemo)(
11626
11677
  () => (0, import_commands2.createCommandPaletteController)(registry, {
11627
11678
  context: () => {
11628
11679
  const c = optionsRef.current.context;
@@ -11643,9 +11694,9 @@ function useCommandPalette(registry, options = {}) {
11643
11694
  // eslint-disable-next-line react-hooks/exhaustive-deps
11644
11695
  [registry]
11645
11696
  );
11646
- const state = (0, import_react74.useSyncExternalStore)(controller.subscribe, controller.getState, controller.getState);
11697
+ const state = (0, import_react75.useSyncExternalStore)(controller.subscribe, controller.getState, controller.getState);
11647
11698
  const { hotkey, hotkeyTarget } = options;
11648
- (0, import_react74.useEffect)(() => {
11699
+ (0, import_react75.useEffect)(() => {
11649
11700
  if (!hotkey) return;
11650
11701
  const target = hotkeyTarget ?? (typeof window !== "undefined" ? window : null);
11651
11702
  if (!target) return;
@@ -11673,13 +11724,13 @@ function useCommandPalette(registry, options = {}) {
11673
11724
  }
11674
11725
 
11675
11726
  // src/commands/CommandPalette.tsx
11676
- var import_react75 = __toESM(require("react"), 1);
11677
- var import_jsx_runtime55 = require("react/jsx-runtime");
11727
+ var import_react76 = __toESM(require("react"), 1);
11728
+ var import_jsx_runtime56 = require("react/jsx-runtime");
11678
11729
  function HighlightedLabel({ item }) {
11679
- if (item.labelIndices.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_jsx_runtime55.Fragment, { children: item.label });
11730
+ if (item.labelIndices.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, { children: item.label });
11680
11731
  const marked = new Set(item.labelIndices);
11681
- return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_jsx_runtime55.Fragment, { children: Array.from(item.label).map(
11682
- (ch, i) => marked.has(i) ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "font-semibold text-foreground", "data-match": "", children: ch }, i) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react75.default.Fragment, { children: ch }, i)
11732
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, { children: Array.from(item.label).map(
11733
+ (ch, i) => marked.has(i) ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "font-semibold text-foreground", "data-match": "", children: ch }, i) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react76.default.Fragment, { children: ch }, i)
11683
11734
  ) });
11684
11735
  }
11685
11736
  var CommandPalette = ({
@@ -11688,22 +11739,22 @@ var CommandPalette = ({
11688
11739
  emptyMessage = "No matching commands",
11689
11740
  className = ""
11690
11741
  }) => {
11691
- const inputRef = (0, import_react75.useRef)(null);
11692
- const listRef = (0, import_react75.useRef)(null);
11693
- const baseId = (0, import_react75.useId)();
11742
+ const inputRef = (0, import_react76.useRef)(null);
11743
+ const listRef = (0, import_react76.useRef)(null);
11744
+ const baseId = (0, import_react76.useId)();
11694
11745
  const listId = `${baseId}-list`;
11695
11746
  const optionId = (index) => `${baseId}-option-${index}`;
11696
11747
  const { open, query, items, activeIndex } = palette;
11697
- (0, import_react75.useEffect)(() => {
11748
+ (0, import_react76.useEffect)(() => {
11698
11749
  if (open) inputRef.current?.focus();
11699
11750
  }, [open]);
11700
- (0, import_react75.useEffect)(() => {
11751
+ (0, import_react76.useEffect)(() => {
11701
11752
  if (!open) return;
11702
11753
  const active = listRef.current?.querySelector('[aria-selected="true"]');
11703
11754
  active?.scrollIntoView?.({ block: "nearest" });
11704
11755
  }, [open, activeIndex]);
11705
11756
  if (!open) return null;
11706
- return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
11757
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
11707
11758
  "div",
11708
11759
  {
11709
11760
  className: "fixed inset-0 z-50 flex items-start justify-center bg-black/30 px-4 pt-[15vh]",
@@ -11711,7 +11762,7 @@ var CommandPalette = ({
11711
11762
  onMouseDown: (e) => {
11712
11763
  if (e.target === e.currentTarget) palette.setOpen(false);
11713
11764
  },
11714
- children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
11765
+ children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
11715
11766
  "div",
11716
11767
  {
11717
11768
  role: "dialog",
@@ -11720,7 +11771,7 @@ var CommandPalette = ({
11720
11771
  className: `w-full max-w-lg overflow-hidden rounded-lg border border-border bg-popover text-popover-foreground shadow-xl ${className}`,
11721
11772
  style: { background: "var(--popover, var(--background, #fff))" },
11722
11773
  children: [
11723
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
11774
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
11724
11775
  "input",
11725
11776
  {
11726
11777
  ref: inputRef,
@@ -11740,7 +11791,7 @@ var CommandPalette = ({
11740
11791
  className: "w-full border-b border-border bg-transparent px-3 py-2 text-sm outline-none placeholder:text-muted-foreground"
11741
11792
  }
11742
11793
  ),
11743
- items.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "px-3 py-6 text-center text-sm text-muted-foreground", children: emptyMessage }) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("ul", { ref: listRef, id: listId, role: "listbox", "aria-label": "Commands", className: "max-h-80 overflow-y-auto py-1", children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
11794
+ items.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "px-3 py-6 text-center text-sm text-muted-foreground", children: emptyMessage }) : /* @__PURE__ */ (0, import_jsx_runtime56.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_runtime56.jsxs)(
11744
11795
  "li",
11745
11796
  {
11746
11797
  id: optionId(index),
@@ -11755,12 +11806,12 @@ var CommandPalette = ({
11755
11806
  onClick: () => palette.run(item.id),
11756
11807
  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"}`,
11757
11808
  children: [
11758
- /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: "min-w-0 flex-1 truncate", children: [
11759
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(HighlightedLabel, { item }),
11760
- item.disabledReason && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "ml-2 text-xs text-muted-foreground", "data-disabled-reason": "", children: item.disabledReason })
11809
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("span", { className: "min-w-0 flex-1 truncate", children: [
11810
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(HighlightedLabel, { item }),
11811
+ item.disabledReason && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "ml-2 text-xs text-muted-foreground", "data-disabled-reason": "", children: item.disabledReason })
11761
11812
  ] }),
11762
- item.group && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "shrink-0 text-xs text-muted-foreground", children: item.group }),
11763
- item.shortcut && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("kbd", { className: "shrink-0 rounded border border-border px-1.5 font-mono text-[10px] text-muted-foreground", children: item.shortcut })
11813
+ item.group && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "shrink-0 text-xs text-muted-foreground", children: item.group }),
11814
+ item.shortcut && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("kbd", { className: "shrink-0 rounded border border-border px-1.5 font-mono text-[10px] text-muted-foreground", children: item.shortcut })
11764
11815
  ]
11765
11816
  },
11766
11817
  item.id
@@ -11773,12 +11824,12 @@ var CommandPalette = ({
11773
11824
  };
11774
11825
 
11775
11826
  // src/commands/useCommandShortcuts.ts
11776
- var import_react76 = require("react");
11827
+ var import_react77 = require("react");
11777
11828
  function useCommandShortcuts(registry, options = {}) {
11778
- const optionsRef = (0, import_react76.useRef)(options);
11829
+ const optionsRef = (0, import_react77.useRef)(options);
11779
11830
  optionsRef.current = options;
11780
11831
  const { enabled = true, target } = options;
11781
- (0, import_react76.useEffect)(() => {
11832
+ (0, import_react77.useEffect)(() => {
11782
11833
  if (!registry || !enabled) return;
11783
11834
  const eventTarget = target ?? (typeof window !== "undefined" ? window : null);
11784
11835
  if (!eventTarget) return;
@@ -11796,14 +11847,14 @@ function useCommandShortcuts(registry, options = {}) {
11796
11847
  }, [registry, enabled, target]);
11797
11848
  }
11798
11849
  function useRegisterCommands(registry, specs) {
11799
- (0, import_react76.useEffect)(() => {
11850
+ (0, import_react77.useEffect)(() => {
11800
11851
  if (!registry || !specs || specs.length === 0) return;
11801
11852
  return registry.register(specs);
11802
11853
  }, [registry, specs]);
11803
11854
  }
11804
11855
 
11805
11856
  // src/persistence/useAutosave.ts
11806
- var import_react77 = require("react");
11857
+ var import_react78 = require("react");
11807
11858
  var import_persistence = require("@pixerate/editor/persistence");
11808
11859
  var IDLE = {
11809
11860
  status: "idle",
@@ -11814,18 +11865,18 @@ var IDLE = {
11814
11865
  ready: false
11815
11866
  };
11816
11867
  function useAutosave(options) {
11817
- const optionsRef = (0, import_react77.useRef)(options);
11868
+ const optionsRef = (0, import_react78.useRef)(options);
11818
11869
  optionsRef.current = options;
11819
11870
  const { storage, key, history, dirty } = options;
11820
11871
  const recover = options.recover !== false;
11821
11872
  const flushOnHide = options.flushOnHide !== false;
11822
11873
  const ready = options.ready !== false;
11823
- const [controller, setController] = (0, import_react77.useState)(null);
11824
- const [status, setStatus] = (0, import_react77.useState)(IDLE);
11825
- const [recovery, setRecovery] = (0, import_react77.useState)(null);
11826
- const [pendingRecovery, setPendingRecovery] = (0, import_react77.useState)(recover);
11827
- const revisionsRef = (0, import_react77.useRef)(null);
11828
- (0, import_react77.useEffect)(() => {
11874
+ const [controller, setController] = (0, import_react78.useState)(null);
11875
+ const [status, setStatus] = (0, import_react78.useState)(IDLE);
11876
+ const [recovery, setRecovery] = (0, import_react78.useState)(null);
11877
+ const [pendingRecovery, setPendingRecovery] = (0, import_react78.useState)(recover);
11878
+ const revisionsRef = (0, import_react78.useRef)(null);
11879
+ (0, import_react78.useEffect)(() => {
11829
11880
  const revisions = (0, import_persistence.createRevisionTracker)({ history, dirty });
11830
11881
  const o = optionsRef.current;
11831
11882
  const instance = (0, import_persistence.createAutosaveController)({
@@ -11868,10 +11919,10 @@ function useAutosave(options) {
11868
11919
  if (revisionsRef.current === revisions) revisionsRef.current = null;
11869
11920
  };
11870
11921
  }, [storage, key, history, dirty, recover]);
11871
- (0, import_react77.useEffect)(() => {
11922
+ (0, import_react78.useEffect)(() => {
11872
11923
  if (controller && ready && !pendingRecovery) controller.ready();
11873
11924
  }, [controller, ready, pendingRecovery]);
11874
- (0, import_react77.useEffect)(() => {
11925
+ (0, import_react78.useEffect)(() => {
11875
11926
  if (!controller || !flushOnHide || typeof window === "undefined") return;
11876
11927
  const flush = () => void controller.flushNow();
11877
11928
  const onVisibility = () => {
@@ -11884,33 +11935,33 @@ function useAutosave(options) {
11884
11935
  document.removeEventListener("visibilitychange", onVisibility);
11885
11936
  };
11886
11937
  }, [controller, flushOnHide]);
11887
- const restore = (0, import_react77.useCallback)(() => {
11938
+ const restore = (0, import_react78.useCallback)(() => {
11888
11939
  const snapshot = recovery?.snapshot;
11889
11940
  setRecovery(null);
11890
11941
  setPendingRecovery(false);
11891
11942
  return snapshot;
11892
11943
  }, [recovery]);
11893
- const discard = (0, import_react77.useCallback)(async () => {
11944
+ const discard = (0, import_react78.useCallback)(async () => {
11894
11945
  if (controller) await controller.discardRecovery();
11895
11946
  setRecovery(null);
11896
11947
  setPendingRecovery(false);
11897
11948
  }, [controller]);
11898
- const flushNow = (0, import_react77.useCallback)(async () => {
11949
+ const flushNow = (0, import_react78.useCallback)(async () => {
11899
11950
  await controller?.flushNow();
11900
11951
  }, [controller]);
11901
- const markClean = (0, import_react77.useCallback)(async () => {
11952
+ const markClean = (0, import_react78.useCallback)(async () => {
11902
11953
  revisionsRef.current?.markSaved();
11903
11954
  await controller?.markClean();
11904
11955
  }, [controller]);
11905
- const notifyChange = (0, import_react77.useCallback)(() => revisionsRef.current?.bump(), []);
11956
+ const notifyChange = (0, import_react78.useCallback)(() => revisionsRef.current?.bump(), []);
11906
11957
  return { status, recovery, pendingRecovery, restore, discard, flushNow, markClean, notifyChange, controller };
11907
11958
  }
11908
11959
 
11909
11960
  // src/persistence/useEditorAutosave.ts
11910
- var import_react78 = require("react");
11961
+ var import_react79 = require("react");
11911
11962
  var import_persistence2 = require("@pixerate/editor/persistence");
11912
11963
  function useEditorAutosave(doc, { collectAssetGarbage, ...options }) {
11913
- const storage = (0, import_react78.useMemo)(
11964
+ const storage = (0, import_react79.useMemo)(
11914
11965
  () => doc.assets ? (0, import_persistence2.withEditorAssets)(options.storage, doc.assets) : options.storage,
11915
11966
  [options.storage, doc.assets]
11916
11967
  );
@@ -11923,19 +11974,19 @@ function useEditorAutosave(doc, { collectAssetGarbage, ...options }) {
11923
11974
  history: doc
11924
11975
  });
11925
11976
  const take = autosave.restore;
11926
- const restore = (0, import_react78.useCallback)(() => {
11977
+ const restore = (0, import_react79.useCallback)(() => {
11927
11978
  const snapshot = take();
11928
11979
  return snapshot ? doc.loadDocument(snapshot, { history: "reset" }) : void 0;
11929
11980
  }, [take, doc]);
11930
11981
  const { markClean: clean, discard: drop } = autosave;
11931
11982
  const rawStorage = options.storage;
11932
- const gcRef = (0, import_react78.useRef)(collectAssetGarbage);
11983
+ const gcRef = (0, import_react79.useRef)(collectAssetGarbage);
11933
11984
  gcRef.current = collectAssetGarbage;
11934
- const markClean = (0, import_react78.useCallback)(async () => {
11985
+ const markClean = (0, import_react79.useCallback)(async () => {
11935
11986
  await clean();
11936
11987
  await (0, import_persistence2.collectRetiredEditorAssets)(rawStorage, doc, gcRef.current);
11937
11988
  }, [clean, rawStorage, doc]);
11938
- const discard = (0, import_react78.useCallback)(async () => {
11989
+ const discard = (0, import_react79.useCallback)(async () => {
11939
11990
  await drop();
11940
11991
  await (0, import_persistence2.collectRetiredEditorAssets)(rawStorage, doc, gcRef.current);
11941
11992
  }, [drop, rawStorage, doc]);
@@ -11944,7 +11995,7 @@ function useEditorAutosave(doc, { collectAssetGarbage, ...options }) {
11944
11995
 
11945
11996
  // src/persistence/RecoveryPrompt.tsx
11946
11997
  var import_persistence3 = require("@pixerate/editor/persistence");
11947
- var import_jsx_runtime56 = require("react/jsx-runtime");
11998
+ var import_jsx_runtime57 = require("react/jsx-runtime");
11948
11999
  var RecoveryPrompt = ({
11949
12000
  recovery,
11950
12001
  onRestore,
@@ -11956,7 +12007,7 @@ var RecoveryPrompt = ({
11956
12007
  }) => {
11957
12008
  if (!recovery) return null;
11958
12009
  const { name } = recovery.meta;
11959
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
12010
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
11960
12011
  "div",
11961
12012
  {
11962
12013
  role: "alertdialog",
@@ -11964,15 +12015,15 @@ var RecoveryPrompt = ({
11964
12015
  "data-recovery-prompt": "",
11965
12016
  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}`,
11966
12017
  children: [
11967
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("span", { className: "min-w-0 flex-1", children: [
12018
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { className: "min-w-0 flex-1", children: [
11968
12019
  (0, import_persistence3.formatRecoveryMessage)(recovery.meta, formatTime),
11969
- name ? /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("span", { className: "ml-1 text-xs text-muted-foreground", children: [
12020
+ name ? /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { className: "ml-1 text-xs text-muted-foreground", children: [
11970
12021
  "(",
11971
12022
  name,
11972
12023
  ")"
11973
12024
  ] }) : null
11974
12025
  ] }),
11975
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
12026
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
11976
12027
  "button",
11977
12028
  {
11978
12029
  type: "button",
@@ -11982,7 +12033,7 @@ var RecoveryPrompt = ({
11982
12033
  children: restoreLabel
11983
12034
  }
11984
12035
  ),
11985
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
12036
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
11986
12037
  "button",
11987
12038
  {
11988
12039
  type: "button",
@@ -11998,17 +12049,17 @@ var RecoveryPrompt = ({
11998
12049
  };
11999
12050
 
12000
12051
  // src/generation/useGenerationPlan.ts
12001
- var import_react79 = require("react");
12052
+ var import_react80 = require("react");
12002
12053
  var import_generation = require("@pixerate/editor/generation");
12003
12054
  function useGenerationPlan(request, capabilities, options = {}) {
12004
12055
  const key = JSON.stringify([request, capabilities, options]);
12005
- return (0, import_react79.useMemo)(() => (0, import_generation.planGenerationRequest)(request, capabilities, options), [key]);
12056
+ return (0, import_react80.useMemo)(() => (0, import_generation.planGenerationRequest)(request, capabilities, options), [key]);
12006
12057
  }
12007
12058
  function useJobProgress(options) {
12008
12059
  const { startedAt, expectedMs, done, now, intervalMs = 1e3 } = options;
12009
- const [tick, setTick] = (0, import_react79.useState)(() => Date.now());
12060
+ const [tick, setTick] = (0, import_react80.useState)(() => Date.now());
12010
12061
  const ticking = !done && now === void 0;
12011
- (0, import_react79.useEffect)(() => {
12062
+ (0, import_react80.useEffect)(() => {
12012
12063
  if (!ticking) return;
12013
12064
  setTick(Date.now());
12014
12065
  const id = setInterval(() => setTick(Date.now()), Math.max(16, intervalMs));
@@ -12018,9 +12069,9 @@ function useJobProgress(options) {
12018
12069
  }
12019
12070
 
12020
12071
  // src/generation/GenerationSettings.tsx
12021
- var import_react80 = require("react");
12072
+ var import_react81 = require("react");
12022
12073
  var import_generation2 = require("@pixerate/editor/generation");
12023
- var import_jsx_runtime57 = require("react/jsx-runtime");
12074
+ var import_jsx_runtime58 = require("react/jsx-runtime");
12024
12075
  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";
12025
12076
  function Control({
12026
12077
  control,
@@ -12030,7 +12081,7 @@ function Control({
12030
12081
  }) {
12031
12082
  const shown = value ?? control.defaultValue;
12032
12083
  if (control.kind === "checkbox") {
12033
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
12084
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12034
12085
  "input",
12035
12086
  {
12036
12087
  id,
@@ -12042,7 +12093,7 @@ function Control({
12042
12093
  );
12043
12094
  }
12044
12095
  if (control.kind === "select") {
12045
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
12096
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
12046
12097
  "select",
12047
12098
  {
12048
12099
  id,
@@ -12051,14 +12102,14 @@ function Control({
12051
12102
  value: shown === void 0 ? "" : String(shown),
12052
12103
  onChange: (e) => onValue((0, import_generation2.parseControlValue)(control, e.target.value)),
12053
12104
  children: [
12054
- shown === void 0 && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("option", { value: "", children: "Default" }),
12055
- control.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("option", { value: String(option.value), children: option.label }, String(option.value)))
12105
+ shown === void 0 && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("option", { value: "", children: "Default" }),
12106
+ control.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("option", { value: String(option.value), children: option.label }, String(option.value)))
12056
12107
  ]
12057
12108
  }
12058
12109
  );
12059
12110
  }
12060
12111
  if (control.kind === "textarea") {
12061
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
12112
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12062
12113
  "textarea",
12063
12114
  {
12064
12115
  id,
@@ -12072,8 +12123,8 @@ function Control({
12072
12123
  );
12073
12124
  }
12074
12125
  const numeric = typeof shown === "number" ? shown : void 0;
12075
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex items-center gap-2", children: [
12076
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
12126
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "flex items-center gap-2", children: [
12127
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12077
12128
  "input",
12078
12129
  {
12079
12130
  id,
@@ -12087,7 +12138,7 @@ function Control({
12087
12138
  onChange: (e) => onValue((0, import_generation2.parseControlValue)(control, e.target.value))
12088
12139
  }
12089
12140
  ),
12090
- control.kind === "range" && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "w-10 text-right tabular-nums text-muted-foreground", "data-field-value": "", children: numeric ?? "\u2013" })
12141
+ control.kind === "range" && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "w-10 text-right tabular-nums text-muted-foreground", "data-field-value": "", children: numeric ?? "\u2013" })
12091
12142
  ] });
12092
12143
  }
12093
12144
  var GenerationSettings = ({
@@ -12101,17 +12152,17 @@ var GenerationSettings = ({
12101
12152
  renderReference,
12102
12153
  className = ""
12103
12154
  }) => {
12104
- const baseId = (0, import_react80.useId)();
12105
- const controls = (0, import_react80.useMemo)(() => (0, import_generation2.getGenerationControls)(capabilities), [capabilities]);
12155
+ const baseId = (0, import_react81.useId)();
12156
+ const controls = (0, import_react81.useMemo)(() => (0, import_generation2.getGenerationControls)(capabilities), [capabilities]);
12106
12157
  const computed = useGenerationPlan(value, capabilities, { strategy });
12107
12158
  const plan = planProp ?? computed;
12108
12159
  const slots = (0, import_generation2.getReferenceSlots)(capabilities, value);
12109
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: `flex flex-col gap-3 text-sm ${className}`, "data-generation-settings": "", "data-model": capabilities.id, children: [
12160
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: `flex flex-col gap-3 text-sm ${className}`, "data-generation-settings": "", "data-model": capabilities.id, children: [
12110
12161
  controls.map((control) => {
12111
12162
  const id = `${baseId}-${control.key}`;
12112
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex flex-col gap-1", "data-control": control.key, children: [
12113
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("label", { htmlFor: id, className: "text-xs font-medium text-muted-foreground", title: control.description, children: control.label }),
12114
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
12163
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "flex flex-col gap-1", "data-control": control.key, children: [
12164
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("label", { htmlFor: id, className: "text-xs font-medium text-muted-foreground", title: control.description, children: control.label }),
12165
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12115
12166
  Control,
12116
12167
  {
12117
12168
  control,
@@ -12122,23 +12173,23 @@ var GenerationSettings = ({
12122
12173
  )
12123
12174
  ] }, control.key);
12124
12175
  }),
12125
- slots.map((slot) => /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("fieldset", { className: "flex flex-col gap-1", "data-reference-role": slot.role, children: [
12126
- /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("legend", { className: "text-xs font-medium text-muted-foreground", title: slot.description, children: [
12176
+ slots.map((slot) => /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("fieldset", { className: "flex flex-col gap-1", "data-reference-role": slot.role, children: [
12177
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("legend", { className: "text-xs font-medium text-muted-foreground", title: slot.description, children: [
12127
12178
  slot.label,
12128
12179
  " ",
12129
- /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { className: "tabular-nums", "data-reference-count": "", children: [
12180
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { className: "tabular-nums", "data-reference-count": "", children: [
12130
12181
  "(",
12131
12182
  slot.references.length,
12132
12183
  "/",
12133
12184
  slot.max,
12134
12185
  ")"
12135
12186
  ] }),
12136
- slot.min > 0 && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "text-destructive", children: " *" })
12187
+ slot.min > 0 && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "text-destructive", children: " *" })
12137
12188
  ] }),
12138
- /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("ul", { className: "flex flex-wrap gap-1", children: [
12139
- slot.references.map((ref) => /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("li", { className: "flex items-center gap-1 rounded border border-border px-1.5 py-0.5", "data-reference-id": ref.id, children: [
12140
- renderReference ? renderReference(ref) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "max-w-[10rem] truncate", children: ref.id }),
12141
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
12189
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("ul", { className: "flex flex-wrap gap-1", children: [
12190
+ slot.references.map((ref) => /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("li", { className: "flex items-center gap-1 rounded border border-border px-1.5 py-0.5", "data-reference-id": ref.id, children: [
12191
+ renderReference ? renderReference(ref) : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "max-w-[10rem] truncate", children: ref.id }),
12192
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12142
12193
  "button",
12143
12194
  {
12144
12195
  type: "button",
@@ -12149,7 +12200,7 @@ var GenerationSettings = ({
12149
12200
  }
12150
12201
  )
12151
12202
  ] }, ref.id)),
12152
- onAddReference && slot.canAdd && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
12203
+ onAddReference && slot.canAdd && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12153
12204
  "button",
12154
12205
  {
12155
12206
  type: "button",
@@ -12160,21 +12211,21 @@ var GenerationSettings = ({
12160
12211
  ) })
12161
12212
  ] })
12162
12213
  ] }, slot.role)),
12163
- showAdjustments && plan.adjustments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("ul", { role: "status", className: "flex flex-col gap-0.5 text-xs text-muted-foreground", "data-generation-adjustments": "", children: plan.adjustments.map((adjustment, index) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("li", { "data-adjustment-field": adjustment.field, "data-adjustment-kind": adjustment.kind, children: adjustment.reason }, index)) }),
12164
- showAdjustments && plan.errors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("ul", { role: "alert", className: "flex flex-col gap-0.5 text-xs text-destructive", "data-generation-errors": "", children: plan.errors.map((error, index) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("li", { "data-error-field": error.field, children: error.message }, index)) })
12214
+ showAdjustments && plan.adjustments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime58.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_runtime58.jsx)("li", { "data-adjustment-field": adjustment.field, "data-adjustment-kind": adjustment.kind, children: adjustment.reason }, index)) }),
12215
+ showAdjustments && plan.errors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime58.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_runtime58.jsx)("li", { "data-error-field": error.field, children: error.message }, index)) })
12165
12216
  ] });
12166
12217
  };
12167
12218
 
12168
12219
  // src/generation/JobProgress.tsx
12169
- var import_jsx_runtime58 = require("react/jsx-runtime");
12220
+ var import_jsx_runtime59 = require("react/jsx-runtime");
12170
12221
  var JobProgress = ({ title, className = "", ...options }) => {
12171
12222
  const progress = useJobProgress(options);
12172
- return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: `flex flex-col gap-1 text-sm ${className}`, "data-job-progress": "", "data-done": options.done ? "" : void 0, children: [
12173
- /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "flex items-center justify-between gap-2 text-muted-foreground", children: [
12174
- title && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "truncate text-foreground", children: title }),
12175
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { "data-job-progress-label": "", "aria-live": "polite", children: progress.label })
12223
+ return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: `flex flex-col gap-1 text-sm ${className}`, "data-job-progress": "", "data-done": options.done ? "" : void 0, children: [
12224
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex items-center justify-between gap-2 text-muted-foreground", children: [
12225
+ title && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "truncate text-foreground", children: title }),
12226
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { "data-job-progress-label": "", "aria-live": "polite", children: progress.label })
12176
12227
  ] }),
12177
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12228
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
12178
12229
  "div",
12179
12230
  {
12180
12231
  role: "progressbar",
@@ -12184,7 +12235,7 @@ var JobProgress = ({ title, className = "", ...options }) => {
12184
12235
  "aria-valuenow": progress.percent,
12185
12236
  "aria-valuetext": `${progress.percent}%, ${progress.label}`,
12186
12237
  className: "h-1.5 w-full overflow-hidden rounded-full bg-muted",
12187
- children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12238
+ children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
12188
12239
  "div",
12189
12240
  {
12190
12241
  className: "h-full rounded-full bg-primary transition-[width] duration-500",
@@ -12197,9 +12248,9 @@ var JobProgress = ({ title, className = "", ...options }) => {
12197
12248
  };
12198
12249
 
12199
12250
  // src/generation/AssetMentionChips.tsx
12200
- var import_react81 = require("react");
12251
+ var import_react82 = require("react");
12201
12252
  var import_generation3 = require("@pixerate/editor/generation");
12202
- var import_jsx_runtime59 = require("react/jsx-runtime");
12253
+ var import_jsx_runtime60 = require("react/jsx-runtime");
12203
12254
  var AssetMentionChips = ({
12204
12255
  content,
12205
12256
  onChange,
@@ -12209,14 +12260,14 @@ var AssetMentionChips = ({
12209
12260
  renderAsset,
12210
12261
  className = ""
12211
12262
  }) => {
12212
- const [open, setOpen] = (0, import_react81.useState)(null);
12213
- const rootRef = (0, import_react81.useRef)(null);
12214
- const chips = (0, import_react81.useMemo)(
12263
+ const [open, setOpen] = (0, import_react82.useState)(null);
12264
+ const rootRef = (0, import_react82.useRef)(null);
12265
+ const chips = (0, import_react82.useMemo)(
12215
12266
  () => (0, import_generation3.describeAssetMentions)((0, import_generation3.findTextMentions)(content), assets, capabilities),
12216
12267
  [content, assets, capabilities]
12217
12268
  );
12218
12269
  const options = roles ?? (capabilities ? (0, import_generation3.getAssetRoleOptions)(capabilities) : (0, import_generation3.defaultAssetRoleOptions)());
12219
- (0, import_react81.useEffect)(() => {
12270
+ (0, import_react82.useEffect)(() => {
12220
12271
  if (open === null) return;
12221
12272
  const onPointer = (event) => {
12222
12273
  if (!rootRef.current?.contains(event.target)) setOpen(null);
@@ -12230,13 +12281,13 @@ var AssetMentionChips = ({
12230
12281
  onChange((0, import_generation3.setMentionRoleInText)(content, chip2.start, role));
12231
12282
  };
12232
12283
  if (chips.length === 0) return null;
12233
- return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { ref: rootRef, className: `flex flex-wrap gap-1.5 ${className}`, "data-asset-mention-chips": "", children: chips.map((chip2) => {
12284
+ return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { ref: rootRef, className: `flex flex-wrap gap-1.5 ${className}`, "data-asset-mention-chips": "", children: chips.map((chip2) => {
12234
12285
  const error = chip2.issues.find((issue) => issue.severity === "error");
12235
12286
  const warning = chip2.issues.find((issue) => issue.severity === "warning");
12236
12287
  const problem = error ?? warning;
12237
12288
  const isOpen = open === chip2.index;
12238
- return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("span", { className: "relative inline-flex", "data-asset-chip": chip2.asset.id, children: [
12239
- /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
12289
+ return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("span", { className: "relative inline-flex", "data-asset-chip": chip2.asset.id, children: [
12290
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
12240
12291
  "button",
12241
12292
  {
12242
12293
  type: "button",
@@ -12250,8 +12301,8 @@ var AssetMentionChips = ({
12250
12301
  },
12251
12302
  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`,
12252
12303
  children: [
12253
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { children: renderAsset ? renderAsset(chip2) : `@${chip2.asset.label ?? chip2.handle}` }),
12254
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
12304
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { children: renderAsset ? renderAsset(chip2) : `@${chip2.asset.label ?? chip2.handle}` }),
12305
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
12255
12306
  "span",
12256
12307
  {
12257
12308
  className: `rounded px-1 text-[10px] uppercase tracking-wide ${chip2.role ? "bg-primary/15" : "opacity-60"}`,
@@ -12262,7 +12313,7 @@ var AssetMentionChips = ({
12262
12313
  ]
12263
12314
  }
12264
12315
  ),
12265
- isOpen && /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
12316
+ isOpen && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
12266
12317
  "div",
12267
12318
  {
12268
12319
  role: "listbox",
@@ -12273,7 +12324,7 @@ var AssetMentionChips = ({
12273
12324
  if (e.key === "Escape") setOpen(null);
12274
12325
  },
12275
12326
  children: [
12276
- options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
12327
+ options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
12277
12328
  "button",
12278
12329
  {
12279
12330
  type: "button",
@@ -12284,13 +12335,13 @@ var AssetMentionChips = ({
12284
12335
  onClick: () => pick(chip2, option.role),
12285
12336
  className: "flex items-center justify-between gap-2 rounded px-2 py-1 text-left hover:bg-muted",
12286
12337
  children: [
12287
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { children: option.label }),
12288
- option.accepts?.length ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "text-[10px] opacity-60", children: option.accepts.join(", ") }) : null
12338
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { children: option.label }),
12339
+ option.accepts?.length ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "text-[10px] opacity-60", children: option.accepts.join(", ") }) : null
12289
12340
  ]
12290
12341
  },
12291
12342
  option.role
12292
12343
  )),
12293
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
12344
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
12294
12345
  "button",
12295
12346
  {
12296
12347
  type: "button",
@@ -12302,7 +12353,7 @@ var AssetMentionChips = ({
12302
12353
  children: "No role"
12303
12354
  }
12304
12355
  ),
12305
- chip2.issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("ul", { className: "mt-1 border-t border-border px-2 pt-1 text-[10px]", "data-chip-issues": "", children: chip2.issues.map((issue, i) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("li", { className: issue.severity === "error" ? "text-red-500" : "text-amber-500", children: issue.message }, i)) })
12356
+ chip2.issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime60.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_runtime60.jsx)("li", { className: issue.severity === "error" ? "text-red-500" : "text-amber-500", children: issue.message }, i)) })
12306
12357
  ]
12307
12358
  }
12308
12359
  )
@@ -12311,15 +12362,15 @@ var AssetMentionChips = ({
12311
12362
  };
12312
12363
 
12313
12364
  // src/generation/GenerationHistory.tsx
12314
- var import_react82 = require("react");
12365
+ var import_react83 = require("react");
12315
12366
  var import_generation4 = require("@pixerate/editor/generation");
12316
- var import_jsx_runtime60 = require("react/jsx-runtime");
12367
+ var import_jsx_runtime61 = require("react/jsx-runtime");
12317
12368
  function useGenerationRecords(store, filter) {
12318
- const [records, setRecords] = (0, import_react82.useState)([]);
12319
- const [loading, setLoading] = (0, import_react82.useState)(!!store);
12320
- const [error, setError] = (0, import_react82.useState)(null);
12369
+ const [records, setRecords] = (0, import_react83.useState)([]);
12370
+ const [loading, setLoading] = (0, import_react83.useState)(!!store);
12371
+ const [error, setError] = (0, import_react83.useState)(null);
12321
12372
  const filterKey = (0, import_generation4.stableStringify)(filter ?? {});
12322
- const refresh = (0, import_react82.useCallback)(async () => {
12373
+ const refresh = (0, import_react83.useCallback)(async () => {
12323
12374
  if (!store) {
12324
12375
  setRecords([]);
12325
12376
  setLoading(false);
@@ -12336,7 +12387,7 @@ function useGenerationRecords(store, filter) {
12336
12387
  setLoading(false);
12337
12388
  }
12338
12389
  }, [store, filterKey]);
12339
- (0, import_react82.useEffect)(() => {
12390
+ (0, import_react83.useEffect)(() => {
12340
12391
  void refresh();
12341
12392
  if (!store) return;
12342
12393
  return store.subscribe(() => void refresh());
@@ -12362,21 +12413,21 @@ var GenerationHistory = ({
12362
12413
  emptyText = "No generations yet.",
12363
12414
  className = ""
12364
12415
  }) => {
12365
- const [innerMode, setInnerMode] = (0, import_react82.useState)("exact");
12416
+ const [innerMode, setInnerMode] = (0, import_react83.useState)("exact");
12366
12417
  const mode = modeProp ?? innerMode;
12367
12418
  const setMode = (next) => {
12368
12419
  if (modeProp === void 0) setInnerMode(next);
12369
12420
  onModeChange?.(next);
12370
12421
  };
12371
- const options = (0, import_react82.useMemo)(() => ({ templates, capabilities, assets, mode }), [templates, capabilities, assets, mode]);
12372
- const results = (0, import_react82.useMemo)(() => records.map((record) => (0, import_generation4.recreateRequest)(record, options)), [records, options]);
12373
- const models = (0, import_react82.useMemo)(
12422
+ const options = (0, import_react83.useMemo)(() => ({ templates, capabilities, assets, mode }), [templates, capabilities, assets, mode]);
12423
+ const results = (0, import_react83.useMemo)(() => records.map((record) => (0, import_generation4.recreateRequest)(record, options)), [records, options]);
12424
+ const models = (0, import_react83.useMemo)(
12374
12425
  () => capabilities ? Array.isArray(capabilities) ? capabilities : [capabilities] : [],
12375
12426
  [capabilities]
12376
12427
  );
12377
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: `flex flex-col gap-2 text-sm ${className}`, "data-generation-history": "", children: [
12378
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "flex items-center gap-2 text-xs", role: "radiogroup", "aria-label": "Recreate mode", children: ["exact", "latest"].map((value) => /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("label", { className: "inline-flex items-center gap-1", children: [
12379
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
12428
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: `flex flex-col gap-2 text-sm ${className}`, "data-generation-history": "", children: [
12429
+ /* @__PURE__ */ (0, import_jsx_runtime61.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_runtime61.jsxs)("label", { className: "inline-flex items-center gap-1", children: [
12430
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12380
12431
  "input",
12381
12432
  {
12382
12433
  type: "radio",
@@ -12389,34 +12440,34 @@ var GenerationHistory = ({
12389
12440
  ),
12390
12441
  value === "exact" ? "Exact (recorded versions)" : "Latest templates & settings"
12391
12442
  ] }, value)) }),
12392
- records.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "text-xs text-muted-foreground", children: emptyText }),
12393
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("ul", { className: "flex flex-col gap-2", children: records.map((record, i) => {
12443
+ records.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("p", { className: "text-xs text-muted-foreground", children: emptyText }),
12444
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("ul", { className: "flex flex-col gap-2", children: records.map((record, i) => {
12394
12445
  const result = results[i];
12395
12446
  const model = models.find((m) => m.id === record.provenance.modelId);
12396
12447
  const blocked = !result.ok;
12397
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
12448
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
12398
12449
  "li",
12399
12450
  {
12400
12451
  className: "rounded-md border border-border p-2",
12401
12452
  "data-record": record.id,
12402
12453
  "data-drift": result.drift.length,
12403
12454
  children: [
12404
- /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-2 text-xs", children: [
12405
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "font-medium", children: model?.name ?? record.provenance.modelId }),
12406
- /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("span", { className: "text-muted-foreground", children: [
12407
- record.kind !== "generate" && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("span", { "data-kind": "", children: [
12455
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-2 text-xs", children: [
12456
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "font-medium", children: model?.name ?? record.provenance.modelId }),
12457
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("span", { className: "text-muted-foreground", children: [
12458
+ record.kind !== "generate" && /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("span", { "data-kind": "", children: [
12408
12459
  record.kind,
12409
12460
  " \xB7 "
12410
12461
  ] }),
12411
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("time", { dateTime: record.createdAt, children: record.createdAt.replace("T", " ").slice(0, 16) }),
12412
- record.seed !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
12462
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("time", { dateTime: record.createdAt, children: record.createdAt.replace("T", " ").slice(0, 16) }),
12463
+ record.seed !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_jsx_runtime61.Fragment, { children: [
12413
12464
  " \xB7 seed ",
12414
12465
  record.seed
12415
12466
  ] })
12416
12467
  ] })
12417
12468
  ] }),
12418
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "mt-1 line-clamp-3 break-words text-xs", "data-record-prompt": "", children: record.provenance.resolvedPrompt }),
12419
- record.assets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "mt-1 flex flex-wrap gap-1", children: record.assets.map((asset) => /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
12469
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("p", { className: "mt-1 line-clamp-3 break-words text-xs", "data-record-prompt": "", children: record.provenance.resolvedPrompt }),
12470
+ record.assets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "mt-1 flex flex-wrap gap-1", children: record.assets.map((asset) => /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
12420
12471
  "span",
12421
12472
  {
12422
12473
  className: "rounded-full bg-muted px-2 py-0.5 text-[10px]",
@@ -12430,16 +12481,16 @@ var GenerationHistory = ({
12430
12481
  `${asset.role}:${asset.id}`
12431
12482
  )) }),
12432
12483
  renderPreview?.(record),
12433
- result.drift.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("ul", { className: "mt-1 flex flex-col gap-0.5 text-[11px]", "data-drift-report": "", children: result.drift.map((item, j) => /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("li", { className: severityClass[item.severity], "data-drift-type": item.type, children: [
12434
- /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("strong", { children: [
12484
+ result.drift.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime61.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_runtime61.jsxs)("li", { className: severityClass[item.severity], "data-drift-type": item.type, children: [
12485
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("strong", { children: [
12435
12486
  import_generation4.DRIFT_TYPE_LABELS[item.type],
12436
12487
  ":"
12437
12488
  ] }),
12438
12489
  " ",
12439
12490
  item.message
12440
12491
  ] }, j)) }),
12441
- /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "mt-2 flex gap-2", children: [
12442
- onRecreate && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
12492
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "mt-2 flex gap-2", children: [
12493
+ onRecreate && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12443
12494
  "button",
12444
12495
  {
12445
12496
  type: "button",
@@ -12451,7 +12502,7 @@ var GenerationHistory = ({
12451
12502
  children: "Recreate"
12452
12503
  }
12453
12504
  ),
12454
- onVariation && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
12505
+ onVariation && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12455
12506
  "button",
12456
12507
  {
12457
12508
  type: "button",
@@ -12461,7 +12512,7 @@ var GenerationHistory = ({
12461
12512
  children: "Variation"
12462
12513
  }
12463
12514
  ),
12464
- onRemove && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
12515
+ onRemove && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12465
12516
  "button",
12466
12517
  {
12467
12518
  type: "button",
@@ -12481,19 +12532,19 @@ var GenerationHistory = ({
12481
12532
  };
12482
12533
 
12483
12534
  // src/find-replace/useFindReplace.ts
12484
- var import_react83 = require("react");
12535
+ var import_react84 = require("react");
12485
12536
  var import_editor17 = require("@pixerate/editor");
12486
12537
  var noopUnsubscribe2 = () => {
12487
12538
  };
12488
12539
  function useFindReplace(editor) {
12489
12540
  const store = (0, import_editor17.getFindReplaceStore)(editor ?? null);
12490
- const subscribe = (0, import_react83.useCallback)(
12541
+ const subscribe = (0, import_react84.useCallback)(
12491
12542
  (onChange) => store ? store.subscribe(() => onChange()) : noopUnsubscribe2,
12492
12543
  [store]
12493
12544
  );
12494
12545
  const getSnapshot2 = () => store?.getSnapshot() ?? import_editor17.EMPTY_FIND_REPLACE_SNAPSHOT;
12495
- const snapshot = (0, import_react83.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
12496
- return (0, import_react83.useMemo)(() => {
12546
+ const snapshot = (0, import_react84.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
12547
+ return (0, import_react84.useMemo)(() => {
12497
12548
  const run = (fn) => {
12498
12549
  if (editor && !editor.isDestroyed && store) fn(editor);
12499
12550
  };
@@ -12517,9 +12568,9 @@ function useFindReplace(editor) {
12517
12568
  }
12518
12569
 
12519
12570
  // src/find-replace/FindReplaceBar.tsx
12520
- var import_react84 = require("react");
12571
+ var import_react85 = require("react");
12521
12572
  var import_editor18 = require("@pixerate/editor");
12522
- var import_jsx_runtime61 = require("react/jsx-runtime");
12573
+ var import_jsx_runtime62 = require("react/jsx-runtime");
12523
12574
  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";
12524
12575
  var buttonClass5 = "rounded px-2 py-1 text-xs text-foreground hover:bg-muted disabled:opacity-40 disabled:hover:bg-transparent";
12525
12576
  var toggleClass = (on) => `${buttonClass5} font-mono ${on ? "bg-primary/10 text-primary" : "text-muted-foreground"}`;
@@ -12532,10 +12583,10 @@ var FindReplaceBar = ({
12532
12583
  onClose
12533
12584
  }) => {
12534
12585
  const find = useFindReplace(editor);
12535
- const findInput = (0, import_react84.useRef)(null);
12536
- const [moreOpen, setMoreOpen] = (0, import_react84.useState)(false);
12586
+ const findInput = (0, import_react85.useRef)(null);
12587
+ const [moreOpen, setMoreOpen] = (0, import_react85.useState)(false);
12537
12588
  const visible = find.available && (alwaysOpen || find.open);
12538
- (0, import_react84.useEffect)(() => {
12589
+ (0, import_react85.useEffect)(() => {
12539
12590
  if (!visible || find.focusRequest === 0) return;
12540
12591
  findInput.current?.focus();
12541
12592
  findInput.current?.select();
@@ -12573,9 +12624,9 @@ var FindReplaceBar = ({
12573
12624
  if (isMod(e)) find.replaceAll();
12574
12625
  else find.replace();
12575
12626
  };
12576
- return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className, role: "search", "aria-label": "Find and replace", onKeyDown: onBarKeyDown, children: [
12577
- /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "flex items-center gap-1", children: [
12578
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12627
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className, role: "search", "aria-label": "Find and replace", onKeyDown: onBarKeyDown, children: [
12628
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "flex items-center gap-1", children: [
12629
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
12579
12630
  "button",
12580
12631
  {
12581
12632
  type: "button",
@@ -12586,7 +12637,7 @@ var FindReplaceBar = ({
12586
12637
  children: showReplace ? "\u25BE" : "\u25B8"
12587
12638
  }
12588
12639
  ),
12589
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12640
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
12590
12641
  "input",
12591
12642
  {
12592
12643
  ref: findInput,
@@ -12600,7 +12651,7 @@ var FindReplaceBar = ({
12600
12651
  onKeyDown: onFindKeyDown
12601
12652
  }
12602
12653
  ),
12603
- import_editor18.FIND_OPTION_TOGGLES.filter((t) => !t.advanced).map((t) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12654
+ import_editor18.FIND_OPTION_TOGGLES.filter((t) => !t.advanced).map((t) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
12604
12655
  "button",
12605
12656
  {
12606
12657
  type: "button",
@@ -12613,7 +12664,7 @@ var FindReplaceBar = ({
12613
12664
  },
12614
12665
  t.key
12615
12666
  )),
12616
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12667
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
12617
12668
  "span",
12618
12669
  {
12619
12670
  className: `min-w-[5rem] px-1 text-center text-xs ${find.error ? "text-destructive" : "text-muted-foreground"}`,
@@ -12623,9 +12674,9 @@ var FindReplaceBar = ({
12623
12674
  children: status
12624
12675
  }
12625
12676
  ),
12626
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Previous match", disabled: !hasMatches, onClick: find.previous, children: "\u2191" }),
12627
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Next match", disabled: !hasMatches, onClick: find.next, children: "\u2193" }),
12628
- showMoreOptions && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12677
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Previous match", disabled: !hasMatches, onClick: find.previous, children: "\u2191" }),
12678
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Next match", disabled: !hasMatches, onClick: find.next, children: "\u2193" }),
12679
+ showMoreOptions && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
12629
12680
  "button",
12630
12681
  {
12631
12682
  type: "button",
@@ -12636,10 +12687,10 @@ var FindReplaceBar = ({
12636
12687
  children: "\u2026"
12637
12688
  }
12638
12689
  ),
12639
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Close find", onClick: close, children: "\xD7" })
12690
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Close find", onClick: close, children: "\xD7" })
12640
12691
  ] }),
12641
- showReplace && /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "flex items-center gap-1 pl-7", children: [
12642
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12692
+ showReplace && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "flex items-center gap-1 pl-7", children: [
12693
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
12643
12694
  "input",
12644
12695
  {
12645
12696
  type: "text",
@@ -12651,7 +12702,7 @@ var FindReplaceBar = ({
12651
12702
  onKeyDown: onReplaceKeyDown
12652
12703
  }
12653
12704
  ),
12654
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12705
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
12655
12706
  "button",
12656
12707
  {
12657
12708
  type: "button",
@@ -12661,11 +12712,11 @@ var FindReplaceBar = ({
12661
12712
  children: "Replace"
12662
12713
  }
12663
12714
  ),
12664
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("button", { type: "button", className: buttonClass5, disabled: !hasMatches, onClick: find.replaceAll, children: "Replace all" }),
12665
- find.lastReplaceCount !== null && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "px-1 text-xs text-muted-foreground", "aria-live": "polite", children: find.lastReplaceCount === 1 ? "1 replaced" : `${find.lastReplaceCount} replaced` })
12715
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("button", { type: "button", className: buttonClass5, disabled: !hasMatches, onClick: find.replaceAll, children: "Replace all" }),
12716
+ find.lastReplaceCount !== null && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "px-1 text-xs text-muted-foreground", "aria-live": "polite", children: find.lastReplaceCount === 1 ? "1 replaced" : `${find.lastReplaceCount} replaced` })
12666
12717
  ] }),
12667
- showMoreOptions && moreOpen && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1 pl-7 text-xs text-muted-foreground", children: import_editor18.FIND_OPTION_TOGGLES.filter((t) => t.advanced).map((t) => /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("label", { className: "flex items-center gap-1", children: [
12668
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12718
+ showMoreOptions && moreOpen && /* @__PURE__ */ (0, import_jsx_runtime62.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_runtime62.jsxs)("label", { className: "flex items-center gap-1", children: [
12719
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
12669
12720
  "input",
12670
12721
  {
12671
12722
  type: "checkbox",
@@ -12679,12 +12730,12 @@ var FindReplaceBar = ({
12679
12730
  };
12680
12731
 
12681
12732
  // src/tables/useTableMenu.ts
12682
- var import_react85 = require("react");
12733
+ var import_react86 = require("react");
12683
12734
  var import_editor19 = require("@pixerate/editor");
12684
12735
  function useTableMenu(editor) {
12685
- const store = (0, import_react85.useMemo)(() => (0, import_editor19.createTableStore)(editor), [editor]);
12686
- const snapshot = (0, import_react85.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
12687
- return (0, import_react85.useMemo)(
12736
+ const store = (0, import_react86.useMemo)(() => (0, import_editor19.createTableStore)(editor), [editor]);
12737
+ const snapshot = (0, import_react86.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
12738
+ return (0, import_react86.useMemo)(
12688
12739
  () => ({
12689
12740
  ...snapshot,
12690
12741
  run: (action, params) => (0, import_editor19.runTableAction)(editor, action, params, { focus: true }),
@@ -12695,9 +12746,9 @@ function useTableMenu(editor) {
12695
12746
  }
12696
12747
 
12697
12748
  // src/tables/TableToolbar.tsx
12698
- var import_react86 = __toESM(require("react"), 1);
12749
+ var import_react87 = __toESM(require("react"), 1);
12699
12750
  var import_editor20 = require("@pixerate/editor");
12700
- var import_jsx_runtime62 = require("react/jsx-runtime");
12751
+ var import_jsx_runtime63 = require("react/jsx-runtime");
12701
12752
  var keepSelection2 = (event) => event.preventDefault();
12702
12753
  var TableToolbar = ({
12703
12754
  editor,
@@ -12711,14 +12762,14 @@ var TableToolbar = ({
12711
12762
  }) => {
12712
12763
  const table = useTableMenu(editor);
12713
12764
  if (!editor || !table.inTable && !showWhenOutside) return null;
12714
- return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className, role: "toolbar", "aria-label": "Table", "data-table-toolbar": "", children: items.map((item, index) => {
12765
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className, role: "toolbar", "aria-label": "Table", "data-table-toolbar": "", children: items.map((item, index) => {
12715
12766
  const status = table.check(item.action, item.params);
12716
12767
  const enabled = status === true;
12717
12768
  const active = item.active?.(table);
12718
12769
  const separator = index > 0 && items[index - 1].group !== item.group;
12719
- return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_react86.default.Fragment, { children: [
12720
- separator && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: separatorClassName, "aria-hidden": "true" }),
12721
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
12770
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_react87.default.Fragment, { children: [
12771
+ separator && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: separatorClassName, "aria-hidden": "true" }),
12772
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12722
12773
  "button",
12723
12774
  {
12724
12775
  type: "button",
@@ -12740,8 +12791,8 @@ var TableToolbar = ({
12740
12791
  };
12741
12792
 
12742
12793
  // src/tables/InsertTableGrid.tsx
12743
- var import_react87 = require("react");
12744
- var import_jsx_runtime63 = require("react/jsx-runtime");
12794
+ var import_react88 = require("react");
12795
+ var import_jsx_runtime64 = require("react/jsx-runtime");
12745
12796
  var keepSelection3 = (event) => event.preventDefault();
12746
12797
  var InsertTableGrid = ({
12747
12798
  editor,
@@ -12754,14 +12805,14 @@ var InsertTableGrid = ({
12754
12805
  onInsert
12755
12806
  }) => {
12756
12807
  const table = useTableMenu(editor);
12757
- const [hover, setHover] = (0, import_react87.useState)(null);
12808
+ const [hover, setHover] = (0, import_react88.useState)(null);
12758
12809
  const status = table.actions.insertTable;
12759
12810
  const disabled = !editor || !status.enabled;
12760
12811
  const insert = (size) => {
12761
12812
  if (table.run("insertTable", { ...size, withHeaderRow })) onInsert?.(size);
12762
12813
  setHover(null);
12763
12814
  };
12764
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
12815
+ return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
12765
12816
  "div",
12766
12817
  {
12767
12818
  className,
@@ -12771,7 +12822,7 @@ var InsertTableGrid = ({
12771
12822
  "data-insert-table-grid": "",
12772
12823
  onMouseLeave: () => setHover(null),
12773
12824
  children: [
12774
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12825
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12775
12826
  "div",
12776
12827
  {
12777
12828
  role: "grid",
@@ -12780,7 +12831,7 @@ var InsertTableGrid = ({
12780
12831
  children: Array.from({ length: rows * cols }, (_, i) => {
12781
12832
  const size = { rows: Math.floor(i / cols) + 1, cols: i % cols + 1 };
12782
12833
  const active = !!hover && size.rows <= hover.rows && size.cols <= hover.cols;
12783
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12834
+ return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12784
12835
  "button",
12785
12836
  {
12786
12837
  type: "button",
@@ -12800,7 +12851,7 @@ var InsertTableGrid = ({
12800
12851
  })
12801
12852
  }
12802
12853
  ),
12803
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { "aria-live": "polite", "data-testid": "insert-table-size", children: disabled ? status.reason : hover ? `${hover.rows} \xD7 ${hover.cols}` : "Insert table" })
12854
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { "aria-live": "polite", "data-testid": "insert-table-size", children: disabled ? status.reason : hover ? `${hover.rows} \xD7 ${hover.cols}` : "Insert table" })
12804
12855
  ]
12805
12856
  }
12806
12857
  );
@@ -12808,31 +12859,31 @@ var InsertTableGrid = ({
12808
12859
 
12809
12860
  // src/tables/TableBubbleMenu.tsx
12810
12861
  var import_editor21 = require("@pixerate/editor");
12811
- var import_jsx_runtime64 = require("react/jsx-runtime");
12862
+ var import_jsx_runtime65 = require("react/jsx-runtime");
12812
12863
  var TableBubbleMenu = ({
12813
12864
  editor,
12814
12865
  children,
12815
12866
  toolbarProps,
12816
12867
  pluginKey = "tableBubbleMenu",
12817
12868
  ...rest
12818
- }) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(BubbleMenu, { editor, pluginKey, shouldShow: import_editor21.shouldShowTableBubbleMenu, ...rest, children: children ?? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(TableToolbar, { editor, ...toolbarProps }) });
12869
+ }) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(BubbleMenu, { editor, pluginKey, shouldShow: import_editor21.shouldShowTableBubbleMenu, ...rest, children: children ?? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(TableToolbar, { editor, ...toolbarProps }) });
12819
12870
 
12820
12871
  // src/chart-node/ChartNodeView.tsx
12821
12872
  var import_client = require("react-dom/client");
12822
12873
 
12823
12874
  // src/chart/ChartCanvas.tsx
12824
- var import_react89 = require("react");
12875
+ var import_react90 = require("react");
12825
12876
  var import_chart2 = require("@pixerate/editor/chart");
12826
12877
 
12827
12878
  // src/chart/useChartEditor.ts
12828
- var import_react88 = require("react");
12879
+ var import_react89 = require("react");
12829
12880
  var import_chart = require("@pixerate/editor/chart");
12830
12881
  function useChartState(controller) {
12831
- return (0, import_react88.useSyncExternalStore)(controller.subscribe, controller.getState, controller.getState);
12882
+ return (0, import_react89.useSyncExternalStore)(controller.subscribe, controller.getState, controller.getState);
12832
12883
  }
12833
12884
 
12834
12885
  // src/chart/ChartCanvas.tsx
12835
- var import_jsx_runtime65 = require("react/jsx-runtime");
12886
+ var import_jsx_runtime66 = require("react/jsx-runtime");
12836
12887
  function renderChartMark(mark, fontFamily, interactive) {
12837
12888
  const common = {
12838
12889
  "data-role": mark.role,
@@ -12844,9 +12895,9 @@ function renderChartMark(mark, fontFamily, interactive) {
12844
12895
  };
12845
12896
  switch (mark.kind) {
12846
12897
  case "rect":
12847
- return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("rect", { ...common, x: mark.x, y: mark.y, width: mark.width, height: mark.height, rx: mark.radius, style: { fill: mark.fill, stroke: mark.stroke, strokeWidth: mark.strokeWidth } }, mark.key);
12898
+ return /* @__PURE__ */ (0, import_jsx_runtime66.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);
12848
12899
  case "path":
12849
- return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
12900
+ return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
12850
12901
  "path",
12851
12902
  {
12852
12903
  ...common,
@@ -12859,11 +12910,11 @@ function renderChartMark(mark, fontFamily, interactive) {
12859
12910
  mark.key
12860
12911
  );
12861
12912
  case "circle":
12862
- return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("circle", { ...common, cx: mark.cx, cy: mark.cy, r: mark.r, style: { fill: mark.fill, stroke: mark.stroke, strokeWidth: mark.strokeWidth } }, mark.key);
12913
+ return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("circle", { ...common, cx: mark.cx, cy: mark.cy, r: mark.r, style: { fill: mark.fill, stroke: mark.stroke, strokeWidth: mark.strokeWidth } }, mark.key);
12863
12914
  case "line":
12864
- return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("line", { ...common, x1: mark.x1, y1: mark.y1, x2: mark.x2, y2: mark.y2, strokeDasharray: mark.dash, style: { stroke: mark.stroke, strokeWidth: mark.strokeWidth } }, mark.key);
12915
+ return /* @__PURE__ */ (0, import_jsx_runtime66.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);
12865
12916
  case "text":
12866
- return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
12917
+ return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
12867
12918
  "text",
12868
12919
  {
12869
12920
  ...common,
@@ -12880,36 +12931,36 @@ function renderChartMark(mark, fontFamily, interactive) {
12880
12931
  }
12881
12932
  }
12882
12933
  function ChartPresenceLayer({ presence }) {
12883
- const { actors } = (0, import_react89.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
12884
- return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("g", { "data-chart-presence": "", pointerEvents: "none", children: actors.map((a) => /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("g", { transform: `translate(${a.x} ${a.y})`, "data-actor": a.id, children: [
12885
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("path", { d: "M0,0 L0,14 L4,10.5 L7,17 L9.5,16 L6.5,9.5 L11.5,9.5 Z", style: { fill: a.color, stroke: "#ffffff", strokeWidth: 1 }, transform: a.pressed ? "scale(0.9)" : void 0 }),
12886
- /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("g", { transform: "translate(13 16)", children: [
12887
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("rect", { x: 0, y: 0, rx: 4, height: 18, width: Math.max(28, (a.message ?? a.name).length * 6.4 + 12), style: { fill: a.color } }),
12888
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("text", { x: 6, y: 9, dominantBaseline: "central", style: { fill: "#ffffff", fontSize: 11, fontWeight: 600, fontFamily: "inherit" }, children: a.message ?? a.name })
12934
+ const { actors } = (0, import_react90.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
12935
+ return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("g", { "data-chart-presence": "", pointerEvents: "none", children: actors.map((a) => /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("g", { transform: `translate(${a.x} ${a.y})`, "data-actor": a.id, children: [
12936
+ /* @__PURE__ */ (0, import_jsx_runtime66.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 }),
12937
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("g", { transform: "translate(13 16)", children: [
12938
+ /* @__PURE__ */ (0, import_jsx_runtime66.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 } }),
12939
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("text", { x: 6, y: 9, dominantBaseline: "central", style: { fill: "#ffffff", fontSize: 11, fontWeight: 600, fontFamily: "inherit" }, children: a.message ?? a.name })
12889
12940
  ] })
12890
12941
  ] }, a.id)) });
12891
12942
  }
12892
12943
  function ChartTooltipContent({ tooltip }) {
12893
- return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
12894
- tooltip.title && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "mb-1 font-medium", children: tooltip.title }),
12895
- tooltip.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex items-center gap-2", children: [
12896
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "h-2 w-2 shrink-0 rounded-full", style: { background: item.color } }),
12897
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { style: { color: "var(--muted-foreground, #64748b)" }, children: item.name }),
12898
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "ml-auto pl-3 font-medium tabular-nums", children: item.text })
12944
+ return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
12945
+ tooltip.title && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "mb-1 font-medium", children: tooltip.title }),
12946
+ tooltip.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex items-center gap-2", children: [
12947
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "h-2 w-2 shrink-0 rounded-full", style: { background: item.color } }),
12948
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { style: { color: "var(--muted-foreground, #64748b)" }, children: item.name }),
12949
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "ml-auto pl-3 font-medium tabular-nums", children: item.text })
12899
12950
  ] }, item.seriesId))
12900
12951
  ] });
12901
12952
  }
12902
12953
  function ChartCanvas({ controller, width = 640, height = 400, responsive = true, theme, editable = true, measureText, emptyMessage, className, presence, sceneRef, tooltip = false, renderTooltip }) {
12903
12954
  const state = useChartState(controller);
12904
- const wrapper = (0, import_react89.useRef)(null);
12905
- const svg = (0, import_react89.useRef)(null);
12906
- const drag = (0, import_react89.useRef)(null);
12907
- const [measured, setMeasured] = (0, import_react89.useState)(null);
12908
- const [frozen, setFrozen] = (0, import_react89.useState)(null);
12955
+ const wrapper = (0, import_react90.useRef)(null);
12956
+ const svg = (0, import_react90.useRef)(null);
12957
+ const drag = (0, import_react90.useRef)(null);
12958
+ const [measured, setMeasured] = (0, import_react90.useState)(null);
12959
+ const [frozen, setFrozen] = (0, import_react90.useState)(null);
12909
12960
  const tooltipMode = tooltip === true ? "point" : tooltip || null;
12910
- const [tip, setTip] = (0, import_react89.useState)(null);
12911
- const [tipAt, setTipAt] = (0, import_react89.useState)({ left: 0, top: 0, flip: false });
12912
- (0, import_react89.useEffect)(() => {
12961
+ const [tip, setTip] = (0, import_react90.useState)(null);
12962
+ const [tipAt, setTipAt] = (0, import_react90.useState)({ left: 0, top: 0, flip: false });
12963
+ (0, import_react90.useEffect)(() => {
12913
12964
  const el = wrapper.current;
12914
12965
  if (!responsive || !el || typeof ResizeObserver === "undefined") return;
12915
12966
  const observer = new ResizeObserver(([entry]) => {
@@ -12920,8 +12971,8 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
12920
12971
  return () => observer.disconnect();
12921
12972
  }, [responsive]);
12922
12973
  const sceneWidth = responsive && measured || width;
12923
- const fullTheme = (0, import_react89.useMemo)(() => ({ ...import_chart2.CSS_VARIABLE_CHART_THEME, ...theme }), [theme]);
12924
- const scene = (0, import_react89.useMemo)(
12974
+ const fullTheme = (0, import_react90.useMemo)(() => ({ ...import_chart2.CSS_VARIABLE_CHART_THEME, ...theme }), [theme]);
12975
+ const scene = (0, import_react90.useMemo)(
12925
12976
  () => (0, import_chart2.layoutChart)(state.spec, {
12926
12977
  width: sceneWidth,
12927
12978
  height,
@@ -12938,8 +12989,8 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
12938
12989
  [state.spec, state.selection, state.raceFrame, sceneWidth, height, fullTheme, editable, measureText, emptyMessage, frozen]
12939
12990
  );
12940
12991
  if (sceneRef) sceneRef.current = scene;
12941
- const byKey = (0, import_react89.useMemo)(() => new Map(scene.marks.map((m) => [m.key, m])), [scene]);
12942
- (0, import_react89.useEffect)(() => () => drag.current?.end(), []);
12992
+ const byKey = (0, import_react90.useMemo)(() => new Map(scene.marks.map((m) => [m.key, m])), [scene]);
12993
+ (0, import_react90.useEffect)(() => () => drag.current?.end(), []);
12943
12994
  const scenePoint = (e) => (0, import_chart2.chartClientToScene)(scene, svg.current.getBoundingClientRect(), e.clientX, e.clientY);
12944
12995
  const onPointerDown = (e) => {
12945
12996
  if (!editable || e.button !== 0) return;
@@ -12986,8 +13037,8 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
12986
13037
  if (editable && (0, import_chart2.handleChartKey)(controller, scene, e)) e.preventDefault();
12987
13038
  };
12988
13039
  const label = state.spec.title || "Chart";
12989
- return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { ref: wrapper, className: `relative w-full ${className ?? ""}`, "data-chart-canvas": "", children: [
12990
- /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
13040
+ return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { ref: wrapper, className: `relative w-full ${className ?? ""}`, "data-chart-canvas": "", children: [
13041
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
12991
13042
  "svg",
12992
13043
  {
12993
13044
  ref: svg,
@@ -13006,11 +13057,11 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
13006
13057
  onKeyDown,
13007
13058
  children: [
13008
13059
  scene.marks.map((m) => renderChartMark(m, scene.theme.fontFamily, editable)),
13009
- presence && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(ChartPresenceLayer, { presence })
13060
+ presence && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartPresenceLayer, { presence })
13010
13061
  ]
13011
13062
  }
13012
13063
  ),
13013
- tip && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
13064
+ tip && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13014
13065
  "div",
13015
13066
  {
13016
13067
  role: "tooltip",
@@ -13025,14 +13076,14 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
13025
13076
  borderColor: "var(--border, #e2e8f0)",
13026
13077
  fontFamily: scene.theme.fontFamily
13027
13078
  },
13028
- children: renderTooltip ? renderTooltip(tip) : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(ChartTooltipContent, { tooltip: tip })
13079
+ children: renderTooltip ? renderTooltip(tip) : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartTooltipContent, { tooltip: tip })
13029
13080
  }
13030
13081
  )
13031
13082
  ] });
13032
13083
  }
13033
13084
 
13034
13085
  // src/chart/ChartDataGrid.tsx
13035
- var import_react90 = require("react");
13086
+ var import_react91 = require("react");
13036
13087
  var import_chart3 = require("@pixerate/editor/chart");
13037
13088
 
13038
13089
  // src/chart/styles.ts
@@ -13045,11 +13096,11 @@ var chartSectionClass = "space-y-2 border-b border-border pb-3 last:border-b-0";
13045
13096
  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";
13046
13097
 
13047
13098
  // src/chart/ChartDataGrid.tsx
13048
- var import_jsx_runtime66 = require("react/jsx-runtime");
13099
+ var import_jsx_runtime67 = require("react/jsx-runtime");
13049
13100
  function ChartCommitInput({ value, onCommit, onKeyDown, onBlur, ...rest }) {
13050
- const [draft, setDraft] = (0, import_react90.useState)(value);
13051
- const typing = (0, import_react90.useRef)(false);
13052
- (0, import_react90.useEffect)(() => {
13101
+ const [draft, setDraft] = (0, import_react91.useState)(value);
13102
+ const typing = (0, import_react91.useRef)(false);
13103
+ (0, import_react91.useEffect)(() => {
13053
13104
  if (!typing.current) setDraft(value);
13054
13105
  }, [value]);
13055
13106
  const commit = () => {
@@ -13058,7 +13109,7 @@ function ChartCommitInput({ value, onCommit, onKeyDown, onBlur, ...rest }) {
13058
13109
  if (draft === value) return;
13059
13110
  if (onCommit(draft) === false) setDraft(value);
13060
13111
  };
13061
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13112
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13062
13113
  "input",
13063
13114
  {
13064
13115
  ...rest,
@@ -13087,20 +13138,20 @@ function ChartCommitInput({ value, onCommit, onKeyDown, onBlur, ...rest }) {
13087
13138
  }
13088
13139
  function ChartTreeGrid({ controller, readOnly = false, className }) {
13089
13140
  const { spec } = useChartState(controller);
13090
- const [columns, setColumns] = (0, import_react90.useState)(1);
13141
+ const [columns, setColumns] = (0, import_react91.useState)(1);
13091
13142
  const rows = (0, import_chart3.chartTreeToRows)(spec.tree);
13092
13143
  const depth = Math.max(columns, (0, import_chart3.chartTreeDepth)(spec.tree));
13093
13144
  const labels = (0, import_chart3.chartTreeColumnLabels)(depth);
13094
13145
  const commit = (next) => controller.setTreeRows(next).ok;
13095
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", "data-chart-tree-grid": "", children: [
13096
- /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
13097
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("tr", { children: [
13098
- labels.map((label) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-left font-medium text-muted-foreground", children: label }, label)),
13099
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-right font-medium text-muted-foreground", children: "Value" }),
13100
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("th", { className: "w-8 border-b border-border" })
13146
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", "data-chart-tree-grid": "", children: [
13147
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
13148
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("tr", { children: [
13149
+ labels.map((label) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-left font-medium text-muted-foreground", children: label }, label)),
13150
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-right font-medium text-muted-foreground", children: "Value" }),
13151
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("th", { className: "w-8 border-b border-border" })
13101
13152
  ] }) }),
13102
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("tbody", { children: rows.map((row, r) => /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("tr", { "data-tree-row": r, children: [
13103
- labels.map((_, k) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13153
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("tbody", { children: rows.map((row, r) => /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("tr", { "data-tree-row": r, children: [
13154
+ labels.map((_, k) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13104
13155
  ChartCommitInput,
13105
13156
  {
13106
13157
  value: row.path[k] ?? "",
@@ -13111,7 +13162,7 @@ function ChartTreeGrid({ controller, readOnly = false, className }) {
13111
13162
  className: `${chartCellClass} text-left`
13112
13163
  }
13113
13164
  ) }, k)),
13114
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13165
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13115
13166
  ChartCommitInput,
13116
13167
  {
13117
13168
  value: String(row.value),
@@ -13124,14 +13175,14 @@ function ChartTreeGrid({ controller, readOnly = false, className }) {
13124
13175
  className: chartCellClass
13125
13176
  }
13126
13177
  ) }),
13127
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("td", { className: "border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Delete item", "aria-label": `Delete ${row.path.join(" / ")}`, "data-action": "tree-remove-row", onClick: () => commit((0, import_chart3.removeChartTreeRow)(rows, r)), children: "\xD7" }) })
13178
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("td", { className: "border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime67.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" }) })
13128
13179
  ] }, r)) })
13129
13180
  ] }),
13130
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex flex-wrap gap-1 p-1", children: [
13131
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "tree-add-row", onClick: () => commit((0, import_chart3.addChartTreeRow)(rows)), children: "+ Add item" }),
13132
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "tree-add-level", disabled: depth >= 6, onClick: () => setColumns(depth + 1), children: "+ Level" }),
13133
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "flex-1" }),
13134
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: `${chartButtonClass} h-6`, "data-action": "tree-ungroup", title: "Keep the group totals as plain data", onClick: () => controller.setTree([]), children: "Ungroup" })
13181
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex flex-wrap gap-1 p-1", children: [
13182
+ /* @__PURE__ */ (0, import_jsx_runtime67.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" }),
13183
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "tree-add-level", disabled: depth >= 6, onClick: () => setColumns(depth + 1), children: "+ Level" }),
13184
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "flex-1" }),
13185
+ /* @__PURE__ */ (0, import_jsx_runtime67.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" })
13135
13186
  ] })
13136
13187
  ] });
13137
13188
  }
@@ -13139,30 +13190,30 @@ function ChartLinksGrid({ controller, readOnly = false, className }) {
13139
13190
  const { spec } = useChartState(controller);
13140
13191
  const links = spec.links;
13141
13192
  const commit = (next) => controller.setLinks(next).ok;
13142
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", "data-chart-links-grid": "", children: [
13143
- /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
13144
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("tr", { children: [
13145
- ["Source", "Target"].map((label) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-left font-medium text-muted-foreground", children: label }, label)),
13146
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-right font-medium text-muted-foreground", children: "Value" }),
13147
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("th", { className: "w-8 border-b border-border" })
13193
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", "data-chart-links-grid": "", children: [
13194
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
13195
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("tr", { children: [
13196
+ ["Source", "Target"].map((label) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-left font-medium text-muted-foreground", children: label }, label)),
13197
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-right font-medium text-muted-foreground", children: "Value" }),
13198
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("th", { className: "w-8 border-b border-border" })
13148
13199
  ] }) }),
13149
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("tbody", { children: links.map((link, i) => /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("tr", { "data-link-row": i, children: [
13150
- ["source", "target"].map((field) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartCommitInput, { value: link[field], "aria-label": `${field === "source" ? "Source" : "Target"} of flow ${i + 1}`, "data-link-cell": `${i}:${field}`, readOnly, onCommit: (text) => commit((0, import_chart3.setChartLinkField)(links, i, field, text)), className: `${chartCellClass} text-left` }) }, field)),
13151
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartCommitInput, { value: String(link.value), inputMode: "decimal", "aria-label": `Value of ${link.source} \u2192 ${link.target}`, "data-link-cell": `${i}:value`, readOnly, onCommit: (text) => commit((0, import_chart3.setChartLinkField)(links, i, "value", text)), className: chartCellClass }) }),
13152
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("td", { className: "border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Delete flow", "aria-label": `Delete ${link.source} \u2192 ${link.target}`, "data-action": "link-remove", onClick: () => controller.removeLink(i), children: "\xD7" }) })
13200
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("tbody", { children: links.map((link, i) => /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("tr", { "data-link-row": i, children: [
13201
+ ["source", "target"].map((field) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime67.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)),
13202
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime67.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 }) }),
13203
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("td", { className: "border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime67.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" }) })
13153
13204
  ] }, i)) })
13154
13205
  ] }),
13155
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex flex-wrap gap-1 p-1", children: [
13156
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "link-add", onClick: () => commit((0, import_chart3.addChartLink)(links)), children: "+ Add flow" }),
13157
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "flex-1" }),
13158
- links.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: `${chartButtonClass} h-6`, "data-action": "links-clear", title: "Keep how much passes through each node as plain data", onClick: () => controller.setLinks([]), children: "Remove flows" })
13206
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex flex-wrap gap-1 p-1", children: [
13207
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "link-add", onClick: () => commit((0, import_chart3.addChartLink)(links)), children: "+ Add flow" }),
13208
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "flex-1" }),
13209
+ links.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime67.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" })
13159
13210
  ] })
13160
13211
  ] });
13161
13212
  }
13162
13213
  function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = false, className }) {
13163
13214
  const { spec, selection } = useChartState(controller);
13164
- if (spec.links.length || spec.type === "sankey") return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartLinksGrid, { controller, readOnly, className });
13165
- if (spec.tree.length) return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartTreeGrid, { controller, readOnly, className });
13215
+ if (spec.links.length || spec.type === "sankey") return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartLinksGrid, { controller, readOnly, className });
13216
+ if (spec.tree.length) return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartTreeGrid, { controller, readOnly, className });
13166
13217
  const canGroup = spec.type === "treemap" || spec.type === "sunburst";
13167
13218
  const paste = (row, column) => (e) => {
13168
13219
  const text = e.clipboardData?.getData("text/plain") ?? "";
@@ -13170,15 +13221,15 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
13170
13221
  e.preventDefault();
13171
13222
  controller.pasteCells(row, column, text);
13172
13223
  };
13173
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", children: [
13174
- /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
13175
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("tr", { children: [
13176
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-left font-medium text-muted-foreground", children: categoryHeader }),
13224
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", children: [
13225
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
13226
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("tr", { children: [
13227
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-left font-medium text-muted-foreground", children: categoryHeader }),
13177
13228
  spec.series.map((s, si) => {
13178
13229
  const color = (0, import_chart3.chartSeriesColor)(spec, si);
13179
13230
  const selected = selection?.kind === "series" && selection.seriesId === s.id;
13180
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("th", { "data-series-id": s.id, className: `border-b border-r border-border px-1 py-1 font-medium ${selected ? "bg-primary/10" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex items-center gap-1", children: [
13181
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13231
+ return /* @__PURE__ */ (0, import_jsx_runtime67.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_runtime67.jsxs)("div", { className: "flex items-center gap-1", children: [
13232
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13182
13233
  "input",
13183
13234
  {
13184
13235
  type: "color",
@@ -13191,7 +13242,7 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
13191
13242
  className: "h-5 w-5 shrink-0 cursor-pointer rounded border-0 bg-transparent p-0"
13192
13243
  }
13193
13244
  ),
13194
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13245
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13195
13246
  ChartCommitInput,
13196
13247
  {
13197
13248
  value: s.name,
@@ -13201,8 +13252,8 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
13201
13252
  className: `${chartInputClass} h-6 min-w-[5rem] border-transparent bg-transparent font-medium ${s.hidden ? "text-muted-foreground line-through" : ""}`
13202
13253
  }
13203
13254
  ),
13204
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
13205
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13255
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_jsx_runtime67.Fragment, { children: [
13256
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13206
13257
  "button",
13207
13258
  {
13208
13259
  type: "button",
@@ -13215,16 +13266,16 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
13215
13266
  children: s.hidden ? "\u25CB" : "\u25CF"
13216
13267
  }
13217
13268
  ),
13218
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Delete series", "aria-label": `Delete ${s.name}`, "data-action": "remove-series", onClick: () => controller.removeSeries(s.id), children: "\xD7" })
13269
+ /* @__PURE__ */ (0, import_jsx_runtime67.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" })
13219
13270
  ] })
13220
13271
  ] }) }, s.id);
13221
13272
  }),
13222
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("th", { className: "w-8 border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Add series", "aria-label": "Add series", "data-action": "add-series", onClick: () => controller.addSeries(), children: "+" }) })
13273
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("th", { className: "w-8 border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Add series", "aria-label": "Add series", "data-action": "add-series", onClick: () => controller.addSeries(), children: "+" }) })
13223
13274
  ] }) }),
13224
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("tbody", { children: spec.categories.map((category, i) => {
13275
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("tbody", { children: spec.categories.map((category, i) => {
13225
13276
  const rowSelected = selection?.kind === "category" && selection.index === i;
13226
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("tr", { "data-category-index": i, className: rowSelected ? "bg-primary/10" : void 0, children: [
13227
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("th", { className: "border-b border-r border-border p-0 text-left font-normal", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13277
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("tr", { "data-category-index": i, className: rowSelected ? "bg-primary/10" : void 0, children: [
13278
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("th", { className: "border-b border-r border-border p-0 text-left font-normal", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13228
13279
  ChartCommitInput,
13229
13280
  {
13230
13281
  value: category,
@@ -13238,7 +13289,7 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
13238
13289
  spec.series.map((s) => {
13239
13290
  const value = s.values[i];
13240
13291
  const selected = selection?.kind === "point" && selection.seriesId === s.id && selection.index === i;
13241
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("td", { className: `border-b border-r border-border p-0 ${selected ? "bg-primary/10" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13292
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("td", { className: `border-b border-r border-border p-0 ${selected ? "bg-primary/10" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13242
13293
  ChartCommitInput,
13243
13294
  {
13244
13295
  value: value === null || value === void 0 ? "" : String(value),
@@ -13253,13 +13304,13 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
13253
13304
  }
13254
13305
  ) }, s.id);
13255
13306
  }),
13256
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("td", { className: "border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Delete category", "aria-label": `Delete ${category}`, "data-action": "remove-category", onClick: () => controller.removeCategory(i), children: "\xD7" }) })
13307
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("td", { className: "border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Delete category", "aria-label": `Delete ${category}`, "data-action": "remove-category", onClick: () => controller.removeCategory(i), children: "\xD7" }) })
13257
13308
  ] }, i);
13258
13309
  }) })
13259
13310
  ] }),
13260
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "p-1", children: [
13261
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "add-category", onClick: () => controller.addCategory(), children: "+ Add category" }),
13262
- canGroup && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13311
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "p-1", children: [
13312
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "add-category", onClick: () => controller.addCategory(), children: "+ Add category" }),
13313
+ canGroup && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13263
13314
  "button",
13264
13315
  {
13265
13316
  type: "button",
@@ -13275,29 +13326,29 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
13275
13326
  }
13276
13327
 
13277
13328
  // src/chart/ChartInspector.tsx
13278
- var import_react91 = require("react");
13329
+ var import_react92 = require("react");
13279
13330
  var import_chart4 = require("@pixerate/editor/chart");
13280
- var import_jsx_runtime67 = require("react/jsx-runtime");
13331
+ var import_jsx_runtime68 = require("react/jsx-runtime");
13281
13332
  var cap = (s) => s.charAt(0).toUpperCase() + s.slice(1);
13282
13333
  function Field({ label, htmlFor, children }) {
13283
- return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex items-center gap-2", children: [
13284
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("label", { htmlFor, className: `${chartLabelClass} w-20 shrink-0`, children: label }),
13285
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "min-w-0 flex-1", children })
13334
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "flex items-center gap-2", children: [
13335
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("label", { htmlFor, className: `${chartLabelClass} w-20 shrink-0`, children: label }),
13336
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "min-w-0 flex-1", children })
13286
13337
  ] });
13287
13338
  }
13288
13339
  function Toggle({ label, checked, onChange, name }) {
13289
- return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("label", { className: "flex cursor-pointer items-center gap-2 text-xs text-foreground", children: [
13290
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("input", { type: "checkbox", className: "h-3.5 w-3.5 accent-primary", checked, "data-option": name, onChange: (e) => onChange(e.currentTarget.checked) }),
13340
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("label", { className: "flex cursor-pointer items-center gap-2 text-xs text-foreground", children: [
13341
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("input", { type: "checkbox", className: "h-3.5 w-3.5 accent-primary", checked, "data-option": name, onChange: (e) => onChange(e.currentTarget.checked) }),
13291
13342
  label
13292
13343
  ] });
13293
13344
  }
13294
13345
  function Select({ id, value, options, onChange, name, labels }) {
13295
- return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("select", { id, className: chartInputClass, value, "data-option": name, onChange: (e) => onChange(e.currentTarget.value), children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: o, children: labels?.[o] ?? cap(o) }, o)) });
13346
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("select", { id, className: chartInputClass, value, "data-option": name, onChange: (e) => onChange(e.currentTarget.value), children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("option", { value: o, children: labels?.[o] ?? cap(o) }, o)) });
13296
13347
  }
13297
13348
  function AxisSection({ controller, axis, value, idBase, horizontal, numeric = false, scales = false }) {
13298
13349
  const set = (patch) => controller.setAxis(axis, patch);
13299
13350
  const setFormat = (patch) => set({ format: { ...value.format, ...patch } });
13300
- const bound = (key2) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13351
+ const bound = (key2) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
13301
13352
  ChartCommitInput,
13302
13353
  {
13303
13354
  id: `${idBase}-${axis}-${key2}`,
@@ -13312,26 +13363,26 @@ function AxisSection({ controller, axis, value, idBase, horizontal, numeric = fa
13312
13363
  const name = axis === "x" ? numeric ? "X axis" : "Category axis" : axis === "y" ? "Value axis" : "Secondary axis";
13313
13364
  const valueAxis = axis !== "x" || numeric;
13314
13365
  const key = axis === "y2" ? "yAxis2" : `${axis}Axis`;
13315
- return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: chartSectionClass, "data-section": `axis-${axis}`, children: [
13316
- /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex items-center justify-between", children: [
13317
- /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("h4", { className: "text-xs font-semibold text-foreground", children: [
13366
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: chartSectionClass, "data-section": `axis-${axis}`, children: [
13367
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "flex items-center justify-between", children: [
13368
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("h4", { className: "text-xs font-semibold text-foreground", children: [
13318
13369
  name,
13319
- /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("span", { className: "ml-1 font-normal text-muted-foreground", children: [
13370
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("span", { className: "ml-1 font-normal text-muted-foreground", children: [
13320
13371
  "(",
13321
13372
  axis === "x" ? horizontal ? "left" : "bottom" : axis === "y2" ? horizontal ? "top" : "right" : horizontal ? "bottom" : "left",
13322
13373
  ")"
13323
13374
  ] })
13324
13375
  ] }),
13325
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "Show", name: `${axis}Axis.show`, checked: value.show, onChange: (show) => set({ show }) })
13376
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Toggle, { label: "Show", name: `${axis}Axis.show`, checked: value.show, onChange: (show) => set({ show }) })
13326
13377
  ] }),
13327
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Title", htmlFor: `${idBase}-${axis}-title`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { id: `${idBase}-${axis}-title`, value: value.title, "data-option": `${axis}Axis.title`, className: chartInputClass, onCommit: (title) => void set({ title }) }) }),
13328
- /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex flex-wrap gap-x-4 gap-y-1", children: [
13329
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "Grid lines", name: `${key}.gridlines`, checked: value.gridlines, onChange: (gridlines) => set({ gridlines }) }),
13330
- axis === "x" && !numeric && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "Dates", name: "xAxis.kind", checked: value.kind === "date", onChange: (dates) => set({ kind: dates ? "date" : void 0 }) }),
13331
- scales && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "Reverse", name: `${key}.reverse`, checked: !!value.reverse, onChange: (reverse) => set({ reverse }) }),
13332
- scales && valueAxis && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "Log scale", name: `${key}.scale`, checked: value.scale === "log", onChange: (log) => set({ scale: log ? "log" : "linear" }) })
13378
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Title", htmlFor: `${idBase}-${axis}-title`, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ChartCommitInput, { id: `${idBase}-${axis}-title`, value: value.title, "data-option": `${axis}Axis.title`, className: chartInputClass, onCommit: (title) => void set({ title }) }) }),
13379
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "flex flex-wrap gap-x-4 gap-y-1", children: [
13380
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Toggle, { label: "Grid lines", name: `${key}.gridlines`, checked: value.gridlines, onChange: (gridlines) => set({ gridlines }) }),
13381
+ axis === "x" && !numeric && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Toggle, { label: "Dates", name: "xAxis.kind", checked: value.kind === "date", onChange: (dates) => set({ kind: dates ? "date" : void 0 }) }),
13382
+ scales && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Toggle, { label: "Reverse", name: `${key}.reverse`, checked: !!value.reverse, onChange: (reverse) => set({ reverse }) }),
13383
+ scales && valueAxis && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Toggle, { label: "Log scale", name: `${key}.scale`, checked: value.scale === "log", onChange: (log) => set({ scale: log ? "log" : "linear" }) })
13333
13384
  ] }),
13334
- scales && valueAxis && value.scale === "log" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Log base", htmlFor: `${idBase}-${axis}-log-base`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13385
+ scales && valueAxis && value.scale === "log" && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Log base", htmlFor: `${idBase}-${axis}-log-base`, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
13335
13386
  ChartCommitInput,
13336
13387
  {
13337
13388
  id: `${idBase}-${axis}-log-base`,
@@ -13342,7 +13393,7 @@ function AxisSection({ controller, axis, value, idBase, horizontal, numeric = fa
13342
13393
  onCommit: (text) => set({ logBase: text.trim() === "" ? void 0 : Number(text) }).ok
13343
13394
  }
13344
13395
  ) }),
13345
- valueAxis && value.scale !== "log" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Step", htmlFor: `${idBase}-${axis}-step`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13396
+ valueAxis && value.scale !== "log" && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Step", htmlFor: `${idBase}-${axis}-step`, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
13346
13397
  ChartCommitInput,
13347
13398
  {
13348
13399
  id: `${idBase}-${axis}-step`,
@@ -13354,14 +13405,14 @@ function AxisSection({ controller, axis, value, idBase, horizontal, numeric = fa
13354
13405
  onCommit: (text) => set({ step: text.trim() === "" ? null : Number(text) }).ok
13355
13406
  }
13356
13407
  ) }),
13357
- valueAxis && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_jsx_runtime67.Fragment, { children: [
13358
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Min / max", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex gap-1", children: [
13408
+ valueAxis && /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_jsx_runtime68.Fragment, { children: [
13409
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Min / max", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "flex gap-1", children: [
13359
13410
  bound("min"),
13360
13411
  bound("max")
13361
13412
  ] }) }),
13362
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Format", htmlFor: `${idBase}-${axis}-format`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex gap-1", children: [
13363
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Select, { id: `${idBase}-${axis}-format`, name: `${key}.format.style`, value: value.format.style ?? "number", options: import_chart4.CHART_NUMBER_STYLES, onChange: (style) => setFormat({ style }) }),
13364
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13413
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Format", htmlFor: `${idBase}-${axis}-format`, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "flex gap-1", children: [
13414
+ /* @__PURE__ */ (0, import_jsx_runtime68.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 }) }),
13415
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
13365
13416
  ChartCommitInput,
13366
13417
  {
13367
13418
  value: value.format.decimals === void 0 ? "" : String(value.format.decimals),
@@ -13380,8 +13431,8 @@ function AxisSection({ controller, axis, value, idBase, horizontal, numeric = fa
13380
13431
  }
13381
13432
  )
13382
13433
  ] }) }),
13383
- value.format.style === "currency" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Currency", htmlFor: `${idBase}-${axis}-currency`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { id: `${idBase}-${axis}-currency`, value: value.format.currency ?? "USD", "data-option": `${key}.format.currency`, className: chartInputClass, onCommit: (currency) => void setFormat({ currency: currency.toUpperCase() }) }) }),
13384
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Code", htmlFor: `${idBase}-${axis}-code`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13434
+ value.format.style === "currency" && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Currency", htmlFor: `${idBase}-${axis}-currency`, children: /* @__PURE__ */ (0, import_jsx_runtime68.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() }) }) }),
13435
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Code", htmlFor: `${idBase}-${axis}-code`, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
13385
13436
  ChartCommitInput,
13386
13437
  {
13387
13438
  id: `${idBase}-${axis}-code`,
@@ -13407,15 +13458,15 @@ function ErrorBarFields({ controller, series, which, idBase }) {
13407
13458
  const values = which === "xErrorBars" ? series.x ?? [] : series.values;
13408
13459
  const set = (next) => controller.updateSeries(series.id, { [which]: next });
13409
13460
  const patch = (p) => bars && set({ ...bars, ...p });
13410
- return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "space-y-1.5", "data-section": which === "errorBars" ? "error-bars" : "x-error-bars", children: [
13411
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: which === "errorBars" ? "Error bars" : "X error bars", htmlFor: `${id}-type`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("select", { id: `${id}-type`, className: chartInputClass, value: bars?.type ?? "", "data-option": `${key}.type`, onChange: (e) => set((0, import_chart4.chartErrorBarsOfType)(e.currentTarget.value, bars, values)), children: [
13412
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: "", children: "None" }),
13413
- import_chart4.CHART_ERROR_BAR_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: t, children: import_chart4.CHART_ERROR_BAR_LABELS[t] }, t))
13461
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "space-y-1.5", "data-section": which === "errorBars" ? "error-bars" : "x-error-bars", children: [
13462
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: which === "errorBars" ? "Error bars" : "X error bars", htmlFor: `${id}-type`, children: /* @__PURE__ */ (0, import_jsx_runtime68.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: [
13463
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("option", { value: "", children: "None" }),
13464
+ import_chart4.CHART_ERROR_BAR_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("option", { value: t, children: import_chart4.CHART_ERROR_BAR_LABELS[t] }, t))
13414
13465
  ] }) }),
13415
- bars && (bars.type === "fixed" || bars.type === "percent" || bars.type === "stddev") && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: bars.type === "percent" ? "Percent" : bars.type === "stddev" ? "Deviations" : "Amount", htmlFor: `${id}-value`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { id: `${id}-value`, value: String(bars.value ?? (0, import_chart4.defaultChartErrorBarValue)(bars.type)), inputMode: "decimal", "data-option": `${key}.value`, className: chartInputClass, onCommit: (text) => !!patch({ value: text.trim() === "" ? void 0 : Number(text) })?.ok }) }),
13416
- bars?.type === "custom" && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_jsx_runtime67.Fragment, { children: [
13417
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Plus", htmlFor: `${id}-plus`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { id: `${id}-plus`, value: (0, import_chart4.formatChartAmountList)(bars.plus), placeholder: "1, 2, -, 0.5", "data-option": `${key}.plus`, className: chartInputClass, onCommit: (text) => !!patch({ plus: (0, import_chart4.parseChartAmountList)(text) })?.ok }) }),
13418
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Minus", htmlFor: `${id}-minus`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13466
+ bars && (bars.type === "fixed" || bars.type === "percent" || bars.type === "stddev") && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: bars.type === "percent" ? "Percent" : bars.type === "stddev" ? "Deviations" : "Amount", htmlFor: `${id}-value`, children: /* @__PURE__ */ (0, import_jsx_runtime68.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 }) }),
13467
+ bars?.type === "custom" && /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_jsx_runtime68.Fragment, { children: [
13468
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Plus", htmlFor: `${id}-plus`, children: /* @__PURE__ */ (0, import_jsx_runtime68.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 }) }),
13469
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Minus", htmlFor: `${id}-minus`, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
13419
13470
  ChartCommitInput,
13420
13471
  {
13421
13472
  id: `${id}-minus`,
@@ -13432,15 +13483,15 @@ function ErrorBarFields({ controller, series, which, idBase }) {
13432
13483
  }
13433
13484
  ) })
13434
13485
  ] }),
13435
- bars && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex items-center gap-2", children: [
13436
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("select", { className: `${chartInputClass} flex-1`, "aria-label": "Error bar direction", value: bars.direction ?? "both", "data-option": `${key}.direction`, onChange: (e) => patch({ direction: e.currentTarget.value }), children: import_chart4.CHART_ERROR_BAR_DIRECTIONS.map((d) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: d, children: d === "both" ? "Both ways" : d === "plus" ? "Plus only" : "Minus only" }, d)) }),
13437
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "Caps", name: `${key}.cap`, checked: bars.cap !== false, onChange: (cap2) => patch({ cap: cap2 }) })
13486
+ bars && /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "flex items-center gap-2", children: [
13487
+ /* @__PURE__ */ (0, import_jsx_runtime68.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_runtime68.jsx)("option", { value: d, children: d === "both" ? "Both ways" : d === "plus" ? "Plus only" : "Minus only" }, d)) }),
13488
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Toggle, { label: "Caps", name: `${key}.cap`, checked: bars.cap !== false, onChange: (cap2) => patch({ cap: cap2 }) })
13438
13489
  ] })
13439
13490
  ] });
13440
13491
  }
13441
13492
  function ChartInspector({ controller, sections, className }) {
13442
13493
  const { spec, selectedSeries, selection, raceFrame, racePlaying } = useChartState(controller);
13443
- const idBase = (0, import_react91.useId)();
13494
+ const idBase = (0, import_react92.useId)();
13444
13495
  const show = (section) => !sections || sections.includes(section);
13445
13496
  const cartesian = (0, import_chart4.isCartesianChart)(spec.type);
13446
13497
  const family = (0, import_chart4.chartFamily)(spec);
@@ -13455,30 +13506,30 @@ function ChartInspector({ controller, sections, className }) {
13455
13506
  const annotated = scales;
13456
13507
  const oneSeries = cartesian && spec.series.filter((s) => !s.hidden).length === 1;
13457
13508
  const calloutIndex = selection?.kind === "point" && selection.seriesId === selectedSeries?.id ? selection.index : null;
13458
- return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: `space-y-3 text-xs ${className ?? ""}`, "data-chart-inspector": "", children: [
13459
- show("type") && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: chartSectionClass, "data-section": "type", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "grid grid-cols-3 gap-0.5 rounded-md bg-muted p-0.5", role: "radiogroup", "aria-label": "Chart type", children: import_chart4.CHART_TYPES.map((type) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", role: "radio", "aria-checked": spec.type === type, "data-chart-type": type, className: chartSegmentClass(spec.type === type), onClick: () => controller.setType(type), children: import_chart4.CHART_TYPE_LABELS[type] }, type)) }) }),
13460
- show("style") && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: chartSectionClass, "data-section": "style", children: [
13461
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Layout", htmlFor: `${idBase}-layout`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("select", { id: `${idBase}-layout`, className: chartInputClass, value: "", "data-option": "preset.layout", onChange: (e) => e.currentTarget.value && controller.applyPreset({ layout: e.currentTarget.value }), children: [
13462
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: "", children: "Quick layout\u2026" }),
13463
- import_chart4.CHART_LAYOUT_PRESETS.map((p) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: p.id, title: p.description, children: p.label }, p.id))
13509
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: `space-y-3 text-xs ${className ?? ""}`, "data-chart-inspector": "", children: [
13510
+ show("type") && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: chartSectionClass, "data-section": "type", children: /* @__PURE__ */ (0, import_jsx_runtime68.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_runtime68.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)) }) }),
13511
+ show("style") && /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: chartSectionClass, "data-section": "style", children: [
13512
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Layout", htmlFor: `${idBase}-layout`, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("select", { id: `${idBase}-layout`, className: chartInputClass, value: "", "data-option": "preset.layout", onChange: (e) => e.currentTarget.value && controller.applyPreset({ layout: e.currentTarget.value }), children: [
13513
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("option", { value: "", children: "Quick layout\u2026" }),
13514
+ import_chart4.CHART_LAYOUT_PRESETS.map((p) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("option", { value: p.id, title: p.description, children: p.label }, p.id))
13464
13515
  ] }) }),
13465
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Colours", htmlFor: `${idBase}-colors`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("select", { id: `${idBase}-colors`, className: chartInputClass, value: import_chart4.CHART_COLOR_SCHEMES.find((c) => c.palette.join() === spec.palette.join())?.id ?? "", "data-option": "preset.colors", onChange: (e) => e.currentTarget.value && controller.applyPreset({ colors: e.currentTarget.value }), children: [
13466
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: "", children: "Custom" }),
13467
- import_chart4.CHART_COLOR_SCHEMES.map((c) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: c.id, title: c.description, children: c.label }, c.id))
13516
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Colours", htmlFor: `${idBase}-colors`, children: /* @__PURE__ */ (0, import_jsx_runtime68.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: [
13517
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("option", { value: "", children: "Custom" }),
13518
+ import_chart4.CHART_COLOR_SCHEMES.map((c) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("option", { value: c.id, title: c.description, children: c.label }, c.id))
13468
13519
  ] }) }),
13469
- !colorCheck.ok && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("p", { className: "text-[11px] leading-snug text-amber-600 dark:text-amber-400", "data-chart-color-warning": "", children: colorCheck.issues[0] }),
13470
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "transpose", onClick: () => controller.transpose(), children: "Switch rows and columns" })
13520
+ !colorCheck.ok && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("p", { className: "text-[11px] leading-snug text-amber-600 dark:text-amber-400", "data-chart-color-warning": "", children: colorCheck.issues[0] }),
13521
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "transpose", onClick: () => controller.transpose(), children: "Switch rows and columns" })
13471
13522
  ] }),
13472
- show("titles") && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: chartSectionClass, "data-section": "titles", children: [
13473
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Title", htmlFor: `${idBase}-title`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { id: `${idBase}-title`, value: spec.title, "data-option": "title", className: chartInputClass, onCommit: (title) => void controller.setTitle(title) }) }),
13474
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Subtitle", htmlFor: `${idBase}-subtitle`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { id: `${idBase}-subtitle`, value: spec.subtitle, "data-option": "subtitle", className: chartInputClass, onCommit: (subtitle) => void controller.setSubtitle(subtitle) }) }),
13475
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Note", htmlFor: `${idBase}-note`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { id: `${idBase}-note`, value: spec.note, placeholder: "Source or footnote", "data-option": "note", className: chartInputClass, onCommit: (note) => void controller.setNote(note) }) })
13523
+ show("titles") && /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: chartSectionClass, "data-section": "titles", children: [
13524
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Title", htmlFor: `${idBase}-title`, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ChartCommitInput, { id: `${idBase}-title`, value: spec.title, "data-option": "title", className: chartInputClass, onCommit: (title) => void controller.setTitle(title) }) }),
13525
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Subtitle", htmlFor: `${idBase}-subtitle`, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ChartCommitInput, { id: `${idBase}-subtitle`, value: spec.subtitle, "data-option": "subtitle", className: chartInputClass, onCommit: (subtitle) => void controller.setSubtitle(subtitle) }) }),
13526
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Note", htmlFor: `${idBase}-note`, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ChartCommitInput, { id: `${idBase}-note`, value: spec.note, placeholder: "Source or footnote", "data-option": "note", className: chartInputClass, onCommit: (note) => void controller.setNote(note) }) })
13476
13527
  ] }),
13477
- show("options") && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: chartSectionClass, "data-section": "options", children: [
13478
- cartesian && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Stacking", htmlFor: `${idBase}-stacking`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Select, { id: `${idBase}-stacking`, name: "stacking", value: spec.stacking, options: import_chart4.CHART_STACKINGS, labels: { none: "None", stacked: "Stacked", percent: "100%" }, onChange: (stacking) => controller.update({ stacking }) }) }),
13479
- hasBars && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Bars", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "flex gap-0.5 rounded-md bg-muted p-0.5", children: ["vertical", "horizontal"].map((o) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", "aria-pressed": spec.orientation === o, "data-option": `orientation.${o}`, className: chartSegmentClass(spec.orientation === o), onClick: () => controller.update({ orientation: o }), children: cap(o) }, o)) }) }),
13480
- hasLines && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Lines", htmlFor: `${idBase}-curve`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Select, { id: `${idBase}-curve`, name: "curve", value: spec.curve, options: import_chart4.CHART_CURVES, onChange: (curve) => controller.update({ curve }) }) }),
13481
- spec.type === "donut" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Hole", htmlFor: `${idBase}-hole`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13528
+ show("options") && /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: chartSectionClass, "data-section": "options", children: [
13529
+ cartesian && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Stacking", htmlFor: `${idBase}-stacking`, children: /* @__PURE__ */ (0, import_jsx_runtime68.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 }) }) }),
13530
+ hasBars && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Bars", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "flex gap-0.5 rounded-md bg-muted p-0.5", children: ["vertical", "horizontal"].map((o) => /* @__PURE__ */ (0, import_jsx_runtime68.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)) }) }),
13531
+ hasLines && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Lines", htmlFor: `${idBase}-curve`, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Select, { id: `${idBase}-curve`, name: "curve", value: spec.curve, options: import_chart4.CHART_CURVES, onChange: (curve) => controller.update({ curve }) }) }),
13532
+ spec.type === "donut" && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Hole", htmlFor: `${idBase}-hole`, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
13482
13533
  "input",
13483
13534
  {
13484
13535
  id: `${idBase}-hole`,
@@ -13494,7 +13545,7 @@ function ChartInspector({ controller, sections, className }) {
13494
13545
  onChange: (e) => controller.update({ innerRadius: Number(e.currentTarget.value) })
13495
13546
  }
13496
13547
  ) }),
13497
- hasBars && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Spacing", htmlFor: `${idBase}-gap`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13548
+ hasBars && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Spacing", htmlFor: `${idBase}-gap`, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
13498
13549
  "input",
13499
13550
  {
13500
13551
  id: `${idBase}-gap`,
@@ -13510,9 +13561,9 @@ function ChartInspector({ controller, sections, className }) {
13510
13561
  onChange: (e) => controller.update({ gapWidth: Number(e.currentTarget.value) })
13511
13562
  }
13512
13563
  ) }),
13513
- spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Map", htmlFor: `${idBase}-map`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("select", { id: `${idBase}-map`, className: chartInputClass, value: spec.map, "data-option": "map", onChange: (e) => controller.update({ map: e.currentTarget.value }), children: [.../* @__PURE__ */ new Set([spec.map, ...(0, import_chart4.listChartMaps)().map((m) => m.id)])].map((id) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: id, children: (0, import_chart4.listChartMaps)().find((m) => m.id === id)?.name ?? `${id} (not loaded)` }, id)) }) }),
13514
- spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Classes", htmlFor: `${idBase}-map-steps`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { id: `${idBase}-map-steps`, value: String(spec.mapSteps), inputMode: "numeric", "data-option": "mapSteps", disabled: spec.mapThresholds.length > 0, className: chartInputClass, onCommit: (text) => controller.update({ mapSteps: Number(text) }).ok }) }),
13515
- spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Breaks", htmlFor: `${idBase}-map-breaks`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13564
+ spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Map", htmlFor: `${idBase}-map`, children: /* @__PURE__ */ (0, import_jsx_runtime68.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_runtime68.jsx)("option", { value: id, children: (0, import_chart4.listChartMaps)().find((m) => m.id === id)?.name ?? `${id} (not loaded)` }, id)) }) }),
13565
+ spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Classes", htmlFor: `${idBase}-map-steps`, children: /* @__PURE__ */ (0, import_jsx_runtime68.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 }) }),
13566
+ spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Breaks", htmlFor: `${idBase}-map-breaks`, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
13516
13567
  ChartCommitInput,
13517
13568
  {
13518
13569
  id: `${idBase}-map-breaks`,
@@ -13523,10 +13574,10 @@ function ChartInspector({ controller, sections, className }) {
13523
13574
  onCommit: (text) => controller.update({ mapThresholds: text.trim() ? text.split(",").map((t) => Number(t.trim())) : [] }).ok
13524
13575
  }
13525
13576
  ) }),
13526
- spec.type === "barrace" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Bars", htmlFor: `${idBase}-race-top`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { id: `${idBase}-race-top`, value: String(spec.raceTopN), inputMode: "numeric", "data-option": "raceTopN", className: chartInputClass, onCommit: (text) => controller.update({ raceTopN: Number(text) }).ok }) }),
13527
- spec.type === "barrace" && spec.categories.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Time", htmlFor: `${idBase}-race-frame`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex items-center gap-1", children: [
13528
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "race-play", "aria-label": racePlaying ? "Pause the race" : "Play the race", onClick: () => racePlaying ? controller.pauseRace() : controller.playRace(), children: racePlaying ? "Pause" : "Play" }),
13529
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13577
+ spec.type === "barrace" && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Bars", htmlFor: `${idBase}-race-top`, children: /* @__PURE__ */ (0, import_jsx_runtime68.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 }) }),
13578
+ spec.type === "barrace" && spec.categories.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Time", htmlFor: `${idBase}-race-frame`, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "flex items-center gap-1", children: [
13579
+ /* @__PURE__ */ (0, import_jsx_runtime68.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" }),
13580
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
13530
13581
  "input",
13531
13582
  {
13532
13583
  id: `${idBase}-race-frame`,
@@ -13541,13 +13592,13 @@ function ChartInspector({ controller, sections, className }) {
13541
13592
  onChange: (e) => controller.setRaceFrame(Number(e.currentTarget.value))
13542
13593
  }
13543
13594
  ),
13544
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "w-12 shrink-0 truncate text-right tabular-nums text-muted-foreground", "data-race-time": "", children: spec.categories[Math.round(raceFrame ?? spec.categories.length - 1)] })
13595
+ /* @__PURE__ */ (0, import_jsx_runtime68.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)] })
13545
13596
  ] }) }),
13546
- spec.type === "sankey" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Flows", htmlFor: `${idBase}-sankey-color`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Select, { id: `${idBase}-sankey-color`, name: "sankeyLinkColor", value: spec.sankeyLinkColor, options: import_chart4.CHART_SANKEY_LINK_COLORS, labels: { source: "Coloured by source", target: "Coloured by target", gray: "Grey" }, onChange: (sankeyLinkColor) => controller.update({ sankeyLinkColor }) }) }),
13547
- spec.type === "sunburst" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Caption", htmlFor: `${idBase}-sunburst-label`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { id: `${idBase}-sunburst-label`, value: spec.sunburstLabel, placeholder: "Under the total", "data-option": "sunburstLabel", className: chartInputClass, onCommit: (sunburstLabel) => controller.update({ sunburstLabel }).ok }) }),
13548
- spec.type === "likert" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Neutral", htmlFor: `${idBase}-likert-neutral`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Select, { id: `${idBase}-likert-neutral`, name: "likertNeutral", value: spec.likertNeutral, options: import_chart4.CHART_LIKERT_NEUTRALS, labels: { split: "Across the centre", separate: "In its own column" }, onChange: (likertNeutral) => controller.update({ likertNeutral }) }) }),
13549
- spec.type === "likert" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Order", htmlFor: `${idBase}-likert-sort`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Select, { id: `${idBase}-likert-sort`, name: "likertSort", value: spec.likertSort, options: import_chart4.CHART_LIKERT_SORTS, labels: { none: "As entered", positive: "Most agreement first", negative: "Most disagreement first" }, onChange: (likertSort) => controller.update({ likertSort }) }) }),
13550
- spec.type === "parliament" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Sweep", htmlFor: `${idBase}-parliament-arc`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13597
+ spec.type === "sankey" && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Flows", htmlFor: `${idBase}-sankey-color`, children: /* @__PURE__ */ (0, import_jsx_runtime68.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 }) }) }),
13598
+ spec.type === "sunburst" && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Caption", htmlFor: `${idBase}-sunburst-label`, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ChartCommitInput, { id: `${idBase}-sunburst-label`, value: spec.sunburstLabel, placeholder: "Under the total", "data-option": "sunburstLabel", className: chartInputClass, onCommit: (sunburstLabel) => controller.update({ sunburstLabel }).ok }) }),
13599
+ spec.type === "likert" && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Neutral", htmlFor: `${idBase}-likert-neutral`, children: /* @__PURE__ */ (0, import_jsx_runtime68.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 }) }) }),
13600
+ spec.type === "likert" && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Order", htmlFor: `${idBase}-likert-sort`, children: /* @__PURE__ */ (0, import_jsx_runtime68.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 }) }) }),
13601
+ spec.type === "parliament" && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Sweep", htmlFor: `${idBase}-parliament-arc`, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
13551
13602
  "input",
13552
13603
  {
13553
13604
  id: `${idBase}-parliament-arc`,
@@ -13563,34 +13614,34 @@ function ChartInspector({ controller, sections, className }) {
13563
13614
  onChange: (e) => controller.update({ parliamentArc: Number(e.currentTarget.value) })
13564
13615
  }
13565
13616
  ) }),
13566
- spec.type === "parliament" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Majority", htmlFor: `${idBase}-parliament-majority`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { id: `${idBase}-parliament-majority`, value: spec.parliamentMajority === null ? "" : String(spec.parliamentMajority), placeholder: "Half plus one", inputMode: "numeric", "data-option": "parliamentMajority", className: chartInputClass, onCommit: (text) => controller.update({ parliamentMajority: text.trim() === "" ? null : Number(text) }).ok }) }),
13567
- spec.type === "parliament" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Caption", htmlFor: `${idBase}-parliament-label`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { id: `${idBase}-parliament-label`, value: spec.parliamentLabel, placeholder: "seats", "data-option": "parliamentLabel", className: chartInputClass, onCommit: (parliamentLabel) => controller.update({ parliamentLabel }).ok }) }),
13568
- spec.type === "radar" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Rings", htmlFor: `${idBase}-radar-ticks`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { id: `${idBase}-radar-ticks`, value: spec.radarTicks === null ? "" : String(spec.radarTicks), placeholder: "Auto", inputMode: "numeric", "data-option": "radarTicks", className: chartInputClass, onCommit: (text) => controller.update({ radarTicks: text.trim() === "" ? null : Number(text) }).ok }) }),
13569
- spec.type === "radar" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Grid", htmlFor: `${idBase}-radar-graticule`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Select, { id: `${idBase}-radar-graticule`, name: "radarGraticule", value: spec.radarGraticule, options: import_chart4.CHART_RADAR_GRATICULES, labels: { polygon: "Polygons", circle: "Circles" }, onChange: (radarGraticule) => controller.update({ radarGraticule }) }) }),
13570
- spec.dataLabels && hasBars && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Labels", htmlFor: `${idBase}-label-position`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Select, { id: `${idBase}-label-position`, name: "labelPosition", value: spec.labelPosition, options: import_chart4.CHART_LABEL_POSITIONS, onChange: (labelPosition) => controller.update({ labelPosition }) }) }),
13571
- spec.type === "histogram" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Bins", htmlFor: `${idBase}-bins`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { id: `${idBase}-bins`, value: spec.bins === null ? "" : String(spec.bins), placeholder: "Auto", inputMode: "numeric", "data-option": "bins", className: chartInputClass, onCommit: (text) => controller.update({ bins: text.trim() === "" ? null : Number(text) }).ok }) }),
13572
- /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex flex-wrap gap-x-4 gap-y-1", children: [
13573
- spec.type === "waterfall" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "Total bar", name: "showTotal", checked: spec.showTotal, onChange: (showTotal) => controller.update({ showTotal }) }),
13574
- hasLines && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "Points", name: "points", checked: spec.points, onChange: (points) => controller.update({ points }) }),
13575
- oneSeries && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "Colour by category", name: "varyColors", checked: spec.varyColors, onChange: (varyColors) => controller.update({ varyColors }) }),
13576
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "Data labels", name: "dataLabels", checked: spec.dataLabels, onChange: (dataLabels) => controller.update({ dataLabels }) })
13617
+ spec.type === "parliament" && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Majority", htmlFor: `${idBase}-parliament-majority`, children: /* @__PURE__ */ (0, import_jsx_runtime68.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 }) }),
13618
+ spec.type === "parliament" && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Caption", htmlFor: `${idBase}-parliament-label`, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ChartCommitInput, { id: `${idBase}-parliament-label`, value: spec.parliamentLabel, placeholder: "seats", "data-option": "parliamentLabel", className: chartInputClass, onCommit: (parliamentLabel) => controller.update({ parliamentLabel }).ok }) }),
13619
+ spec.type === "radar" && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Rings", htmlFor: `${idBase}-radar-ticks`, children: /* @__PURE__ */ (0, import_jsx_runtime68.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 }) }),
13620
+ spec.type === "radar" && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Grid", htmlFor: `${idBase}-radar-graticule`, children: /* @__PURE__ */ (0, import_jsx_runtime68.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 }) }) }),
13621
+ spec.dataLabels && hasBars && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Labels", htmlFor: `${idBase}-label-position`, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Select, { id: `${idBase}-label-position`, name: "labelPosition", value: spec.labelPosition, options: import_chart4.CHART_LABEL_POSITIONS, onChange: (labelPosition) => controller.update({ labelPosition }) }) }),
13622
+ spec.type === "histogram" && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Bins", htmlFor: `${idBase}-bins`, children: /* @__PURE__ */ (0, import_jsx_runtime68.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 }) }),
13623
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "flex flex-wrap gap-x-4 gap-y-1", children: [
13624
+ spec.type === "waterfall" && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Toggle, { label: "Total bar", name: "showTotal", checked: spec.showTotal, onChange: (showTotal) => controller.update({ showTotal }) }),
13625
+ hasLines && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Toggle, { label: "Points", name: "points", checked: spec.points, onChange: (points) => controller.update({ points }) }),
13626
+ oneSeries && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Toggle, { label: "Colour by category", name: "varyColors", checked: spec.varyColors, onChange: (varyColors) => controller.update({ varyColors }) }),
13627
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Toggle, { label: "Data labels", name: "dataLabels", checked: spec.dataLabels, onChange: (dataLabels) => controller.update({ dataLabels }) })
13577
13628
  ] })
13578
13629
  ] }),
13579
- show("legend") && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: chartSectionClass, "data-section": "legend", children: [
13580
- /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex items-center justify-between", children: [
13581
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Legend" }),
13582
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "Show", name: "legend.show", checked: spec.legend.show, onChange: (v) => controller.setLegend({ show: v }) })
13630
+ show("legend") && /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: chartSectionClass, "data-section": "legend", children: [
13631
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "flex items-center justify-between", children: [
13632
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Legend" }),
13633
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Toggle, { label: "Show", name: "legend.show", checked: spec.legend.show, onChange: (v) => controller.setLegend({ show: v }) })
13583
13634
  ] }),
13584
- spec.legend.show && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "flex gap-0.5 rounded-md bg-muted p-0.5", children: import_chart4.CHART_LEGEND_POSITIONS.map((p) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", "aria-pressed": spec.legend.position === p, "data-option": `legend.${p}`, className: chartSegmentClass(spec.legend.position === p), onClick: () => controller.setLegend({ position: p }), children: cap(p) }, p)) })
13635
+ spec.legend.show && /* @__PURE__ */ (0, import_jsx_runtime68.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_runtime68.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)) })
13585
13636
  ] }),
13586
- show("axes") && hasAxes && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_jsx_runtime67.Fragment, { children: [
13587
- family !== "box" && family !== "histogram" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(AxisSection, { controller, axis: "x", value: spec.xAxis, idBase, horizontal: spec.orientation === "horizontal", numeric: family === "xy", scales }),
13588
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(AxisSection, { controller, axis: "y", value: spec.yAxis, idBase, horizontal: spec.orientation === "horizontal", scales }),
13589
- usesSecondary && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(AxisSection, { controller, axis: "y2", value: spec.yAxis2, idBase, horizontal: spec.orientation === "horizontal", scales })
13637
+ show("axes") && hasAxes && /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_jsx_runtime68.Fragment, { children: [
13638
+ family !== "box" && family !== "histogram" && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(AxisSection, { controller, axis: "x", value: spec.xAxis, idBase, horizontal: spec.orientation === "horizontal", numeric: family === "xy", scales }),
13639
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(AxisSection, { controller, axis: "y", value: spec.yAxis, idBase, horizontal: spec.orientation === "horizontal", scales }),
13640
+ usesSecondary && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(AxisSection, { controller, axis: "y2", value: spec.yAxis2, idBase, horizontal: spec.orientation === "horizontal", scales })
13590
13641
  ] }),
13591
- show("annotations") && annotated && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: chartSectionClass, "data-section": "annotations", children: [
13592
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Annotations" }),
13593
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Highlight", htmlFor: `${idBase}-highlight`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13642
+ show("annotations") && annotated && /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: chartSectionClass, "data-section": "annotations", children: [
13643
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Annotations" }),
13644
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Highlight", htmlFor: `${idBase}-highlight`, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
13594
13645
  ChartCommitInput,
13595
13646
  {
13596
13647
  id: `${idBase}-highlight`,
@@ -13601,27 +13652,27 @@ function ChartInspector({ controller, sections, className }) {
13601
13652
  onCommit: (text) => controller.setHighlight(text.split(",").map((n) => n.trim()).filter(Boolean)).ok
13602
13653
  }
13603
13654
  ) }),
13604
- spec.referenceLines.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex items-center gap-1", "data-reference-line": i, children: [
13605
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { value: String(line.value), "aria-label": "Line value", inputMode: "decimal", "data-option": `referenceLine.${i}.value`, className: `${chartInputClass} w-16 shrink-0`, onCommit: (text) => controller.updateReferenceLine(i, { value: Number(text) }).ok }),
13606
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { value: line.label ?? "", "aria-label": "Line label", placeholder: "Label", "data-option": `referenceLine.${i}.label`, className: `${chartInputClass} flex-1`, onCommit: (text) => controller.updateReferenceLine(i, { label: text || null }).ok }),
13607
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", className: chartButtonClass, "aria-label": "Delete reference line", "data-action": "reference-line-delete", onClick: () => controller.removeReferenceLine(i), children: "\xD7" })
13655
+ spec.referenceLines.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "flex items-center gap-1", "data-reference-line": i, children: [
13656
+ /* @__PURE__ */ (0, import_jsx_runtime68.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 }),
13657
+ /* @__PURE__ */ (0, import_jsx_runtime68.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 }),
13658
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("button", { type: "button", className: chartButtonClass, "aria-label": "Delete reference line", "data-action": "reference-line-delete", onClick: () => controller.removeReferenceLine(i), children: "\xD7" })
13608
13659
  ] }, `line-${i}`)),
13609
- spec.referenceBands.map((band, i) => /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex items-center gap-1", "data-reference-band": i, children: [
13610
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { value: String(band.from), "aria-label": "Band from", inputMode: "decimal", "data-option": `referenceBand.${i}.from`, className: `${chartInputClass} w-14 shrink-0`, onCommit: (text) => controller.updateReferenceBand(i, { from: Number(text) }).ok }),
13611
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { value: String(band.to), "aria-label": "Band to", inputMode: "decimal", "data-option": `referenceBand.${i}.to`, className: `${chartInputClass} w-14 shrink-0`, onCommit: (text) => controller.updateReferenceBand(i, { to: Number(text) }).ok }),
13612
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { value: band.label ?? "", "aria-label": "Band label", placeholder: "Label", "data-option": `referenceBand.${i}.label`, className: `${chartInputClass} flex-1`, onCommit: (text) => controller.updateReferenceBand(i, { label: text || null }).ok }),
13613
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", className: chartButtonClass, "aria-label": "Delete reference band", "data-action": "reference-band-delete", onClick: () => controller.removeReferenceBand(i), children: "\xD7" })
13660
+ spec.referenceBands.map((band, i) => /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "flex items-center gap-1", "data-reference-band": i, children: [
13661
+ /* @__PURE__ */ (0, import_jsx_runtime68.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 }),
13662
+ /* @__PURE__ */ (0, import_jsx_runtime68.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 }),
13663
+ /* @__PURE__ */ (0, import_jsx_runtime68.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 }),
13664
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("button", { type: "button", className: chartButtonClass, "aria-label": "Delete reference band", "data-action": "reference-band-delete", onClick: () => controller.removeReferenceBand(i), children: "\xD7" })
13614
13665
  ] }, `band-${i}`)),
13615
- /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex gap-1", children: [
13616
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", className: chartButtonClass, "data-option": "referenceLine.add", onClick: () => controller.addReferenceLine((0, import_chart4.suggestChartReferences)(spec).line), children: "Add line" }),
13617
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", className: chartButtonClass, "data-option": "referenceBand.add", onClick: () => controller.addReferenceBand((0, import_chart4.suggestChartReferences)(spec).band), children: "Add band" })
13666
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "flex gap-1", children: [
13667
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("button", { type: "button", className: chartButtonClass, "data-option": "referenceLine.add", onClick: () => controller.addReferenceLine((0, import_chart4.suggestChartReferences)(spec).line), children: "Add line" }),
13668
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("button", { type: "button", className: chartButtonClass, "data-option": "referenceBand.add", onClick: () => controller.addReferenceBand((0, import_chart4.suggestChartReferences)(spec).band), children: "Add band" })
13618
13669
  ] })
13619
13670
  ] }),
13620
- show("series") && selectedSeries && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: chartSectionClass, "data-section": "series", "data-series-id": selectedSeries.id, children: [
13621
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Series" }),
13622
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Name", htmlFor: `${idBase}-series-name`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChartCommitInput, { id: `${idBase}-series-name`, value: selectedSeries.name, "data-option": "series.name", className: chartInputClass, onCommit: (name) => void controller.updateSeries(selectedSeries.id, { name }) }) }),
13623
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Colour", htmlFor: `${idBase}-series-color`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex items-center gap-1", children: [
13624
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13671
+ show("series") && selectedSeries && /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: chartSectionClass, "data-section": "series", "data-series-id": selectedSeries.id, children: [
13672
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Series" }),
13673
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Name", htmlFor: `${idBase}-series-name`, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ChartCommitInput, { id: `${idBase}-series-name`, value: selectedSeries.name, "data-option": "series.name", className: chartInputClass, onCommit: (name) => void controller.updateSeries(selectedSeries.id, { name }) }) }),
13674
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Colour", htmlFor: `${idBase}-series-color`, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "flex items-center gap-1", children: [
13675
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
13625
13676
  "input",
13626
13677
  {
13627
13678
  id: `${idBase}-series-color`,
@@ -13634,9 +13685,9 @@ function ChartInspector({ controller, sections, className }) {
13634
13685
  onChange: (e) => controller.updateSeries(selectedSeries.id, { color: e.currentTarget.value })
13635
13686
  }
13636
13687
  ),
13637
- selectedSeries.color && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "reset-color", onClick: () => controller.updateSeries(selectedSeries.id, { color: null }), children: "Palette" })
13688
+ selectedSeries.color && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "reset-color", onClick: () => controller.updateSeries(selectedSeries.id, { color: null }), children: "Palette" })
13638
13689
  ] }) }),
13639
- cartesian && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Draw as", htmlFor: `${idBase}-series-type`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
13690
+ cartesian && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Draw as", htmlFor: `${idBase}-series-type`, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
13640
13691
  "select",
13641
13692
  {
13642
13693
  id: `${idBase}-series-type`,
@@ -13645,12 +13696,12 @@ function ChartInspector({ controller, sections, className }) {
13645
13696
  "data-option": "series.type",
13646
13697
  onChange: (e) => controller.updateSeries(selectedSeries.id, { type: e.currentTarget.value || null }),
13647
13698
  children: [
13648
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: "", children: "Chart type" }),
13649
- import_chart4.CHART_SERIES_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: t, children: import_chart4.CHART_TYPE_LABELS[t] }, t))
13699
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("option", { value: "", children: "Chart type" }),
13700
+ import_chart4.CHART_SERIES_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("option", { value: t, children: import_chart4.CHART_TYPE_LABELS[t] }, t))
13650
13701
  ]
13651
13702
  }
13652
13703
  ) }),
13653
- (cartesian || family === "xy") && ["line", "area", "scatter"].includes((0, import_chart4.chartSeriesType)(spec, selectedSeries)) && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Marker", htmlFor: `${idBase}-series-marker`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
13704
+ (cartesian || family === "xy") && ["line", "area", "scatter"].includes((0, import_chart4.chartSeriesType)(spec, selectedSeries)) && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Marker", htmlFor: `${idBase}-series-marker`, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
13654
13705
  "select",
13655
13706
  {
13656
13707
  id: `${idBase}-series-marker`,
@@ -13659,12 +13710,12 @@ function ChartInspector({ controller, sections, className }) {
13659
13710
  "data-option": "series.marker",
13660
13711
  onChange: (e) => controller.updateSeries(selectedSeries.id, { marker: e.currentTarget.value || null }),
13661
13712
  children: [
13662
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: "", children: "Default" }),
13663
- import_chart4.CHART_MARKERS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: m, children: cap(m) }, m))
13713
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("option", { value: "", children: "Default" }),
13714
+ import_chart4.CHART_MARKERS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("option", { value: m, children: cap(m) }, m))
13664
13715
  ]
13665
13716
  }
13666
13717
  ) }),
13667
- annotated && calloutIndex !== null && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Field, { label: "Callout", htmlFor: `${idBase}-series-callout`, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13718
+ annotated && calloutIndex !== null && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Field, { label: "Callout", htmlFor: `${idBase}-series-callout`, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
13668
13719
  ChartCommitInput,
13669
13720
  {
13670
13721
  id: `${idBase}-series-callout`,
@@ -13675,15 +13726,15 @@ function ChartInspector({ controller, sections, className }) {
13675
13726
  onCommit: (text) => controller.setCallout(selectedSeries.id, calloutIndex, text || null).ok
13676
13727
  }
13677
13728
  ) }),
13678
- scales && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ErrorBarFields, { controller, series: selectedSeries, which: "errorBars", idBase }),
13679
- family === "xy" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ErrorBarFields, { controller, series: selectedSeries, which: "xErrorBars", idBase }),
13680
- (0, import_chart4.chartSupportsTrendlines)(spec.type, spec.stacking) && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "space-y-1", "data-section": "trendlines", children: [
13681
- (selectedSeries.trendlines ?? []).map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex items-center gap-1", "data-trendline": i, children: [
13682
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "flex-1 truncate text-muted-foreground", children: (0, import_chart4.chartTrendlineName)(t, selectedSeries.name) }),
13683
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "R\xB2", name: `trendline.${i}.showR2`, checked: !!t.showR2, onChange: (showR2) => controller.updateTrendline(selectedSeries.id, i, { showR2 }) }),
13684
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", className: chartButtonClass, "aria-label": "Delete trendline", "data-action": "trendline-delete", onClick: () => controller.removeTrendline(selectedSeries.id, i), children: "\xD7" })
13729
+ scales && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ErrorBarFields, { controller, series: selectedSeries, which: "errorBars", idBase }),
13730
+ family === "xy" && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ErrorBarFields, { controller, series: selectedSeries, which: "xErrorBars", idBase }),
13731
+ (0, import_chart4.chartSupportsTrendlines)(spec.type, spec.stacking) && /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "space-y-1", "data-section": "trendlines", children: [
13732
+ (selectedSeries.trendlines ?? []).map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "flex items-center gap-1", "data-trendline": i, children: [
13733
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "flex-1 truncate text-muted-foreground", children: (0, import_chart4.chartTrendlineName)(t, selectedSeries.name) }),
13734
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Toggle, { label: "R\xB2", name: `trendline.${i}.showR2`, checked: !!t.showR2, onChange: (showR2) => controller.updateTrendline(selectedSeries.id, i, { showR2 }) }),
13735
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("button", { type: "button", className: chartButtonClass, "aria-label": "Delete trendline", "data-action": "trendline-delete", onClick: () => controller.removeTrendline(selectedSeries.id, i), children: "\xD7" })
13685
13736
  ] }, i)),
13686
- /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
13737
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
13687
13738
  "select",
13688
13739
  {
13689
13740
  className: chartInputClass,
@@ -13692,32 +13743,32 @@ function ChartInspector({ controller, sections, className }) {
13692
13743
  "data-option": "trendline.add",
13693
13744
  onChange: (e) => e.currentTarget.value && controller.addTrendline(selectedSeries.id, { type: e.currentTarget.value }),
13694
13745
  children: [
13695
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: "", children: "Add trendline\u2026" }),
13696
- import_chart4.CHART_TRENDLINE_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: t, children: cap(t.replace("-", " ")) }, t))
13746
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("option", { value: "", children: "Add trendline\u2026" }),
13747
+ import_chart4.CHART_TRENDLINE_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("option", { value: t, children: cap(t.replace("-", " ")) }, t))
13697
13748
  ]
13698
13749
  }
13699
13750
  )
13700
13751
  ] }),
13701
- /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
13702
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "Hidden", name: "series.hidden", checked: !!selectedSeries.hidden, onChange: (hidden) => controller.updateSeries(selectedSeries.id, { hidden }) }),
13703
- family === "cartesian" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "Secondary axis", name: "series.axis", checked: selectedSeries.axis === "secondary", onChange: (secondary) => controller.updateSeries(selectedSeries.id, { axis: secondary ? "secondary" : null }) }),
13704
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "flex-1" }),
13705
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", className: chartButtonClass, disabled: seriesIndex <= 0, "aria-label": "Move series earlier", "data-action": "series-up", onClick: () => controller.moveSeries(selectedSeries.id, seriesIndex - 1), children: "\u2191" }),
13706
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", className: chartButtonClass, disabled: seriesIndex >= spec.series.length - 1, "aria-label": "Move series later", "data-action": "series-down", onClick: () => controller.moveSeries(selectedSeries.id, seriesIndex + 1), children: "\u2193" }),
13707
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("button", { type: "button", className: `${chartButtonClass} text-destructive`, "data-action": "series-delete", onClick: () => controller.removeSeries(selectedSeries.id), children: "Delete" })
13752
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
13753
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Toggle, { label: "Hidden", name: "series.hidden", checked: !!selectedSeries.hidden, onChange: (hidden) => controller.updateSeries(selectedSeries.id, { hidden }) }),
13754
+ family === "cartesian" && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Toggle, { label: "Secondary axis", name: "series.axis", checked: selectedSeries.axis === "secondary", onChange: (secondary) => controller.updateSeries(selectedSeries.id, { axis: secondary ? "secondary" : null }) }),
13755
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "flex-1" }),
13756
+ /* @__PURE__ */ (0, import_jsx_runtime68.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" }),
13757
+ /* @__PURE__ */ (0, import_jsx_runtime68.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" }),
13758
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("button", { type: "button", className: `${chartButtonClass} text-destructive`, "data-action": "series-delete", onClick: () => controller.removeSeries(selectedSeries.id), children: "Delete" })
13708
13759
  ] })
13709
13760
  ] })
13710
13761
  ] });
13711
13762
  }
13712
13763
 
13713
13764
  // src/chart-node/ChartNodeView.tsx
13714
- var import_jsx_runtime68 = require("react/jsx-runtime");
13765
+ var import_jsx_runtime69 = require("react/jsx-runtime");
13715
13766
  function ChartNodeView({ state, theme, showDataGrid = true }) {
13716
13767
  const { controller, editing, editable, selected, width, height, setEditing } = state;
13717
13768
  const open = () => {
13718
13769
  if (editable && !editing) setEditing(true);
13719
13770
  };
13720
- return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
13771
+ return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
13721
13772
  "div",
13722
13773
  {
13723
13774
  className: `not-prose my-2 rounded-md border bg-background p-1 ${selected ? "border-primary ring-1 ring-primary" : "border-border"}`,
@@ -13730,24 +13781,24 @@ function ChartNodeView({ state, theme, showDataGrid = true }) {
13730
13781
  }
13731
13782
  },
13732
13783
  children: [
13733
- editing && /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "mb-1 flex items-center justify-between gap-2 px-1", "data-chart-node-toolbar": "", children: [
13734
- /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "text-xs text-muted-foreground", children: "Editing chart" }),
13735
- /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "done", onClick: () => setEditing(false), children: "Done" })
13784
+ editing && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "mb-1 flex items-center justify-between gap-2 px-1", "data-chart-node-toolbar": "", children: [
13785
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "text-xs text-muted-foreground", children: "Editing chart" }),
13786
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "done", onClick: () => setEditing(false), children: "Done" })
13736
13787
  ] }),
13737
- /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
13788
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
13738
13789
  "div",
13739
13790
  {
13740
13791
  className: editable && !editing ? "cursor-pointer" : void 0,
13741
13792
  onClick: open,
13742
13793
  title: editable && !editing ? "Click to edit the chart" : void 0,
13743
13794
  "data-chart-node-canvas": "",
13744
- children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ChartCanvas, { controller, width: width ?? 640, height, responsive: width === null, editable: editing, theme })
13795
+ children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(ChartCanvas, { controller, width: width ?? 640, height, responsive: width === null, editable: editing, theme })
13745
13796
  }
13746
13797
  ),
13747
13798
  editing && // Wraps by the document's width, not the viewport's: side by side when there is room.
13748
- /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "mt-2 flex flex-wrap items-start gap-2", "data-chart-node-panel": "", children: [
13749
- showDataGrid && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "min-w-0 flex-[1_1_20rem] overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ChartDataGrid, { controller }) }),
13750
- /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ChartInspector, { controller, className: "max-h-96 min-w-0 flex-[1_1_16rem] overflow-y-auto rounded-md border border-border p-3" })
13799
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "mt-2 flex flex-wrap items-start gap-2", "data-chart-node-panel": "", children: [
13800
+ showDataGrid && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "min-w-0 flex-[1_1_20rem] overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(ChartDataGrid, { controller }) }),
13801
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(ChartInspector, { controller, className: "max-h-96 min-w-0 flex-[1_1_16rem] overflow-y-auto rounded-md border border-border p-3" })
13751
13802
  ] })
13752
13803
  ]
13753
13804
  }
@@ -13765,7 +13816,7 @@ function createReactChartNodeView(options = {}) {
13765
13816
  scheduled = true;
13766
13817
  queueMicrotask(() => {
13767
13818
  scheduled = false;
13768
- if (!destroyed) root.render(/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Component, { ...props, state: latest }));
13819
+ if (!destroyed) root.render(/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Component, { ...props, state: latest }));
13769
13820
  });
13770
13821
  };
13771
13822
  schedule();
@@ -13783,10 +13834,10 @@ function createReactChartNodeView(options = {}) {
13783
13834
  }
13784
13835
 
13785
13836
  // src/style/useStyle.ts
13786
- var import_react92 = require("react");
13837
+ var import_react93 = require("react");
13787
13838
  var message = (error) => error instanceof Error ? error.message : String(error);
13788
13839
  function useResolverTask(styles, run, deliver, deps) {
13789
- (0, import_react92.useEffect)(() => {
13840
+ (0, import_react93.useEffect)(() => {
13790
13841
  if (!styles || !run) {
13791
13842
  deliver({ value: null, error: null });
13792
13843
  return;
@@ -13813,7 +13864,7 @@ function useResolverTask(styles, run, deliver, deps) {
13813
13864
  }, [styles, ...deps]);
13814
13865
  }
13815
13866
  function useStyle(styles, domain) {
13816
- const [result, setResult] = (0, import_react92.useState)({ style: null, error: null });
13867
+ const [result, setResult] = (0, import_react93.useState)({ style: null, error: null });
13817
13868
  useResolverTask(
13818
13869
  styles,
13819
13870
  (s) => s.resolve(domain),
@@ -13823,7 +13874,7 @@ function useStyle(styles, domain) {
13823
13874
  return result;
13824
13875
  }
13825
13876
  function useStyleFindings(styles, domain, state) {
13826
- const [result, setResult] = (0, import_react92.useState)({ report: null, style: null, error: null });
13877
+ const [result, setResult] = (0, import_react93.useState)({ report: null, style: null, error: null });
13827
13878
  useResolverTask(
13828
13879
  styles,
13829
13880
  (s) => s.check(domain, state),
@@ -13840,7 +13891,7 @@ function useStyleFindings(styles, domain, state) {
13840
13891
  }
13841
13892
 
13842
13893
  // src/style/StyleFindings.tsx
13843
- var import_jsx_runtime69 = require("react/jsx-runtime");
13894
+ var import_jsx_runtime70 = require("react/jsx-runtime");
13844
13895
  var SEVERITY_CLASS = {
13845
13896
  error: "text-destructive",
13846
13897
  warning: "text-amber-600",
@@ -13849,24 +13900,24 @@ var SEVERITY_CLASS = {
13849
13900
  function StyleFindings({ report, onSelect, title = "House style", className = "" }) {
13850
13901
  if (!report) return null;
13851
13902
  const { findings, ran, skipped } = report;
13852
- return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("section", { "data-style-findings": "", "aria-label": title, className: `flex flex-col gap-1.5 text-xs text-foreground ${className}`, children: [
13853
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("h3", { className: "text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: title }),
13854
- findings.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("ul", { className: "flex flex-col gap-1", children: findings.map((finding, i) => {
13903
+ return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("section", { "data-style-findings": "", "aria-label": title, className: `flex flex-col gap-1.5 text-xs text-foreground ${className}`, children: [
13904
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("h3", { className: "text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: title }),
13905
+ findings.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("ul", { className: "flex flex-col gap-1", children: findings.map((finding, i) => {
13855
13906
  const selectable = finding.target !== void 0 && !!onSelect;
13856
- const body = /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
13857
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { "data-style-severity": finding.severity, className: `shrink-0 font-semibold uppercase text-[10px] ${SEVERITY_CLASS[finding.severity]}`, children: finding.severity }),
13858
- /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("span", { className: "flex min-w-0 flex-col", children: [
13859
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { "data-style-message": "", children: finding.message }),
13860
- /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("span", { className: "text-[10px] text-muted-foreground", children: [
13861
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("code", { children: finding.check }),
13862
- finding.layer && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
13907
+ const body = /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_jsx_runtime70.Fragment, { children: [
13908
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { "data-style-severity": finding.severity, className: `shrink-0 font-semibold uppercase text-[10px] ${SEVERITY_CLASS[finding.severity]}`, children: finding.severity }),
13909
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("span", { className: "flex min-w-0 flex-col", children: [
13910
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { "data-style-message": "", children: finding.message }),
13911
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("span", { className: "text-[10px] text-muted-foreground", children: [
13912
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("code", { children: finding.check }),
13913
+ finding.layer && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_jsx_runtime70.Fragment, { children: [
13863
13914
  " \xB7 ",
13864
13915
  finding.layer
13865
13916
  ] })
13866
13917
  ] })
13867
13918
  ] })
13868
13919
  ] });
13869
- return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("li", { "data-style-finding": finding.check, children: selectable ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
13920
+ return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("li", { "data-style-finding": finding.check, children: selectable ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
13870
13921
  "button",
13871
13922
  {
13872
13923
  type: "button",
@@ -13874,19 +13925,19 @@ function StyleFindings({ report, onSelect, title = "House style", className = ""
13874
13925
  onClick: () => onSelect(finding),
13875
13926
  children: body
13876
13927
  }
13877
- ) : /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "flex items-start gap-2 rounded border border-border px-2 py-1", children: body }) }, `${finding.check}-${i}`);
13928
+ ) : /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "flex items-start gap-2 rounded border border-border px-2 py-1", children: body }) }, `${finding.check}-${i}`);
13878
13929
  }) }),
13879
- findings.length === 0 && ran.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("p", { "data-style-clear": "", className: "text-emerald-600", children: [
13930
+ findings.length === 0 && ran.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("p", { "data-style-clear": "", className: "text-emerald-600", children: [
13880
13931
  "All clear: ",
13881
13932
  ran.length,
13882
13933
  " ",
13883
13934
  ran.length === 1 ? "check" : "checks",
13884
13935
  " passed."
13885
13936
  ] }),
13886
- findings.length === 0 && ran.length === 0 && skipped.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("p", { className: "text-muted-foreground", children: "No house-style checks apply." }),
13887
- skipped.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("ul", { "data-style-skipped": "", "aria-label": "Skipped checks", className: "flex flex-col gap-0.5 text-muted-foreground", children: skipped.map((s) => /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("li", { "data-style-skipped-check": s.check, children: [
13937
+ findings.length === 0 && ran.length === 0 && skipped.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("p", { className: "text-muted-foreground", children: "No house-style checks apply." }),
13938
+ skipped.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime70.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_runtime70.jsxs)("li", { "data-style-skipped-check": s.check, children: [
13888
13939
  "Skipped ",
13889
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("code", { children: s.check }),
13940
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("code", { children: s.check }),
13890
13941
  ": ",
13891
13942
  s.reason
13892
13943
  ] }, s.check)) })
@@ -13932,6 +13983,7 @@ function StyleFindings({ report, onSelect, title = "House style", className = ""
13932
13983
  JobProgress,
13933
13984
  LayerEffectsPanel,
13934
13985
  LayersPanel,
13986
+ MaskEdgeCheck,
13935
13987
  MergePreview,
13936
13988
  NameManager,
13937
13989
  OutlinePanel,