@pixerate/editor-react 0.142.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");
@@ -4184,6 +4185,12 @@ var ImageEditorCanvas = ({
4184
4185
  typeToolRef.current = new import_image_editor2.TypeToolGesture(controller, () => typeOptionsRef.current);
4185
4186
  shapeTypeControllerRef.current = controller;
4186
4187
  }
4188
+ const pathGestureRef = (0, import_react41.useRef)(null);
4189
+ const pathControllerRef = (0, import_react41.useRef)(controller);
4190
+ if (!pathGestureRef.current || pathControllerRef.current !== controller) {
4191
+ pathGestureRef.current = new import_image_editor2.PathEditGesture(controller);
4192
+ pathControllerRef.current = controller;
4193
+ }
4187
4194
  const typeInputRef = (0, import_react41.useRef)(null);
4188
4195
  const [typeSession, setTypeSessionState] = (0, import_react41.useState)(typeToolRef.current.session);
4189
4196
  const setTypeSession = (session) => {
@@ -4205,7 +4212,10 @@ var ImageEditorCanvas = ({
4205
4212
  if (!canvas || !container) return;
4206
4213
  const viewport = (0, import_image_editor2.measureCanvasViewport)(container);
4207
4214
  viewRef.current = { width: viewport.width, height: viewport.height };
4208
- transformTool.setView((0, import_image_editor2.getViewportProjection)(controller.getState(), viewport.width, viewport.height, mode === "crop").scale);
4215
+ const viewScale = (0, import_image_editor2.getViewportProjection)(controller.getState(), viewport.width, viewport.height, mode === "crop").scale;
4216
+ transformTool.setView(viewScale);
4217
+ pathGestureRef.current?.setView(viewScale);
4218
+ const activeTool = controller.getState().activeTool;
4209
4219
  await controller.render(canvas, {
4210
4220
  viewportWidth: viewport.width,
4211
4221
  viewportHeight: viewport.height,
@@ -4221,7 +4231,8 @@ var ImageEditorCanvas = ({
4221
4231
  draftSelectionPath: selectionDraftRef.current,
4222
4232
  brushCursor: mode === "paint" && brushCursorRef.current && controller.getState().activeTool !== "move" && !transformTool.active ? { ...brushCursorRef.current, diameter: controller.getState().paint.brush.size } : null,
4223
4233
  freeTransform: transformTool.overlay(),
4224
- textEdit: typeToolRef.current?.session?.alive ? typeToolRef.current.session.overlay() : null
4234
+ textEdit: typeToolRef.current?.session?.alive ? typeToolRef.current.session.overlay() : null,
4235
+ pathEdit: mode === "annotate" && (0, import_image_editor2.isPathEditTool)(activeTool) ? pathGestureRef.current?.overlay(activeTool) : null
4225
4236
  });
4226
4237
  },
4227
4238
  [controller, mode, fit, transformTool]
@@ -4438,6 +4449,21 @@ var ImageEditorCanvas = ({
4438
4449
  window.addEventListener("keydown", onKey);
4439
4450
  return () => window.removeEventListener("keydown", onKey);
4440
4451
  });
4452
+ (0, import_react41.useEffect)(() => {
4453
+ if (mode !== "annotate" || typeof window === "undefined") return;
4454
+ const onKey = (e) => {
4455
+ const target = e.target;
4456
+ if (target?.closest?.('input, textarea, select, [contenteditable="true"]')) return;
4457
+ if (!(0, import_image_editor2.isPathEditTool)(controller.getState().activeTool)) return;
4458
+ if (pathGestureRef.current?.key(e.key)) {
4459
+ e.preventDefault();
4460
+ report("path", pathGestureRef.current.error);
4461
+ void renderCanvas();
4462
+ }
4463
+ };
4464
+ window.addEventListener("keydown", onKey);
4465
+ return () => window.removeEventListener("keydown", onKey);
4466
+ });
4441
4467
  (0, import_react41.useEffect)(() => {
4442
4468
  if (mode !== "paint" || typeof window === "undefined") return;
4443
4469
  const onKey = (e) => {
@@ -4486,6 +4512,13 @@ var ImageEditorCanvas = ({
4486
4512
  }
4487
4513
  return;
4488
4514
  }
4515
+ if (mode === "annotate" && (0, import_image_editor2.isPathEditTool)(state.activeTool)) {
4516
+ const g = pathGestureRef.current;
4517
+ g.down((0, import_image_editor2.canvasToImagePoint)(canvasPt, state, viewRef.current.width, viewRef.current.height, false), state.activeTool, { shift: e.shiftKey, alt: e.altKey });
4518
+ report("path", g.error);
4519
+ void renderCanvas();
4520
+ return;
4521
+ }
4489
4522
  if (mode === "annotate" && (state.activeTool === "shape" || state.activeTool === "type")) {
4490
4523
  const imgPt = (0, import_image_editor2.canvasToImagePoint)(canvasPt, state, viewRef.current.width, viewRef.current.height, false);
4491
4524
  report(state.activeTool, null);
@@ -4587,6 +4620,16 @@ var ImageEditorCanvas = ({
4587
4620
  }
4588
4621
  return;
4589
4622
  }
4623
+ if (mode === "annotate" && (0, import_image_editor2.isPathEditTool)(state.activeTool)) {
4624
+ const g = pathGestureRef.current;
4625
+ const imgPt = (0, import_image_editor2.canvasToImagePoint)(canvasPt, state, viewRef.current.width, viewRef.current.height, false);
4626
+ if (g.active) {
4627
+ g.move(imgPt, { shift: e.shiftKey, alt: e.altKey });
4628
+ if (g.error) report("path", g.error);
4629
+ } else g.hover(imgPt);
4630
+ void renderCanvas();
4631
+ return;
4632
+ }
4590
4633
  if (mode === "annotate" && state.activeTool === "shape") {
4591
4634
  const g = shapeGestureRef.current;
4592
4635
  if (g.active) {
@@ -4698,6 +4741,11 @@ var ImageEditorCanvas = ({
4698
4741
  }
4699
4742
  return;
4700
4743
  }
4744
+ if (mode === "annotate" && (0, import_image_editor2.isPathEditTool)(state.activeTool)) {
4745
+ pathGestureRef.current.up();
4746
+ void renderCanvas();
4747
+ return;
4748
+ }
4701
4749
  if (mode === "annotate" && state.activeTool === "shape") {
4702
4750
  shapeGestureRef.current.up();
4703
4751
  return;
@@ -4786,7 +4834,7 @@ var ImageEditorCanvas = ({
4786
4834
  onPointerCancel: () => paintGestureRef.current?.cancel(),
4787
4835
  "data-testid": "image-editor-canvas",
4788
4836
  style: transformTool.active ? { width: "100%", height: "100%", cursor: transformCursor } : { width: "100%", height: "100%" },
4789
- className: `absolute inset-0 w-full h-full block ${transformTool.active ? "touch-none" : mode === "paint" ? "touch-none cursor-crosshair" : mode === "annotate" && state.activeTool === "type" ? "cursor-text" : mode === "annotate" && state.activeTool === "shape" ? "cursor-crosshair" : ""}`
4837
+ className: `absolute inset-0 w-full h-full block ${transformTool.active ? "touch-none" : mode === "paint" ? "touch-none cursor-crosshair" : mode === "annotate" && state.activeTool === "type" ? "cursor-text" : mode === "annotate" && (state.activeTool === "shape" || state.activeTool === "path-pen") ? "cursor-crosshair" : mode === "annotate" && (0, import_image_editor2.isPathEditTool)(state.activeTool) ? "cursor-default" : ""}`
4790
4838
  }
4791
4839
  ),
4792
4840
  typeSession && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
@@ -9329,20 +9377,69 @@ var SelectionOptionsBar = ({
9329
9377
  };
9330
9378
 
9331
9379
  // src/image-editor/RefineEdgePanel.tsx
9332
- 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);
9333
9385
  var import_image_editor17 = require("@pixerate/editor/image-editor");
9334
9386
  var import_jsx_runtime44 = require("react/jsx-runtime");
9335
- var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
9336
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";
9337
- var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
9338
- const [params, setParams] = (0, import_react64.useState)(DEFAULT_PARAMS);
9339
- 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);
9340
9391
  const [error, setError] = (0, import_react64.useState)(null);
9341
- const [layerId, setLayerId] = (0, import_react64.useState)("");
9342
- const [newKind, setNewKind] = (0, import_react64.useState)("hueSaturation");
9343
- const [output, setOutput] = (0, import_react64.useState)("selection");
9344
- const [decontaminate, setDecontaminate] = (0, import_react64.useState)(0);
9345
- 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);
9346
9443
  const canObject = Boolean(controller.segmentationProvider);
9347
9444
  const toLayer = output !== "selection" && output !== "layer-mask";
9348
9445
  const sel = selection === void 0 ? controller.getSelection() : selection;
@@ -9362,17 +9459,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
9362
9459
  setBusy(false);
9363
9460
  }
9364
9461
  };
9365
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
9366
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
9367
- import_image_editor17.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "flex flex-col gap-1", children: [
9368
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
9369
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { children: c.label }),
9370
- /* @__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: [
9371
9468
  params[c.id],
9372
9469
  c.unit
9373
9470
  ] })
9374
9471
  ] }),
9375
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
9472
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
9376
9473
  "input",
9377
9474
  {
9378
9475
  type: "range",
@@ -9386,39 +9483,39 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
9386
9483
  }
9387
9484
  )
9388
9485
  ] }, c.id)),
9389
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
9390
- /* @__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 }) }),
9391
9488
  "Smart Radius"
9392
9489
  ] }),
9393
- canObject && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
9394
- /* @__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) }),
9395
9492
  "Object aware (segmentation model)"
9396
9493
  ] }),
9397
- /* @__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: [
9398
9495
  "Output to",
9399
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
9496
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
9400
9497
  "select",
9401
9498
  {
9402
9499
  "aria-label": "Refine output",
9403
9500
  value: output,
9404
9501
  onChange: (e) => setOutput(e.target.value),
9405
9502
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
9406
- 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))
9407
9504
  }
9408
9505
  )
9409
9506
  ] }),
9410
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "flex flex-col gap-1", children: [
9411
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
9412
- /* @__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: [
9413
9510
  "Decontaminate colors",
9414
9511
  toLayer ? "" : " (new layer or document outputs)"
9415
9512
  ] }),
9416
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "font-mono", children: [
9513
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { className: "font-mono", children: [
9417
9514
  decontaminate,
9418
9515
  "%"
9419
9516
  ] })
9420
9517
  ] }),
9421
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
9518
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
9422
9519
  "input",
9423
9520
  {
9424
9521
  type: "range",
@@ -9433,63 +9530,64 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
9433
9530
  }
9434
9531
  )
9435
9532
  ] }),
9436
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex gap-1", children: [
9437
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("button", { type: "button", className: button4, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
9438
- /* @__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" })
9439
9536
  ] }),
9440
- error && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
9441
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
9442
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex gap-1 items-center", children: [
9443
- /* @__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)(
9444
9542
  "select",
9445
9543
  {
9446
9544
  "aria-label": "New masked layer kind",
9447
9545
  value: newKind,
9448
9546
  onChange: (e) => setNewKind(e.target.value),
9449
9547
  className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
9450
- 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))
9451
9549
  }
9452
9550
  ),
9453
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
9551
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
9454
9552
  "button",
9455
9553
  {
9456
9554
  type: "button",
9457
- className: button4,
9555
+ className: button5,
9458
9556
  disabled: !sel,
9459
- 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) })),
9460
9558
  children: "New Masked Layer"
9461
9559
  }
9462
9560
  )
9463
9561
  ] }),
9464
- list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex flex-col gap-2", children: [
9465
- /* @__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)(
9466
9564
  "select",
9467
9565
  {
9468
9566
  "aria-label": "Mask layer",
9469
9567
  value: target.id,
9470
9568
  onChange: (e) => setLayerId(e.target.value),
9471
9569
  className: "bg-background border border-border rounded px-1 py-1 text-foreground",
9472
- children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("option", { value: l.id, children: [
9473
- 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),
9474
9572
  l.mask ? " (masked)" : ""
9475
9573
  ] }, l.id))
9476
9574
  }
9477
9575
  ),
9478
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
9479
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("button", { type: "button", className: button4, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
9480
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("button", { type: "button", className: button4, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
9481
- /* @__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" })
9482
9580
  ] }),
9483
- target.mask && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
9484
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "flex flex-col gap-1", children: [
9485
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
9486
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { children: "Density" }),
9487
- /* @__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: [
9488
9586
  Math.round((target.mask.density ?? 1) * 100),
9489
9587
  "%"
9490
9588
  ] })
9491
9589
  ] }),
9492
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
9590
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
9493
9591
  "input",
9494
9592
  {
9495
9593
  type: "range",
@@ -9503,15 +9601,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
9503
9601
  }
9504
9602
  )
9505
9603
  ] }),
9506
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "flex flex-col gap-1", children: [
9507
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
9508
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { children: "Mask Feather" }),
9509
- /* @__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: [
9510
9608
  target.mask.feather ?? 0,
9511
9609
  "px"
9512
9610
  ] })
9513
9611
  ] }),
9514
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
9612
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
9515
9613
  "input",
9516
9614
  {
9517
9615
  type: "range",
@@ -9531,32 +9629,32 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
9531
9629
  };
9532
9630
 
9533
9631
  // src/image-editor/ChannelsPanel.tsx
9534
- var import_react65 = require("react");
9535
- var import_image_editor18 = require("@pixerate/editor/image-editor");
9536
- 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");
9537
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"}`;
9538
9636
  var ChannelThumb = ({ channel, size }) => {
9539
- const ref = (0, import_react65.useRef)(null);
9540
- (0, import_react65.useEffect)(() => {
9637
+ const ref = (0, import_react66.useRef)(null);
9638
+ (0, import_react66.useEffect)(() => {
9541
9639
  const canvas = ref.current;
9542
9640
  const ctx = canvas?.getContext("2d");
9543
9641
  if (!canvas || !ctx || typeof ctx.createImageData !== "function") return;
9544
- const px = (0, import_image_editor18.channelThumbnail)(channel, 64);
9642
+ const px = (0, import_image_editor19.channelThumbnail)(channel, 64);
9545
9643
  canvas.width = px.width;
9546
9644
  canvas.height = px.height;
9547
9645
  const img = ctx.createImageData(px.width, px.height);
9548
9646
  img.data.set(px.data);
9549
9647
  ctx.putImageData(img, 0, 0);
9550
9648
  }, [channel.mask]);
9551
- 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" });
9552
9650
  };
9553
9651
  var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9554
- const [, setTick] = (0, import_react65.useState)(0);
9555
- (0, import_react65.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
9556
- const [activeId, setActiveId] = (0, import_react65.useState)(null);
9557
- const [renaming, setRenaming] = (0, import_react65.useState)(null);
9558
- const [error, setError] = (0, import_react65.useState)(null);
9559
- 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);
9560
9658
  const channels = controller.getChannels();
9561
9659
  const active = channels.find((c) => c.id === activeId) ?? null;
9562
9660
  const hasSelection = Boolean(controller.getSelection());
@@ -9573,18 +9671,18 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9573
9671
  if (!file) return;
9574
9672
  setError(null);
9575
9673
  try {
9576
- setActiveId((await (0, import_image_editor18.openMaskFile)(controller, file)).id);
9674
+ setActiveId((await (0, import_image_editor19.openMaskFile)(controller, file)).id);
9577
9675
  } catch (err) {
9578
9676
  setError(err instanceof Error ? err.message : String(err));
9579
9677
  }
9580
9678
  };
9581
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
9582
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex items-center justify-between", children: [
9583
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: imageSectionTitleClass, children: "Channels" }),
9584
- /* @__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" })
9585
9683
  ] }),
9586
- channels.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
9587
- /* @__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)(
9588
9686
  "li",
9589
9687
  {
9590
9688
  "data-testid": "channel-row",
@@ -9592,11 +9690,11 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9592
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"}`,
9593
9691
  onClick: (e) => {
9594
9692
  setActiveId(c.id);
9595
- 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") }));
9596
9694
  },
9597
9695
  onDoubleClick: () => setRenaming(c.id),
9598
9696
  children: [
9599
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
9697
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9600
9698
  "button",
9601
9699
  {
9602
9700
  type: "button",
@@ -9610,8 +9708,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9610
9708
  children: c.visible ? "\u25CF" : "\u25CB"
9611
9709
  }
9612
9710
  ),
9613
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(ChannelThumb, { channel: c, size: thumbnailSize }),
9614
- 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)(
9615
9713
  "input",
9616
9714
  {
9617
9715
  autoFocus: true,
@@ -9628,16 +9726,16 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9628
9726
  if (e.key === "Escape") setRenaming(null);
9629
9727
  }
9630
9728
  }
9631
- ) : /* @__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 })
9632
9730
  ]
9633
9731
  },
9634
9732
  c.id
9635
9733
  )) }),
9636
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
9637
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
9638
- /* @__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" }),
9639
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
9640
- /* @__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)(
9641
9739
  "button",
9642
9740
  {
9643
9741
  type: "button",
@@ -9650,24 +9748,24 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9650
9748
  children: "Delete"
9651
9749
  }
9652
9750
  ),
9653
- /* @__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" }),
9654
- /* @__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)(
9655
9753
  "button",
9656
9754
  {
9657
9755
  type: "button",
9658
9756
  className: btn2(),
9659
9757
  disabled: !active && !hasSelection,
9660
9758
  title: active ? "Save the channel as a greyscale PNG" : "Save the selection as a greyscale PNG",
9661
- 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")),
9662
9760
  children: "Export PNG"
9663
9761
  }
9664
9762
  ),
9665
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
9763
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9666
9764
  "input",
9667
9765
  {
9668
9766
  ref: fileInput,
9669
9767
  type: "file",
9670
- accept: import_image_editor18.MASK_FILE_ACCEPT,
9768
+ accept: import_image_editor19.MASK_FILE_ACCEPT,
9671
9769
  hidden: true,
9672
9770
  "data-testid": "channel-import-input",
9673
9771
  onChange: (e) => {
@@ -9677,22 +9775,22 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9677
9775
  }
9678
9776
  )
9679
9777
  ] }),
9680
- 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 })
9681
9779
  ] });
9682
9780
  };
9683
9781
 
9684
9782
  // src/image-editor/PathsPanel.tsx
9685
- var import_react66 = require("react");
9686
- var import_image_editor19 = require("@pixerate/editor/image-editor");
9687
- 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");
9688
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"}`;
9689
9787
  var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9690
- const [, setTick] = (0, import_react66.useState)(0);
9691
- (0, import_react66.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
9692
- const [renaming, setRenaming] = (0, import_react66.useState)(null);
9693
- const [color, setColor] = (0, import_react66.useState)("#000000");
9694
- const [width, setWidth] = (0, import_react66.useState)(2);
9695
- 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);
9696
9794
  const paths = controller.getPaths();
9697
9795
  const activeId = controller.getState().activePathId ?? null;
9698
9796
  const active = paths.find((p) => p.id === activeId) ?? null;
@@ -9706,96 +9804,99 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
9706
9804
  setError(err instanceof Error ? err.message : String(err));
9707
9805
  }
9708
9806
  };
9709
- return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { "data-testid": "paths-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
9710
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: imageSectionTitleClass, children: "Paths" }),
9711
- paths.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
9712
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("ul", { role: "list", className: "flex flex-col gap-0.5", children: paths.map((p) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
9713
- "li",
9714
- {
9715
- "data-testid": "path-row",
9716
- "aria-current": p.id === activeId ? "true" : void 0,
9717
- className: `flex items-center gap-1.5 px-1.5 py-1 rounded cursor-pointer select-none ${p.id === activeId ? "bg-primary/30 ring-1 ring-primary" : "hover:bg-muted"}`,
9718
- onClick: () => attempt(() => controller.setActivePath(p.id)),
9719
- onDoubleClick: () => setRenaming(p.id),
9720
- children: [
9721
- /* @__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" }) }),
9722
- renaming === p.id ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9723
- "input",
9724
- {
9725
- autoFocus: true,
9726
- "aria-label": "Path name",
9727
- defaultValue: p.work ? "" : p.name,
9728
- placeholder: "Path name",
9729
- className: "min-w-0 flex-1 bg-background border border-border rounded px-1 py-0.5 text-foreground",
9730
- onClick: (e) => e.stopPropagation(),
9731
- onBlur: (e) => {
9732
- setRenaming(null);
9733
- const name = e.currentTarget.value.trim();
9734
- if (name && name !== p.name) attempt(() => controller.renamePath(p.id, name));
9735
- },
9736
- onKeyDown: (e) => {
9737
- if (e.key === "Enter") e.currentTarget.blur();
9738
- if (e.key === "Escape") setRenaming(null);
9739
- }
9740
- }
9741
- ) : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
9742
- ]
9743
- },
9744
- p.id
9745
- )) }),
9746
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
9747
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9748
- "button",
9807
+ return (
9808
+ // Clicking the panel's empty space deselects the path (the path tools then edit the active layer).
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)(
9813
+ "li",
9749
9814
  {
9750
- type: "button",
9751
- className: btn3(),
9752
- disabled: !active,
9753
- title: "Load the path as the selection (Shift adds, Alt subtracts)",
9754
- onClick: (e) => attempt(() => controller.loadPathAsSelection(active.id, { mode: (0, import_image_editor19.selectionModeFromModifiers)(e, "replace") })),
9755
- children: "Load as Selection"
9756
- }
9757
- ),
9758
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
9759
- active?.work && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
9760
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
9761
- ] }),
9762
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
9763
- /* @__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" }),
9764
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
9765
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
9766
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9767
- "input",
9815
+ "data-testid": "path-row",
9816
+ "aria-current": p.id === activeId ? "true" : void 0,
9817
+ className: `flex items-center gap-1.5 px-1.5 py-1 rounded cursor-pointer select-none ${p.id === activeId ? "bg-primary/30 ring-1 ring-primary" : "hover:bg-muted"}`,
9818
+ onClick: () => attempt(() => controller.setActivePath(p.id)),
9819
+ onDoubleClick: () => setRenaming(p.id),
9820
+ children: [
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)(
9823
+ "input",
9824
+ {
9825
+ autoFocus: true,
9826
+ "aria-label": "Path name",
9827
+ defaultValue: p.work ? "" : p.name,
9828
+ placeholder: "Path name",
9829
+ className: "min-w-0 flex-1 bg-background border border-border rounded px-1 py-0.5 text-foreground",
9830
+ onClick: (e) => e.stopPropagation(),
9831
+ onBlur: (e) => {
9832
+ setRenaming(null);
9833
+ const name = e.currentTarget.value.trim();
9834
+ if (name && name !== p.name) attempt(() => controller.renamePath(p.id, name));
9835
+ },
9836
+ onKeyDown: (e) => {
9837
+ if (e.key === "Enter") e.currentTarget.blur();
9838
+ if (e.key === "Escape") setRenaming(null);
9839
+ }
9840
+ }
9841
+ ) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
9842
+ ]
9843
+ },
9844
+ p.id
9845
+ )) }),
9846
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
9847
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9848
+ "button",
9768
9849
  {
9769
- type: "number",
9770
- min: 0.5,
9771
- max: 250,
9772
- step: 0.5,
9773
- "aria-label": "Stroke width",
9774
- value: width,
9775
- onChange: (e) => setWidth(Math.min(250, Math.max(0.5, Number(e.target.value) || 1))),
9776
- className: "w-12 bg-background border border-border rounded px-1 py-0.5 text-foreground"
9850
+ type: "button",
9851
+ className: btn3(),
9852
+ disabled: !active,
9853
+ title: "Load the path as the selection (Shift adds, Alt subtracts)",
9854
+ onClick: (e) => attempt(() => controller.loadPathAsSelection(active.id, { mode: (0, import_image_editor20.selectionModeFromModifiers)(e, "replace") })),
9855
+ children: "Load as Selection"
9777
9856
  }
9778
9857
  ),
9779
- "px"
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" })
9780
9861
  ] }),
9781
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
9782
- ] }),
9783
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
9784
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
9785
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
9786
- ] }),
9787
- error && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { role: "alert", className: "text-destructive", children: error })
9788
- ] });
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)(
9867
+ "input",
9868
+ {
9869
+ type: "number",
9870
+ min: 0.5,
9871
+ max: 250,
9872
+ step: 0.5,
9873
+ "aria-label": "Stroke width",
9874
+ value: width,
9875
+ onChange: (e) => setWidth(Math.min(250, Math.max(0.5, Number(e.target.value) || 1))),
9876
+ className: "w-12 bg-background border border-border rounded px-1 py-0.5 text-foreground"
9877
+ }
9878
+ ),
9879
+ "px"
9880
+ ] }),
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" })
9882
+ ] }),
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" })
9886
+ ] }),
9887
+ error && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { role: "alert", className: "text-destructive", children: error })
9888
+ ] })
9889
+ );
9789
9890
  };
9790
9891
 
9791
9892
  // src/image-editor/FreeTransformOptionsBar.tsx
9792
- var import_react67 = require("react");
9793
- var import_image_editor20 = require("@pixerate/editor/image-editor");
9794
- 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");
9795
9896
  var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
9796
9897
  var FreeTransformOptionsBar = ({ tool, className }) => {
9797
- const [, setTick] = (0, import_react67.useState)(0);
9798
- (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]);
9799
9900
  const bar = tool.bar();
9800
9901
  if (!tool.active || !bar) return null;
9801
9902
  const warp = tool.warpBar();
@@ -9807,17 +9908,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
9807
9908
  const v = Number(raw);
9808
9909
  if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
9809
9910
  };
9810
- 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: [
9811
- /* @__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)) }),
9812
- /* @__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)) }),
9813
- 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: [
9814
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1", children: [
9815
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
9816
- /* @__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)) })
9817
9918
  ] }),
9818
- ["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1", children: [
9819
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
9820
- /* @__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)(
9821
9922
  "input",
9822
9923
  {
9823
9924
  type: "number",
@@ -9838,9 +9939,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
9838
9939
  },
9839
9940
  `${k}:${warp[k]}`
9840
9941
  ),
9841
- /* @__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: "%" })
9842
9943
  ] }, k)),
9843
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
9944
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
9844
9945
  "button",
9845
9946
  {
9846
9947
  type: "button",
@@ -9852,26 +9953,26 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
9852
9953
  children: "Vertical"
9853
9954
  }
9854
9955
  ),
9855
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1", children: [
9856
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
9857
- /* @__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)(
9858
9959
  "select",
9859
9960
  {
9860
9961
  "aria-label": "Warp grid",
9861
- 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",
9862
9963
  onChange: (e) => {
9863
- 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);
9864
9965
  tool.setWarp({ columns: g.columns, rows: g.rows });
9865
9966
  },
9866
9967
  className: imageFieldClass,
9867
- 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))
9868
9969
  }
9869
9970
  )
9870
9971
  ] })
9871
9972
  ] }),
9872
- 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: [
9873
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-muted-foreground", children: f.label }),
9874
- /* @__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)(
9875
9976
  "input",
9876
9977
  {
9877
9978
  type: "number",
@@ -9891,8 +9992,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
9891
9992
  },
9892
9993
  `${f.id}:${round(bar[f.id], f.unit)}`
9893
9994
  ),
9894
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
9895
- 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)(
9896
9997
  "button",
9897
9998
  {
9898
9999
  type: "button",
@@ -9907,33 +10008,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
9907
10008
  }
9908
10009
  )
9909
10010
  ] }, f.id)),
9910
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1", children: [
9911
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
9912
- /* @__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)(
9913
10014
  "select",
9914
10015
  {
9915
10016
  "aria-label": "Interpolation",
9916
10017
  value: tool.interpolation,
9917
10018
  onChange: (e) => tool.setInterpolation(e.target.value),
9918
10019
  className: imageFieldClass,
9919
- 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))
9920
10021
  }
9921
10022
  )
9922
10023
  ] }),
9923
- /* @__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" }),
9924
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
9925
- 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 })
9926
10027
  ] });
9927
10028
  };
9928
10029
 
9929
10030
  // src/image-editor/ShapeOptionsBar.tsx
9930
- var import_react68 = require("react");
9931
- var import_image_editor21 = require("@pixerate/editor/image-editor");
9932
- 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");
9933
10034
  var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
9934
- const [, setTick] = (0, import_react68.useState)(0);
9935
- (0, import_react68.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
9936
- 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);
9937
10038
  const active = controller.getActiveLayer();
9938
10039
  const shapeId = active?.type === "shape" ? active.id : null;
9939
10040
  const set = (change) => {
@@ -9941,28 +10042,28 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
9941
10042
  if (!shapeId) return;
9942
10043
  try {
9943
10044
  setError(null);
9944
- (0, import_image_editor21.applyShapeOptions)(controller, shapeId, change);
10045
+ (0, import_image_editor22.applyShapeOptions)(controller, shapeId, change);
9945
10046
  } catch (e) {
9946
10047
  setError(e instanceof Error ? e.message : String(e));
9947
10048
  }
9948
10049
  };
9949
10050
  const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
9950
- return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
9951
- /* @__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)) }),
9952
- /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
9953
- /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-1", children: [
9954
- /* @__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 }) }),
9955
10056
  "Fill",
9956
- /* @__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 }) })
9957
10058
  ] }),
9958
- /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-1", children: [
9959
- /* @__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 }) }),
9960
10061
  "Stroke",
9961
- /* @__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 }) })
9962
10063
  ] }),
9963
- /* @__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: [
9964
10065
  "Width",
9965
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
10066
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
9966
10067
  "input",
9967
10068
  {
9968
10069
  type: "number",
@@ -9976,52 +10077,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
9976
10077
  )
9977
10078
  ] })
9978
10079
  ] }),
9979
- /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
9980
- 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: [
9981
10082
  "Radius",
9982
- /* @__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}` })
9983
10084
  ] }),
9984
- 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: [
9985
10086
  "Sides",
9986
- /* @__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}` })
9987
10088
  ] }),
9988
- options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
9989
- /* @__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: [
9990
10091
  "Points",
9991
- /* @__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}` })
9992
10093
  ] }),
9993
- /* @__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: [
9994
10095
  "Inner",
9995
- /* @__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 }) })
9996
10097
  ] })
9997
10098
  ] }),
9998
- options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
9999
- /* @__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: [
10000
10101
  "Weight",
10001
- /* @__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}` })
10002
10103
  ] }),
10003
- /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-1", children: [
10004
- /* @__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 }) }),
10005
10106
  "Arrowhead"
10006
10107
  ] })
10007
10108
  ] })
10008
10109
  ] }),
10009
- /* @__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." }),
10010
- 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 })
10011
10112
  ] });
10012
10113
  };
10013
10114
 
10014
10115
  // src/image-editor/TypeOptionsBar.tsx
10015
- var import_react69 = require("react");
10016
- var import_image_editor22 = require("@pixerate/editor/image-editor");
10017
- 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");
10018
10119
  var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
10019
10120
  var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
10020
10121
  var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
10021
- const [, setTick] = (0, import_react69.useState)(0);
10022
- (0, import_react69.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
10023
- (0, import_react69.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
10024
- 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);
10025
10126
  const active = controller.getActiveLayer();
10026
10127
  const typeId = !session && active?.type === "type" ? active.id : null;
10027
10128
  const here = session?.alive ? session.styleHere() : {};
@@ -10074,11 +10175,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
10074
10175
  setError(e instanceof Error ? e.message : String(e));
10075
10176
  }
10076
10177
  };
10077
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
10078
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
10079
- /* @__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: [
10080
10181
  "Font",
10081
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10182
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10082
10183
  "input",
10083
10184
  {
10084
10185
  list: "pixerate-type-fonts",
@@ -10088,11 +10189,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
10088
10189
  className: "w-32 rounded border border-border bg-background px-1 py-0.5"
10089
10190
  }
10090
10191
  ),
10091
- /* @__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)) })
10092
10193
  ] }),
10093
- /* @__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: [
10094
10195
  "Size",
10095
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
10196
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10096
10197
  "input",
10097
10198
  {
10098
10199
  type: "number",
@@ -10105,14 +10206,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
10105
10206
  }
10106
10207
  )
10107
10208
  ] }),
10108
- /* @__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" }),
10109
- /* @__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" }),
10110
- /* @__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 }) })
10111
10212
  ] }),
10112
- /* @__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)) }),
10113
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
10114
- 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)),
10115
- 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)(
10116
10217
  "button",
10117
10218
  {
10118
10219
  type: "button",
@@ -10124,19 +10225,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
10124
10225
  }
10125
10226
  )
10126
10227
  ] }),
10127
- /* @__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." }),
10128
- 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: [
10129
10230
  "Missing ",
10130
10231
  missing.length === 1 ? "font" : "fonts",
10131
10232
  ": ",
10132
10233
  missing.join(", ")
10133
10234
  ] }),
10134
- 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 })
10135
10236
  ] });
10136
10237
  };
10137
10238
 
10138
10239
  // src/image-editor/ImageEditor.tsx
10139
- var import_jsx_runtime50 = require("react/jsx-runtime");
10240
+ var import_jsx_runtime51 = require("react/jsx-runtime");
10140
10241
  var ImageEditor = ({
10141
10242
  editor: externalEditor,
10142
10243
  src,
@@ -10160,51 +10261,51 @@ var ImageEditor = ({
10160
10261
  const effectsShown = !!controller.effectsProvider || state.layers.some(function has(l) {
10161
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);
10162
10263
  });
10163
- const legacyProcess = (0, import_image_editor23.normalizeProcessVersion)(state.adjustments.process) < import_image_editor23.LATEST_PROCESS_VERSION;
10164
- const [activeTab, setActiveTab] = (0, import_react70.useState)("crop");
10165
- 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);
10166
10267
  const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
10167
- const activeTabRef = (0, import_react70.useRef)(activeTab);
10268
+ const activeTabRef = (0, import_react71.useRef)(activeTab);
10168
10269
  activeTabRef.current = activeTab;
10169
10270
  const openPanel = async (ref) => {
10170
10271
  if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
10171
10272
  rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
10172
10273
  await new Promise((resolve) => setTimeout(resolve, 60));
10173
10274
  };
10174
- const [activeCropRatio, setActiveCropRatio] = (0, import_react70.useState)(null);
10175
- const [selectionOptions, setSelectionOptions] = (0, import_react70.useState)(import_image_editor23.DEFAULT_SELECTION_TOOL_OPTIONS);
10176
- const [shapeOptions, setShapeOptions] = (0, import_react70.useState)(import_image_editor23.DEFAULT_SHAPE_TOOL_OPTIONS);
10177
- const [typeOptions, setTypeOptions] = (0, import_react70.useState)(import_image_editor23.DEFAULT_TYPE_TOOL_OPTIONS);
10178
- const [typeSession, setTypeSession] = (0, import_react70.useState)(null);
10179
- const [selectionError, setSelectionError] = (0, import_react70.useState)(null);
10180
- const [paintError, setPaintError] = (0, import_react70.useState)(null);
10181
- 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);
10182
10283
  const handleCanvasError = (source, message2) => {
10183
10284
  if (source === "paint") setPaintError(message2);
10184
10285
  else if (source === "select") setSelectionError(message2);
10185
10286
  else setShapeTypeError(message2);
10186
10287
  };
10187
10288
  const finishTyping = () => setTypeSession(null);
10188
- const transformToolRef = (0, import_react70.useRef)(null);
10189
- const transformControllerRef = (0, import_react70.useRef)(controller);
10289
+ const transformToolRef = (0, import_react71.useRef)(null);
10290
+ const transformControllerRef = (0, import_react71.useRef)(controller);
10190
10291
  if (!transformToolRef.current || transformControllerRef.current !== controller) {
10191
10292
  transformToolRef.current?.cancel();
10192
- transformToolRef.current = new import_image_editor23.FreeTransformTool(controller, {
10293
+ transformToolRef.current = new import_image_editor24.FreeTransformTool(controller, {
10193
10294
  schedule: (run) => typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame(run) : run()
10194
10295
  });
10195
10296
  transformControllerRef.current = controller;
10196
10297
  }
10197
10298
  const transformTool = transformToolRef.current;
10198
- const [, setTransformTick] = (0, import_react70.useState)(0);
10199
- (0, import_react70.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
10200
- (0, import_react70.useEffect)(() => () => transformToolRef.current?.cancel(), []);
10201
- const [inpaintPrompt, setInpaintPrompt] = (0, import_react70.useState)("");
10202
- const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react70.useState)("annotations");
10203
- const [isRemovingBg, setIsRemovingBg] = (0, import_react70.useState)(false);
10204
- const [isInpainting, setIsInpainting] = (0, import_react70.useState)(false);
10205
- const [aiError, setAiError] = (0, import_react70.useState)(null);
10206
- const [aiSuccess, setAiSuccess] = (0, import_react70.useState)(null);
10207
- 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");
10208
10309
  const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
10209
10310
  const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
10210
10311
  const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
@@ -10267,11 +10368,11 @@ var ImageEditor = ({
10267
10368
  setIsInpainting(false);
10268
10369
  }
10269
10370
  };
10270
- const [activeColor, setActiveColor] = (0, import_react70.useState)("#ef4444");
10271
- const [strokeWidth, setStrokeWidth] = (0, import_react70.useState)(3);
10272
- const [fontSize, setFontSize] = (0, import_react70.useState)(24);
10273
- const [textInput, setTextInput] = (0, import_react70.useState)("");
10274
- (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)(() => {
10275
10376
  if (activeTab === "crop" && editor.state.activeTool !== "crop") {
10276
10377
  editor.setTool("crop");
10277
10378
  }
@@ -10299,16 +10400,16 @@ var ImageEditor = ({
10299
10400
  link.click();
10300
10401
  }
10301
10402
  };
10302
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
10403
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
10303
10404
  "div",
10304
10405
  {
10305
10406
  ref: rootRef,
10306
10407
  className: `${imageEditorFrameClass} ${className}`,
10307
10408
  style,
10308
10409
  children: [
10309
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: imageEditorHeaderClass, children: [
10310
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
10311
- /* @__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)(
10312
10413
  "button",
10313
10414
  {
10314
10415
  type: "button",
@@ -10323,7 +10424,7 @@ var ImageEditor = ({
10323
10424
  children: "Transform & Crop"
10324
10425
  }
10325
10426
  ),
10326
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10427
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10327
10428
  "button",
10328
10429
  {
10329
10430
  type: "button",
@@ -10338,7 +10439,7 @@ var ImageEditor = ({
10338
10439
  children: "Adjustments"
10339
10440
  }
10340
10441
  ),
10341
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10442
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10342
10443
  "button",
10343
10444
  {
10344
10445
  type: "button",
@@ -10353,7 +10454,7 @@ var ImageEditor = ({
10353
10454
  children: "Layers"
10354
10455
  }
10355
10456
  ),
10356
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10457
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10357
10458
  "button",
10358
10459
  {
10359
10460
  type: "button",
@@ -10368,7 +10469,7 @@ var ImageEditor = ({
10368
10469
  children: "Paint"
10369
10470
  }
10370
10471
  ),
10371
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10472
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10372
10473
  "button",
10373
10474
  {
10374
10475
  type: "button",
@@ -10383,7 +10484,7 @@ var ImageEditor = ({
10383
10484
  children: "Select & Mask"
10384
10485
  }
10385
10486
  ),
10386
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10487
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10387
10488
  "button",
10388
10489
  {
10389
10490
  type: "button",
@@ -10398,7 +10499,7 @@ var ImageEditor = ({
10398
10499
  children: "Annotations"
10399
10500
  }
10400
10501
  ),
10401
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10502
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10402
10503
  "button",
10403
10504
  {
10404
10505
  type: "button",
@@ -10413,7 +10514,7 @@ var ImageEditor = ({
10413
10514
  children: "Depth Mask"
10414
10515
  }
10415
10516
  ),
10416
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
10517
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
10417
10518
  "button",
10418
10519
  {
10419
10520
  type: "button",
@@ -10426,14 +10527,14 @@ var ImageEditor = ({
10426
10527
  "aria-selected": activeTab === "ai",
10427
10528
  className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
10428
10529
  children: [
10429
- /* @__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" }) }),
10430
10531
  "AI Tools"
10431
10532
  ]
10432
10533
  }
10433
10534
  )
10434
10535
  ] }),
10435
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
10436
- /* @__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)(
10437
10538
  "button",
10438
10539
  {
10439
10540
  type: "button",
@@ -10444,7 +10545,7 @@ var ImageEditor = ({
10444
10545
  children: "\u21A9"
10445
10546
  }
10446
10547
  ),
10447
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10548
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10448
10549
  "button",
10449
10550
  {
10450
10551
  type: "button",
@@ -10455,7 +10556,7 @@ var ImageEditor = ({
10455
10556
  children: "\u21AA"
10456
10557
  }
10457
10558
  ),
10458
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10559
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10459
10560
  "button",
10460
10561
  {
10461
10562
  type: "button",
@@ -10464,8 +10565,8 @@ var ImageEditor = ({
10464
10565
  children: "Reset"
10465
10566
  }
10466
10567
  ),
10467
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
10468
- /* @__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)(
10469
10570
  "button",
10470
10571
  {
10471
10572
  type: "button",
@@ -10475,11 +10576,11 @@ var ImageEditor = ({
10475
10576
  children: "-"
10476
10577
  }
10477
10578
  ),
10478
- /* @__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: [
10479
10580
  Math.round(state.zoom * 100),
10480
10581
  "%"
10481
10582
  ] }),
10482
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10583
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10483
10584
  "button",
10484
10585
  {
10485
10586
  type: "button",
@@ -10489,8 +10590,8 @@ var ImageEditor = ({
10489
10590
  children: "+"
10490
10591
  }
10491
10592
  ),
10492
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
10493
- /* @__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)(
10494
10595
  "button",
10495
10596
  {
10496
10597
  type: "button",
@@ -10501,7 +10602,7 @@ var ImageEditor = ({
10501
10602
  children: "Hold Compare"
10502
10603
  }
10503
10604
  ),
10504
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10605
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10505
10606
  "button",
10506
10607
  {
10507
10608
  type: "button",
@@ -10512,10 +10613,10 @@ var ImageEditor = ({
10512
10613
  )
10513
10614
  ] })
10514
10615
  ] }),
10515
- transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
10516
- !transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
10517
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
10518
- /* @__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)(
10519
10620
  ImageEditorCanvas,
10520
10621
  {
10521
10622
  editor,
@@ -10539,11 +10640,11 @@ var ImageEditor = ({
10539
10640
  className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
10540
10641
  }
10541
10642
  ),
10542
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: imageSidebarClass, children: [
10543
- activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
10544
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
10545
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
10546
- /* @__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)(
10547
10648
  "button",
10548
10649
  {
10549
10650
  type: "button",
@@ -10555,7 +10656,7 @@ var ImageEditor = ({
10555
10656
  children: "Freeform"
10556
10657
  }
10557
10658
  ),
10558
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10659
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10559
10660
  "button",
10560
10661
  {
10561
10662
  type: "button",
@@ -10567,7 +10668,7 @@ var ImageEditor = ({
10567
10668
  children: "1:1 Square"
10568
10669
  }
10569
10670
  ),
10570
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10671
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10571
10672
  "button",
10572
10673
  {
10573
10674
  type: "button",
@@ -10579,7 +10680,7 @@ var ImageEditor = ({
10579
10680
  children: "4:3 Standard"
10580
10681
  }
10581
10682
  ),
10582
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10683
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10583
10684
  "button",
10584
10685
  {
10585
10686
  type: "button",
@@ -10591,7 +10692,7 @@ var ImageEditor = ({
10591
10692
  children: "16:9 Wide"
10592
10693
  }
10593
10694
  ),
10594
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10695
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10595
10696
  "button",
10596
10697
  {
10597
10698
  type: "button",
@@ -10603,7 +10704,7 @@ var ImageEditor = ({
10603
10704
  children: "3:2 Photo"
10604
10705
  }
10605
10706
  ),
10606
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10707
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10607
10708
  "button",
10608
10709
  {
10609
10710
  type: "button",
@@ -10616,10 +10717,10 @@ var ImageEditor = ({
10616
10717
  }
10617
10718
  )
10618
10719
  ] }),
10619
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: imageDividerClass }),
10620
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
10621
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
10622
- /* @__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)(
10623
10724
  "button",
10624
10725
  {
10625
10726
  type: "button",
@@ -10628,7 +10729,7 @@ var ImageEditor = ({
10628
10729
  children: "Rotate -90\xB0"
10629
10730
  }
10630
10731
  ),
10631
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10732
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10632
10733
  "button",
10633
10734
  {
10634
10735
  type: "button",
@@ -10637,7 +10738,7 @@ var ImageEditor = ({
10637
10738
  children: "Rotate +90\xB0"
10638
10739
  }
10639
10740
  ),
10640
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10741
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10641
10742
  "button",
10642
10743
  {
10643
10744
  type: "button",
@@ -10646,7 +10747,7 @@ var ImageEditor = ({
10646
10747
  children: "Flip Horizontal"
10647
10748
  }
10648
10749
  ),
10649
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10750
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10650
10751
  "button",
10651
10752
  {
10652
10753
  type: "button",
@@ -10657,10 +10758,10 @@ var ImageEditor = ({
10657
10758
  )
10658
10759
  ] })
10659
10760
  ] }),
10660
- activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
10661
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center justify-between", children: [
10662
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
10663
- /* @__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)(
10664
10765
  "button",
10665
10766
  {
10666
10767
  type: "button",
@@ -10670,25 +10771,25 @@ var ImageEditor = ({
10670
10771
  }
10671
10772
  )
10672
10773
  ] }),
10673
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Histogram, { histogram: editor.histogram }),
10674
- import_image_editor23.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_react70.default.Fragment, { children: [
10675
- /* @__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)(
10676
10777
  ControlSlider,
10677
10778
  {
10678
10779
  spec,
10679
- value: (0, import_image_editor23.readAdjustmentControls)(state.adjustments)[spec.id],
10780
+ value: (0, import_image_editor24.readAdjustmentControls)(state.adjustments)[spec.id],
10680
10781
  disabled: spec.requiresProcess !== void 0 && legacyProcess,
10681
10782
  onChange: (v) => editor.setAdjustments({ [spec.id]: v })
10682
10783
  }
10683
10784
  ),
10684
- spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
10785
+ spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
10685
10786
  "div",
10686
10787
  {
10687
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",
10688
10789
  "data-testid": "image-editor-process-notice",
10689
10790
  children: [
10690
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
10691
- /* @__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)(
10692
10793
  "button",
10693
10794
  {
10694
10795
  type: "button",
@@ -10701,7 +10802,7 @@ var ImageEditor = ({
10701
10802
  }
10702
10803
  )
10703
10804
  ] }, spec.id)),
10704
- /* @__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)(
10705
10806
  AdjustmentLayersPanel,
10706
10807
  {
10707
10808
  controller,
@@ -10710,9 +10811,9 @@ var ImageEditor = ({
10710
10811
  }
10711
10812
  ) })
10712
10813
  ] }),
10713
- activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
10714
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
10715
- /* @__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)(
10716
10817
  "button",
10717
10818
  {
10718
10819
  type: "button",
@@ -10723,15 +10824,15 @@ var ImageEditor = ({
10723
10824
  children: "Free Transform"
10724
10825
  }
10725
10826
  ),
10726
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(LayersPanel, { controller }),
10727
- effectsShown && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
10728
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
10729
- /* @__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 })
10730
10831
  ] }),
10731
- activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
10732
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
10733
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(BrushOptionsBar, { controller }),
10734
- /* @__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)(
10735
10836
  "button",
10736
10837
  {
10737
10838
  type: "button",
@@ -10742,50 +10843,50 @@ var ImageEditor = ({
10742
10843
  children: "Free Transform"
10743
10844
  }
10744
10845
  ),
10745
- paintError && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
10746
- /* @__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 }) })
10747
10848
  ] }),
10748
- activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
10749
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers" }),
10750
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
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)(
10751
10852
  "button",
10752
10853
  {
10753
10854
  type: "button",
10754
10855
  "aria-pressed": state.activeTool === t,
10755
10856
  onClick: () => editor.setTool(t),
10756
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"}`,
10757
- children: t === "shape" ? "Shape" : "Type"
10858
+ children: (0, import_image_editor24.imageToolLabel)(t)
10758
10859
  },
10759
10860
  t
10760
10861
  )) }),
10761
- state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
10762
- state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
10763
- 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" }),
10764
- shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
10765
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: imageDividerClass }),
10766
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
10767
- /* @__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)(
10768
10869
  "button",
10769
10870
  {
10770
10871
  type: "button",
10771
10872
  onClick: () => editor.setTool(t),
10772
10873
  className: `py-1.5 px-2 rounded-lg font-medium capitalize border transition-colors ${state.activeTool === t ? "bg-primary border-primary text-primary-foreground" : "bg-muted border-border text-foreground hover:bg-accent"}`,
10773
- children: t
10874
+ children: t === "pen" ? "freehand" : t
10774
10875
  },
10775
10876
  t
10776
10877
  )) }),
10777
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
10778
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
10779
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
10780
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex-1 ml-2", children: [
10781
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
10782
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: "Width:" }),
10783
- /* @__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: [
10784
10885
  strokeWidth,
10785
10886
  "px"
10786
10887
  ] })
10787
10888
  ] }),
10788
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10889
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10789
10890
  "input",
10790
10891
  {
10791
10892
  type: "range",
@@ -10798,10 +10899,10 @@ var ImageEditor = ({
10798
10899
  )
10799
10900
  ] })
10800
10901
  ] }),
10801
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: imageDividerClass }),
10802
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
10803
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex gap-2", children: [
10804
- /* @__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)(
10805
10906
  "input",
10806
10907
  {
10807
10908
  type: "text",
@@ -10812,7 +10913,7 @@ var ImageEditor = ({
10812
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"
10813
10914
  }
10814
10915
  ),
10815
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10916
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10816
10917
  "button",
10817
10918
  {
10818
10919
  type: "button",
@@ -10822,14 +10923,14 @@ var ImageEditor = ({
10822
10923
  }
10823
10924
  )
10824
10925
  ] }),
10825
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
10826
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: "Font Size:" }),
10827
- /* @__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: [
10828
10929
  fontSize,
10829
10930
  "px"
10830
10931
  ] })
10831
10932
  ] }),
10832
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10933
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10833
10934
  "input",
10834
10935
  {
10835
10936
  type: "range",
@@ -10840,14 +10941,14 @@ var ImageEditor = ({
10840
10941
  className: imageRangeClass
10841
10942
  }
10842
10943
  ),
10843
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: imageDividerClass }),
10844
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center justify-between", children: [
10845
- /* @__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: [
10846
10947
  "Layers (",
10847
10948
  state.annotations.length,
10848
10949
  ")"
10849
10950
  ] }),
10850
- state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10951
+ state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10851
10952
  "button",
10852
10953
  {
10853
10954
  type: "button",
@@ -10856,7 +10957,7 @@ var ImageEditor = ({
10856
10957
  children: "Delete Selected"
10857
10958
  }
10858
10959
  ),
10859
- state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10960
+ state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10860
10961
  "button",
10861
10962
  {
10862
10963
  type: "button",
@@ -10867,10 +10968,10 @@ var ImageEditor = ({
10867
10968
  )
10868
10969
  ] })
10869
10970
  ] }),
10870
- activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
10871
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center justify-between", children: [
10872
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
10873
- /* @__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)(
10874
10975
  "button",
10875
10976
  {
10876
10977
  type: "button",
@@ -10880,8 +10981,8 @@ var ImageEditor = ({
10880
10981
  }
10881
10982
  )
10882
10983
  ] }),
10883
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
10884
- /* @__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)(
10885
10986
  "input",
10886
10987
  {
10887
10988
  type: "checkbox",
@@ -10890,12 +10991,12 @@ var ImageEditor = ({
10890
10991
  className: "rounded accent-primary"
10891
10992
  }
10892
10993
  ),
10893
- /* @__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" })
10894
10995
  ] }),
10895
- state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
10896
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { children: [
10897
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
10898
- /* @__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)(
10899
11000
  "input",
10900
11001
  {
10901
11002
  type: "text",
@@ -10906,8 +11007,8 @@ var ImageEditor = ({
10906
11007
  }
10907
11008
  )
10908
11009
  ] }),
10909
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex gap-2", children: [
10910
- /* @__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)(
10911
11012
  "button",
10912
11013
  {
10913
11014
  type: "button",
@@ -10916,7 +11017,7 @@ var ImageEditor = ({
10916
11017
  children: "Threshold Mode"
10917
11018
  }
10918
11019
  ),
10919
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11020
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10920
11021
  "button",
10921
11022
  {
10922
11023
  type: "button",
@@ -10926,12 +11027,12 @@ var ImageEditor = ({
10926
11027
  }
10927
11028
  )
10928
11029
  ] }),
10929
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { children: [
10930
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
10931
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: "Depth Start (Lower):" }),
10932
- /* @__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] })
10933
11034
  ] }),
10934
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11035
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10935
11036
  "input",
10936
11037
  {
10937
11038
  type: "range",
@@ -10945,12 +11046,12 @@ var ImageEditor = ({
10945
11046
  }
10946
11047
  )
10947
11048
  ] }),
10948
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { children: [
10949
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
10950
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: "Depth Stop (Upper):" }),
10951
- /* @__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] })
10952
11053
  ] }),
10953
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11054
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10954
11055
  "input",
10955
11056
  {
10956
11057
  type: "range",
@@ -10964,12 +11065,12 @@ var ImageEditor = ({
10964
11065
  }
10965
11066
  )
10966
11067
  ] }),
10967
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { children: [
10968
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
10969
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: "Softness:" }),
10970
- /* @__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 })
10971
11072
  ] }),
10972
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11073
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10973
11074
  "input",
10974
11075
  {
10975
11076
  type: "range",
@@ -10981,8 +11082,8 @@ var ImageEditor = ({
10981
11082
  }
10982
11083
  )
10983
11084
  ] }),
10984
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
10985
- /* @__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)(
10986
11087
  "input",
10987
11088
  {
10988
11089
  type: "checkbox",
@@ -10991,12 +11092,12 @@ var ImageEditor = ({
10991
11092
  className: "rounded accent-primary"
10992
11093
  }
10993
11094
  ),
10994
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: "Invert Mask" })
11095
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { children: "Invert Mask" })
10995
11096
  ] })
10996
11097
  ] })
10997
11098
  ] }),
10998
- activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
10999
- /* @__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)(
11000
11101
  SelectionOptionsBar,
11001
11102
  {
11002
11103
  controller,
@@ -11007,9 +11108,9 @@ var ImageEditor = ({
11007
11108
  selectionDisplay: state.selectionDisplay
11008
11109
  }
11009
11110
  ),
11010
- selectionError && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
11011
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex gap-1", children: [
11012
- /* @__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)(
11013
11114
  "button",
11014
11115
  {
11015
11116
  type: "button",
@@ -11020,7 +11121,7 @@ var ImageEditor = ({
11020
11121
  children: "Transform Selection"
11021
11122
  }
11022
11123
  ),
11023
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11124
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11024
11125
  "button",
11025
11126
  {
11026
11127
  type: "button",
@@ -11032,14 +11133,14 @@ var ImageEditor = ({
11032
11133
  }
11033
11134
  )
11034
11135
  ] }),
11035
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
11036
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ChannelsPanel, { controller }),
11037
- /* @__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 })
11038
11139
  ] }),
11039
- activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
11040
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
11041
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: "Results go to" }),
11042
- /* @__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)(
11043
11144
  "select",
11044
11145
  {
11045
11146
  "aria-label": "AI result target",
@@ -11047,54 +11148,54 @@ var ImageEditor = ({
11047
11148
  onChange: (e) => setAiTarget(e.target.value),
11048
11149
  className: imageSelectClass,
11049
11150
  children: [
11050
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
11051
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
11052
- /* @__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" })
11053
11154
  ]
11054
11155
  }
11055
11156
  )
11056
11157
  ] }),
11057
- /* @__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: [
11058
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center justify-between", children: [
11059
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
11060
- /* @__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" }) }),
11061
11162
  "Background Removal"
11062
11163
  ] }),
11063
- 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..." })
11064
11165
  ] }),
11065
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
11066
- /* @__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)(
11067
11168
  "button",
11068
11169
  {
11069
11170
  type: "button",
11070
11171
  onClick: handleRemoveBackground,
11071
11172
  disabled: isRemovingBg || isInpainting,
11072
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",
11073
- children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
11074
- /* @__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 }),
11075
11176
  "Removing Background..."
11076
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
11077
- /* @__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" }) }),
11078
11179
  "Remove Background"
11079
11180
  ] })
11080
11181
  }
11081
11182
  )
11082
11183
  ] }),
11083
- /* @__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: [
11084
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center justify-between", children: [
11085
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
11086
- /* @__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: [
11087
- /* @__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" }),
11088
- /* @__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" })
11089
11190
  ] }),
11090
11191
  "Generative Inpainting"
11091
11192
  ] }),
11092
- 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..." })
11093
11194
  ] }),
11094
- /* @__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." }),
11095
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col gap-1", children: [
11096
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
11097
- /* @__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)(
11098
11199
  "textarea",
11099
11200
  {
11100
11201
  id: "ai-inpaint-prompt-react",
@@ -11106,10 +11207,10 @@ var ImageEditor = ({
11106
11207
  }
11107
11208
  )
11108
11209
  ] }),
11109
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col gap-1", children: [
11110
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
11111
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
11112
- /* @__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)(
11113
11214
  "button",
11114
11215
  {
11115
11216
  type: "button",
@@ -11122,7 +11223,7 @@ var ImageEditor = ({
11122
11223
  ]
11123
11224
  }
11124
11225
  ),
11125
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
11226
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
11126
11227
  "button",
11127
11228
  {
11128
11229
  type: "button",
@@ -11137,25 +11238,25 @@ var ImageEditor = ({
11137
11238
  )
11138
11239
  ] })
11139
11240
  ] }),
11140
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11241
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11141
11242
  "button",
11142
11243
  {
11143
11244
  type: "button",
11144
11245
  onClick: handleInpaint,
11145
11246
  disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
11146
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",
11147
- children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
11148
- /* @__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 }),
11149
11250
  "Generating Inpaint..."
11150
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
11151
- /* @__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" }) }),
11152
11253
  "Apply Inpainting"
11153
11254
  ] })
11154
11255
  }
11155
11256
  )
11156
11257
  ] }),
11157
- 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 }),
11158
- 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 })
11159
11260
  ] })
11160
11261
  ] })
11161
11262
  ] })
@@ -11165,7 +11266,7 @@ var ImageEditor = ({
11165
11266
  };
11166
11267
 
11167
11268
  // src/review/useReview.ts
11168
- var import_react71 = require("react");
11269
+ var import_react72 = require("react");
11169
11270
  var import_editor13 = require("@pixerate/editor");
11170
11271
  var EMPTY_COMMENTS = Object.freeze({
11171
11272
  threads: [],
@@ -11184,23 +11285,23 @@ function isCommentStore(value) {
11184
11285
  }
11185
11286
  function useComments(source) {
11186
11287
  const store = isCommentStore(source) ? source : (0, import_editor13.getCommentStore)(source);
11187
- const subscribe = (0, import_react71.useCallback)(
11288
+ const subscribe = (0, import_react72.useCallback)(
11188
11289
  (onChange) => store ? store.subscribe(() => onChange()) : noopUnsubscribe,
11189
11290
  [store]
11190
11291
  );
11191
11292
  const getSnapshot2 = () => store?.getSnapshot() ?? EMPTY_COMMENTS;
11192
- const snapshot = (0, import_react71.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
11193
- 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]);
11194
11295
  }
11195
11296
  function useTrackChanges(editor) {
11196
11297
  const store = (0, import_editor13.getTrackChangesStore)(editor ?? null);
11197
- const subscribe = (0, import_react71.useCallback)(
11298
+ const subscribe = (0, import_react72.useCallback)(
11198
11299
  (onChange) => store ? store.subscribe(() => onChange()) : noopUnsubscribe,
11199
11300
  [store]
11200
11301
  );
11201
11302
  const getSnapshot2 = () => store?.getSnapshot() ?? EMPTY_TRACK_CHANGES;
11202
- const snapshot = (0, import_react71.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
11203
- return (0, import_react71.useMemo)(() => {
11303
+ const snapshot = (0, import_react72.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
11304
+ return (0, import_react72.useMemo)(() => {
11204
11305
  const run = (fn) => () => {
11205
11306
  if (editor && !editor.isDestroyed) fn(editor);
11206
11307
  };
@@ -11223,9 +11324,9 @@ function useTrackChanges(editor) {
11223
11324
  }
11224
11325
 
11225
11326
  // src/review/CommentsPanel.tsx
11226
- var import_react72 = require("react");
11327
+ var import_react73 = require("react");
11227
11328
  var import_editor14 = require("@pixerate/editor");
11228
- var import_jsx_runtime51 = require("react/jsx-runtime");
11329
+ var import_jsx_runtime52 = require("react/jsx-runtime");
11229
11330
  var buttonClass2 = "rounded px-2 py-1 text-xs text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-50";
11230
11331
  var primaryButtonClass = "rounded px-2 py-1 text-xs bg-primary/10 text-primary hover:bg-primary/20 disabled:opacity-50";
11231
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";
@@ -11239,18 +11340,18 @@ var CommentsPanel = ({
11239
11340
  emptyMessage = "No comments yet. Select text and add a comment."
11240
11341
  }) => {
11241
11342
  const { threads, activeThreadId, store } = useComments(storeProp ?? editor);
11242
- const [showResolved, setShowResolved] = (0, import_react72.useState)(showResolvedInitial);
11343
+ const [showResolved, setShowResolved] = (0, import_react73.useState)(showResolvedInitial);
11243
11344
  const author = authorProp ?? (0, import_editor14.getCommentAuthor)(editor) ?? { id: "anonymous", name: "Anonymous" };
11244
11345
  const visible = threads.filter((t) => showResolved || !t.resolved);
11245
11346
  const resolvedCount = threads.filter((t) => t.resolved).length;
11246
- return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("aside", { className, "aria-label": "Comments", children: [
11247
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
11248
- /* @__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: [
11249
11350
  threads.length - resolvedCount,
11250
11351
  " open",
11251
11352
  resolvedCount > 0 ? ` \xB7 ${resolvedCount} resolved` : ""
11252
11353
  ] }),
11253
- resolvedCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
11354
+ resolvedCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
11254
11355
  "button",
11255
11356
  {
11256
11357
  type: "button",
@@ -11261,7 +11362,7 @@ var CommentsPanel = ({
11261
11362
  }
11262
11363
  )
11263
11364
  ] }),
11264
- 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)(
11265
11366
  CommentThreadCard,
11266
11367
  {
11267
11368
  thread,
@@ -11283,7 +11384,7 @@ var CommentThreadCard = ({
11283
11384
  author,
11284
11385
  formatTime
11285
11386
  }) => {
11286
- const [draft, setDraft] = (0, import_react72.useState)("");
11387
+ const [draft, setDraft] = (0, import_react73.useState)("");
11287
11388
  const isDraft = thread.body === "";
11288
11389
  const quote = thread.anchor?.quote ?? thread.lastQuote ?? "";
11289
11390
  const live = editor && !editor.isDestroyed ? editor : null;
@@ -11309,7 +11410,7 @@ var CommentThreadCard = ({
11309
11410
  setDraft("");
11310
11411
  };
11311
11412
  const stop = (e) => e.stopPropagation();
11312
- return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
11413
+ return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
11313
11414
  "li",
11314
11415
  {
11315
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" : ""}`,
@@ -11325,24 +11426,24 @@ var CommentThreadCard = ({
11325
11426
  }
11326
11427
  },
11327
11428
  children: [
11328
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex items-baseline justify-between gap-2", children: [
11329
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "font-medium", children: thread.author.name }),
11330
- /* @__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) })
11331
11432
  ] }),
11332
- 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 }),
11333
- thread.orphaned && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-xs text-destructive", children: "The commented text was deleted." }),
11334
- thread.resolved && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-xs text-muted-foreground", children: "Resolved" }),
11335
- !isDraft && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "whitespace-pre-wrap break-words", children: thread.body }),
11336
- 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: [
11337
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("span", { className: "text-xs", children: [
11338
- /* @__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 }),
11339
11440
  " ",
11340
- /* @__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) })
11341
11442
  ] }),
11342
- /* @__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 })
11343
11444
  ] }, reply.id)) }),
11344
- (active || isDraft) && !thread.resolved && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex flex-col gap-1", onClick: stop, children: [
11345
- /* @__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)(
11346
11447
  "textarea",
11347
11448
  {
11348
11449
  className: textareaClass,
@@ -11360,9 +11461,9 @@ var CommentThreadCard = ({
11360
11461
  }
11361
11462
  }
11362
11463
  ),
11363
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex justify-end gap-1", children: [
11364
- isDraft && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("button", { type: "button", className: buttonClass2, onClick: remove, children: "Cancel" }),
11365
- /* @__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)(
11366
11467
  "button",
11367
11468
  {
11368
11469
  type: "button",
@@ -11374,9 +11475,9 @@ var CommentThreadCard = ({
11374
11475
  )
11375
11476
  ] })
11376
11477
  ] }),
11377
- !isDraft && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex justify-end gap-1", onClick: stop, children: [
11378
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("button", { type: "button", className: buttonClass2, onClick: () => setResolved(!thread.resolved), children: thread.resolved ? "Reopen" : "Resolve" }),
11379
- /* @__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)(
11380
11481
  "button",
11381
11482
  {
11382
11483
  type: "button",
@@ -11392,7 +11493,7 @@ var CommentThreadCard = ({
11392
11493
  };
11393
11494
 
11394
11495
  // src/review/ReviewToolbar.tsx
11395
- var import_jsx_runtime52 = require("react/jsx-runtime");
11496
+ var import_jsx_runtime53 = require("react/jsx-runtime");
11396
11497
  var defaultDescriptionClass = "max-w-[16rem] truncate px-1 text-xs text-muted-foreground";
11397
11498
  var buttonClass3 = "rounded px-2 py-1 text-xs text-foreground hover:bg-muted disabled:opacity-40 disabled:hover:bg-transparent";
11398
11499
  var ReviewToolbar = ({
@@ -11405,8 +11506,8 @@ var ReviewToolbar = ({
11405
11506
  const count = review.changes.length;
11406
11507
  const current = review.currentChange;
11407
11508
  const index = current ? review.changes.findIndex((c) => c.id === current.id) + 1 : 0;
11408
- return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className, role: "toolbar", "aria-label": "Review", children: [
11409
- /* @__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)(
11410
11511
  "button",
11411
11512
  {
11412
11513
  type: "button",
@@ -11417,8 +11518,8 @@ var ReviewToolbar = ({
11417
11518
  children: review.enabled ? "Tracking on" : "Track changes"
11418
11519
  }
11419
11520
  ),
11420
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "mx-1 h-4 w-px bg-border", "aria-hidden": "true" }),
11421
- /* @__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)(
11422
11523
  "button",
11423
11524
  {
11424
11525
  type: "button",
@@ -11429,8 +11530,8 @@ var ReviewToolbar = ({
11429
11530
  children: "\u2039"
11430
11531
  }
11431
11532
  ),
11432
- /* @__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` }),
11433
- /* @__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)(
11434
11535
  "button",
11435
11536
  {
11436
11537
  type: "button",
@@ -11441,7 +11542,7 @@ var ReviewToolbar = ({
11441
11542
  children: "\u203A"
11442
11543
  }
11443
11544
  ),
11444
- showDescription && current && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
11545
+ showDescription && current && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
11445
11546
  "span",
11446
11547
  {
11447
11548
  className: descriptionClassName,
@@ -11453,8 +11554,8 @@ var ReviewToolbar = ({
11453
11554
  ]
11454
11555
  }
11455
11556
  ),
11456
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "mx-1 h-4 w-px bg-border", "aria-hidden": "true" }),
11457
- /* @__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)(
11458
11559
  "button",
11459
11560
  {
11460
11561
  type: "button",
@@ -11464,7 +11565,7 @@ var ReviewToolbar = ({
11464
11565
  children: "Accept"
11465
11566
  }
11466
11567
  ),
11467
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
11568
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11468
11569
  "button",
11469
11570
  {
11470
11571
  type: "button",
@@ -11474,18 +11575,18 @@ var ReviewToolbar = ({
11474
11575
  children: "Reject"
11475
11576
  }
11476
11577
  ),
11477
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("button", { type: "button", className: buttonClass3, disabled: count === 0, onClick: review.acceptAll, children: "Accept all" }),
11478
- /* @__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" })
11479
11580
  ] });
11480
11581
  };
11481
11582
 
11482
11583
  // src/review/CommentButton.tsx
11483
- var import_jsx_runtime53 = require("react/jsx-runtime");
11584
+ var import_jsx_runtime54 = require("react/jsx-runtime");
11484
11585
  var CommentButton = ({
11485
11586
  editor,
11486
11587
  className = "rounded px-2 py-1 text-xs text-popover-foreground hover:bg-muted",
11487
11588
  children = "Comment"
11488
- }) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11589
+ }) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11489
11590
  "button",
11490
11591
  {
11491
11592
  type: "button",
@@ -11497,13 +11598,13 @@ var CommentButton = ({
11497
11598
  );
11498
11599
 
11499
11600
  // src/review/useDocumentCompare.ts
11500
- var import_react73 = require("react");
11601
+ var import_react74 = require("react");
11501
11602
  var import_editor15 = require("@pixerate/editor");
11502
11603
  function useDocumentCompare(editor, options) {
11503
- const [summary, setSummary] = (0, import_react73.useState)(null);
11504
- const defaults = (0, import_react73.useRef)(options);
11604
+ const [summary, setSummary] = (0, import_react74.useState)(null);
11605
+ const defaults = (0, import_react74.useRef)(options);
11505
11606
  defaults.current = options;
11506
- const compare = (0, import_react73.useCallback)(
11607
+ const compare = (0, import_react74.useCallback)(
11507
11608
  (original, revised, overrides) => {
11508
11609
  if (!editor || editor.isDestroyed) return null;
11509
11610
  const result = (0, import_editor15.applyDocumentComparison)(editor, original, revised, {
@@ -11515,13 +11616,13 @@ function useDocumentCompare(editor, options) {
11515
11616
  },
11516
11617
  [editor]
11517
11618
  );
11518
- const clear = (0, import_react73.useCallback)(() => setSummary(null), []);
11519
- 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]);
11520
11621
  }
11521
11622
 
11522
11623
  // src/review/TrackedChangesList.tsx
11523
11624
  var import_editor16 = require("@pixerate/editor");
11524
- var import_jsx_runtime54 = require("react/jsx-runtime");
11625
+ var import_jsx_runtime55 = require("react/jsx-runtime");
11525
11626
  var buttonClass4 = "rounded px-1.5 py-0.5 text-xs text-foreground hover:bg-muted disabled:opacity-40";
11526
11627
  var TrackedChangesList = ({
11527
11628
  editor,
@@ -11532,18 +11633,18 @@ var TrackedChangesList = ({
11532
11633
  }) => {
11533
11634
  const review = useTrackChanges(editor);
11534
11635
  if (review.changes.length === 0) {
11535
- 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 }) });
11536
11637
  }
11537
- 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) => {
11538
11639
  const active = change.id === review.currentChangeId;
11539
- return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
11640
+ return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
11540
11641
  "li",
11541
11642
  {
11542
11643
  className: active ? `${itemClassName} ${activeItemClassName}` : itemClassName,
11543
11644
  "data-change-type": change.type,
11544
11645
  "data-change-id": change.id,
11545
11646
  children: [
11546
- /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
11647
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
11547
11648
  "button",
11548
11649
  {
11549
11650
  type: "button",
@@ -11551,14 +11652,14 @@ var TrackedChangesList = ({
11551
11652
  title: `${change.author.name}: ${change.description}`,
11552
11653
  onClick: () => review.select(change.id),
11553
11654
  children: [
11554
- /* @__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) }),
11555
11656
  change.author.name ? ` \xB7 ${change.author.name}` : "",
11556
- /* @__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 })
11557
11658
  ]
11558
11659
  }
11559
11660
  ),
11560
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("button", { type: "button", className: buttonClass4, onClick: () => review.accept(change.id), children: "Accept" }),
11561
- /* @__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" })
11562
11663
  ]
11563
11664
  },
11564
11665
  `${change.type}:${change.id}`
@@ -11567,12 +11668,12 @@ var TrackedChangesList = ({
11567
11668
  };
11568
11669
 
11569
11670
  // src/commands/useCommandPalette.ts
11570
- var import_react74 = require("react");
11671
+ var import_react75 = require("react");
11571
11672
  var import_commands2 = require("@pixerate/editor/commands");
11572
11673
  function useCommandPalette(registry, options = {}) {
11573
- const optionsRef = (0, import_react74.useRef)(options);
11674
+ const optionsRef = (0, import_react75.useRef)(options);
11574
11675
  optionsRef.current = options;
11575
- const controller = (0, import_react74.useMemo)(
11676
+ const controller = (0, import_react75.useMemo)(
11576
11677
  () => (0, import_commands2.createCommandPaletteController)(registry, {
11577
11678
  context: () => {
11578
11679
  const c = optionsRef.current.context;
@@ -11593,9 +11694,9 @@ function useCommandPalette(registry, options = {}) {
11593
11694
  // eslint-disable-next-line react-hooks/exhaustive-deps
11594
11695
  [registry]
11595
11696
  );
11596
- 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);
11597
11698
  const { hotkey, hotkeyTarget } = options;
11598
- (0, import_react74.useEffect)(() => {
11699
+ (0, import_react75.useEffect)(() => {
11599
11700
  if (!hotkey) return;
11600
11701
  const target = hotkeyTarget ?? (typeof window !== "undefined" ? window : null);
11601
11702
  if (!target) return;
@@ -11623,13 +11724,13 @@ function useCommandPalette(registry, options = {}) {
11623
11724
  }
11624
11725
 
11625
11726
  // src/commands/CommandPalette.tsx
11626
- var import_react75 = __toESM(require("react"), 1);
11627
- 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");
11628
11729
  function HighlightedLabel({ item }) {
11629
- 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 });
11630
11731
  const marked = new Set(item.labelIndices);
11631
- return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_jsx_runtime55.Fragment, { children: Array.from(item.label).map(
11632
- (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)
11633
11734
  ) });
11634
11735
  }
11635
11736
  var CommandPalette = ({
@@ -11638,22 +11739,22 @@ var CommandPalette = ({
11638
11739
  emptyMessage = "No matching commands",
11639
11740
  className = ""
11640
11741
  }) => {
11641
- const inputRef = (0, import_react75.useRef)(null);
11642
- const listRef = (0, import_react75.useRef)(null);
11643
- 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)();
11644
11745
  const listId = `${baseId}-list`;
11645
11746
  const optionId = (index) => `${baseId}-option-${index}`;
11646
11747
  const { open, query, items, activeIndex } = palette;
11647
- (0, import_react75.useEffect)(() => {
11748
+ (0, import_react76.useEffect)(() => {
11648
11749
  if (open) inputRef.current?.focus();
11649
11750
  }, [open]);
11650
- (0, import_react75.useEffect)(() => {
11751
+ (0, import_react76.useEffect)(() => {
11651
11752
  if (!open) return;
11652
11753
  const active = listRef.current?.querySelector('[aria-selected="true"]');
11653
11754
  active?.scrollIntoView?.({ block: "nearest" });
11654
11755
  }, [open, activeIndex]);
11655
11756
  if (!open) return null;
11656
- return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
11757
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
11657
11758
  "div",
11658
11759
  {
11659
11760
  className: "fixed inset-0 z-50 flex items-start justify-center bg-black/30 px-4 pt-[15vh]",
@@ -11661,7 +11762,7 @@ var CommandPalette = ({
11661
11762
  onMouseDown: (e) => {
11662
11763
  if (e.target === e.currentTarget) palette.setOpen(false);
11663
11764
  },
11664
- children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
11765
+ children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
11665
11766
  "div",
11666
11767
  {
11667
11768
  role: "dialog",
@@ -11670,7 +11771,7 @@ var CommandPalette = ({
11670
11771
  className: `w-full max-w-lg overflow-hidden rounded-lg border border-border bg-popover text-popover-foreground shadow-xl ${className}`,
11671
11772
  style: { background: "var(--popover, var(--background, #fff))" },
11672
11773
  children: [
11673
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
11774
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
11674
11775
  "input",
11675
11776
  {
11676
11777
  ref: inputRef,
@@ -11690,7 +11791,7 @@ var CommandPalette = ({
11690
11791
  className: "w-full border-b border-border bg-transparent px-3 py-2 text-sm outline-none placeholder:text-muted-foreground"
11691
11792
  }
11692
11793
  ),
11693
- 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)(
11694
11795
  "li",
11695
11796
  {
11696
11797
  id: optionId(index),
@@ -11705,12 +11806,12 @@ var CommandPalette = ({
11705
11806
  onClick: () => palette.run(item.id),
11706
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"}`,
11707
11808
  children: [
11708
- /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: "min-w-0 flex-1 truncate", children: [
11709
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(HighlightedLabel, { item }),
11710
- 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 })
11711
11812
  ] }),
11712
- item.group && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "shrink-0 text-xs text-muted-foreground", children: item.group }),
11713
- 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 })
11714
11815
  ]
11715
11816
  },
11716
11817
  item.id
@@ -11723,12 +11824,12 @@ var CommandPalette = ({
11723
11824
  };
11724
11825
 
11725
11826
  // src/commands/useCommandShortcuts.ts
11726
- var import_react76 = require("react");
11827
+ var import_react77 = require("react");
11727
11828
  function useCommandShortcuts(registry, options = {}) {
11728
- const optionsRef = (0, import_react76.useRef)(options);
11829
+ const optionsRef = (0, import_react77.useRef)(options);
11729
11830
  optionsRef.current = options;
11730
11831
  const { enabled = true, target } = options;
11731
- (0, import_react76.useEffect)(() => {
11832
+ (0, import_react77.useEffect)(() => {
11732
11833
  if (!registry || !enabled) return;
11733
11834
  const eventTarget = target ?? (typeof window !== "undefined" ? window : null);
11734
11835
  if (!eventTarget) return;
@@ -11746,14 +11847,14 @@ function useCommandShortcuts(registry, options = {}) {
11746
11847
  }, [registry, enabled, target]);
11747
11848
  }
11748
11849
  function useRegisterCommands(registry, specs) {
11749
- (0, import_react76.useEffect)(() => {
11850
+ (0, import_react77.useEffect)(() => {
11750
11851
  if (!registry || !specs || specs.length === 0) return;
11751
11852
  return registry.register(specs);
11752
11853
  }, [registry, specs]);
11753
11854
  }
11754
11855
 
11755
11856
  // src/persistence/useAutosave.ts
11756
- var import_react77 = require("react");
11857
+ var import_react78 = require("react");
11757
11858
  var import_persistence = require("@pixerate/editor/persistence");
11758
11859
  var IDLE = {
11759
11860
  status: "idle",
@@ -11764,18 +11865,18 @@ var IDLE = {
11764
11865
  ready: false
11765
11866
  };
11766
11867
  function useAutosave(options) {
11767
- const optionsRef = (0, import_react77.useRef)(options);
11868
+ const optionsRef = (0, import_react78.useRef)(options);
11768
11869
  optionsRef.current = options;
11769
11870
  const { storage, key, history, dirty } = options;
11770
11871
  const recover = options.recover !== false;
11771
11872
  const flushOnHide = options.flushOnHide !== false;
11772
11873
  const ready = options.ready !== false;
11773
- const [controller, setController] = (0, import_react77.useState)(null);
11774
- const [status, setStatus] = (0, import_react77.useState)(IDLE);
11775
- const [recovery, setRecovery] = (0, import_react77.useState)(null);
11776
- const [pendingRecovery, setPendingRecovery] = (0, import_react77.useState)(recover);
11777
- const revisionsRef = (0, import_react77.useRef)(null);
11778
- (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)(() => {
11779
11880
  const revisions = (0, import_persistence.createRevisionTracker)({ history, dirty });
11780
11881
  const o = optionsRef.current;
11781
11882
  const instance = (0, import_persistence.createAutosaveController)({
@@ -11818,10 +11919,10 @@ function useAutosave(options) {
11818
11919
  if (revisionsRef.current === revisions) revisionsRef.current = null;
11819
11920
  };
11820
11921
  }, [storage, key, history, dirty, recover]);
11821
- (0, import_react77.useEffect)(() => {
11922
+ (0, import_react78.useEffect)(() => {
11822
11923
  if (controller && ready && !pendingRecovery) controller.ready();
11823
11924
  }, [controller, ready, pendingRecovery]);
11824
- (0, import_react77.useEffect)(() => {
11925
+ (0, import_react78.useEffect)(() => {
11825
11926
  if (!controller || !flushOnHide || typeof window === "undefined") return;
11826
11927
  const flush = () => void controller.flushNow();
11827
11928
  const onVisibility = () => {
@@ -11834,33 +11935,33 @@ function useAutosave(options) {
11834
11935
  document.removeEventListener("visibilitychange", onVisibility);
11835
11936
  };
11836
11937
  }, [controller, flushOnHide]);
11837
- const restore = (0, import_react77.useCallback)(() => {
11938
+ const restore = (0, import_react78.useCallback)(() => {
11838
11939
  const snapshot = recovery?.snapshot;
11839
11940
  setRecovery(null);
11840
11941
  setPendingRecovery(false);
11841
11942
  return snapshot;
11842
11943
  }, [recovery]);
11843
- const discard = (0, import_react77.useCallback)(async () => {
11944
+ const discard = (0, import_react78.useCallback)(async () => {
11844
11945
  if (controller) await controller.discardRecovery();
11845
11946
  setRecovery(null);
11846
11947
  setPendingRecovery(false);
11847
11948
  }, [controller]);
11848
- const flushNow = (0, import_react77.useCallback)(async () => {
11949
+ const flushNow = (0, import_react78.useCallback)(async () => {
11849
11950
  await controller?.flushNow();
11850
11951
  }, [controller]);
11851
- const markClean = (0, import_react77.useCallback)(async () => {
11952
+ const markClean = (0, import_react78.useCallback)(async () => {
11852
11953
  revisionsRef.current?.markSaved();
11853
11954
  await controller?.markClean();
11854
11955
  }, [controller]);
11855
- const notifyChange = (0, import_react77.useCallback)(() => revisionsRef.current?.bump(), []);
11956
+ const notifyChange = (0, import_react78.useCallback)(() => revisionsRef.current?.bump(), []);
11856
11957
  return { status, recovery, pendingRecovery, restore, discard, flushNow, markClean, notifyChange, controller };
11857
11958
  }
11858
11959
 
11859
11960
  // src/persistence/useEditorAutosave.ts
11860
- var import_react78 = require("react");
11961
+ var import_react79 = require("react");
11861
11962
  var import_persistence2 = require("@pixerate/editor/persistence");
11862
11963
  function useEditorAutosave(doc, { collectAssetGarbage, ...options }) {
11863
- const storage = (0, import_react78.useMemo)(
11964
+ const storage = (0, import_react79.useMemo)(
11864
11965
  () => doc.assets ? (0, import_persistence2.withEditorAssets)(options.storage, doc.assets) : options.storage,
11865
11966
  [options.storage, doc.assets]
11866
11967
  );
@@ -11873,19 +11974,19 @@ function useEditorAutosave(doc, { collectAssetGarbage, ...options }) {
11873
11974
  history: doc
11874
11975
  });
11875
11976
  const take = autosave.restore;
11876
- const restore = (0, import_react78.useCallback)(() => {
11977
+ const restore = (0, import_react79.useCallback)(() => {
11877
11978
  const snapshot = take();
11878
11979
  return snapshot ? doc.loadDocument(snapshot, { history: "reset" }) : void 0;
11879
11980
  }, [take, doc]);
11880
11981
  const { markClean: clean, discard: drop } = autosave;
11881
11982
  const rawStorage = options.storage;
11882
- const gcRef = (0, import_react78.useRef)(collectAssetGarbage);
11983
+ const gcRef = (0, import_react79.useRef)(collectAssetGarbage);
11883
11984
  gcRef.current = collectAssetGarbage;
11884
- const markClean = (0, import_react78.useCallback)(async () => {
11985
+ const markClean = (0, import_react79.useCallback)(async () => {
11885
11986
  await clean();
11886
11987
  await (0, import_persistence2.collectRetiredEditorAssets)(rawStorage, doc, gcRef.current);
11887
11988
  }, [clean, rawStorage, doc]);
11888
- const discard = (0, import_react78.useCallback)(async () => {
11989
+ const discard = (0, import_react79.useCallback)(async () => {
11889
11990
  await drop();
11890
11991
  await (0, import_persistence2.collectRetiredEditorAssets)(rawStorage, doc, gcRef.current);
11891
11992
  }, [drop, rawStorage, doc]);
@@ -11894,7 +11995,7 @@ function useEditorAutosave(doc, { collectAssetGarbage, ...options }) {
11894
11995
 
11895
11996
  // src/persistence/RecoveryPrompt.tsx
11896
11997
  var import_persistence3 = require("@pixerate/editor/persistence");
11897
- var import_jsx_runtime56 = require("react/jsx-runtime");
11998
+ var import_jsx_runtime57 = require("react/jsx-runtime");
11898
11999
  var RecoveryPrompt = ({
11899
12000
  recovery,
11900
12001
  onRestore,
@@ -11906,7 +12007,7 @@ var RecoveryPrompt = ({
11906
12007
  }) => {
11907
12008
  if (!recovery) return null;
11908
12009
  const { name } = recovery.meta;
11909
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
12010
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
11910
12011
  "div",
11911
12012
  {
11912
12013
  role: "alertdialog",
@@ -11914,15 +12015,15 @@ var RecoveryPrompt = ({
11914
12015
  "data-recovery-prompt": "",
11915
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}`,
11916
12017
  children: [
11917
- /* @__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: [
11918
12019
  (0, import_persistence3.formatRecoveryMessage)(recovery.meta, formatTime),
11919
- 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: [
11920
12021
  "(",
11921
12022
  name,
11922
12023
  ")"
11923
12024
  ] }) : null
11924
12025
  ] }),
11925
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
12026
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
11926
12027
  "button",
11927
12028
  {
11928
12029
  type: "button",
@@ -11932,7 +12033,7 @@ var RecoveryPrompt = ({
11932
12033
  children: restoreLabel
11933
12034
  }
11934
12035
  ),
11935
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
12036
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
11936
12037
  "button",
11937
12038
  {
11938
12039
  type: "button",
@@ -11948,17 +12049,17 @@ var RecoveryPrompt = ({
11948
12049
  };
11949
12050
 
11950
12051
  // src/generation/useGenerationPlan.ts
11951
- var import_react79 = require("react");
12052
+ var import_react80 = require("react");
11952
12053
  var import_generation = require("@pixerate/editor/generation");
11953
12054
  function useGenerationPlan(request, capabilities, options = {}) {
11954
12055
  const key = JSON.stringify([request, capabilities, options]);
11955
- 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]);
11956
12057
  }
11957
12058
  function useJobProgress(options) {
11958
12059
  const { startedAt, expectedMs, done, now, intervalMs = 1e3 } = options;
11959
- const [tick, setTick] = (0, import_react79.useState)(() => Date.now());
12060
+ const [tick, setTick] = (0, import_react80.useState)(() => Date.now());
11960
12061
  const ticking = !done && now === void 0;
11961
- (0, import_react79.useEffect)(() => {
12062
+ (0, import_react80.useEffect)(() => {
11962
12063
  if (!ticking) return;
11963
12064
  setTick(Date.now());
11964
12065
  const id = setInterval(() => setTick(Date.now()), Math.max(16, intervalMs));
@@ -11968,9 +12069,9 @@ function useJobProgress(options) {
11968
12069
  }
11969
12070
 
11970
12071
  // src/generation/GenerationSettings.tsx
11971
- var import_react80 = require("react");
12072
+ var import_react81 = require("react");
11972
12073
  var import_generation2 = require("@pixerate/editor/generation");
11973
- var import_jsx_runtime57 = require("react/jsx-runtime");
12074
+ var import_jsx_runtime58 = require("react/jsx-runtime");
11974
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";
11975
12076
  function Control({
11976
12077
  control,
@@ -11980,7 +12081,7 @@ function Control({
11980
12081
  }) {
11981
12082
  const shown = value ?? control.defaultValue;
11982
12083
  if (control.kind === "checkbox") {
11983
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
12084
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
11984
12085
  "input",
11985
12086
  {
11986
12087
  id,
@@ -11992,7 +12093,7 @@ function Control({
11992
12093
  );
11993
12094
  }
11994
12095
  if (control.kind === "select") {
11995
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
12096
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
11996
12097
  "select",
11997
12098
  {
11998
12099
  id,
@@ -12001,14 +12102,14 @@ function Control({
12001
12102
  value: shown === void 0 ? "" : String(shown),
12002
12103
  onChange: (e) => onValue((0, import_generation2.parseControlValue)(control, e.target.value)),
12003
12104
  children: [
12004
- shown === void 0 && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("option", { value: "", children: "Default" }),
12005
- 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)))
12006
12107
  ]
12007
12108
  }
12008
12109
  );
12009
12110
  }
12010
12111
  if (control.kind === "textarea") {
12011
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
12112
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12012
12113
  "textarea",
12013
12114
  {
12014
12115
  id,
@@ -12022,8 +12123,8 @@ function Control({
12022
12123
  );
12023
12124
  }
12024
12125
  const numeric = typeof shown === "number" ? shown : void 0;
12025
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex items-center gap-2", children: [
12026
- /* @__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)(
12027
12128
  "input",
12028
12129
  {
12029
12130
  id,
@@ -12037,7 +12138,7 @@ function Control({
12037
12138
  onChange: (e) => onValue((0, import_generation2.parseControlValue)(control, e.target.value))
12038
12139
  }
12039
12140
  ),
12040
- 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" })
12041
12142
  ] });
12042
12143
  }
12043
12144
  var GenerationSettings = ({
@@ -12051,17 +12152,17 @@ var GenerationSettings = ({
12051
12152
  renderReference,
12052
12153
  className = ""
12053
12154
  }) => {
12054
- const baseId = (0, import_react80.useId)();
12055
- 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]);
12056
12157
  const computed = useGenerationPlan(value, capabilities, { strategy });
12057
12158
  const plan = planProp ?? computed;
12058
12159
  const slots = (0, import_generation2.getReferenceSlots)(capabilities, value);
12059
- 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: [
12060
12161
  controls.map((control) => {
12061
12162
  const id = `${baseId}-${control.key}`;
12062
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex flex-col gap-1", "data-control": control.key, children: [
12063
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("label", { htmlFor: id, className: "text-xs font-medium text-muted-foreground", title: control.description, children: control.label }),
12064
- /* @__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)(
12065
12166
  Control,
12066
12167
  {
12067
12168
  control,
@@ -12072,23 +12173,23 @@ var GenerationSettings = ({
12072
12173
  )
12073
12174
  ] }, control.key);
12074
12175
  }),
12075
- slots.map((slot) => /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("fieldset", { className: "flex flex-col gap-1", "data-reference-role": slot.role, children: [
12076
- /* @__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: [
12077
12178
  slot.label,
12078
12179
  " ",
12079
- /* @__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: [
12080
12181
  "(",
12081
12182
  slot.references.length,
12082
12183
  "/",
12083
12184
  slot.max,
12084
12185
  ")"
12085
12186
  ] }),
12086
- 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: " *" })
12087
12188
  ] }),
12088
- /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("ul", { className: "flex flex-wrap gap-1", children: [
12089
- 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: [
12090
- renderReference ? renderReference(ref) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "max-w-[10rem] truncate", children: ref.id }),
12091
- /* @__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)(
12092
12193
  "button",
12093
12194
  {
12094
12195
  type: "button",
@@ -12099,7 +12200,7 @@ var GenerationSettings = ({
12099
12200
  }
12100
12201
  )
12101
12202
  ] }, ref.id)),
12102
- 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)(
12103
12204
  "button",
12104
12205
  {
12105
12206
  type: "button",
@@ -12110,21 +12211,21 @@ var GenerationSettings = ({
12110
12211
  ) })
12111
12212
  ] })
12112
12213
  ] }, slot.role)),
12113
- 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)) }),
12114
- 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)) })
12115
12216
  ] });
12116
12217
  };
12117
12218
 
12118
12219
  // src/generation/JobProgress.tsx
12119
- var import_jsx_runtime58 = require("react/jsx-runtime");
12220
+ var import_jsx_runtime59 = require("react/jsx-runtime");
12120
12221
  var JobProgress = ({ title, className = "", ...options }) => {
12121
12222
  const progress = useJobProgress(options);
12122
- 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: [
12123
- /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "flex items-center justify-between gap-2 text-muted-foreground", children: [
12124
- title && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "truncate text-foreground", children: title }),
12125
- /* @__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 })
12126
12227
  ] }),
12127
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12228
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
12128
12229
  "div",
12129
12230
  {
12130
12231
  role: "progressbar",
@@ -12134,7 +12235,7 @@ var JobProgress = ({ title, className = "", ...options }) => {
12134
12235
  "aria-valuenow": progress.percent,
12135
12236
  "aria-valuetext": `${progress.percent}%, ${progress.label}`,
12136
12237
  className: "h-1.5 w-full overflow-hidden rounded-full bg-muted",
12137
- children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
12238
+ children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
12138
12239
  "div",
12139
12240
  {
12140
12241
  className: "h-full rounded-full bg-primary transition-[width] duration-500",
@@ -12147,9 +12248,9 @@ var JobProgress = ({ title, className = "", ...options }) => {
12147
12248
  };
12148
12249
 
12149
12250
  // src/generation/AssetMentionChips.tsx
12150
- var import_react81 = require("react");
12251
+ var import_react82 = require("react");
12151
12252
  var import_generation3 = require("@pixerate/editor/generation");
12152
- var import_jsx_runtime59 = require("react/jsx-runtime");
12253
+ var import_jsx_runtime60 = require("react/jsx-runtime");
12153
12254
  var AssetMentionChips = ({
12154
12255
  content,
12155
12256
  onChange,
@@ -12159,14 +12260,14 @@ var AssetMentionChips = ({
12159
12260
  renderAsset,
12160
12261
  className = ""
12161
12262
  }) => {
12162
- const [open, setOpen] = (0, import_react81.useState)(null);
12163
- const rootRef = (0, import_react81.useRef)(null);
12164
- 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)(
12165
12266
  () => (0, import_generation3.describeAssetMentions)((0, import_generation3.findTextMentions)(content), assets, capabilities),
12166
12267
  [content, assets, capabilities]
12167
12268
  );
12168
12269
  const options = roles ?? (capabilities ? (0, import_generation3.getAssetRoleOptions)(capabilities) : (0, import_generation3.defaultAssetRoleOptions)());
12169
- (0, import_react81.useEffect)(() => {
12270
+ (0, import_react82.useEffect)(() => {
12170
12271
  if (open === null) return;
12171
12272
  const onPointer = (event) => {
12172
12273
  if (!rootRef.current?.contains(event.target)) setOpen(null);
@@ -12180,13 +12281,13 @@ var AssetMentionChips = ({
12180
12281
  onChange((0, import_generation3.setMentionRoleInText)(content, chip2.start, role));
12181
12282
  };
12182
12283
  if (chips.length === 0) return null;
12183
- 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) => {
12184
12285
  const error = chip2.issues.find((issue) => issue.severity === "error");
12185
12286
  const warning = chip2.issues.find((issue) => issue.severity === "warning");
12186
12287
  const problem = error ?? warning;
12187
12288
  const isOpen = open === chip2.index;
12188
- return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("span", { className: "relative inline-flex", "data-asset-chip": chip2.asset.id, children: [
12189
- /* @__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)(
12190
12291
  "button",
12191
12292
  {
12192
12293
  type: "button",
@@ -12200,8 +12301,8 @@ var AssetMentionChips = ({
12200
12301
  },
12201
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`,
12202
12303
  children: [
12203
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { children: renderAsset ? renderAsset(chip2) : `@${chip2.asset.label ?? chip2.handle}` }),
12204
- /* @__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)(
12205
12306
  "span",
12206
12307
  {
12207
12308
  className: `rounded px-1 text-[10px] uppercase tracking-wide ${chip2.role ? "bg-primary/15" : "opacity-60"}`,
@@ -12212,7 +12313,7 @@ var AssetMentionChips = ({
12212
12313
  ]
12213
12314
  }
12214
12315
  ),
12215
- isOpen && /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
12316
+ isOpen && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
12216
12317
  "div",
12217
12318
  {
12218
12319
  role: "listbox",
@@ -12223,7 +12324,7 @@ var AssetMentionChips = ({
12223
12324
  if (e.key === "Escape") setOpen(null);
12224
12325
  },
12225
12326
  children: [
12226
- options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
12327
+ options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
12227
12328
  "button",
12228
12329
  {
12229
12330
  type: "button",
@@ -12234,13 +12335,13 @@ var AssetMentionChips = ({
12234
12335
  onClick: () => pick(chip2, option.role),
12235
12336
  className: "flex items-center justify-between gap-2 rounded px-2 py-1 text-left hover:bg-muted",
12236
12337
  children: [
12237
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { children: option.label }),
12238
- 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
12239
12340
  ]
12240
12341
  },
12241
12342
  option.role
12242
12343
  )),
12243
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
12344
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
12244
12345
  "button",
12245
12346
  {
12246
12347
  type: "button",
@@ -12252,7 +12353,7 @@ var AssetMentionChips = ({
12252
12353
  children: "No role"
12253
12354
  }
12254
12355
  ),
12255
- 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)) })
12256
12357
  ]
12257
12358
  }
12258
12359
  )
@@ -12261,15 +12362,15 @@ var AssetMentionChips = ({
12261
12362
  };
12262
12363
 
12263
12364
  // src/generation/GenerationHistory.tsx
12264
- var import_react82 = require("react");
12365
+ var import_react83 = require("react");
12265
12366
  var import_generation4 = require("@pixerate/editor/generation");
12266
- var import_jsx_runtime60 = require("react/jsx-runtime");
12367
+ var import_jsx_runtime61 = require("react/jsx-runtime");
12267
12368
  function useGenerationRecords(store, filter) {
12268
- const [records, setRecords] = (0, import_react82.useState)([]);
12269
- const [loading, setLoading] = (0, import_react82.useState)(!!store);
12270
- 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);
12271
12372
  const filterKey = (0, import_generation4.stableStringify)(filter ?? {});
12272
- const refresh = (0, import_react82.useCallback)(async () => {
12373
+ const refresh = (0, import_react83.useCallback)(async () => {
12273
12374
  if (!store) {
12274
12375
  setRecords([]);
12275
12376
  setLoading(false);
@@ -12286,7 +12387,7 @@ function useGenerationRecords(store, filter) {
12286
12387
  setLoading(false);
12287
12388
  }
12288
12389
  }, [store, filterKey]);
12289
- (0, import_react82.useEffect)(() => {
12390
+ (0, import_react83.useEffect)(() => {
12290
12391
  void refresh();
12291
12392
  if (!store) return;
12292
12393
  return store.subscribe(() => void refresh());
@@ -12312,21 +12413,21 @@ var GenerationHistory = ({
12312
12413
  emptyText = "No generations yet.",
12313
12414
  className = ""
12314
12415
  }) => {
12315
- const [innerMode, setInnerMode] = (0, import_react82.useState)("exact");
12416
+ const [innerMode, setInnerMode] = (0, import_react83.useState)("exact");
12316
12417
  const mode = modeProp ?? innerMode;
12317
12418
  const setMode = (next) => {
12318
12419
  if (modeProp === void 0) setInnerMode(next);
12319
12420
  onModeChange?.(next);
12320
12421
  };
12321
- const options = (0, import_react82.useMemo)(() => ({ templates, capabilities, assets, mode }), [templates, capabilities, assets, mode]);
12322
- const results = (0, import_react82.useMemo)(() => records.map((record) => (0, import_generation4.recreateRequest)(record, options)), [records, options]);
12323
- 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)(
12324
12425
  () => capabilities ? Array.isArray(capabilities) ? capabilities : [capabilities] : [],
12325
12426
  [capabilities]
12326
12427
  );
12327
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: `flex flex-col gap-2 text-sm ${className}`, "data-generation-history": "", children: [
12328
- /* @__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: [
12329
- /* @__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)(
12330
12431
  "input",
12331
12432
  {
12332
12433
  type: "radio",
@@ -12339,34 +12440,34 @@ var GenerationHistory = ({
12339
12440
  ),
12340
12441
  value === "exact" ? "Exact (recorded versions)" : "Latest templates & settings"
12341
12442
  ] }, value)) }),
12342
- records.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "text-xs text-muted-foreground", children: emptyText }),
12343
- /* @__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) => {
12344
12445
  const result = results[i];
12345
12446
  const model = models.find((m) => m.id === record.provenance.modelId);
12346
12447
  const blocked = !result.ok;
12347
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
12448
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
12348
12449
  "li",
12349
12450
  {
12350
12451
  className: "rounded-md border border-border p-2",
12351
12452
  "data-record": record.id,
12352
12453
  "data-drift": result.drift.length,
12353
12454
  children: [
12354
- /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-2 text-xs", children: [
12355
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "font-medium", children: model?.name ?? record.provenance.modelId }),
12356
- /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("span", { className: "text-muted-foreground", children: [
12357
- 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: [
12358
12459
  record.kind,
12359
12460
  " \xB7 "
12360
12461
  ] }),
12361
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("time", { dateTime: record.createdAt, children: record.createdAt.replace("T", " ").slice(0, 16) }),
12362
- 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: [
12363
12464
  " \xB7 seed ",
12364
12465
  record.seed
12365
12466
  ] })
12366
12467
  ] })
12367
12468
  ] }),
12368
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "mt-1 line-clamp-3 break-words text-xs", "data-record-prompt": "", children: record.provenance.resolvedPrompt }),
12369
- 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)(
12370
12471
  "span",
12371
12472
  {
12372
12473
  className: "rounded-full bg-muted px-2 py-0.5 text-[10px]",
@@ -12380,16 +12481,16 @@ var GenerationHistory = ({
12380
12481
  `${asset.role}:${asset.id}`
12381
12482
  )) }),
12382
12483
  renderPreview?.(record),
12383
- 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: [
12384
- /* @__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: [
12385
12486
  import_generation4.DRIFT_TYPE_LABELS[item.type],
12386
12487
  ":"
12387
12488
  ] }),
12388
12489
  " ",
12389
12490
  item.message
12390
12491
  ] }, j)) }),
12391
- /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "mt-2 flex gap-2", children: [
12392
- 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)(
12393
12494
  "button",
12394
12495
  {
12395
12496
  type: "button",
@@ -12401,7 +12502,7 @@ var GenerationHistory = ({
12401
12502
  children: "Recreate"
12402
12503
  }
12403
12504
  ),
12404
- onVariation && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
12505
+ onVariation && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12405
12506
  "button",
12406
12507
  {
12407
12508
  type: "button",
@@ -12411,7 +12512,7 @@ var GenerationHistory = ({
12411
12512
  children: "Variation"
12412
12513
  }
12413
12514
  ),
12414
- onRemove && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
12515
+ onRemove && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12415
12516
  "button",
12416
12517
  {
12417
12518
  type: "button",
@@ -12431,19 +12532,19 @@ var GenerationHistory = ({
12431
12532
  };
12432
12533
 
12433
12534
  // src/find-replace/useFindReplace.ts
12434
- var import_react83 = require("react");
12535
+ var import_react84 = require("react");
12435
12536
  var import_editor17 = require("@pixerate/editor");
12436
12537
  var noopUnsubscribe2 = () => {
12437
12538
  };
12438
12539
  function useFindReplace(editor) {
12439
12540
  const store = (0, import_editor17.getFindReplaceStore)(editor ?? null);
12440
- const subscribe = (0, import_react83.useCallback)(
12541
+ const subscribe = (0, import_react84.useCallback)(
12441
12542
  (onChange) => store ? store.subscribe(() => onChange()) : noopUnsubscribe2,
12442
12543
  [store]
12443
12544
  );
12444
12545
  const getSnapshot2 = () => store?.getSnapshot() ?? import_editor17.EMPTY_FIND_REPLACE_SNAPSHOT;
12445
- const snapshot = (0, import_react83.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
12446
- return (0, import_react83.useMemo)(() => {
12546
+ const snapshot = (0, import_react84.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
12547
+ return (0, import_react84.useMemo)(() => {
12447
12548
  const run = (fn) => {
12448
12549
  if (editor && !editor.isDestroyed && store) fn(editor);
12449
12550
  };
@@ -12467,9 +12568,9 @@ function useFindReplace(editor) {
12467
12568
  }
12468
12569
 
12469
12570
  // src/find-replace/FindReplaceBar.tsx
12470
- var import_react84 = require("react");
12571
+ var import_react85 = require("react");
12471
12572
  var import_editor18 = require("@pixerate/editor");
12472
- var import_jsx_runtime61 = require("react/jsx-runtime");
12573
+ var import_jsx_runtime62 = require("react/jsx-runtime");
12473
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";
12474
12575
  var buttonClass5 = "rounded px-2 py-1 text-xs text-foreground hover:bg-muted disabled:opacity-40 disabled:hover:bg-transparent";
12475
12576
  var toggleClass = (on) => `${buttonClass5} font-mono ${on ? "bg-primary/10 text-primary" : "text-muted-foreground"}`;
@@ -12482,10 +12583,10 @@ var FindReplaceBar = ({
12482
12583
  onClose
12483
12584
  }) => {
12484
12585
  const find = useFindReplace(editor);
12485
- const findInput = (0, import_react84.useRef)(null);
12486
- 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);
12487
12588
  const visible = find.available && (alwaysOpen || find.open);
12488
- (0, import_react84.useEffect)(() => {
12589
+ (0, import_react85.useEffect)(() => {
12489
12590
  if (!visible || find.focusRequest === 0) return;
12490
12591
  findInput.current?.focus();
12491
12592
  findInput.current?.select();
@@ -12523,9 +12624,9 @@ var FindReplaceBar = ({
12523
12624
  if (isMod(e)) find.replaceAll();
12524
12625
  else find.replace();
12525
12626
  };
12526
- return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className, role: "search", "aria-label": "Find and replace", onKeyDown: onBarKeyDown, children: [
12527
- /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "flex items-center gap-1", children: [
12528
- /* @__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)(
12529
12630
  "button",
12530
12631
  {
12531
12632
  type: "button",
@@ -12536,7 +12637,7 @@ var FindReplaceBar = ({
12536
12637
  children: showReplace ? "\u25BE" : "\u25B8"
12537
12638
  }
12538
12639
  ),
12539
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12640
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
12540
12641
  "input",
12541
12642
  {
12542
12643
  ref: findInput,
@@ -12550,7 +12651,7 @@ var FindReplaceBar = ({
12550
12651
  onKeyDown: onFindKeyDown
12551
12652
  }
12552
12653
  ),
12553
- 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)(
12554
12655
  "button",
12555
12656
  {
12556
12657
  type: "button",
@@ -12563,7 +12664,7 @@ var FindReplaceBar = ({
12563
12664
  },
12564
12665
  t.key
12565
12666
  )),
12566
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12667
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
12567
12668
  "span",
12568
12669
  {
12569
12670
  className: `min-w-[5rem] px-1 text-center text-xs ${find.error ? "text-destructive" : "text-muted-foreground"}`,
@@ -12573,9 +12674,9 @@ var FindReplaceBar = ({
12573
12674
  children: status
12574
12675
  }
12575
12676
  ),
12576
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Previous match", disabled: !hasMatches, onClick: find.previous, children: "\u2191" }),
12577
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Next match", disabled: !hasMatches, onClick: find.next, children: "\u2193" }),
12578
- 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)(
12579
12680
  "button",
12580
12681
  {
12581
12682
  type: "button",
@@ -12586,10 +12687,10 @@ var FindReplaceBar = ({
12586
12687
  children: "\u2026"
12587
12688
  }
12588
12689
  ),
12589
- /* @__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" })
12590
12691
  ] }),
12591
- showReplace && /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "flex items-center gap-1 pl-7", children: [
12592
- /* @__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)(
12593
12694
  "input",
12594
12695
  {
12595
12696
  type: "text",
@@ -12601,7 +12702,7 @@ var FindReplaceBar = ({
12601
12702
  onKeyDown: onReplaceKeyDown
12602
12703
  }
12603
12704
  ),
12604
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12705
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
12605
12706
  "button",
12606
12707
  {
12607
12708
  type: "button",
@@ -12611,11 +12712,11 @@ var FindReplaceBar = ({
12611
12712
  children: "Replace"
12612
12713
  }
12613
12714
  ),
12614
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("button", { type: "button", className: buttonClass5, disabled: !hasMatches, onClick: find.replaceAll, children: "Replace all" }),
12615
- 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` })
12616
12717
  ] }),
12617
- 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: [
12618
- /* @__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)(
12619
12720
  "input",
12620
12721
  {
12621
12722
  type: "checkbox",
@@ -12629,12 +12730,12 @@ var FindReplaceBar = ({
12629
12730
  };
12630
12731
 
12631
12732
  // src/tables/useTableMenu.ts
12632
- var import_react85 = require("react");
12733
+ var import_react86 = require("react");
12633
12734
  var import_editor19 = require("@pixerate/editor");
12634
12735
  function useTableMenu(editor) {
12635
- const store = (0, import_react85.useMemo)(() => (0, import_editor19.createTableStore)(editor), [editor]);
12636
- const snapshot = (0, import_react85.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
12637
- 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)(
12638
12739
  () => ({
12639
12740
  ...snapshot,
12640
12741
  run: (action, params) => (0, import_editor19.runTableAction)(editor, action, params, { focus: true }),
@@ -12645,9 +12746,9 @@ function useTableMenu(editor) {
12645
12746
  }
12646
12747
 
12647
12748
  // src/tables/TableToolbar.tsx
12648
- var import_react86 = __toESM(require("react"), 1);
12749
+ var import_react87 = __toESM(require("react"), 1);
12649
12750
  var import_editor20 = require("@pixerate/editor");
12650
- var import_jsx_runtime62 = require("react/jsx-runtime");
12751
+ var import_jsx_runtime63 = require("react/jsx-runtime");
12651
12752
  var keepSelection2 = (event) => event.preventDefault();
12652
12753
  var TableToolbar = ({
12653
12754
  editor,
@@ -12661,14 +12762,14 @@ var TableToolbar = ({
12661
12762
  }) => {
12662
12763
  const table = useTableMenu(editor);
12663
12764
  if (!editor || !table.inTable && !showWhenOutside) return null;
12664
- 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) => {
12665
12766
  const status = table.check(item.action, item.params);
12666
12767
  const enabled = status === true;
12667
12768
  const active = item.active?.(table);
12668
12769
  const separator = index > 0 && items[index - 1].group !== item.group;
12669
- return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_react86.default.Fragment, { children: [
12670
- separator && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: separatorClassName, "aria-hidden": "true" }),
12671
- /* @__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)(
12672
12773
  "button",
12673
12774
  {
12674
12775
  type: "button",
@@ -12690,8 +12791,8 @@ var TableToolbar = ({
12690
12791
  };
12691
12792
 
12692
12793
  // src/tables/InsertTableGrid.tsx
12693
- var import_react87 = require("react");
12694
- var import_jsx_runtime63 = require("react/jsx-runtime");
12794
+ var import_react88 = require("react");
12795
+ var import_jsx_runtime64 = require("react/jsx-runtime");
12695
12796
  var keepSelection3 = (event) => event.preventDefault();
12696
12797
  var InsertTableGrid = ({
12697
12798
  editor,
@@ -12704,14 +12805,14 @@ var InsertTableGrid = ({
12704
12805
  onInsert
12705
12806
  }) => {
12706
12807
  const table = useTableMenu(editor);
12707
- const [hover, setHover] = (0, import_react87.useState)(null);
12808
+ const [hover, setHover] = (0, import_react88.useState)(null);
12708
12809
  const status = table.actions.insertTable;
12709
12810
  const disabled = !editor || !status.enabled;
12710
12811
  const insert = (size) => {
12711
12812
  if (table.run("insertTable", { ...size, withHeaderRow })) onInsert?.(size);
12712
12813
  setHover(null);
12713
12814
  };
12714
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
12815
+ return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
12715
12816
  "div",
12716
12817
  {
12717
12818
  className,
@@ -12721,7 +12822,7 @@ var InsertTableGrid = ({
12721
12822
  "data-insert-table-grid": "",
12722
12823
  onMouseLeave: () => setHover(null),
12723
12824
  children: [
12724
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12825
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12725
12826
  "div",
12726
12827
  {
12727
12828
  role: "grid",
@@ -12730,7 +12831,7 @@ var InsertTableGrid = ({
12730
12831
  children: Array.from({ length: rows * cols }, (_, i) => {
12731
12832
  const size = { rows: Math.floor(i / cols) + 1, cols: i % cols + 1 };
12732
12833
  const active = !!hover && size.rows <= hover.rows && size.cols <= hover.cols;
12733
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12834
+ return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12734
12835
  "button",
12735
12836
  {
12736
12837
  type: "button",
@@ -12750,7 +12851,7 @@ var InsertTableGrid = ({
12750
12851
  })
12751
12852
  }
12752
12853
  ),
12753
- /* @__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" })
12754
12855
  ]
12755
12856
  }
12756
12857
  );
@@ -12758,31 +12859,31 @@ var InsertTableGrid = ({
12758
12859
 
12759
12860
  // src/tables/TableBubbleMenu.tsx
12760
12861
  var import_editor21 = require("@pixerate/editor");
12761
- var import_jsx_runtime64 = require("react/jsx-runtime");
12862
+ var import_jsx_runtime65 = require("react/jsx-runtime");
12762
12863
  var TableBubbleMenu = ({
12763
12864
  editor,
12764
12865
  children,
12765
12866
  toolbarProps,
12766
12867
  pluginKey = "tableBubbleMenu",
12767
12868
  ...rest
12768
- }) => /* @__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 }) });
12769
12870
 
12770
12871
  // src/chart-node/ChartNodeView.tsx
12771
12872
  var import_client = require("react-dom/client");
12772
12873
 
12773
12874
  // src/chart/ChartCanvas.tsx
12774
- var import_react89 = require("react");
12875
+ var import_react90 = require("react");
12775
12876
  var import_chart2 = require("@pixerate/editor/chart");
12776
12877
 
12777
12878
  // src/chart/useChartEditor.ts
12778
- var import_react88 = require("react");
12879
+ var import_react89 = require("react");
12779
12880
  var import_chart = require("@pixerate/editor/chart");
12780
12881
  function useChartState(controller) {
12781
- return (0, import_react88.useSyncExternalStore)(controller.subscribe, controller.getState, controller.getState);
12882
+ return (0, import_react89.useSyncExternalStore)(controller.subscribe, controller.getState, controller.getState);
12782
12883
  }
12783
12884
 
12784
12885
  // src/chart/ChartCanvas.tsx
12785
- var import_jsx_runtime65 = require("react/jsx-runtime");
12886
+ var import_jsx_runtime66 = require("react/jsx-runtime");
12786
12887
  function renderChartMark(mark, fontFamily, interactive) {
12787
12888
  const common = {
12788
12889
  "data-role": mark.role,
@@ -12794,9 +12895,9 @@ function renderChartMark(mark, fontFamily, interactive) {
12794
12895
  };
12795
12896
  switch (mark.kind) {
12796
12897
  case "rect":
12797
- 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);
12798
12899
  case "path":
12799
- return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
12900
+ return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
12800
12901
  "path",
12801
12902
  {
12802
12903
  ...common,
@@ -12809,11 +12910,11 @@ function renderChartMark(mark, fontFamily, interactive) {
12809
12910
  mark.key
12810
12911
  );
12811
12912
  case "circle":
12812
- 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);
12813
12914
  case "line":
12814
- 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);
12815
12916
  case "text":
12816
- return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
12917
+ return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
12817
12918
  "text",
12818
12919
  {
12819
12920
  ...common,
@@ -12830,36 +12931,36 @@ function renderChartMark(mark, fontFamily, interactive) {
12830
12931
  }
12831
12932
  }
12832
12933
  function ChartPresenceLayer({ presence }) {
12833
- const { actors } = (0, import_react89.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
12834
- 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: [
12835
- /* @__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 }),
12836
- /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("g", { transform: "translate(13 16)", children: [
12837
- /* @__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 } }),
12838
- /* @__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 })
12839
12940
  ] })
12840
12941
  ] }, a.id)) });
12841
12942
  }
12842
12943
  function ChartTooltipContent({ tooltip }) {
12843
- return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
12844
- tooltip.title && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "mb-1 font-medium", children: tooltip.title }),
12845
- tooltip.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex items-center gap-2", children: [
12846
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "h-2 w-2 shrink-0 rounded-full", style: { background: item.color } }),
12847
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { style: { color: "var(--muted-foreground, #64748b)" }, children: item.name }),
12848
- /* @__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 })
12849
12950
  ] }, item.seriesId))
12850
12951
  ] });
12851
12952
  }
12852
12953
  function ChartCanvas({ controller, width = 640, height = 400, responsive = true, theme, editable = true, measureText, emptyMessage, className, presence, sceneRef, tooltip = false, renderTooltip }) {
12853
12954
  const state = useChartState(controller);
12854
- const wrapper = (0, import_react89.useRef)(null);
12855
- const svg = (0, import_react89.useRef)(null);
12856
- const drag = (0, import_react89.useRef)(null);
12857
- const [measured, setMeasured] = (0, import_react89.useState)(null);
12858
- 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);
12859
12960
  const tooltipMode = tooltip === true ? "point" : tooltip || null;
12860
- const [tip, setTip] = (0, import_react89.useState)(null);
12861
- const [tipAt, setTipAt] = (0, import_react89.useState)({ left: 0, top: 0, flip: false });
12862
- (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)(() => {
12863
12964
  const el = wrapper.current;
12864
12965
  if (!responsive || !el || typeof ResizeObserver === "undefined") return;
12865
12966
  const observer = new ResizeObserver(([entry]) => {
@@ -12870,8 +12971,8 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
12870
12971
  return () => observer.disconnect();
12871
12972
  }, [responsive]);
12872
12973
  const sceneWidth = responsive && measured || width;
12873
- const fullTheme = (0, import_react89.useMemo)(() => ({ ...import_chart2.CSS_VARIABLE_CHART_THEME, ...theme }), [theme]);
12874
- 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)(
12875
12976
  () => (0, import_chart2.layoutChart)(state.spec, {
12876
12977
  width: sceneWidth,
12877
12978
  height,
@@ -12888,8 +12989,8 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
12888
12989
  [state.spec, state.selection, state.raceFrame, sceneWidth, height, fullTheme, editable, measureText, emptyMessage, frozen]
12889
12990
  );
12890
12991
  if (sceneRef) sceneRef.current = scene;
12891
- const byKey = (0, import_react89.useMemo)(() => new Map(scene.marks.map((m) => [m.key, m])), [scene]);
12892
- (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(), []);
12893
12994
  const scenePoint = (e) => (0, import_chart2.chartClientToScene)(scene, svg.current.getBoundingClientRect(), e.clientX, e.clientY);
12894
12995
  const onPointerDown = (e) => {
12895
12996
  if (!editable || e.button !== 0) return;
@@ -12936,8 +13037,8 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
12936
13037
  if (editable && (0, import_chart2.handleChartKey)(controller, scene, e)) e.preventDefault();
12937
13038
  };
12938
13039
  const label = state.spec.title || "Chart";
12939
- return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { ref: wrapper, className: `relative w-full ${className ?? ""}`, "data-chart-canvas": "", children: [
12940
- /* @__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)(
12941
13042
  "svg",
12942
13043
  {
12943
13044
  ref: svg,
@@ -12956,11 +13057,11 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
12956
13057
  onKeyDown,
12957
13058
  children: [
12958
13059
  scene.marks.map((m) => renderChartMark(m, scene.theme.fontFamily, editable)),
12959
- presence && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(ChartPresenceLayer, { presence })
13060
+ presence && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartPresenceLayer, { presence })
12960
13061
  ]
12961
13062
  }
12962
13063
  ),
12963
- tip && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
13064
+ tip && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
12964
13065
  "div",
12965
13066
  {
12966
13067
  role: "tooltip",
@@ -12975,14 +13076,14 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
12975
13076
  borderColor: "var(--border, #e2e8f0)",
12976
13077
  fontFamily: scene.theme.fontFamily
12977
13078
  },
12978
- 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 })
12979
13080
  }
12980
13081
  )
12981
13082
  ] });
12982
13083
  }
12983
13084
 
12984
13085
  // src/chart/ChartDataGrid.tsx
12985
- var import_react90 = require("react");
13086
+ var import_react91 = require("react");
12986
13087
  var import_chart3 = require("@pixerate/editor/chart");
12987
13088
 
12988
13089
  // src/chart/styles.ts
@@ -12995,11 +13096,11 @@ var chartSectionClass = "space-y-2 border-b border-border pb-3 last:border-b-0";
12995
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";
12996
13097
 
12997
13098
  // src/chart/ChartDataGrid.tsx
12998
- var import_jsx_runtime66 = require("react/jsx-runtime");
13099
+ var import_jsx_runtime67 = require("react/jsx-runtime");
12999
13100
  function ChartCommitInput({ value, onCommit, onKeyDown, onBlur, ...rest }) {
13000
- const [draft, setDraft] = (0, import_react90.useState)(value);
13001
- const typing = (0, import_react90.useRef)(false);
13002
- (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)(() => {
13003
13104
  if (!typing.current) setDraft(value);
13004
13105
  }, [value]);
13005
13106
  const commit = () => {
@@ -13008,7 +13109,7 @@ function ChartCommitInput({ value, onCommit, onKeyDown, onBlur, ...rest }) {
13008
13109
  if (draft === value) return;
13009
13110
  if (onCommit(draft) === false) setDraft(value);
13010
13111
  };
13011
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13112
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13012
13113
  "input",
13013
13114
  {
13014
13115
  ...rest,
@@ -13037,20 +13138,20 @@ function ChartCommitInput({ value, onCommit, onKeyDown, onBlur, ...rest }) {
13037
13138
  }
13038
13139
  function ChartTreeGrid({ controller, readOnly = false, className }) {
13039
13140
  const { spec } = useChartState(controller);
13040
- const [columns, setColumns] = (0, import_react90.useState)(1);
13141
+ const [columns, setColumns] = (0, import_react91.useState)(1);
13041
13142
  const rows = (0, import_chart3.chartTreeToRows)(spec.tree);
13042
13143
  const depth = Math.max(columns, (0, import_chart3.chartTreeDepth)(spec.tree));
13043
13144
  const labels = (0, import_chart3.chartTreeColumnLabels)(depth);
13044
13145
  const commit = (next) => controller.setTreeRows(next).ok;
13045
- 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: [
13046
- /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
13047
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("tr", { children: [
13048
- 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)),
13049
- /* @__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" }),
13050
- !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" })
13051
13152
  ] }) }),
13052
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("tbody", { children: rows.map((row, r) => /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("tr", { "data-tree-row": r, children: [
13053
- 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)(
13054
13155
  ChartCommitInput,
13055
13156
  {
13056
13157
  value: row.path[k] ?? "",
@@ -13061,7 +13162,7 @@ function ChartTreeGrid({ controller, readOnly = false, className }) {
13061
13162
  className: `${chartCellClass} text-left`
13062
13163
  }
13063
13164
  ) }, k)),
13064
- /* @__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)(
13065
13166
  ChartCommitInput,
13066
13167
  {
13067
13168
  value: String(row.value),
@@ -13074,14 +13175,14 @@ function ChartTreeGrid({ controller, readOnly = false, className }) {
13074
13175
  className: chartCellClass
13075
13176
  }
13076
13177
  ) }),
13077
- !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" }) })
13078
13179
  ] }, r)) })
13079
13180
  ] }),
13080
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex flex-wrap gap-1 p-1", children: [
13081
- /* @__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" }),
13082
- /* @__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" }),
13083
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "flex-1" }),
13084
- /* @__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" })
13085
13186
  ] })
13086
13187
  ] });
13087
13188
  }
@@ -13089,30 +13190,30 @@ function ChartLinksGrid({ controller, readOnly = false, className }) {
13089
13190
  const { spec } = useChartState(controller);
13090
13191
  const links = spec.links;
13091
13192
  const commit = (next) => controller.setLinks(next).ok;
13092
- 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: [
13093
- /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
13094
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("tr", { children: [
13095
- ["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)),
13096
- /* @__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" }),
13097
- !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" })
13098
13199
  ] }) }),
13099
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("tbody", { children: links.map((link, i) => /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("tr", { "data-link-row": i, children: [
13100
- ["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)),
13101
- /* @__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 }) }),
13102
- !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" }) })
13103
13204
  ] }, i)) })
13104
13205
  ] }),
13105
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex flex-wrap gap-1 p-1", children: [
13106
- /* @__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" }),
13107
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "flex-1" }),
13108
- 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" })
13109
13210
  ] })
13110
13211
  ] });
13111
13212
  }
13112
13213
  function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = false, className }) {
13113
13214
  const { spec, selection } = useChartState(controller);
13114
- if (spec.links.length || spec.type === "sankey") return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartLinksGrid, { controller, readOnly, className });
13115
- 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 });
13116
13217
  const canGroup = spec.type === "treemap" || spec.type === "sunburst";
13117
13218
  const paste = (row, column) => (e) => {
13118
13219
  const text = e.clipboardData?.getData("text/plain") ?? "";
@@ -13120,15 +13221,15 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
13120
13221
  e.preventDefault();
13121
13222
  controller.pasteCells(row, column, text);
13122
13223
  };
13123
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", children: [
13124
- /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
13125
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("tr", { children: [
13126
- /* @__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 }),
13127
13228
  spec.series.map((s, si) => {
13128
13229
  const color = (0, import_chart3.chartSeriesColor)(spec, si);
13129
13230
  const selected = selection?.kind === "series" && selection.seriesId === s.id;
13130
- 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: [
13131
- /* @__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)(
13132
13233
  "input",
13133
13234
  {
13134
13235
  type: "color",
@@ -13141,7 +13242,7 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
13141
13242
  className: "h-5 w-5 shrink-0 cursor-pointer rounded border-0 bg-transparent p-0"
13142
13243
  }
13143
13244
  ),
13144
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13245
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13145
13246
  ChartCommitInput,
13146
13247
  {
13147
13248
  value: s.name,
@@ -13151,8 +13252,8 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
13151
13252
  className: `${chartInputClass} h-6 min-w-[5rem] border-transparent bg-transparent font-medium ${s.hidden ? "text-muted-foreground line-through" : ""}`
13152
13253
  }
13153
13254
  ),
13154
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
13155
- /* @__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)(
13156
13257
  "button",
13157
13258
  {
13158
13259
  type: "button",
@@ -13165,16 +13266,16 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
13165
13266
  children: s.hidden ? "\u25CB" : "\u25CF"
13166
13267
  }
13167
13268
  ),
13168
- /* @__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" })
13169
13270
  ] })
13170
13271
  ] }) }, s.id);
13171
13272
  }),
13172
- !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: "+" }) })
13173
13274
  ] }) }),
13174
- /* @__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) => {
13175
13276
  const rowSelected = selection?.kind === "category" && selection.index === i;
13176
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("tr", { "data-category-index": i, className: rowSelected ? "bg-primary/10" : void 0, children: [
13177
- /* @__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)(
13178
13279
  ChartCommitInput,
13179
13280
  {
13180
13281
  value: category,
@@ -13188,7 +13289,7 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
13188
13289
  spec.series.map((s) => {
13189
13290
  const value = s.values[i];
13190
13291
  const selected = selection?.kind === "point" && selection.seriesId === s.id && selection.index === i;
13191
- 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)(
13192
13293
  ChartCommitInput,
13193
13294
  {
13194
13295
  value: value === null || value === void 0 ? "" : String(value),
@@ -13203,13 +13304,13 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
13203
13304
  }
13204
13305
  ) }, s.id);
13205
13306
  }),
13206
- !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" }) })
13207
13308
  ] }, i);
13208
13309
  }) })
13209
13310
  ] }),
13210
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "p-1", children: [
13211
- /* @__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" }),
13212
- 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)(
13213
13314
  "button",
13214
13315
  {
13215
13316
  type: "button",
@@ -13225,29 +13326,29 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
13225
13326
  }
13226
13327
 
13227
13328
  // src/chart/ChartInspector.tsx
13228
- var import_react91 = require("react");
13329
+ var import_react92 = require("react");
13229
13330
  var import_chart4 = require("@pixerate/editor/chart");
13230
- var import_jsx_runtime67 = require("react/jsx-runtime");
13331
+ var import_jsx_runtime68 = require("react/jsx-runtime");
13231
13332
  var cap = (s) => s.charAt(0).toUpperCase() + s.slice(1);
13232
13333
  function Field({ label, htmlFor, children }) {
13233
- return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex items-center gap-2", children: [
13234
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("label", { htmlFor, className: `${chartLabelClass} w-20 shrink-0`, children: label }),
13235
- /* @__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 })
13236
13337
  ] });
13237
13338
  }
13238
13339
  function Toggle({ label, checked, onChange, name }) {
13239
- return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("label", { className: "flex cursor-pointer items-center gap-2 text-xs text-foreground", children: [
13240
- /* @__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) }),
13241
13342
  label
13242
13343
  ] });
13243
13344
  }
13244
13345
  function Select({ id, value, options, onChange, name, labels }) {
13245
- 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)) });
13246
13347
  }
13247
13348
  function AxisSection({ controller, axis, value, idBase, horizontal, numeric = false, scales = false }) {
13248
13349
  const set = (patch) => controller.setAxis(axis, patch);
13249
13350
  const setFormat = (patch) => set({ format: { ...value.format, ...patch } });
13250
- const bound = (key2) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13351
+ const bound = (key2) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
13251
13352
  ChartCommitInput,
13252
13353
  {
13253
13354
  id: `${idBase}-${axis}-${key2}`,
@@ -13262,26 +13363,26 @@ function AxisSection({ controller, axis, value, idBase, horizontal, numeric = fa
13262
13363
  const name = axis === "x" ? numeric ? "X axis" : "Category axis" : axis === "y" ? "Value axis" : "Secondary axis";
13263
13364
  const valueAxis = axis !== "x" || numeric;
13264
13365
  const key = axis === "y2" ? "yAxis2" : `${axis}Axis`;
13265
- return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: chartSectionClass, "data-section": `axis-${axis}`, children: [
13266
- /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex items-center justify-between", children: [
13267
- /* @__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: [
13268
13369
  name,
13269
- /* @__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: [
13270
13371
  "(",
13271
13372
  axis === "x" ? horizontal ? "left" : "bottom" : axis === "y2" ? horizontal ? "top" : "right" : horizontal ? "bottom" : "left",
13272
13373
  ")"
13273
13374
  ] })
13274
13375
  ] }),
13275
- /* @__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 }) })
13276
13377
  ] }),
13277
- /* @__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 }) }) }),
13278
- /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex flex-wrap gap-x-4 gap-y-1", children: [
13279
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "Grid lines", name: `${key}.gridlines`, checked: value.gridlines, onChange: (gridlines) => set({ gridlines }) }),
13280
- 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 }) }),
13281
- scales && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "Reverse", name: `${key}.reverse`, checked: !!value.reverse, onChange: (reverse) => set({ reverse }) }),
13282
- 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" }) })
13283
13384
  ] }),
13284
- 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)(
13285
13386
  ChartCommitInput,
13286
13387
  {
13287
13388
  id: `${idBase}-${axis}-log-base`,
@@ -13292,7 +13393,7 @@ function AxisSection({ controller, axis, value, idBase, horizontal, numeric = fa
13292
13393
  onCommit: (text) => set({ logBase: text.trim() === "" ? void 0 : Number(text) }).ok
13293
13394
  }
13294
13395
  ) }),
13295
- 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)(
13296
13397
  ChartCommitInput,
13297
13398
  {
13298
13399
  id: `${idBase}-${axis}-step`,
@@ -13304,14 +13405,14 @@ function AxisSection({ controller, axis, value, idBase, horizontal, numeric = fa
13304
13405
  onCommit: (text) => set({ step: text.trim() === "" ? null : Number(text) }).ok
13305
13406
  }
13306
13407
  ) }),
13307
- valueAxis && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_jsx_runtime67.Fragment, { children: [
13308
- /* @__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: [
13309
13410
  bound("min"),
13310
13411
  bound("max")
13311
13412
  ] }) }),
13312
- /* @__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: [
13313
- /* @__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 }) }),
13314
- /* @__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)(
13315
13416
  ChartCommitInput,
13316
13417
  {
13317
13418
  value: value.format.decimals === void 0 ? "" : String(value.format.decimals),
@@ -13330,8 +13431,8 @@ function AxisSection({ controller, axis, value, idBase, horizontal, numeric = fa
13330
13431
  }
13331
13432
  )
13332
13433
  ] }) }),
13333
- 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() }) }) }),
13334
- /* @__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)(
13335
13436
  ChartCommitInput,
13336
13437
  {
13337
13438
  id: `${idBase}-${axis}-code`,
@@ -13357,15 +13458,15 @@ function ErrorBarFields({ controller, series, which, idBase }) {
13357
13458
  const values = which === "xErrorBars" ? series.x ?? [] : series.values;
13358
13459
  const set = (next) => controller.updateSeries(series.id, { [which]: next });
13359
13460
  const patch = (p) => bars && set({ ...bars, ...p });
13360
- return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "space-y-1.5", "data-section": which === "errorBars" ? "error-bars" : "x-error-bars", children: [
13361
- /* @__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: [
13362
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: "", children: "None" }),
13363
- 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))
13364
13465
  ] }) }),
13365
- 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 }) }),
13366
- bars?.type === "custom" && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_jsx_runtime67.Fragment, { children: [
13367
- /* @__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 }) }),
13368
- /* @__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)(
13369
13470
  ChartCommitInput,
13370
13471
  {
13371
13472
  id: `${id}-minus`,
@@ -13382,15 +13483,15 @@ function ErrorBarFields({ controller, series, which, idBase }) {
13382
13483
  }
13383
13484
  ) })
13384
13485
  ] }),
13385
- bars && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex items-center gap-2", children: [
13386
- /* @__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)) }),
13387
- /* @__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 }) })
13388
13489
  ] })
13389
13490
  ] });
13390
13491
  }
13391
13492
  function ChartInspector({ controller, sections, className }) {
13392
13493
  const { spec, selectedSeries, selection, raceFrame, racePlaying } = useChartState(controller);
13393
- const idBase = (0, import_react91.useId)();
13494
+ const idBase = (0, import_react92.useId)();
13394
13495
  const show = (section) => !sections || sections.includes(section);
13395
13496
  const cartesian = (0, import_chart4.isCartesianChart)(spec.type);
13396
13497
  const family = (0, import_chart4.chartFamily)(spec);
@@ -13405,30 +13506,30 @@ function ChartInspector({ controller, sections, className }) {
13405
13506
  const annotated = scales;
13406
13507
  const oneSeries = cartesian && spec.series.filter((s) => !s.hidden).length === 1;
13407
13508
  const calloutIndex = selection?.kind === "point" && selection.seriesId === selectedSeries?.id ? selection.index : null;
13408
- return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: `space-y-3 text-xs ${className ?? ""}`, "data-chart-inspector": "", children: [
13409
- 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)) }) }),
13410
- show("style") && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: chartSectionClass, "data-section": "style", children: [
13411
- /* @__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: [
13412
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: "", children: "Quick layout\u2026" }),
13413
- 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))
13414
13515
  ] }) }),
13415
- /* @__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: [
13416
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: "", children: "Custom" }),
13417
- 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))
13418
13519
  ] }) }),
13419
- !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] }),
13420
- /* @__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" })
13421
13522
  ] }),
13422
- show("titles") && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: chartSectionClass, "data-section": "titles", children: [
13423
- /* @__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) }) }),
13424
- /* @__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) }) }),
13425
- /* @__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) }) })
13426
13527
  ] }),
13427
- show("options") && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: chartSectionClass, "data-section": "options", children: [
13428
- 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 }) }) }),
13429
- 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)) }) }),
13430
- 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 }) }) }),
13431
- 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)(
13432
13533
  "input",
13433
13534
  {
13434
13535
  id: `${idBase}-hole`,
@@ -13444,7 +13545,7 @@ function ChartInspector({ controller, sections, className }) {
13444
13545
  onChange: (e) => controller.update({ innerRadius: Number(e.currentTarget.value) })
13445
13546
  }
13446
13547
  ) }),
13447
- 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)(
13448
13549
  "input",
13449
13550
  {
13450
13551
  id: `${idBase}-gap`,
@@ -13460,9 +13561,9 @@ function ChartInspector({ controller, sections, className }) {
13460
13561
  onChange: (e) => controller.update({ gapWidth: Number(e.currentTarget.value) })
13461
13562
  }
13462
13563
  ) }),
13463
- 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)) }) }),
13464
- 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 }) }),
13465
- 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)(
13466
13567
  ChartCommitInput,
13467
13568
  {
13468
13569
  id: `${idBase}-map-breaks`,
@@ -13473,10 +13574,10 @@ function ChartInspector({ controller, sections, className }) {
13473
13574
  onCommit: (text) => controller.update({ mapThresholds: text.trim() ? text.split(",").map((t) => Number(t.trim())) : [] }).ok
13474
13575
  }
13475
13576
  ) }),
13476
- 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 }) }),
13477
- 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: [
13478
- /* @__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" }),
13479
- /* @__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)(
13480
13581
  "input",
13481
13582
  {
13482
13583
  id: `${idBase}-race-frame`,
@@ -13491,13 +13592,13 @@ function ChartInspector({ controller, sections, className }) {
13491
13592
  onChange: (e) => controller.setRaceFrame(Number(e.currentTarget.value))
13492
13593
  }
13493
13594
  ),
13494
- /* @__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)] })
13495
13596
  ] }) }),
13496
- 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 }) }) }),
13497
- 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 }) }),
13498
- 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 }) }) }),
13499
- 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 }) }) }),
13500
- 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)(
13501
13602
  "input",
13502
13603
  {
13503
13604
  id: `${idBase}-parliament-arc`,
@@ -13513,34 +13614,34 @@ function ChartInspector({ controller, sections, className }) {
13513
13614
  onChange: (e) => controller.update({ parliamentArc: Number(e.currentTarget.value) })
13514
13615
  }
13515
13616
  ) }),
13516
- 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 }) }),
13517
- 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 }) }),
13518
- 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 }) }),
13519
- 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 }) }) }),
13520
- 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 }) }) }),
13521
- 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 }) }),
13522
- /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex flex-wrap gap-x-4 gap-y-1", children: [
13523
- spec.type === "waterfall" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "Total bar", name: "showTotal", checked: spec.showTotal, onChange: (showTotal) => controller.update({ showTotal }) }),
13524
- hasLines && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "Points", name: "points", checked: spec.points, onChange: (points) => controller.update({ points }) }),
13525
- oneSeries && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "Colour by category", name: "varyColors", checked: spec.varyColors, onChange: (varyColors) => controller.update({ varyColors }) }),
13526
- /* @__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 }) })
13527
13628
  ] })
13528
13629
  ] }),
13529
- show("legend") && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: chartSectionClass, "data-section": "legend", children: [
13530
- /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex items-center justify-between", children: [
13531
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Legend" }),
13532
- /* @__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 }) })
13533
13634
  ] }),
13534
- 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)) })
13535
13636
  ] }),
13536
- show("axes") && hasAxes && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_jsx_runtime67.Fragment, { children: [
13537
- 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 }),
13538
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(AxisSection, { controller, axis: "y", value: spec.yAxis, idBase, horizontal: spec.orientation === "horizontal", scales }),
13539
- 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 })
13540
13641
  ] }),
13541
- show("annotations") && annotated && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: chartSectionClass, "data-section": "annotations", children: [
13542
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Annotations" }),
13543
- /* @__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)(
13544
13645
  ChartCommitInput,
13545
13646
  {
13546
13647
  id: `${idBase}-highlight`,
@@ -13551,27 +13652,27 @@ function ChartInspector({ controller, sections, className }) {
13551
13652
  onCommit: (text) => controller.setHighlight(text.split(",").map((n) => n.trim()).filter(Boolean)).ok
13552
13653
  }
13553
13654
  ) }),
13554
- spec.referenceLines.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex items-center gap-1", "data-reference-line": i, children: [
13555
- /* @__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 }),
13556
- /* @__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 }),
13557
- /* @__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" })
13558
13659
  ] }, `line-${i}`)),
13559
- spec.referenceBands.map((band, i) => /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex items-center gap-1", "data-reference-band": i, children: [
13560
- /* @__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 }),
13561
- /* @__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 }),
13562
- /* @__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 }),
13563
- /* @__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" })
13564
13665
  ] }, `band-${i}`)),
13565
- /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex gap-1", children: [
13566
- /* @__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" }),
13567
- /* @__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" })
13568
13669
  ] })
13569
13670
  ] }),
13570
- show("series") && selectedSeries && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: chartSectionClass, "data-section": "series", "data-series-id": selectedSeries.id, children: [
13571
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Series" }),
13572
- /* @__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 }) }) }),
13573
- /* @__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: [
13574
- /* @__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)(
13575
13676
  "input",
13576
13677
  {
13577
13678
  id: `${idBase}-series-color`,
@@ -13584,9 +13685,9 @@ function ChartInspector({ controller, sections, className }) {
13584
13685
  onChange: (e) => controller.updateSeries(selectedSeries.id, { color: e.currentTarget.value })
13585
13686
  }
13586
13687
  ),
13587
- 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" })
13588
13689
  ] }) }),
13589
- 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)(
13590
13691
  "select",
13591
13692
  {
13592
13693
  id: `${idBase}-series-type`,
@@ -13595,12 +13696,12 @@ function ChartInspector({ controller, sections, className }) {
13595
13696
  "data-option": "series.type",
13596
13697
  onChange: (e) => controller.updateSeries(selectedSeries.id, { type: e.currentTarget.value || null }),
13597
13698
  children: [
13598
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: "", children: "Chart type" }),
13599
- 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))
13600
13701
  ]
13601
13702
  }
13602
13703
  ) }),
13603
- (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)(
13604
13705
  "select",
13605
13706
  {
13606
13707
  id: `${idBase}-series-marker`,
@@ -13609,12 +13710,12 @@ function ChartInspector({ controller, sections, className }) {
13609
13710
  "data-option": "series.marker",
13610
13711
  onChange: (e) => controller.updateSeries(selectedSeries.id, { marker: e.currentTarget.value || null }),
13611
13712
  children: [
13612
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: "", children: "Default" }),
13613
- 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))
13614
13715
  ]
13615
13716
  }
13616
13717
  ) }),
13617
- 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)(
13618
13719
  ChartCommitInput,
13619
13720
  {
13620
13721
  id: `${idBase}-series-callout`,
@@ -13625,15 +13726,15 @@ function ChartInspector({ controller, sections, className }) {
13625
13726
  onCommit: (text) => controller.setCallout(selectedSeries.id, calloutIndex, text || null).ok
13626
13727
  }
13627
13728
  ) }),
13628
- scales && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ErrorBarFields, { controller, series: selectedSeries, which: "errorBars", idBase }),
13629
- family === "xy" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ErrorBarFields, { controller, series: selectedSeries, which: "xErrorBars", idBase }),
13630
- (0, import_chart4.chartSupportsTrendlines)(spec.type, spec.stacking) && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "space-y-1", "data-section": "trendlines", children: [
13631
- (selectedSeries.trendlines ?? []).map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex items-center gap-1", "data-trendline": i, children: [
13632
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "flex-1 truncate text-muted-foreground", children: (0, import_chart4.chartTrendlineName)(t, selectedSeries.name) }),
13633
- /* @__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 }) }),
13634
- /* @__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" })
13635
13736
  ] }, i)),
13636
- /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
13737
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
13637
13738
  "select",
13638
13739
  {
13639
13740
  className: chartInputClass,
@@ -13642,32 +13743,32 @@ function ChartInspector({ controller, sections, className }) {
13642
13743
  "data-option": "trendline.add",
13643
13744
  onChange: (e) => e.currentTarget.value && controller.addTrendline(selectedSeries.id, { type: e.currentTarget.value }),
13644
13745
  children: [
13645
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: "", children: "Add trendline\u2026" }),
13646
- 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))
13647
13748
  ]
13648
13749
  }
13649
13750
  )
13650
13751
  ] }),
13651
- /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
13652
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Toggle, { label: "Hidden", name: "series.hidden", checked: !!selectedSeries.hidden, onChange: (hidden) => controller.updateSeries(selectedSeries.id, { hidden }) }),
13653
- 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 }) }),
13654
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "flex-1" }),
13655
- /* @__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" }),
13656
- /* @__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" }),
13657
- /* @__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" })
13658
13759
  ] })
13659
13760
  ] })
13660
13761
  ] });
13661
13762
  }
13662
13763
 
13663
13764
  // src/chart-node/ChartNodeView.tsx
13664
- var import_jsx_runtime68 = require("react/jsx-runtime");
13765
+ var import_jsx_runtime69 = require("react/jsx-runtime");
13665
13766
  function ChartNodeView({ state, theme, showDataGrid = true }) {
13666
13767
  const { controller, editing, editable, selected, width, height, setEditing } = state;
13667
13768
  const open = () => {
13668
13769
  if (editable && !editing) setEditing(true);
13669
13770
  };
13670
- return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
13771
+ return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
13671
13772
  "div",
13672
13773
  {
13673
13774
  className: `not-prose my-2 rounded-md border bg-background p-1 ${selected ? "border-primary ring-1 ring-primary" : "border-border"}`,
@@ -13680,24 +13781,24 @@ function ChartNodeView({ state, theme, showDataGrid = true }) {
13680
13781
  }
13681
13782
  },
13682
13783
  children: [
13683
- 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: [
13684
- /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "text-xs text-muted-foreground", children: "Editing chart" }),
13685
- /* @__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" })
13686
13787
  ] }),
13687
- /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
13788
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
13688
13789
  "div",
13689
13790
  {
13690
13791
  className: editable && !editing ? "cursor-pointer" : void 0,
13691
13792
  onClick: open,
13692
13793
  title: editable && !editing ? "Click to edit the chart" : void 0,
13693
13794
  "data-chart-node-canvas": "",
13694
- 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 })
13695
13796
  }
13696
13797
  ),
13697
13798
  editing && // Wraps by the document's width, not the viewport's: side by side when there is room.
13698
- /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "mt-2 flex flex-wrap items-start gap-2", "data-chart-node-panel": "", children: [
13699
- 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 }) }),
13700
- /* @__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" })
13701
13802
  ] })
13702
13803
  ]
13703
13804
  }
@@ -13715,7 +13816,7 @@ function createReactChartNodeView(options = {}) {
13715
13816
  scheduled = true;
13716
13817
  queueMicrotask(() => {
13717
13818
  scheduled = false;
13718
- 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 }));
13719
13820
  });
13720
13821
  };
13721
13822
  schedule();
@@ -13733,10 +13834,10 @@ function createReactChartNodeView(options = {}) {
13733
13834
  }
13734
13835
 
13735
13836
  // src/style/useStyle.ts
13736
- var import_react92 = require("react");
13837
+ var import_react93 = require("react");
13737
13838
  var message = (error) => error instanceof Error ? error.message : String(error);
13738
13839
  function useResolverTask(styles, run, deliver, deps) {
13739
- (0, import_react92.useEffect)(() => {
13840
+ (0, import_react93.useEffect)(() => {
13740
13841
  if (!styles || !run) {
13741
13842
  deliver({ value: null, error: null });
13742
13843
  return;
@@ -13763,7 +13864,7 @@ function useResolverTask(styles, run, deliver, deps) {
13763
13864
  }, [styles, ...deps]);
13764
13865
  }
13765
13866
  function useStyle(styles, domain) {
13766
- const [result, setResult] = (0, import_react92.useState)({ style: null, error: null });
13867
+ const [result, setResult] = (0, import_react93.useState)({ style: null, error: null });
13767
13868
  useResolverTask(
13768
13869
  styles,
13769
13870
  (s) => s.resolve(domain),
@@ -13773,7 +13874,7 @@ function useStyle(styles, domain) {
13773
13874
  return result;
13774
13875
  }
13775
13876
  function useStyleFindings(styles, domain, state) {
13776
- 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 });
13777
13878
  useResolverTask(
13778
13879
  styles,
13779
13880
  (s) => s.check(domain, state),
@@ -13790,7 +13891,7 @@ function useStyleFindings(styles, domain, state) {
13790
13891
  }
13791
13892
 
13792
13893
  // src/style/StyleFindings.tsx
13793
- var import_jsx_runtime69 = require("react/jsx-runtime");
13894
+ var import_jsx_runtime70 = require("react/jsx-runtime");
13794
13895
  var SEVERITY_CLASS = {
13795
13896
  error: "text-destructive",
13796
13897
  warning: "text-amber-600",
@@ -13799,24 +13900,24 @@ var SEVERITY_CLASS = {
13799
13900
  function StyleFindings({ report, onSelect, title = "House style", className = "" }) {
13800
13901
  if (!report) return null;
13801
13902
  const { findings, ran, skipped } = report;
13802
- 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: [
13803
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("h3", { className: "text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: title }),
13804
- 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) => {
13805
13906
  const selectable = finding.target !== void 0 && !!onSelect;
13806
- const body = /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
13807
- /* @__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 }),
13808
- /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("span", { className: "flex min-w-0 flex-col", children: [
13809
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { "data-style-message": "", children: finding.message }),
13810
- /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("span", { className: "text-[10px] text-muted-foreground", children: [
13811
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("code", { children: finding.check }),
13812
- 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: [
13813
13914
  " \xB7 ",
13814
13915
  finding.layer
13815
13916
  ] })
13816
13917
  ] })
13817
13918
  ] })
13818
13919
  ] });
13819
- 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)(
13820
13921
  "button",
13821
13922
  {
13822
13923
  type: "button",
@@ -13824,19 +13925,19 @@ function StyleFindings({ report, onSelect, title = "House style", className = ""
13824
13925
  onClick: () => onSelect(finding),
13825
13926
  children: body
13826
13927
  }
13827
- ) : /* @__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}`);
13828
13929
  }) }),
13829
- 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: [
13830
13931
  "All clear: ",
13831
13932
  ran.length,
13832
13933
  " ",
13833
13934
  ran.length === 1 ? "check" : "checks",
13834
13935
  " passed."
13835
13936
  ] }),
13836
- 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." }),
13837
- 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: [
13838
13939
  "Skipped ",
13839
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("code", { children: s.check }),
13940
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("code", { children: s.check }),
13840
13941
  ": ",
13841
13942
  s.reason
13842
13943
  ] }, s.check)) })
@@ -13882,6 +13983,7 @@ function StyleFindings({ report, onSelect, title = "House style", className = ""
13882
13983
  JobProgress,
13883
13984
  LayerEffectsPanel,
13884
13985
  LayersPanel,
13986
+ MaskEdgeCheck,
13885
13987
  MergePreview,
13886
13988
  NameManager,
13887
13989
  OutlinePanel,