@pixerate/editor-react 0.197.0 → 0.198.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.
@@ -35,6 +35,7 @@ __export(paint_editor_exports, {
35
35
  BrushLibraryBrowser: () => BrushLibraryBrowser,
36
36
  BrushPanel: () => BrushPanel,
37
37
  ColorPanel: () => ColorPanel,
38
+ CulturePanel: () => CulturePanel,
38
39
  EvolutionPanel: () => EvolutionPanel,
39
40
  FerroPanel: () => FerroPanel,
40
41
  PaintCanvas: () => PaintCanvas,
@@ -190,8 +191,13 @@ var PaintCanvas = ({ controller, tool = "brush", fillOptions, showGuides = true,
190
191
  if (ctx && typeof ctx.createImageData === "function") (0, import_paint_editor2.drawWaterOverlay)(controller, ctx);
191
192
  }, [state, controller]);
192
193
  (0, import_react2.useEffect)(() => {
194
+ controller.catchUpCultures();
193
195
  const player = controller.playEffects();
194
- return () => player.stop();
196
+ const cultures = controller.playCultures();
197
+ return () => {
198
+ player.stop();
199
+ cultures.stop();
200
+ };
195
201
  }, [controller]);
196
202
  (0, import_react2.useEffect)(() => {
197
203
  const el = viewport.current;
@@ -1299,7 +1305,7 @@ var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, clas
1299
1305
 
1300
1306
  // src/paint-editor/PaperPanel.tsx
1301
1307
  var import_react12 = require("react");
1302
- var import_paint_editor8 = require("@pixerate/editor/paint-editor");
1308
+ var import_paint_editor9 = require("@pixerate/editor/paint-editor");
1303
1309
 
1304
1310
  // src/paint-editor/FerroPanel.tsx
1305
1311
  var import_react11 = require("react");
@@ -1433,20 +1439,102 @@ var TimeMachinePanel = ({ controller, className }) => {
1433
1439
  ] });
1434
1440
  };
1435
1441
 
1436
- // src/paint-editor/PaperPanel.tsx
1442
+ // src/paint-editor/CulturePanel.tsx
1443
+ var import_paint_editor8 = require("@pixerate/editor/paint-editor");
1437
1444
  var import_jsx_runtime13 = require("react/jsx-runtime");
1445
+ var CulturePanel = ({ controller, className }) => {
1446
+ const state = usePaintEditorState(controller);
1447
+ const [error, attempt] = useAttempt();
1448
+ const { cultures, brush } = state;
1449
+ const activeId = state.document.activeLayerId;
1450
+ const activeColony = cultures.layers.find((l) => l.layerId === activeId) ?? cultures.layers[0] ?? null;
1451
+ const totalTips = cultures.layers.reduce((acc, l) => acc + l.tips, 0);
1452
+ const totalSegments = cultures.layers.reduce((acc, l) => acc + l.segments, 0);
1453
+ const canCarryCulture = ["dab", "mixer", "impasto", "particle", "bristle"].includes(brush.engine);
1454
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "culture-panel", children: [
1455
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center justify-between", children: [
1456
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "font-medium text-slate-300", children: "Biopaint (mycelial ink)" }),
1457
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex gap-1", children: [
1458
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.growCultures({ steps: 40 })), children: "Grow" }),
1459
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1460
+ "button",
1461
+ {
1462
+ type: "button",
1463
+ "aria-pressed": cultures.paused,
1464
+ className: chip(cultures.paused),
1465
+ onClick: () => controller.setCulturePaused(!cultures.paused),
1466
+ children: cultures.paused ? "Paused" : "Pause"
1467
+ }
1468
+ ),
1469
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1470
+ "button",
1471
+ {
1472
+ type: "button",
1473
+ className: button,
1474
+ disabled: !activeColony || activeColony.tips === 0,
1475
+ onClick: () => attempt(() => controller.removeCultures(activeColony?.layerId)),
1476
+ children: "Kill colony"
1477
+ }
1478
+ )
1479
+ ] })
1480
+ ] }),
1481
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex items-center justify-between text-[11px] text-slate-400", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: activeColony ? `${totalTips} living tips \xB7 ${totalSegments} segments (${activeColony.status})` : "No mycelial colony on canvas" }) }),
1482
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex items-center gap-2 text-[11px]", children: [
1483
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1484
+ "input",
1485
+ {
1486
+ type: "checkbox",
1487
+ checked: cultures.growWhileClosed,
1488
+ onChange: (e) => attempt(() => controller.setCultureOptions({ growWhileClosed: e.target.checked }))
1489
+ }
1490
+ ),
1491
+ "Grow while closed"
1492
+ ] }),
1493
+ canCarryCulture && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-col gap-1 border-t border-slate-800 pt-1.5", children: [
1494
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center justify-between", children: [
1495
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-[11px] text-slate-400", children: "Brush spores" }),
1496
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1497
+ "button",
1498
+ {
1499
+ type: "button",
1500
+ "aria-pressed": Boolean(brush.culture),
1501
+ className: chip(Boolean(brush.culture)),
1502
+ onClick: () => attempt(() => controller.setBrush({ culture: brush.culture ? null : {} })),
1503
+ children: brush.culture ? "On" : "Off"
1504
+ }
1505
+ )
1506
+ ] }),
1507
+ brush.culture && import_paint_editor8.CULTURE_SLIDERS.map((c) => {
1508
+ const key = c.path.replace(/^culture\./, "");
1509
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1510
+ PaintSlider,
1511
+ {
1512
+ control: c,
1513
+ value: (0, import_paint_editor8.readPath)(brush.culture, key),
1514
+ onCommit: (v) => attempt(() => controller.setBrush({ culture: { [key]: v } }))
1515
+ },
1516
+ c.path
1517
+ );
1518
+ })
1519
+ ] }),
1520
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ErrorLine, { error })
1521
+ ] });
1522
+ };
1523
+
1524
+ // src/paint-editor/PaperPanel.tsx
1525
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1438
1526
  var SWATCH = { x: 0, y: 0, width: 64, height: 40 };
1439
1527
  var PaperPanel = ({ controller, className }) => {
1440
1528
  const state = usePaintEditorState(controller);
1441
1529
  const [error, attempt] = useAttempt();
1442
1530
  const [tiltFollow, setTiltFollow] = (0, import_react12.useState)(false);
1443
- (0, import_react12.useEffect)(() => tiltFollow ? (0, import_paint_editor8.startDeviceTilt)(controller) : void 0, [controller, tiltFollow]);
1531
+ (0, import_react12.useEffect)(() => tiltFollow ? (0, import_paint_editor9.startDeviceTilt)(controller) : void 0, [controller, tiltFollow]);
1444
1532
  const paper = state.document.paper;
1445
- const previews = (0, import_react12.useMemo)(() => new Map(import_paint_editor8.PAPER_LIBRARY.map((p) => [p.preset, { ...SWATCH, data: (0, import_paint_editor8.renderPaper)({ ...p, shading: Math.max(0.8, p.shading) }, SWATCH) }])), []);
1446
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paper-panel", children: [
1447
- import_paint_editor8.PAPER_FAMILIES.map((family) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { children: [
1448
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "mb-0.5 text-[10px] uppercase tracking-wide text-slate-500", children: family }),
1449
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": `${family} papers`, children: import_paint_editor8.PAPER_LIBRARY.filter((p) => p.family === family).map((p) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1533
+ const previews = (0, import_react12.useMemo)(() => new Map(import_paint_editor9.PAPER_LIBRARY.map((p) => [p.preset, { ...SWATCH, data: (0, import_paint_editor9.renderPaper)({ ...p, shading: Math.max(0.8, p.shading) }, SWATCH) }])), []);
1534
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paper-panel", children: [
1535
+ import_paint_editor9.PAPER_FAMILIES.map((family) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
1536
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "mb-0.5 text-[10px] uppercase tracking-wide text-slate-500", children: family }),
1537
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": `${family} papers`, children: import_paint_editor9.PAPER_LIBRARY.filter((p) => p.family === family).map((p) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1450
1538
  "button",
1451
1539
  {
1452
1540
  type: "button",
@@ -1455,74 +1543,75 @@ var PaperPanel = ({ controller, className }) => {
1455
1543
  title: p.name,
1456
1544
  className: `rounded p-0.5 ${paper.preset === p.preset ? "ring-2 ring-indigo-500" : "ring-1 ring-slate-700 hover:ring-slate-500"}`,
1457
1545
  onClick: () => attempt(() => controller.setPaper({ preset: p.preset })),
1458
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PixelCanvas, { pixels: previews.get(p.preset) ?? null, label: p.name, style: { width: 48, height: 30 } })
1546
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PixelCanvas, { pixels: previews.get(p.preset) ?? null, label: p.name, style: { width: 48, height: 30 } })
1459
1547
  },
1460
1548
  p.preset
1461
1549
  )) })
1462
1550
  ] }, family)),
1463
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "text-slate-300", children: paper.name }),
1464
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex items-center justify-between", children: [
1465
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-slate-400", children: "Colour" }),
1466
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CommitColorInput, { label: "Paper colour", value: paper.color, onCommit: (v) => attempt(() => controller.setPaper({ color: v })), className: "h-6 w-10 rounded bg-transparent" })
1551
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "text-slate-300", children: paper.name }),
1552
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center justify-between", children: [
1553
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-slate-400", children: "Colour" }),
1554
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CommitColorInput, { label: "Paper colour", value: paper.color, onCommit: (v) => attempt(() => controller.setPaper({ color: v })), className: "h-6 w-10 rounded bg-transparent" })
1467
1555
  ] }),
1468
- import_paint_editor8.PAPER_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor8.readPath)(paper, c.path), onCommit: (v) => attempt(() => controller.setPaper((0, import_paint_editor8.patchPath)(paper, c.path, v))) }, c.path)),
1469
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex items-center justify-between", children: [
1470
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-slate-400", children: "Backlight colour" }),
1471
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CommitColorInput, { label: "Backlight colour", value: paper.backlightColor ?? import_paint_editor8.DEFAULT_BACKLIGHT_COLOR, onCommit: (v) => attempt(() => controller.setPaper({ backlightColor: v })), className: "h-6 w-10 rounded bg-transparent" })
1556
+ import_paint_editor9.PAPER_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor9.readPath)(paper, c.path), onCommit: (v) => attempt(() => controller.setPaper((0, import_paint_editor9.patchPath)(paper, c.path, v))) }, c.path)),
1557
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center justify-between", children: [
1558
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-slate-400", children: "Backlight colour" }),
1559
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CommitColorInput, { label: "Backlight colour", value: paper.backlightColor ?? import_paint_editor9.DEFAULT_BACKLIGHT_COLOR, onCommit: (v) => attempt(() => controller.setPaper({ backlightColor: v })), className: "h-6 w-10 rounded bg-transparent" })
1472
1560
  ] }),
1473
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex items-center gap-2", children: [
1474
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { type: "checkbox", checked: paper.tiling === "mirror", onChange: (e) => attempt(() => controller.setPaper({ tiling: e.target.checked ? "mirror" : "repeat" })) }),
1561
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-2", children: [
1562
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "checkbox", checked: paper.tiling === "mirror", onChange: (e) => attempt(() => controller.setPaper({ tiling: e.target.checked ? "mirror" : "repeat" })) }),
1475
1563
  " Mirror tiling"
1476
1564
  ] }),
1477
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: "self-start px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.setPaper({ seed: paper.seed + 1 })), children: "New sheet" }),
1478
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "light-panel", children: [
1479
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "font-medium text-slate-300", children: "Light (thick paint, iridescence, metallic paper)" }),
1480
- import_paint_editor8.LIGHT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor8.readPath)(controller.getLighting(), c.path), onChange: (v) => attempt(() => controller.setLighting({ [c.path]: v })) }, c.path)),
1481
- import_paint_editor8.VIEW_TILT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor8.readPath)(state.viewTilt, c.path), onChange: (v) => attempt(() => controller.setViewTilt({ [c.path]: v })) }, c.path)),
1482
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1483
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1565
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: "self-start px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.setPaper({ seed: paper.seed + 1 })), children: "New sheet" }),
1566
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "light-panel", children: [
1567
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "font-medium text-slate-300", children: "Light (thick paint, iridescence, metallic paper)" }),
1568
+ import_paint_editor9.LIGHT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor9.readPath)(controller.getLighting(), c.path), onChange: (v) => attempt(() => controller.setLighting({ [c.path]: v })) }, c.path)),
1569
+ import_paint_editor9.VIEW_TILT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor9.readPath)(state.viewTilt, c.path), onChange: (v) => attempt(() => controller.setViewTilt({ [c.path]: v })) }, c.path)),
1570
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1571
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1484
1572
  "button",
1485
1573
  {
1486
1574
  type: "button",
1487
1575
  "aria-pressed": tiltFollow,
1488
1576
  className: chip(tiltFollow),
1489
1577
  onClick: () => attempt(async () => {
1490
- if (!tiltFollow && !await (0, import_paint_editor8.requestDeviceTiltPermission)()) return;
1578
+ if (!tiltFollow && !await (0, import_paint_editor9.requestDeviceTiltPermission)()) return;
1491
1579
  setTiltFollow((v) => !v);
1492
1580
  }),
1493
1581
  children: "Device tilt"
1494
1582
  }
1495
1583
  ),
1496
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: "self-start px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.flattenRelief()), children: "Flatten relief" })
1584
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: "self-start px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.flattenRelief()), children: "Flatten relief" })
1497
1585
  ] })
1498
1586
  ] }),
1499
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "uv-heat-panel", children: [
1500
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "font-medium text-slate-300", children: "UV blacklight & heat" }),
1501
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex items-center gap-2", children: [
1502
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { type: "checkbox", checked: state.uvLight.on, onChange: (e) => attempt(() => controller.setUvLight({ on: e.target.checked })) }),
1587
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "uv-heat-panel", children: [
1588
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "font-medium text-slate-300", children: "UV blacklight & heat" }),
1589
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-2", children: [
1590
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "checkbox", checked: state.uvLight.on, onChange: (e) => attempt(() => controller.setUvLight({ on: e.target.checked })) }),
1503
1591
  " UV blacklight"
1504
1592
  ] }),
1505
- import_paint_editor8.UV_LIGHT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor8.readPath)(state.uvLight, c.path), onChange: (v) => attempt(() => controller.setUvLight({ [c.path]: v })) }, c.path)),
1506
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1.5", children: [
1507
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.advanceHeat(10)), children: "Step heat" }),
1508
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.clearHeat()), children: "Cool canvas" }),
1509
- state.heat.hotCells > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "text-[11px] text-amber-400", children: [
1593
+ import_paint_editor9.UV_LIGHT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor9.readPath)(state.uvLight, c.path), onChange: (v) => attempt(() => controller.setUvLight({ [c.path]: v })) }, c.path)),
1594
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-1.5", children: [
1595
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.advanceHeat(10)), children: "Step heat" }),
1596
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700", onClick: () => attempt(() => controller.clearHeat()), children: "Cool canvas" }),
1597
+ state.heat.hotCells > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "text-[11px] text-amber-400", children: [
1510
1598
  Math.round(state.heat.max * 100),
1511
1599
  "% warm"
1512
1600
  ] })
1513
1601
  ] })
1514
1602
  ] }),
1515
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(FerroPanel, { controller }),
1516
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TimeMachinePanel, { controller }),
1517
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ErrorLine, { error })
1603
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FerroPanel, { controller }),
1604
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TimeMachinePanel, { controller }),
1605
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CulturePanel, { controller }),
1606
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ErrorLine, { error })
1518
1607
  ] });
1519
1608
  };
1520
1609
 
1521
1610
  // src/paint-editor/ColorPanel.tsx
1522
1611
  var import_react13 = require("react");
1523
- var import_paint_editor9 = require("@pixerate/editor/paint-editor");
1524
1612
  var import_paint_editor10 = require("@pixerate/editor/paint-editor");
1525
- var import_jsx_runtime14 = require("react/jsx-runtime");
1613
+ var import_paint_editor11 = require("@pixerate/editor/paint-editor");
1614
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1526
1615
  var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className }) => {
1527
1616
  const state = usePaintEditorState(controller);
1528
1617
  const [error, attempt] = useAttempt();
@@ -1533,54 +1622,54 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1533
1622
  const [parts, setParts] = (0, import_react13.useState)([1, 1]);
1534
1623
  const [padName, setPadName] = (0, import_react13.useState)("");
1535
1624
  const padPoints = (0, import_react13.useRef)(null);
1536
- const ring = (0, import_react13.useMemo)(() => (0, import_paint_editor9.renderColorWheel)(wheelSize, wheel), [wheelSize, wheel]);
1625
+ const ring = (0, import_react13.useMemo)(() => (0, import_paint_editor10.renderColorWheel)(wheelSize, wheel), [wheelSize, wheel]);
1537
1626
  const color = state.color;
1538
1627
  const harmony = (0, import_react13.useMemo)(() => controller.harmony(kind, { color, wheel }), [controller, kind, color, wheel]);
1539
- const [r, g, b] = (0, import_paint_editor9.parseHexColor)(color);
1540
- const hsv = (0, import_paint_editor9.rgbToHsv)(r, g, b);
1628
+ const [r, g, b] = (0, import_paint_editor10.parseHexColor)(color);
1629
+ const hsv = (0, import_paint_editor10.rgbToHsv)(r, g, b);
1541
1630
  const effectWell = (0, import_react13.useMemo)(() => state.effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(64) : null, [controller, state.effectPaint, state.effectPaintRendering]);
1542
- const pad = (0, import_react13.useMemo)(() => ({ width: import_paint_editor9.MIXING_PAD_WIDTH, height: import_paint_editor9.MIXING_PAD_HEIGHT, data: controller.mixingPad.pixels() }), [controller, state.mixingPadVersion]);
1631
+ const pad = (0, import_react13.useMemo)(() => ({ width: import_paint_editor10.MIXING_PAD_WIDTH, height: import_paint_editor10.MIXING_PAD_HEIGHT, data: controller.mixingPad.pixels() }), [controller, state.mixingPadVersion]);
1543
1632
  const R = wheelSize / 2;
1544
1633
  const mid = R * 0.82;
1545
- const setHsv = (s, v) => controller.setColor((0, import_paint_editor9.rgbToHexColor)(...(0, import_paint_editor9.hsvToRgb)(hsv.h, s, v)));
1634
+ const setHsv = (s, v) => controller.setColor((0, import_paint_editor10.rgbToHexColor)(...(0, import_paint_editor10.hsvToRgb)(hsv.h, s, v)));
1546
1635
  const padPoint = (e) => {
1547
1636
  const rect = e.currentTarget.getBoundingClientRect();
1548
- const kx = import_paint_editor9.MIXING_PAD_WIDTH / (rect.width || import_paint_editor9.MIXING_PAD_WIDTH);
1549
- const ky = import_paint_editor9.MIXING_PAD_HEIGHT / (rect.height || import_paint_editor9.MIXING_PAD_HEIGHT);
1550
- const x = Math.min(import_paint_editor9.MIXING_PAD_WIDTH, Math.max(0, (e.clientX - rect.left) * kx));
1551
- const y = Math.min(import_paint_editor9.MIXING_PAD_HEIGHT, Math.max(0, (e.clientY - rect.top) * ky));
1637
+ const kx = import_paint_editor10.MIXING_PAD_WIDTH / (rect.width || import_paint_editor10.MIXING_PAD_WIDTH);
1638
+ const ky = import_paint_editor10.MIXING_PAD_HEIGHT / (rect.height || import_paint_editor10.MIXING_PAD_HEIGHT);
1639
+ const x = Math.min(import_paint_editor10.MIXING_PAD_WIDTH, Math.max(0, (e.clientX - rect.left) * kx));
1640
+ const y = Math.min(import_paint_editor10.MIXING_PAD_HEIGHT, Math.max(0, (e.clientY - rect.top) * ky));
1552
1641
  return e.pointerType === "pen" && e.pressure > 0 ? { x, y, pressure: e.pressure } : { x, y };
1553
1642
  };
1554
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "color-panel", children: [
1555
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "relative self-center", style: { width: wheelSize, height: wheelSize }, children: [
1556
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1643
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "color-panel", children: [
1644
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "relative self-center", style: { width: wheelSize, height: wheelSize }, children: [
1645
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1557
1646
  "div",
1558
1647
  {
1559
1648
  role: "slider",
1560
1649
  "aria-label": "Hue wheel",
1561
1650
  "aria-valuemin": 0,
1562
1651
  "aria-valuemax": 360,
1563
- "aria-valuenow": Math.round((0, import_paint_editor9.hueToWheel)(hsv.h, wheel)),
1652
+ "aria-valuenow": Math.round((0, import_paint_editor10.hueToWheel)(hsv.h, wheel)),
1564
1653
  tabIndex: 0,
1565
1654
  className: "absolute inset-0 cursor-crosshair",
1566
1655
  onPointerDown: (e) => {
1567
1656
  const rect = e.currentTarget.getBoundingClientRect();
1568
- controller.setColor((0, import_paint_editor9.wheelPick)(e.clientX - rect.left - R, e.clientY - rect.top - R, wheel, color));
1657
+ controller.setColor((0, import_paint_editor10.wheelPick)(e.clientX - rect.left - R, e.clientY - rect.top - R, wheel, color));
1569
1658
  },
1570
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PixelCanvas, { pixels: ring, label: "Colour wheel", style: { width: wheelSize, height: wheelSize } })
1659
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PixelCanvas, { pixels: ring, label: "Colour wheel", style: { width: wheelSize, height: wheelSize } })
1571
1660
  }
1572
1661
  ),
1573
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("svg", { className: "pointer-events-none absolute inset-0", width: wheelSize, height: wheelSize, "aria-hidden": "true", children: harmony.map((h, i) => {
1574
- const p = (0, import_paint_editor9.wheelPoint)(h.angle, mid);
1575
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("circle", { cx: R + p.x, cy: R + p.y, r: i === 0 ? 7 : 5, fill: h.color, stroke: "#fff", strokeWidth: i === 0 ? 2 : 1 }, i);
1662
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("svg", { className: "pointer-events-none absolute inset-0", width: wheelSize, height: wheelSize, "aria-hidden": "true", children: harmony.map((h, i) => {
1663
+ const p = (0, import_paint_editor10.wheelPoint)(h.angle, mid);
1664
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("circle", { cx: R + p.x, cy: R + p.y, r: i === 0 ? 7 : 5, fill: h.color, stroke: "#fff", strokeWidth: i === 0 ? 2 : 1 }, i);
1576
1665
  }) }),
1577
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "absolute rounded-full border border-slate-700", style: { left: R - R * 0.45, top: R - R * 0.45, width: R * 0.9, height: R * 0.9, background: color } })
1666
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "absolute rounded-full border border-slate-700", style: { left: R - R * 0.45, top: R - R * 0.45, width: R * 0.9, height: R * 0.9, background: color } })
1578
1667
  ] }),
1579
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-2", children: [
1580
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "color", "aria-label": "Paint colour", value: color, onChange: (e) => controller.setColor(e.target.value), className: "h-7 w-9 rounded bg-transparent" }),
1581
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "color", "aria-label": "Second colour", value: state.secondaryColor, onChange: (e) => controller.setSecondaryColor(e.target.value), className: "h-5 w-7 rounded bg-transparent" }),
1582
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button, title: "Swap colours (X)", onClick: () => controller.swapColors(), children: "Swap" }),
1583
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1668
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-2", children: [
1669
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "color", "aria-label": "Paint colour", value: color, onChange: (e) => controller.setColor(e.target.value), className: "h-7 w-9 rounded bg-transparent" }),
1670
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "color", "aria-label": "Second colour", value: state.secondaryColor, onChange: (e) => controller.setSecondaryColor(e.target.value), className: "h-5 w-7 rounded bg-transparent" }),
1671
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, title: "Swap colours (X)", onClick: () => controller.swapColors(), children: "Swap" }),
1672
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1584
1673
  "input",
1585
1674
  {
1586
1675
  "aria-label": "Hex colour",
@@ -1591,49 +1680,49 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1591
1680
  color
1592
1681
  )
1593
1682
  ] }),
1594
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-2", "data-testid": "paint-source", children: [
1595
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1683
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-2", "data-testid": "paint-source", children: [
1684
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1596
1685
  "span",
1597
1686
  {
1598
1687
  className: "h-5 flex-1 rounded ring-1 ring-slate-700",
1599
1688
  "aria-label": state.effectPaint ? `Effect paint: ${state.effectPaint.effect}` : state.paint.type === "gradient" ? "Gradient paint" : "Paint colour",
1600
1689
  "data-testid": "paint-well",
1601
1690
  "data-effect-paint": state.effectPaint ? state.effectPaint.effect : void 0,
1602
- style: { background: effectWell ? `center / cover no-repeat url("${effectWell}")` : (0, import_paint_editor10.paintSourceCss)(state.paint, { paint: color, secondary: state.secondaryColor }) }
1691
+ style: { background: effectWell ? `center / cover no-repeat url("${effectWell}")` : (0, import_paint_editor11.paintSourceCss)(state.paint, { paint: color, secondary: state.secondaryColor }) }
1603
1692
  }
1604
1693
  ),
1605
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1694
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1606
1695
  "button",
1607
1696
  {
1608
1697
  type: "button",
1609
1698
  className: chip(state.paint.type === "gradient"),
1610
1699
  "aria-pressed": state.paint.type === "gradient",
1611
1700
  title: "Paint that changes colour as the stroke goes",
1612
- onClick: () => attempt(() => state.paint.type === "gradient" ? controller.setColor(color) : controller.setPaint(import_paint_editor10.DEFAULT_PAINT_GRADIENT)),
1701
+ onClick: () => attempt(() => state.paint.type === "gradient" ? controller.setColor(color) : controller.setPaint(import_paint_editor11.DEFAULT_PAINT_GRADIENT)),
1613
1702
  children: "Gradient"
1614
1703
  }
1615
1704
  )
1616
1705
  ] }),
1617
- state.paint.type === "gradient" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PaintGradientEditor, { value: state.paint, colors: { paint: color, secondary: state.secondaryColor }, onChange: (g2) => attempt(() => controller.setPaint(g2)) }),
1618
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-2", children: [
1619
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w-16 text-slate-400", children: "Saturation" }),
1620
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "range", "aria-label": "Saturation", min: 0, max: 1, step: 0.01, value: hsv.s, onChange: (e) => setHsv(Number(e.target.value), hsv.v), className: "flex-1 accent-indigo-500" })
1706
+ state.paint.type === "gradient" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PaintGradientEditor, { value: state.paint, colors: { paint: color, secondary: state.secondaryColor }, onChange: (g2) => attempt(() => controller.setPaint(g2)) }),
1707
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center gap-2", children: [
1708
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w-16 text-slate-400", children: "Saturation" }),
1709
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "range", "aria-label": "Saturation", min: 0, max: 1, step: 0.01, value: hsv.s, onChange: (e) => setHsv(Number(e.target.value), hsv.v), className: "flex-1 accent-indigo-500" })
1621
1710
  ] }),
1622
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-2", children: [
1623
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w-16 text-slate-400", children: "Value" }),
1624
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "range", "aria-label": "Value", min: 0, max: 1, step: 0.01, value: hsv.v, onChange: (e) => setHsv(hsv.s, Number(e.target.value)), className: "flex-1 accent-indigo-500" })
1711
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center gap-2", children: [
1712
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "w-16 text-slate-400", children: "Value" }),
1713
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "range", "aria-label": "Value", min: 0, max: 1, step: 0.01, value: hsv.v, onChange: (e) => setHsv(hsv.s, Number(e.target.value)), className: "flex-1 accent-indigo-500" })
1625
1714
  ] }),
1626
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-1", children: [
1627
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("select", { "aria-label": "Harmony", value: kind, onChange: (e) => setKind(e.target.value), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor9.HARMONY_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: k, children: k }, k)) }),
1628
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: chip(wheel === "ryb"), "aria-pressed": wheel === "ryb", onClick: () => setWheel("ryb"), children: "RYB" }),
1629
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: chip(wheel === "rgb"), "aria-pressed": wheel === "rgb", onClick: () => setWheel("rgb"), children: "RGB" })
1715
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-1", children: [
1716
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("select", { "aria-label": "Harmony", value: kind, onChange: (e) => setKind(e.target.value), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor10.HARMONY_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: k, children: k }, k)) }),
1717
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: chip(wheel === "ryb"), "aria-pressed": wheel === "ryb", onClick: () => setWheel("ryb"), children: "RYB" }),
1718
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: chip(wheel === "rgb"), "aria-pressed": wheel === "rgb", onClick: () => setWheel("rgb"), children: "RGB" })
1630
1719
  ] }),
1631
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap gap-1", "aria-label": "Harmony colours", children: [
1632
- harmony.map((h, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", "aria-label": `Use ${h.color}`, title: h.color, className: "h-6 w-6 rounded ring-1 ring-slate-700", style: { background: h.color }, onClick: () => controller.setColor(h.color) }, i)),
1633
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button, onClick: () => harmony.forEach((h) => controller.addSwatch(h.color)), children: "+ swatches" })
1720
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-wrap gap-1", "aria-label": "Harmony colours", children: [
1721
+ harmony.map((h, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", "aria-label": `Use ${h.color}`, title: h.color, className: "h-6 w-6 rounded ring-1 ring-slate-700", style: { background: h.color }, onClick: () => controller.setColor(h.color) }, i)),
1722
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, onClick: () => harmony.forEach((h) => controller.addSwatch(h.color)), children: "+ swatches" })
1634
1723
  ] }),
1635
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": "Swatches", children: [
1636
- state.swatches.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1724
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-wrap gap-1", role: "listbox", "aria-label": "Swatches", children: [
1725
+ state.swatches.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1637
1726
  "button",
1638
1727
  {
1639
1728
  type: "button",
@@ -1642,7 +1731,7 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1642
1731
  "aria-label": s.name ?? (s.paint ? "Gradient" : s.color),
1643
1732
  title: `${s.name ?? (s.paint ? "Gradient" : s.color)} (right-click to remove)`,
1644
1733
  className: "h-5 w-5 rounded ring-1 ring-slate-700",
1645
- style: { background: s.paint ? (0, import_paint_editor10.paintSourceCss)(s.paint, { paint: color, secondary: state.secondaryColor }) : s.color },
1734
+ style: { background: s.paint ? (0, import_paint_editor11.paintSourceCss)(s.paint, { paint: color, secondary: state.secondaryColor }) : s.color },
1646
1735
  onClick: () => attempt(() => s.paint ? controller.setPaint(s.paint) : controller.setColor(s.color)),
1647
1736
  onContextMenu: (e) => {
1648
1737
  e.preventDefault();
@@ -1651,15 +1740,15 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1651
1740
  },
1652
1741
  i
1653
1742
  )),
1654
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button, "aria-label": "Add swatch", onClick: () => attempt(() => controller.addSwatch(state.paint)), children: "+" })
1743
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, "aria-label": "Add swatch", onClick: () => attempt(() => controller.addSwatch(state.paint)), children: "+" })
1655
1744
  ] }),
1656
- mixingPad && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-col gap-1", "data-testid": "mixing-pad", children: [
1657
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-1", children: [
1658
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-slate-400", children: "Mixing pad" }),
1659
- ["paint", "knife", "pick"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", "aria-pressed": padTool === t, className: chip(padTool === t), onClick: () => setPadTool(t), children: t === "paint" ? "Paint" : t === "knife" ? "Knife" : "Pick" }, t)),
1660
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button, onClick: () => controller.clearMixingPad(), children: "Clear" })
1745
+ mixingPad && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-col gap-1", "data-testid": "mixing-pad", children: [
1746
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-1", children: [
1747
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-slate-400", children: "Mixing pad" }),
1748
+ ["paint", "knife", "pick"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", "aria-pressed": padTool === t, className: chip(padTool === t), onClick: () => setPadTool(t), children: t === "paint" ? "Paint" : t === "knife" ? "Knife" : "Pick" }, t)),
1749
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, onClick: () => controller.clearMixingPad(), children: "Clear" })
1661
1750
  ] }),
1662
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1751
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1663
1752
  "div",
1664
1753
  {
1665
1754
  role: "application",
@@ -1668,7 +1757,7 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1668
1757
  onPointerDown: (e) => {
1669
1758
  const p = padPoint(e);
1670
1759
  if (padTool === "pick") {
1671
- attempt(() => controller.mixingPadPick(p.x, p.y, { setColor: true, radius: (0, import_paint_editor9.padSampleRadius)(sample) }));
1760
+ attempt(() => controller.mixingPadPick(p.x, p.y, { setColor: true, radius: (0, import_paint_editor10.padSampleRadius)(sample) }));
1672
1761
  return;
1673
1762
  }
1674
1763
  padPoints.current = [p];
@@ -1680,20 +1769,20 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1680
1769
  padPoints.current = null;
1681
1770
  if (pts?.length) attempt(() => controller.mixingPadStroke(pts, { tool: padTool === "knife" ? "knife" : "paint" }));
1682
1771
  },
1683
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PixelCanvas, { pixels: pad, label: "Mixing pad pixels", className: "w-full rounded", style: { aspectRatio: `${import_paint_editor9.MIXING_PAD_WIDTH} / ${import_paint_editor9.MIXING_PAD_HEIGHT}` } })
1772
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PixelCanvas, { pixels: pad, label: "Mixing pad pixels", className: "w-full rounded", style: { aspectRatio: `${import_paint_editor10.MIXING_PAD_WIDTH} / ${import_paint_editor10.MIXING_PAD_HEIGHT}` } })
1684
1773
  }
1685
1774
  ),
1686
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex flex-wrap items-center gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-1", children: [
1687
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-slate-400", children: "Sample" }),
1688
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("select", { "aria-label": "Pick sample size", value: sample, onChange: (e) => setSample(Number(e.target.value)), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor9.PAD_SAMPLE_SIZES.map((n) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: n, children: n === 1 ? "1 px" : `${n}\xD7${n}` }, n)) })
1775
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex flex-wrap items-center gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex items-center gap-1", children: [
1776
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-slate-400", children: "Sample" }),
1777
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("select", { "aria-label": "Pick sample size", value: sample, onChange: (e) => setSample(Number(e.target.value)), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor10.PAD_SAMPLE_SIZES.map((n) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: n, children: n === 1 ? "1 px" : `${n}\xD7${n}` }, n)) })
1689
1778
  ] }) }),
1690
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1691
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: color } }),
1692
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "number", "aria-label": "Paint colour parts", min: 0, max: 20, value: parts[0], onChange: (e) => setParts([Number(e.target.value), parts[1]]), className: "w-10 rounded bg-slate-800 px-1 py-0.5" }),
1693
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-slate-500", children: ":" }),
1694
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "number", "aria-label": "Second colour parts", min: 0, max: 20, value: parts[1], onChange: (e) => setParts([parts[0], Number(e.target.value)]), className: "w-10 rounded bg-slate-800 px-1 py-0.5" }),
1695
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: state.secondaryColor } }),
1696
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1779
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1780
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: color } }),
1781
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "number", "aria-label": "Paint colour parts", min: 0, max: 20, value: parts[0], onChange: (e) => setParts([Number(e.target.value), parts[1]]), className: "w-10 rounded bg-slate-800 px-1 py-0.5" }),
1782
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-slate-500", children: ":" }),
1783
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "number", "aria-label": "Second colour parts", min: 0, max: 20, value: parts[1], onChange: (e) => setParts([parts[0], Number(e.target.value)]), className: "w-10 rounded bg-slate-800 px-1 py-0.5" }),
1784
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "h-4 w-4 rounded ring-1 ring-slate-700", style: { background: state.secondaryColor } }),
1785
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1697
1786
  "button",
1698
1787
  {
1699
1788
  type: "button",
@@ -1712,22 +1801,22 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1712
1801
  }
1713
1802
  )
1714
1803
  ] }),
1715
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1716
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { value: padName, placeholder: "Pad name", "aria-label": "Pad name", onChange: (e) => setPadName(e.target.value), className: "w-24 rounded bg-slate-800 px-1.5 py-0.5" }),
1717
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.saveMixingPad(padName || void 0), setPadName(""))), children: "Keep pad" })
1804
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
1805
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { value: padName, placeholder: "Pad name", "aria-label": "Pad name", onChange: (e) => setPadName(e.target.value), className: "w-24 rounded bg-slate-800 px-1.5 py-0.5" }),
1806
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.saveMixingPad(padName || void 0), setPadName(""))), children: "Keep pad" })
1718
1807
  ] }),
1719
- state.savedMixingPads.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ul", { className: "flex flex-col gap-0.5", "aria-label": "Kept pads", children: state.savedMixingPads.map((p) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("li", { className: "flex items-center gap-1", children: [
1720
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: `${button} flex-1 text-left`, onClick: () => attempt(() => controller.loadMixingPad(p.id)), children: p.name }),
1721
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button, "aria-label": `Remove ${p.name}`, onClick: () => attempt(() => controller.removeMixingPad(p.id)), children: "\xD7" })
1808
+ state.savedMixingPads.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("ul", { className: "flex flex-col gap-0.5", "aria-label": "Kept pads", children: state.savedMixingPads.map((p) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("li", { className: "flex items-center gap-1", children: [
1809
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: `${button} flex-1 text-left`, onClick: () => attempt(() => controller.loadMixingPad(p.id)), children: p.name }),
1810
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: button, "aria-label": `Remove ${p.name}`, onClick: () => attempt(() => controller.removeMixingPad(p.id)), children: "\xD7" })
1722
1811
  ] }, p.id)) })
1723
1812
  ] }),
1724
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ErrorLine, { error })
1813
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ErrorLine, { error })
1725
1814
  ] });
1726
1815
  };
1727
1816
 
1728
1817
  // src/paint-editor/PaintLayersPanel.tsx
1729
1818
  var import_react16 = require("react");
1730
- var import_paint_editor11 = require("@pixerate/editor/paint-editor");
1819
+ var import_paint_editor12 = require("@pixerate/editor/paint-editor");
1731
1820
 
1732
1821
  // src/image-editor/LayerEffectsPanel.tsx
1733
1822
  var import_react15 = require("react");
@@ -1740,16 +1829,16 @@ var imageColorInputClass = "h-6 w-8 rounded border border-border bg-transparent"
1740
1829
 
1741
1830
  // src/image-editor/controls/controls.tsx
1742
1831
  var import_react14 = require("react");
1743
- var import_jsx_runtime15 = require("react/jsx-runtime");
1832
+ var import_jsx_runtime16 = require("react/jsx-runtime");
1744
1833
  var ControlsContext = (0, import_react14.createContext)({});
1745
1834
  function useImageEditorControls() {
1746
1835
  return (0, import_react14.useContext)(ControlsContext);
1747
1836
  }
1748
1837
  function ImageCheckbox(props) {
1749
1838
  const Host = useImageEditorControls().Checkbox;
1750
- if (Host) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Host, { ...props });
1839
+ if (Host) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Host, { ...props });
1751
1840
  const { checked, label, disabled, onChange, className = "" } = props;
1752
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1841
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1753
1842
  "input",
1754
1843
  {
1755
1844
  type: "checkbox",
@@ -1763,9 +1852,9 @@ function ImageCheckbox(props) {
1763
1852
  }
1764
1853
  function ImageRange(props) {
1765
1854
  const Host = useImageEditorControls().Range;
1766
- if (Host) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Host, { ...props });
1855
+ if (Host) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Host, { ...props });
1767
1856
  const { value, min, max, step, label, disabled, onChange, onStart, onEnd, className = "" } = props;
1768
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1857
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1769
1858
  "input",
1770
1859
  {
1771
1860
  type: "range",
@@ -1786,18 +1875,18 @@ function ImageRange(props) {
1786
1875
  }
1787
1876
  function ImageSelect(props) {
1788
1877
  const Host = useImageEditorControls().Select;
1789
- if (Host) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Host, { ...props });
1878
+ if (Host) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Host, { ...props });
1790
1879
  const { value, options, label, placeholder, disabled, onChange, className = "" } = props;
1791
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("select", { "aria-label": label, value, disabled, onChange: (e) => onChange(e.target.value), className: `${imageSelectClass} ${className}`, children: [
1792
- placeholder !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: "", children: placeholder }),
1793
- options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: o.value, children: o.label }, o.value))
1880
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("select", { "aria-label": label, value, disabled, onChange: (e) => onChange(e.target.value), className: `${imageSelectClass} ${className}`, children: [
1881
+ placeholder !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "", children: placeholder }),
1882
+ options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: o.value, children: o.label }, o.value))
1794
1883
  ] });
1795
1884
  }
1796
1885
  function ImageColor(props) {
1797
1886
  const Host = useImageEditorControls().Color;
1798
- if (Host) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Host, { ...props });
1887
+ if (Host) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Host, { ...props });
1799
1888
  const { value, label, alpha, disabled, onChange, className = "" } = props;
1800
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1889
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1801
1890
  "input",
1802
1891
  {
1803
1892
  type: "color",
@@ -1811,7 +1900,7 @@ function ImageColor(props) {
1811
1900
  }
1812
1901
 
1813
1902
  // src/image-editor/LayerEffectsPanel.tsx
1814
- var import_jsx_runtime16 = require("react/jsx-runtime");
1903
+ var import_jsx_runtime17 = require("react/jsx-runtime");
1815
1904
  var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) => {
1816
1905
  const [, setTick] = (0, import_react15.useState)(0);
1817
1906
  (0, import_react15.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
@@ -1830,7 +1919,7 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1830
1919
  }
1831
1920
  };
1832
1921
  if (!model.available || !id) {
1833
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: `text-xs text-muted-foreground ${className ?? ""}`, "data-testid": "layer-effects", children: model.reason });
1922
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: `text-xs text-muted-foreground ${className ?? ""}`, "data-testid": "layer-effects", children: model.reason });
1834
1923
  }
1835
1924
  const effects = controller.getLayerEffects(id);
1836
1925
  const patterns = controller.getDocumentPatterns();
@@ -1845,14 +1934,14 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1845
1934
  case "range": {
1846
1935
  const k = c.percent ? 100 : 1;
1847
1936
  const shown = Math.round(c.value * k * 100) / 100;
1848
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1849
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "text-muted-foreground", children: [
1937
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1938
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "text-muted-foreground", children: [
1850
1939
  label,
1851
1940
  " ",
1852
1941
  shown,
1853
1942
  c.unit
1854
1943
  ] }),
1855
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1944
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1856
1945
  ImageRange,
1857
1946
  {
1858
1947
  label,
@@ -1869,19 +1958,19 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1869
1958
  ] }, c.key);
1870
1959
  }
1871
1960
  case "color":
1872
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
1873
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ImageColor, { label, value: c.value, disabled: model.readOnly, onChange: (v) => change(effectId, c, v) }),
1961
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
1962
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ImageColor, { label, value: c.value, disabled: model.readOnly, onChange: (v) => change(effectId, c, v) }),
1874
1963
  label
1875
1964
  ] }, c.key);
1876
1965
  case "checkbox":
1877
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
1878
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ImageCheckbox, { label, checked: c.value, disabled: model.readOnly, onChange: (on) => change(effectId, c, on) }),
1966
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
1967
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ImageCheckbox, { label, checked: c.value, disabled: model.readOnly, onChange: (on) => change(effectId, c, on) }),
1879
1968
  label
1880
1969
  ] }, c.key);
1881
1970
  case "select":
1882
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1883
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-muted-foreground", children: label }),
1884
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1971
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1972
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-muted-foreground", children: label }),
1973
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1885
1974
  ImageSelect,
1886
1975
  {
1887
1976
  label,
@@ -1894,16 +1983,16 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1894
1983
  ] }, c.key);
1895
1984
  }
1896
1985
  };
1897
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-foreground ${className ?? ""}`, "data-testid": "layer-effects", "aria-label": "Layer style", role: "group", children: [
1898
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
1899
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "font-semibold text-foreground", children: heading ? "Layer Style" : "Styles" }),
1900
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1 text-foreground", children: [
1901
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ImageCheckbox, { label: "Effects on", checked: model.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.setLayerEffectsEnabled(id, on)) }),
1986
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-foreground ${className ?? ""}`, "data-testid": "layer-effects", "aria-label": "Layer style", role: "group", children: [
1987
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
1988
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "font-semibold text-foreground", children: heading ? "Layer Style" : "Styles" }),
1989
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-1 text-foreground", children: [
1990
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ImageCheckbox, { label: "Effects on", checked: model.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.setLayerEffectsEnabled(id, on)) }),
1902
1991
  "On"
1903
1992
  ] }),
1904
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
1993
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
1905
1994
  "Scale",
1906
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1995
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1907
1996
  "input",
1908
1997
  {
1909
1998
  type: "number",
@@ -1922,7 +2011,7 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1922
2011
  ),
1923
2012
  "%"
1924
2013
  ] }),
1925
- heading && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2014
+ heading && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1926
2015
  ImageSelect,
1927
2016
  {
1928
2017
  label: "Add style",
@@ -1938,14 +2027,14 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1938
2027
  }
1939
2028
  )
1940
2029
  ] }),
1941
- model.readOnly && model.reason && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-muted-foreground", children: model.reason }),
1942
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ul", { className: "flex flex-col gap-1", "aria-label": "Effects", children: model.rows.map((row) => {
2030
+ model.readOnly && model.reason && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-muted-foreground", children: model.reason }),
2031
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("ul", { className: "flex flex-col gap-1", "aria-label": "Effects", children: model.rows.map((row) => {
1943
2032
  const effect = effects.items.find((e) => e.id === row.id);
1944
2033
  const expanded = open === row.id;
1945
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("li", { "data-effect-id": row.id, className: "rounded bg-background/60 ring-1 ring-border", children: [
1946
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-1.5 px-1.5 py-1", children: [
1947
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ImageCheckbox, { label: `${row.label} on`, checked: row.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.updateLayerEffect(id, row.id, { enabled: on })) }),
1948
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2034
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("li", { "data-effect-id": row.id, className: "rounded bg-background/60 ring-1 ring-border", children: [
2035
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-1.5 px-1.5 py-1", children: [
2036
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ImageCheckbox, { label: `${row.label} on`, checked: row.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.updateLayerEffect(id, row.id, { enabled: on })) }),
2037
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1949
2038
  "button",
1950
2039
  {
1951
2040
  type: "button",
@@ -1955,17 +2044,17 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
1955
2044
  children: row.label
1956
2045
  }
1957
2046
  ),
1958
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: imageIconButtonClass, "aria-label": `Remove ${row.label}`, disabled: model.readOnly, onClick: () => attempt(() => controller.removeLayerEffect(id, row.id)), children: "\u2715" })
2047
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: imageIconButtonClass, "aria-label": `Remove ${row.label}`, disabled: model.readOnly, onClick: () => attempt(() => controller.removeLayerEffect(id, row.id)), children: "\u2715" })
1959
2048
  ] }),
1960
- expanded && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 px-1.5 pb-1.5", "data-testid": "effect-settings", children: (0, import_raster.layerEffectControls)(effect, patterns).map((c) => renderControl(row.id, c)) })
2049
+ expanded && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "grid grid-cols-2 gap-x-2 gap-y-1 px-1.5 pb-1.5", "data-testid": "effect-settings", children: (0, import_raster.layerEffectControls)(effect, patterns).map((c) => renderControl(row.id, c)) })
1961
2050
  ] }, row.id);
1962
2051
  }) }),
1963
- error && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { role: "alert", className: "text-destructive", children: error })
2052
+ error && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { role: "alert", className: "text-destructive", children: error })
1964
2053
  ] });
1965
2054
  };
1966
2055
 
1967
2056
  // src/paint-editor/PaintLayersPanel.tsx
1968
- var import_jsx_runtime17 = require("react/jsx-runtime");
2057
+ var import_jsx_runtime18 = require("react/jsx-runtime");
1969
2058
  function siblingIndex(layers, l) {
1970
2059
  const sibs = layers.filter((x) => x.parentId === l.parentId).reverse();
1971
2060
  return { index: sibs.findIndex((x) => x.id === l.id), count: sibs.length };
@@ -1983,18 +2072,18 @@ var PaintLayersPanel = ({ controller, className }) => {
1983
2072
  const to = Math.min(count - 1, Math.max(0, index + delta));
1984
2073
  if (to !== index) attempt(() => controller.moveLayer(active.id, to));
1985
2074
  };
1986
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-layers-panel", children: [
1987
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1988
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer()), children: "New layer" }),
1989
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer({ type: "group" })), children: "New group" }),
1990
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button, title: "A layer whose strokes stay editable", onClick: () => attempt(() => controller.addLayer({ type: "strokes" })), children: "New stroke layer" }),
1991
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.duplicateLayer(active.id)), children: "Duplicate" }),
1992
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer up", onClick: () => move(1), children: "\u2191" }),
1993
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer down", onClick: () => move(-1), children: "\u2193" }),
1994
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.mergeDown(active.id)), children: "Merge down" }),
1995
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button, disabled: !active || layers.length < 2, onClick: () => active && attempt(() => controller.removeLayer(active.id)), children: "Delete" })
2075
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-layers-panel", children: [
2076
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2077
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer()), children: "New layer" }),
2078
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer({ type: "group" })), children: "New group" }),
2079
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, title: "A layer whose strokes stay editable", onClick: () => attempt(() => controller.addLayer({ type: "strokes" })), children: "New stroke layer" }),
2080
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.duplicateLayer(active.id)), children: "Duplicate" }),
2081
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer up", onClick: () => move(1), children: "\u2191" }),
2082
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer down", onClick: () => move(-1), children: "\u2193" }),
2083
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.mergeDown(active.id)), children: "Merge down" }),
2084
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, disabled: !active || layers.length < 2, onClick: () => active && attempt(() => controller.removeLayer(active.id)), children: "Delete" })
1996
2085
  ] }),
1997
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("ul", { role: "tree", "aria-label": "Layers", className: "flex flex-col gap-0.5", children: layers.map((l) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2086
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("ul", { role: "tree", "aria-label": "Layers", className: "flex flex-col gap-0.5", children: layers.map((l) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1998
2087
  "li",
1999
2088
  {
2000
2089
  role: "treeitem",
@@ -2003,7 +2092,7 @@ var PaintLayersPanel = ({ controller, className }) => {
2003
2092
  style: { paddingLeft: 6 + l.depth * 12 },
2004
2093
  onClick: () => controller.setActiveLayer(l.id),
2005
2094
  children: [
2006
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2095
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2007
2096
  "button",
2008
2097
  {
2009
2098
  type: "button",
@@ -2016,7 +2105,7 @@ var PaintLayersPanel = ({ controller, className }) => {
2016
2105
  children: l.visible ? "\u25CF" : "\u25CB"
2017
2106
  }
2018
2107
  ),
2019
- renaming === l.id ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2108
+ renaming === l.id ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2020
2109
  "input",
2021
2110
  {
2022
2111
  autoFocus: true,
@@ -2033,23 +2122,23 @@ var PaintLayersPanel = ({ controller, className }) => {
2033
2122
  if (e.key === "Escape") setRenaming(null);
2034
2123
  }
2035
2124
  }
2036
- ) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "flex-1 truncate", onDoubleClick: () => setRenaming(l.id), children: [
2125
+ ) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "flex-1 truncate", onDoubleClick: () => setRenaming(l.id), children: [
2037
2126
  l.type === "group" ? "\u25B8 " : "",
2038
- l.liveStrokes !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { "aria-label": "Stroke layer", title: `Stroke layer: ${l.liveStrokes} editable strokes`, children: [
2127
+ l.liveStrokes !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { "aria-label": "Stroke layer", title: `Stroke layer: ${l.liveStrokes} editable strokes`, children: [
2039
2128
  "\u270E",
2040
2129
  " "
2041
2130
  ] }),
2042
2131
  l.name
2043
2132
  ] }),
2044
- l.locks.pixels || l.locks.all ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { title: "Locked", children: "\u{1F512}" }) : null
2133
+ l.locks.pixels || l.locks.all ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { title: "Locked", children: "\u{1F512}" }) : null
2045
2134
  ]
2046
2135
  },
2047
2136
  l.id
2048
2137
  )) }),
2049
- active && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
2050
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-2", children: [
2051
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w-14 text-slate-400", children: "Opacity" }),
2052
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2138
+ active && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
2139
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-2", children: [
2140
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "w-14 text-slate-400", children: "Opacity" }),
2141
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2053
2142
  "input",
2054
2143
  {
2055
2144
  type: "range",
@@ -2063,40 +2152,40 @@ var PaintLayersPanel = ({ controller, className }) => {
2063
2152
  }
2064
2153
  )
2065
2154
  ] }),
2066
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-2", children: [
2067
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w-14 text-slate-400", children: "Blend" }),
2068
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("select", { "aria-label": "Layer blend", value: active.blend, onChange: (e) => attempt(() => controller.updateLayer(active.id, { blend: e.target.value })), className: "flex-1 rounded bg-slate-800 px-1 py-0.5", children: [
2069
- active.type === "group" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "pass-through", children: "Pass through" }),
2070
- import_paint_editor11.BLEND_MENU_GROUPS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("optgroup", { label: g.label, children: g.modes.map((m) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: m.id, title: m.description, children: m.label }, m.id)) }, g.label))
2155
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-2", children: [
2156
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "w-14 text-slate-400", children: "Blend" }),
2157
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("select", { "aria-label": "Layer blend", value: active.blend, onChange: (e) => attempt(() => controller.updateLayer(active.id, { blend: e.target.value })), className: "flex-1 rounded bg-slate-800 px-1 py-0.5", children: [
2158
+ active.type === "group" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "pass-through", children: "Pass through" }),
2159
+ import_paint_editor12.BLEND_MENU_GROUPS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("optgroup", { label: g.label, children: g.modes.map((m) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: m.id, title: m.description, children: m.label }, m.id)) }, g.label))
2071
2160
  ] })
2072
2161
  ] }),
2073
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex gap-1", children: [
2074
- ["pixels", "transparency"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", "aria-pressed": Boolean(active.locks[k]), className: chip(Boolean(active.locks[k])), onClick: () => attempt(() => controller.updateLayer(active.id, { locks: { [k]: !active.locks[k] } })), children: k === "pixels" ? "Lock pixels" : "Lock transparency" }, k)),
2075
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", "aria-pressed": active.clipped, className: chip(active.clipped), onClick: () => attempt(() => controller.updateLayer(active.id, { clipped: !active.clipped })), children: "Clip" })
2162
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex gap-1", children: [
2163
+ ["pixels", "transparency"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", "aria-pressed": Boolean(active.locks[k]), className: chip(Boolean(active.locks[k])), onClick: () => attempt(() => controller.updateLayer(active.id, { locks: { [k]: !active.locks[k] } })), children: k === "pixels" ? "Lock pixels" : "Lock transparency" }, k)),
2164
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", "aria-pressed": active.clipped, className: chip(active.clipped), onClick: () => attempt(() => controller.updateLayer(active.id, { clipped: !active.clipped })), children: "Clip" })
2076
2165
  ] }),
2077
- light?.hasLight && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-col gap-1.5 border-t border-slate-800 pt-1.5", "data-testid": "layer-light", children: [
2078
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center justify-between", children: [
2079
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "font-medium text-slate-300", title: "This layer's paint gives off light", children: "Light" }),
2080
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.clearLight(active.id)), children: "Clear light" })
2166
+ light?.hasLight && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-1.5 border-t border-slate-800 pt-1.5", "data-testid": "layer-light", children: [
2167
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center justify-between", children: [
2168
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "font-medium text-slate-300", title: "This layer's paint gives off light", children: "Light" }),
2169
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.clearLight(active.id)), children: "Clear light" })
2081
2170
  ] }),
2082
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-2", title: "How far the light spills onto the paint and paper around it (0 turns it off)", children: [
2083
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w-14 text-slate-400", children: "Spill" }),
2084
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { type: "range", "aria-label": "Light spill radius", min: 0, max: 120, step: 1, value: light.spill.radius, onChange: (e) => attempt(() => controller.setLightSpill(active.id, { radius: Number(e.target.value) })), className: "flex-1 accent-indigo-500" })
2171
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-2", title: "How far the light spills onto the paint and paper around it (0 turns it off)", children: [
2172
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "w-14 text-slate-400", children: "Spill" }),
2173
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "range", "aria-label": "Light spill radius", min: 0, max: 120, step: 1, value: light.spill.radius, onChange: (e) => attempt(() => controller.setLightSpill(active.id, { radius: Number(e.target.value) })), className: "flex-1 accent-indigo-500" })
2085
2174
  ] }),
2086
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex items-center gap-2", children: [
2087
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w-14 text-slate-400", children: "Strength" }),
2088
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { type: "range", "aria-label": "Light spill strength", min: 0, max: 2, step: 0.05, value: light.spill.strength, onChange: (e) => attempt(() => controller.setLightSpill(active.id, { strength: Number(e.target.value) })), className: "flex-1 accent-indigo-500" })
2175
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center gap-2", children: [
2176
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "w-14 text-slate-400", children: "Strength" }),
2177
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "range", "aria-label": "Light spill strength", min: 0, max: 2, step: 0.05, value: light.spill.strength, onChange: (e) => attempt(() => controller.setLightSpill(active.id, { strength: Number(e.target.value) })), className: "flex-1 accent-indigo-500" })
2089
2178
  ] })
2090
2179
  ] }),
2091
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "border-t border-slate-800 pt-1.5", "data-testid": "paint-layer-effects", title: "Live layer styles drawn from this layer's paint: glows, shadows, strokes", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(LayerEffectsPanel, { controller, layerId: active.id }) })
2180
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "border-t border-slate-800 pt-1.5", "data-testid": "paint-layer-effects", title: "Live layer styles drawn from this layer's paint: glows, shadows, strokes", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(LayerEffectsPanel, { controller, layerId: active.id }) })
2092
2181
  ] }),
2093
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ErrorLine, { error })
2182
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ErrorLine, { error })
2094
2183
  ] });
2095
2184
  };
2096
2185
 
2097
2186
  // src/paint-editor/WetPanel.tsx
2098
- var import_paint_editor12 = require("@pixerate/editor/paint-editor");
2099
- var import_jsx_runtime18 = require("react/jsx-runtime");
2187
+ var import_paint_editor13 = require("@pixerate/editor/paint-editor");
2188
+ var import_jsx_runtime19 = require("react/jsx-runtime");
2100
2189
  var FLOW_LABELS = { none: "None", linear: "One way", swirl: "Swirl", radial: "Outwards", turbulent: "Eddies" };
2101
2190
  var WetPanel = ({ controller, className }) => {
2102
2191
  const state = usePaintEditorState(controller);
@@ -2106,31 +2195,31 @@ var WetPanel = ({ controller, className }) => {
2106
2195
  const info = layerId ? controller.wetLayerInfo(layerId) : null;
2107
2196
  const livePattern = layerId ? controller.getLivePatterns(layerId).layers[0] ?? null : null;
2108
2197
  const backend = controller.wetState();
2109
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "wet-panel", children: [
2110
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center justify-between", children: [
2111
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: wet.wet ? "text-sky-300" : "text-slate-400", "data-testid": "wet-status", children: wet.wet ? wet.paused ? "Wet (paused)" : "Wet" : "Dry" }),
2112
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "text-[10px] text-slate-500", children: [
2198
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "wet-panel", children: [
2199
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between", children: [
2200
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: wet.wet ? "text-sky-300" : "text-slate-400", "data-testid": "wet-status", children: wet.wet ? wet.paused ? "Wet (paused)" : "Wet" : "Dry" }),
2201
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "text-[10px] text-slate-500", children: [
2113
2202
  "step ",
2114
2203
  wet.clock
2115
2204
  ] })
2116
2205
  ] }),
2117
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2118
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, disabled: !wet.layerIds.length, onClick: () => attempt(async () => (await controller.wetIdle(), controller.dryPaint())), children: "Dry now" }),
2119
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: chip(wet.paused), "aria-pressed": wet.paused, onClick: () => controller.setWetPaused(!wet.paused), children: wet.paused ? "Resume" : "Pause" }),
2120
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: chip(wet.overlay), "aria-pressed": wet.overlay, onClick: () => controller.setWaterOverlay(!wet.overlay), children: "Water" }),
2121
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: chip(wet.instantDry), "aria-pressed": wet.instantDry, title: "Each wet stroke dries as soon as it ends", onClick: () => controller.setInstantDry(!wet.instantDry), children: "Instant dry" }),
2122
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: button, disabled: !layerId, onClick: () => attempt(async () => (await controller.wetIdle(), controller.wetPaper({}))), children: "Wet paper" })
2206
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2207
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, disabled: !wet.layerIds.length, onClick: () => attempt(async () => (await controller.wetIdle(), controller.dryPaint())), children: "Dry now" }),
2208
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: chip(wet.paused), "aria-pressed": wet.paused, onClick: () => controller.setWetPaused(!wet.paused), children: wet.paused ? "Resume" : "Pause" }),
2209
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: chip(wet.overlay), "aria-pressed": wet.overlay, onClick: () => controller.setWaterOverlay(!wet.overlay), children: "Water" }),
2210
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: chip(wet.instantDry), "aria-pressed": wet.instantDry, title: "Each wet stroke dries as soon as it ends", onClick: () => controller.setInstantDry(!wet.instantDry), children: "Instant dry" }),
2211
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, disabled: !layerId, onClick: () => attempt(async () => (await controller.wetIdle(), controller.wetPaper({}))), children: "Wet paper" })
2123
2212
  ] }),
2124
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PaintSlider, { control: import_paint_editor12.WET_SPEED_SLIDER, value: wet.speed, onChange: (v) => controller.setWetSpeed(v) }),
2125
- import_paint_editor12.WET_TILT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor12.readPath)(wet.tilt, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setCanvasTilt({ [c.path]: v }))) }, c.path)),
2126
- info && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "wet-layer", children: [
2127
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "font-medium text-slate-300", children: "This layer" }),
2128
- import_paint_editor12.WET_PARAM_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor12.readPath)(info.params, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setWetParams(layerId, { [c.path]: v }))) }, c.path)),
2129
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
2130
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-slate-400", children: "Flow map" }),
2131
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("select", { "aria-label": "Flow map", value: info.flow.kind, onChange: (e) => attempt(async () => (await controller.wetIdle(), controller.setFlowMap(layerId, { kind: e.target.value }))), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor12.WET_FLOW_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: k, children: FLOW_LABELS[k] }, k)) })
2213
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PaintSlider, { control: import_paint_editor13.WET_SPEED_SLIDER, value: wet.speed, onChange: (v) => controller.setWetSpeed(v) }),
2214
+ import_paint_editor13.WET_TILT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor13.readPath)(wet.tilt, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setCanvasTilt({ [c.path]: v }))) }, c.path)),
2215
+ info && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "wet-layer", children: [
2216
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "font-medium text-slate-300", children: "This layer" }),
2217
+ import_paint_editor13.WET_PARAM_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor13.readPath)(info.params, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setWetParams(layerId, { [c.path]: v }))) }, c.path)),
2218
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
2219
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-slate-400", children: "Flow map" }),
2220
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("select", { "aria-label": "Flow map", value: info.flow.kind, onChange: (e) => attempt(async () => (await controller.wetIdle(), controller.setFlowMap(layerId, { kind: e.target.value }))), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor13.WET_FLOW_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: k, children: FLOW_LABELS[k] }, k)) })
2132
2221
  ] }),
2133
- info.flow.kind !== "none" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2222
+ info.flow.kind !== "none" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2134
2223
  PaintSlider,
2135
2224
  {
2136
2225
  control: { path: "strength", label: "Flow strength", min: 0, max: 1, step: 0.01 },
@@ -2139,10 +2228,10 @@ var WetPanel = ({ controller, className }) => {
2139
2228
  }
2140
2229
  )
2141
2230
  ] }),
2142
- livePattern && layerId && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "wet-live-patterns", children: [
2143
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center justify-between", children: [
2144
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "font-medium text-slate-300", children: "Live patterns" }),
2145
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2231
+ livePattern && layerId && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "wet-live-patterns", children: [
2232
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between", children: [
2233
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "font-medium text-slate-300", children: "Live patterns" }),
2234
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2146
2235
  "button",
2147
2236
  {
2148
2237
  type: "button",
@@ -2157,35 +2246,35 @@ var WetPanel = ({ controller, className }) => {
2157
2246
  }
2158
2247
  )
2159
2248
  ] }),
2160
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
2161
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-slate-400", children: "Pattern" }),
2162
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2249
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
2250
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-slate-400", children: "Pattern" }),
2251
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2163
2252
  "select",
2164
2253
  {
2165
2254
  "aria-label": "Live pattern",
2166
2255
  value: livePattern.settings.pattern,
2167
2256
  onChange: (e) => attempt(async () => (await controller.wetIdle(), controller.setLivePatterns(layerId, { pattern: e.target.value }))),
2168
2257
  className: "rounded bg-slate-800 px-1 py-0.5",
2169
- children: import_paint_editor12.LIVE_PATTERN_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: k, children: import_paint_editor12.LIVE_PATTERN_LABELS[k] }, k))
2258
+ children: import_paint_editor13.LIVE_PATTERN_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: k, children: import_paint_editor13.LIVE_PATTERN_LABELS[k] }, k))
2170
2259
  }
2171
2260
  )
2172
2261
  ] }),
2173
- import_paint_editor12.LIVE_PATTERN_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor12.readPath)(livePattern.settings, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setLivePatterns(layerId, { [c.path]: v }))) }, c.path))
2262
+ import_paint_editor13.LIVE_PATTERN_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor13.readPath)(livePattern.settings, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setLivePatterns(layerId, { [c.path]: v }))) }, c.path))
2174
2263
  ] }),
2175
- backend.message && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-[10px] text-amber-300", "data-testid": "wet-message", children: backend.message }),
2176
- backend.backend && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-[10px] text-slate-500", children: backend.backend.kind === "wasm-threads" ? `WebAssembly, ${backend.backend.threads} threads` : backend.backend.kind === "wasm" ? "WebAssembly, one thread" : "JavaScript" }),
2177
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
2178
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-slate-400", children: "Engine" }),
2179
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("select", { "aria-label": "Wet engine", value: wet.gpu, onChange: (e) => attempt(() => controller.setWetEngine({ gpu: e.target.value })), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor12.WET_GPU_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: o.value, children: o.label }, o.value)) })
2264
+ backend.message && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-[10px] text-amber-300", "data-testid": "wet-message", children: backend.message }),
2265
+ backend.backend && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-[10px] text-slate-500", children: backend.backend.kind === "wasm-threads" ? `WebAssembly, ${backend.backend.threads} threads` : backend.backend.kind === "wasm" ? "WebAssembly, one thread" : "JavaScript" }),
2266
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
2267
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-slate-400", children: "Engine" }),
2268
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("select", { "aria-label": "Wet engine", value: wet.gpu, onChange: (e) => attempt(() => controller.setWetEngine({ gpu: e.target.value })), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor13.WET_GPU_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: o.value, children: o.label }, o.value)) })
2180
2269
  ] }),
2181
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: `text-[10px] ${backend.engine.state === "active" ? "text-emerald-300" : "text-slate-500"}`, "data-testid": "wet-engine", children: (0, import_paint_editor12.wetEngineSummary)(backend.engine) }),
2182
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ErrorLine, { error })
2270
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: `text-[10px] ${backend.engine.state === "active" ? "text-emerald-300" : "text-slate-500"}`, "data-testid": "wet-engine", children: (0, import_paint_editor13.wetEngineSummary)(backend.engine) }),
2271
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ErrorLine, { error })
2183
2272
  ] });
2184
2273
  };
2185
2274
 
2186
2275
  // src/paint-editor/StickerPanel.tsx
2187
- var import_paint_editor13 = require("@pixerate/editor/paint-editor");
2188
- var import_jsx_runtime19 = require("react/jsx-runtime");
2276
+ var import_paint_editor14 = require("@pixerate/editor/paint-editor");
2277
+ var import_jsx_runtime20 = require("react/jsx-runtime");
2189
2278
  var StickerPanel = ({ controller, className }) => {
2190
2279
  const state = usePaintEditorState(controller);
2191
2280
  const [error, attempt] = useAttempt();
@@ -2195,16 +2284,16 @@ var StickerPanel = ({ controller, className }) => {
2195
2284
  const stickers = layerId ? state.document.stickers?.[layerId] ?? [] : [];
2196
2285
  if (!stickers.length) return null;
2197
2286
  const sel = stickers.find((s) => s.id === picked) ?? null;
2198
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "sticker-panel", children: [
2199
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "font-medium text-slate-300", children: [
2287
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "sticker-panel", children: [
2288
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "font-medium text-slate-300", children: [
2200
2289
  "Stickers (",
2201
2290
  stickers.length,
2202
2291
  ")"
2203
2292
  ] }),
2204
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex max-h-24 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Stickers", children: stickers.map((s) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", role: "option", "aria-selected": s.id === picked, title: `${(0, import_paint_editor13.stickerRefLabel)(s.ref)} ${s.id}`, className: `h-5 w-5 rounded ring-1 ${s.id === picked ? "ring-indigo-400" : "ring-slate-700"}`, style: { background: s.color }, onClick: () => setPicked(s.id) }, s.id)) }),
2205
- sel && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "sticker-edit", children: [
2206
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-slate-400", children: "Sticker" }),
2207
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2293
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex max-h-24 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Stickers", children: stickers.map((s) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", role: "option", "aria-selected": s.id === picked, title: `${(0, import_paint_editor14.stickerRefLabel)(s.ref)} ${s.id}`, className: `h-5 w-5 rounded ring-1 ${s.id === picked ? "ring-indigo-400" : "ring-slate-700"}`, style: { background: s.color }, onClick: () => setPicked(s.id) }, s.id)) }),
2294
+ sel && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "sticker-edit", children: [
2295
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: "Sticker" }),
2296
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2208
2297
  StickerPicker,
2209
2298
  {
2210
2299
  controller,
@@ -2218,9 +2307,9 @@ var StickerPanel = ({ controller, className }) => {
2218
2307
  )
2219
2308
  }
2220
2309
  ),
2221
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
2222
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-slate-400", children: "Position" }),
2223
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "flex gap-1", children: ["x", "y"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2310
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
2311
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: "Position" }),
2312
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "flex gap-1", children: ["x", "y"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2224
2313
  "input",
2225
2314
  {
2226
2315
  type: "number",
@@ -2234,24 +2323,24 @@ var StickerPanel = ({ controller, className }) => {
2234
2323
  `${sel.id}-${k}-${sel[k]}`
2235
2324
  )) })
2236
2325
  ] }),
2237
- import_paint_editor13.STICKER_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor13.readPath)(sel, c.path), onCommit: (v) => attempt(() => controller.updateSticker(layerId, sel.id, { [c.path]: v })) }, c.path)),
2238
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center justify-between", children: [
2239
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-slate-400", children: "Colour" }),
2240
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CommitColorInput, { label: "Sticker colour", value: sel.color, onCommit: (v) => attempt(() => controller.updateSticker(layerId, sel.id, { color: v })), className: "h-6 w-10 rounded bg-transparent" })
2326
+ import_paint_editor14.STICKER_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor14.readPath)(sel, c.path), onCommit: (v) => attempt(() => controller.updateSticker(layerId, sel.id, { [c.path]: v })) }, c.path)),
2327
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center justify-between", children: [
2328
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: "Colour" }),
2329
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CommitColorInput, { label: "Sticker colour", value: sel.color, onCommit: (v) => attempt(() => controller.updateSticker(layerId, sel.id, { color: v })), className: "h-6 w-10 rounded bg-transparent" })
2241
2330
  ] }),
2242
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2243
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "front")), children: "To front" }),
2244
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "back")), children: "To back" }),
2245
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStickers(layerId, [sel.id]), setPicked(null))), children: "Delete" })
2331
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2332
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "front")), children: "To front" }),
2333
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "back")), children: "To back" }),
2334
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStickers(layerId, [sel.id]), setPicked(null))), children: "Delete" })
2246
2335
  ] })
2247
2336
  ] }),
2248
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ErrorLine, { error })
2337
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ErrorLine, { error })
2249
2338
  ] });
2250
2339
  };
2251
2340
 
2252
2341
  // src/paint-editor/StrokePanel.tsx
2253
- var import_paint_editor14 = require("@pixerate/editor/paint-editor");
2254
- var import_jsx_runtime20 = require("react/jsx-runtime");
2342
+ var import_paint_editor15 = require("@pixerate/editor/paint-editor");
2343
+ var import_jsx_runtime21 = require("react/jsx-runtime");
2255
2344
  var StrokePanel = ({ controller, className }) => {
2256
2345
  const state = usePaintEditorState(controller);
2257
2346
  const [error, attempt] = useAttempt();
@@ -2260,17 +2349,17 @@ var StrokePanel = ({ controller, className }) => {
2260
2349
  if (!layerId || !strokes) return null;
2261
2350
  const index = strokes.findIndex((s) => s.id === state.selectedStroke);
2262
2351
  const sel = index >= 0 ? strokes[index] : null;
2263
- const brushes = state.brushes.filter((b) => !(0, import_paint_editor14.liveStrokeRefusal)(b));
2264
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "stroke-panel", children: [
2265
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between", children: [
2266
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "font-medium text-slate-300", children: [
2352
+ const brushes = state.brushes.filter((b) => !(0, import_paint_editor15.liveStrokeRefusal)(b));
2353
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "stroke-panel", children: [
2354
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center justify-between", children: [
2355
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "font-medium text-slate-300", children: [
2267
2356
  "Strokes (",
2268
2357
  strokes.length,
2269
2358
  ")"
2270
2359
  ] }),
2271
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.rasterizeLiveStrokes(layerId)), children: "Rasterize" })
2360
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.rasterizeLiveStrokes(layerId)), children: "Rasterize" })
2272
2361
  ] }),
2273
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex max-h-24 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Strokes", children: strokes.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2362
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex max-h-24 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Strokes", children: strokes.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2274
2363
  "button",
2275
2364
  {
2276
2365
  type: "button",
@@ -2283,10 +2372,10 @@ var StrokePanel = ({ controller, className }) => {
2283
2372
  },
2284
2373
  s.id
2285
2374
  )) }),
2286
- sel && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "stroke-edit", children: [
2287
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
2288
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: "Brush" }),
2289
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2375
+ sel && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "stroke-edit", children: [
2376
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
2377
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-slate-400", children: "Brush" }),
2378
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2290
2379
  "select",
2291
2380
  {
2292
2381
  "aria-label": "Stroke brush",
@@ -2294,41 +2383,41 @@ var StrokePanel = ({ controller, className }) => {
2294
2383
  onChange: (e) => e.target.value && attempt(() => controller.updateStroke(sel.id, { brushId: e.target.value })),
2295
2384
  className: "max-w-[10rem] rounded bg-slate-800 px-1 py-0.5",
2296
2385
  children: [
2297
- !brushes.some((b) => b.id === sel.brush.id) && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "", children: sel.brush.name }),
2298
- brushes.map((b) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: b.id, children: b.name }, b.id))
2386
+ !brushes.some((b) => b.id === sel.brush.id) && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "", children: sel.brush.name }),
2387
+ brushes.map((b) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: b.id, children: b.name }, b.id))
2299
2388
  ]
2300
2389
  }
2301
2390
  )
2302
2391
  ] }),
2303
- import_paint_editor14.STROKE_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor14.readPath)(sel.brush, c.path), onCommit: (v) => attempt(() => controller.updateStroke(sel.id, { brush: { tip: { [c.path.split(".")[1]]: v } } })) }, c.path)),
2304
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center justify-between", children: [
2305
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: "Colour" }),
2306
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CommitColorInput, { label: "Stroke colour", value: sel.color, onCommit: (v) => attempt(() => controller.updateStroke(sel.id, { color: v })), className: "h-6 w-10 rounded bg-transparent" })
2392
+ import_paint_editor15.STROKE_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor15.readPath)(sel.brush, c.path), onCommit: (v) => attempt(() => controller.updateStroke(sel.id, { brush: { tip: { [c.path.split(".")[1]]: v } } })) }, c.path)),
2393
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center justify-between", children: [
2394
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-slate-400", children: "Colour" }),
2395
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CommitColorInput, { label: "Stroke colour", value: sel.color, onCommit: (v) => attempt(() => controller.updateStroke(sel.id, { color: v })), className: "h-6 w-10 rounded bg-transparent" })
2307
2396
  ] }),
2308
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2309
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.updateStroke(sel.id, { seed: (sel.seed + 1) % 2147483647 })), children: "New seed" }),
2310
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: button, disabled: index === strokes.length - 1, "aria-label": "Move stroke up", onClick: () => attempt(() => controller.reorderStroke(sel.id, index + 1)), children: "\u2191" }),
2311
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: button, disabled: index === 0, "aria-label": "Move stroke down", onClick: () => attempt(() => controller.reorderStroke(sel.id, index - 1)), children: "\u2193" }),
2312
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStrokes([sel.id]), controller.selectStroke(null))), children: "Delete" })
2397
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2398
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.updateStroke(sel.id, { seed: (sel.seed + 1) % 2147483647 })), children: "New seed" }),
2399
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button, disabled: index === strokes.length - 1, "aria-label": "Move stroke up", onClick: () => attempt(() => controller.reorderStroke(sel.id, index + 1)), children: "\u2191" }),
2400
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button, disabled: index === 0, "aria-label": "Move stroke down", onClick: () => attempt(() => controller.reorderStroke(sel.id, index - 1)), children: "\u2193" }),
2401
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStrokes([sel.id]), controller.selectStroke(null))), children: "Delete" })
2313
2402
  ] })
2314
2403
  ] }),
2315
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ErrorLine, { error })
2404
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ErrorLine, { error })
2316
2405
  ] });
2317
2406
  };
2318
2407
 
2319
2408
  // src/paint-editor/PathStrokePanel.tsx
2320
2409
  var import_react17 = require("react");
2321
- var import_paint_editor15 = require("@pixerate/editor/paint-editor");
2322
- var import_jsx_runtime21 = require("react/jsx-runtime");
2410
+ var import_paint_editor16 = require("@pixerate/editor/paint-editor");
2411
+ var import_jsx_runtime22 = require("react/jsx-runtime");
2323
2412
  var PathStrokePanel = ({ controller, className }) => {
2324
2413
  const state = usePaintEditorState(controller);
2325
2414
  const [error, attempt] = useAttempt();
2326
2415
  const [path, setPath] = (0, import_react17.useState)("");
2327
- const [taper, setTaper] = (0, import_react17.useState)(import_paint_editor15.PATH_STROKE_TAPERS[0].id);
2328
- const pressure = import_paint_editor15.PATH_STROKE_TAPERS.find((t) => t.id === taper)?.pressure;
2329
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "path-stroke-panel", children: [
2330
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "font-medium text-slate-300", children: "Brush a path" }),
2331
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2416
+ const [taper, setTaper] = (0, import_react17.useState)(import_paint_editor16.PATH_STROKE_TAPERS[0].id);
2417
+ const pressure = import_paint_editor16.PATH_STROKE_TAPERS.find((t) => t.id === taper)?.pressure;
2418
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "path-stroke-panel", children: [
2419
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "font-medium text-slate-300", children: "Brush a path" }),
2420
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2332
2421
  "textarea",
2333
2422
  {
2334
2423
  "aria-label": "SVG path data",
@@ -2339,18 +2428,18 @@ var PathStrokePanel = ({ controller, className }) => {
2339
2428
  className: "w-full resize-y rounded bg-slate-800 px-1 py-0.5 font-mono text-[11px]"
2340
2429
  }
2341
2430
  ),
2342
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2", children: [
2343
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("select", { "aria-label": "Pressure along the path", value: taper, onChange: (e) => setTaper(e.target.value), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor15.PATH_STROKE_TAPERS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: t.id, children: t.label }, t.id)) }),
2344
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button, disabled: !path.trim() || state.stroking, onClick: () => attempt(() => controller.strokePath({ path, ...pressure ? { pressure } : {} })), children: "Brush path" })
2431
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-2", children: [
2432
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("select", { "aria-label": "Pressure along the path", value: taper, onChange: (e) => setTaper(e.target.value), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor16.PATH_STROKE_TAPERS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: t.id, children: t.label }, t.id)) }),
2433
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: button, disabled: !path.trim() || state.stroking, onClick: () => attempt(() => controller.strokePath({ path, ...pressure ? { pressure } : {} })), children: "Brush path" })
2345
2434
  ] }),
2346
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ErrorLine, { error })
2435
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ErrorLine, { error })
2347
2436
  ] });
2348
2437
  };
2349
2438
 
2350
2439
  // src/paint-editor/EvolutionPanel.tsx
2351
2440
  var import_react18 = require("react");
2352
- var import_paint_editor16 = require("@pixerate/editor/paint-editor");
2353
- var import_jsx_runtime22 = require("react/jsx-runtime");
2441
+ var import_paint_editor17 = require("@pixerate/editor/paint-editor");
2442
+ var import_jsx_runtime23 = require("react/jsx-runtime");
2354
2443
  var EvolutionPanel = ({ controller, proposals, className }) => {
2355
2444
  const state = usePaintEditorState(controller);
2356
2445
  const store = proposals ?? controller.proposals;
@@ -2360,12 +2449,12 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2360
2449
  const [selectedProposals, setSelectedProposals] = (0, import_react18.useState)([]);
2361
2450
  const [count, setCount] = (0, import_react18.useState)(4);
2362
2451
  const [seed, setSeed] = (0, import_react18.useState)(1);
2363
- const [mutation, setMutation] = (0, import_react18.useState)(() => (0, import_paint_editor16.normalizeMutationRates)());
2452
+ const [mutation, setMutation] = (0, import_react18.useState)(() => (0, import_paint_editor17.normalizeMutationRates)());
2364
2453
  const [contactSheetUrl, setContactSheetUrl] = (0, import_react18.useState)(null);
2365
- const eligibleStrokes = state.document.strokes.filter((s) => !(0, import_paint_editor16.liveStrokeRefusal)(s.brush));
2454
+ const eligibleStrokes = state.document.strokes.filter((s) => !(0, import_paint_editor17.liveStrokeRefusal)(s.brush));
2366
2455
  const activeStrokeIds = selectedStrokes.filter((id) => eligibleStrokes.some((s) => s.id === id));
2367
2456
  const effectiveStrokeIds = activeStrokeIds.length > 0 ? activeStrokeIds : state.selectedStroke && eligibleStrokes.some((s) => s.id === state.selectedStroke) ? [state.selectedStroke] : eligibleStrokes.length > 0 ? [eligibleStrokes[eligibleStrokes.length - 1].id] : [];
2368
- const variants = proposalState.proposals.filter((p) => (0, import_paint_editor16.proposalGenomeStrokes)(p).length > 0);
2457
+ const variants = proposalState.proposals.filter((p) => (0, import_paint_editor17.proposalGenomeStrokes)(p).length > 0);
2369
2458
  const activeProposalIds = selectedProposals.filter((id) => variants.some((v) => v.id === id));
2370
2459
  const toggleStroke = (id) => {
2371
2460
  setSelectedStrokes((prev) => prev.includes(id) ? prev.filter((x) => x !== id) : [...prev.slice(-15), id]);
@@ -2373,16 +2462,16 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2373
2462
  const toggleProposal = (id) => {
2374
2463
  setSelectedProposals((prev) => prev.includes(id) ? prev.filter((x) => x !== id) : [...prev.slice(-1), id]);
2375
2464
  };
2376
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "evolution-panel", children: [
2377
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center justify-between", children: [
2378
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "font-medium text-slate-300", children: [
2465
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "evolution-panel", children: [
2466
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center justify-between", children: [
2467
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "font-medium text-slate-300", children: [
2379
2468
  "Evolution (",
2380
2469
  eligibleStrokes.length,
2381
2470
  ")"
2382
2471
  ] }),
2383
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1 text-[11px] text-slate-400", children: [
2384
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: "Count" }),
2385
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2472
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-1 text-[11px] text-slate-400", children: [
2473
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "Count" }),
2474
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2386
2475
  "input",
2387
2476
  {
2388
2477
  type: "number",
@@ -2396,9 +2485,9 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2396
2485
  )
2397
2486
  ] }) })
2398
2487
  ] }),
2399
- eligibleStrokes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex max-h-20 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Parent strokes", children: eligibleStrokes.map((s, i) => {
2488
+ eligibleStrokes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex max-h-20 flex-wrap gap-1 overflow-y-auto", role: "listbox", "aria-label": "Parent strokes", children: eligibleStrokes.map((s, i) => {
2400
2489
  const on = effectiveStrokeIds.includes(s.id);
2401
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2490
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2402
2491
  "button",
2403
2492
  {
2404
2493
  type: "button",
@@ -2412,9 +2501,9 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2412
2501
  s.id
2413
2502
  );
2414
2503
  }) }),
2415
- import_paint_editor16.EVOLUTION_SLIDERS.map((c) => {
2504
+ import_paint_editor17.EVOLUTION_SLIDERS.map((c) => {
2416
2505
  const key = c.path;
2417
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2506
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2418
2507
  PaintSlider,
2419
2508
  {
2420
2509
  control: c,
@@ -2424,8 +2513,8 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2424
2513
  c.path
2425
2514
  );
2426
2515
  }),
2427
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2428
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2516
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2517
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2429
2518
  "button",
2430
2519
  {
2431
2520
  type: "button",
@@ -2438,7 +2527,7 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2438
2527
  children: "Breed strokes"
2439
2528
  }
2440
2529
  ),
2441
- activeProposalIds.length === 2 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2530
+ activeProposalIds.length === 2 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2442
2531
  "button",
2443
2532
  {
2444
2533
  type: "button",
@@ -2451,29 +2540,29 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2451
2540
  children: "Cross over (2)"
2452
2541
  }
2453
2542
  ),
2454
- variants.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2543
+ variants.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2455
2544
  "button",
2456
2545
  {
2457
2546
  type: "button",
2458
2547
  className: button,
2459
2548
  onClick: () => attempt(() => {
2460
- const sheet = (0, import_paint_editor16.exportProposalContactSheetPng)(controller, variants);
2549
+ const sheet = (0, import_paint_editor17.exportProposalContactSheetPng)(controller, variants);
2461
2550
  setContactSheetUrl(`data:image/png;base64,${sheet.base64}`);
2462
2551
  }),
2463
2552
  children: "Contact sheet"
2464
2553
  }
2465
2554
  )
2466
2555
  ] }),
2467
- variants.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "grid grid-cols-2 gap-1.5", "data-testid": "evolution-grid", children: variants.map((p) => {
2468
- const g = (0, import_paint_editor16.paintProposalGhost)(p);
2556
+ variants.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "grid grid-cols-2 gap-1.5", "data-testid": "evolution-grid", children: variants.map((p) => {
2557
+ const g = (0, import_paint_editor17.paintProposalGhost)(p);
2469
2558
  const picked = activeProposalIds.includes(p.id);
2470
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2559
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
2471
2560
  "div",
2472
2561
  {
2473
2562
  "data-testid": `evolution-variant-${p.id}`,
2474
2563
  className: `flex flex-col gap-1 rounded border p-1.5 ${picked ? "border-indigo-500 bg-slate-800/90" : "border-slate-800 bg-slate-950/60"}`,
2475
2564
  children: [
2476
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex items-center justify-between gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2565
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex items-center justify-between gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2477
2566
  "button",
2478
2567
  {
2479
2568
  type: "button",
@@ -2483,10 +2572,10 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2483
2572
  children: p.title
2484
2573
  }
2485
2574
  ) }),
2486
- g && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex h-16 items-center justify-center overflow-hidden rounded bg-slate-900/80 p-1", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(PixelCanvas, { pixels: g, label: p.title, className: "max-h-full max-w-full object-contain" }) }),
2487
- p.rationale && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "line-clamp-2 text-[10px] text-slate-400", title: p.rationale, children: p.rationale }),
2488
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2489
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2575
+ g && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex h-16 items-center justify-center overflow-hidden rounded bg-slate-900/80 p-1", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PixelCanvas, { pixels: g, label: p.title, className: "max-h-full max-w-full object-contain" }) }),
2576
+ p.rationale && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "line-clamp-2 text-[10px] text-slate-400", title: p.rationale, children: p.rationale }),
2577
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2578
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2490
2579
  "button",
2491
2580
  {
2492
2581
  type: "button",
@@ -2499,26 +2588,26 @@ var EvolutionPanel = ({ controller, proposals, className }) => {
2499
2588
  children: "Breed from"
2500
2589
  }
2501
2590
  ),
2502
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => store.accept(p.id)), children: "Accept" }),
2503
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => store.reject(p.id)), children: "Dismiss" })
2591
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => store.accept(p.id)), children: "Accept" }),
2592
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => store.reject(p.id)), children: "Dismiss" })
2504
2593
  ] })
2505
2594
  ]
2506
2595
  },
2507
2596
  p.id
2508
2597
  );
2509
2598
  }) }),
2510
- contactSheetUrl && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("img", { src: contactSheetUrl, alt: "Variant contact sheet", className: "w-full rounded border border-slate-800", "data-testid": "evolution-contact-sheet" }),
2511
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ErrorLine, { error })
2599
+ contactSheetUrl && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("img", { src: contactSheetUrl, alt: "Variant contact sheet", className: "w-full rounded border border-slate-800", "data-testid": "evolution-contact-sheet" }),
2600
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ErrorLine, { error })
2512
2601
  ] });
2513
2602
  };
2514
2603
 
2515
2604
  // src/paint-editor/PaintEditor.tsx
2516
2605
  var import_react32 = require("react");
2517
- var import_paint_editor18 = require("@pixerate/editor/paint-editor");
2606
+ var import_paint_editor19 = require("@pixerate/editor/paint-editor");
2518
2607
 
2519
2608
  // src/playback/AgentPlaybackContext.tsx
2520
2609
  var import_react19 = require("react");
2521
- var import_jsx_runtime23 = require("react/jsx-runtime");
2610
+ var import_jsx_runtime24 = require("react/jsx-runtime");
2522
2611
  var AgentPlaybackContext = (0, import_react19.createContext)(null);
2523
2612
  function useAgentPlayback() {
2524
2613
  return (0, import_react19.useContext)(AgentPlaybackContext);
@@ -2567,12 +2656,12 @@ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
2567
2656
 
2568
2657
  // src/playback/PresenceLayer.tsx
2569
2658
  var import_react21 = __toESM(require("react"), 1);
2570
- var import_jsx_runtime24 = require("react/jsx-runtime");
2659
+ var import_jsx_runtime25 = require("react/jsx-runtime");
2571
2660
  function PresenceLayer({ presence, viewport, clip = true, renderCursor, className = "" }) {
2572
2661
  const { actors } = (0, import_react21.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
2573
2662
  if (!actors.length) return null;
2574
2663
  const map = typeof viewport === "function" ? viewport : viewport ? (p) => ({ x: p.x * viewport.zoom + viewport.x, y: p.y * viewport.zoom + viewport.y }) : (p) => p;
2575
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2664
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2576
2665
  "div",
2577
2666
  {
2578
2667
  className: `pixerate-presence ${className}`.trim(),
@@ -2586,19 +2675,19 @@ function PresenceLayer({ presence, viewport, clip = true, renderCursor, classNam
2586
2675
  const br = map({ x: a.focus.x + a.focus.width, y: a.focus.y + a.focus.height });
2587
2676
  return { left: tl.x - 4, top: tl.y - 4, width: br.x - tl.x + 8, height: br.y - tl.y + 8 };
2588
2677
  })();
2589
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_react21.default.Fragment, { children: [
2590
- ring && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2678
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_react21.default.Fragment, { children: [
2679
+ ring && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2591
2680
  "div",
2592
2681
  {
2593
2682
  "data-actor-focus": a.id,
2594
2683
  style: { position: "absolute", ...ring, borderRadius: 8, border: `2px solid ${a.color}`, background: `${a.color}14`, transition: "all 160ms ease-out" }
2595
2684
  }
2596
2685
  ),
2597
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: renderCursor ? renderCursor(a) : /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
2598
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("svg", { width: "18", height: "20", viewBox: "0 0 12 18", style: { display: "block", transform: a.pressed ? "scale(0.85)" : void 0, transformOrigin: "0 0", filter: "drop-shadow(0 1px 2px rgba(0,0,0,.35))" }, children: /* @__PURE__ */ (0, import_jsx_runtime24.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 } }) }),
2599
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
2600
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
2601
- a.message && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { "data-actor-message": a.id, style: { width: "max-content", maxWidth: 240, borderRadius: 8, borderTopLeftRadius: 0, padding: "4px 8px", fontSize: 12, color: "#1e293b", background: "#ffffff", boxShadow: "0 4px 12px rgba(15,23,42,.18)" }, children: a.message })
2686
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: renderCursor ? renderCursor(a) : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
2687
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("svg", { width: "18", height: "20", viewBox: "0 0 12 18", style: { display: "block", transform: a.pressed ? "scale(0.85)" : void 0, transformOrigin: "0 0", filter: "drop-shadow(0 1px 2px rgba(0,0,0,.35))" }, children: /* @__PURE__ */ (0, import_jsx_runtime25.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 } }) }),
2688
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
2689
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
2690
+ a.message && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { "data-actor-message": a.id, style: { width: "max-content", maxWidth: 240, borderRadius: 8, borderTopLeftRadius: 0, padding: "4px 8px", fontSize: 12, color: "#1e293b", background: "#ffffff", boxShadow: "0 4px 12px rgba(15,23,42,.18)" }, children: a.message })
2602
2691
  ] })
2603
2692
  ] }) })
2604
2693
  ] }, a.id);
@@ -2609,7 +2698,7 @@ function PresenceLayer({ presence, viewport, clip = true, renderCursor, classNam
2609
2698
 
2610
2699
  // src/paint-editor/PaintEffectsPanel.tsx
2611
2700
  var import_react31 = require("react");
2612
- var import_paint_editor17 = require("@pixerate/editor/paint-editor");
2701
+ var import_paint_editor18 = require("@pixerate/editor/paint-editor");
2613
2702
  var import_effects4 = require("@pixerate/editor/effects");
2614
2703
 
2615
2704
  // src/effects/useEffects.ts
@@ -2634,7 +2723,7 @@ function useEffectDescription(provider, effect) {
2634
2723
  // src/effects/EffectThumbnail.tsx
2635
2724
  var import_react23 = require("react");
2636
2725
  var import_effects = require("@pixerate/editor/effects");
2637
- var import_jsx_runtime25 = require("react/jsx-runtime");
2726
+ var import_jsx_runtime26 = require("react/jsx-runtime");
2638
2727
  var LABELS = { motion: "Motion", camera: "Camera", timing: "Timing" };
2639
2728
  function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
2640
2729
  const ref = (0, import_react23.useRef)(null);
@@ -2654,13 +2743,13 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
2654
2743
  live = false;
2655
2744
  };
2656
2745
  }, [provider, effect, width, height]);
2657
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2746
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2658
2747
  "div",
2659
2748
  {
2660
2749
  className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
2661
2750
  style: { aspectRatio: `${width} / ${height}` },
2662
2751
  "data-effect-thumbnail": effect.id,
2663
- children: failed ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: LABELS[effect.kind] ?? "No preview" }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
2752
+ children: failed ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: LABELS[effect.kind] ?? "No preview" }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
2664
2753
  }
2665
2754
  );
2666
2755
  }
@@ -2668,7 +2757,7 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
2668
2757
  // src/effects/EffectsBrowser.tsx
2669
2758
  var import_react24 = require("react");
2670
2759
  var import_effects2 = require("@pixerate/editor/effects");
2671
- var import_jsx_runtime26 = require("react/jsx-runtime");
2760
+ var import_jsx_runtime27 = require("react/jsx-runtime");
2672
2761
  function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
2673
2762
  const [all, setAll] = (0, import_react24.useState)([]);
2674
2763
  const [query, setQuery] = (0, import_react24.useState)("");
@@ -2699,11 +2788,11 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2699
2788
  const categories = (0, import_react24.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
2700
2789
  const shown = found.filter(allowed);
2701
2790
  if (!provider)
2702
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: `rounded-md border border-dashed border-border p-3 text-xs text-muted-foreground ${className}`, "data-effects-browser": "", "data-effects-unavailable": "", children: "No effects provider is registered, so effects cannot be added. Effects already in the document are kept." });
2703
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
2704
- title && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h3", { className: "text-xs font-semibold", children: title }),
2705
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2706
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2791
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: `rounded-md border border-dashed border-border p-3 text-xs text-muted-foreground ${className}`, "data-effects-browser": "", "data-effects-unavailable": "", children: "No effects provider is registered, so effects cannot be added. Effects already in the document are kept." });
2792
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
2793
+ title && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("h3", { className: "text-xs font-semibold", children: title }),
2794
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
2795
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2707
2796
  "input",
2708
2797
  {
2709
2798
  type: "search",
@@ -2714,17 +2803,17 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2714
2803
  onChange: (e) => setQuery(e.currentTarget.value)
2715
2804
  }
2716
2805
  ),
2717
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", "aria-label": "Category", value: category, onChange: (e) => setCategory(e.currentTarget.value), children: [
2718
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: "", children: "All categories" }),
2719
- categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: c, children: c }, c))
2806
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", "aria-label": "Category", value: category, onChange: (e) => setCategory(e.currentTarget.value), children: [
2807
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: "", children: "All categories" }),
2808
+ categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: c, children: c }, c))
2720
2809
  ] }),
2721
- uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", "aria-label": "Use", value: use, onChange: (e) => setUse(e.currentTarget.value), children: [
2722
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: "", children: "Any use" }),
2723
- uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
2810
+ uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("select", { className: "rounded border border-border bg-transparent px-1 py-0.5 text-xs", "aria-label": "Use", value: use, onChange: (e) => setUse(e.currentTarget.value), children: [
2811
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: "", children: "Any use" }),
2812
+ uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
2724
2813
  ] })
2725
2814
  ] }),
2726
- error && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
2727
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("ul", { className: "grid max-h-96 grid-cols-[repeat(auto-fill,minmax(6.5rem,1fr))] gap-1.5 overflow-y-auto", role: "list", children: shown.map((e) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
2815
+ error && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
2816
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("ul", { className: "grid max-h-96 grid-cols-[repeat(auto-fill,minmax(6.5rem,1fr))] gap-1.5 overflow-y-auto", role: "list", children: shown.map((e) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
2728
2817
  "button",
2729
2818
  {
2730
2819
  type: "button",
@@ -2733,13 +2822,13 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2733
2822
  "data-effect-id": e.id,
2734
2823
  onClick: () => onPick(e),
2735
2824
  children: [
2736
- thumbnails && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(EffectThumbnail, { provider, effect: e }),
2737
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
2738
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
2825
+ thumbnails && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(EffectThumbnail, { provider, effect: e }),
2826
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
2827
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
2739
2828
  ]
2740
2829
  }
2741
2830
  ) }, e.id)) }),
2742
- !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
2831
+ !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
2743
2832
  ] });
2744
2833
  }
2745
2834
 
@@ -2764,7 +2853,7 @@ __export(color_exports, {
2764
2853
  // src/color/ColorPicker.tsx
2765
2854
  var import_react25 = require("react");
2766
2855
  var import_color = require("@pixerate/editor/color");
2767
- var import_jsx_runtime27 = require("react/jsx-runtime");
2856
+ var import_jsx_runtime28 = require("react/jsx-runtime");
2768
2857
  var LOCAL_STORAGE_KEY = "pixerate:color:recent";
2769
2858
  function readLocalRecents() {
2770
2859
  try {
@@ -2971,7 +3060,7 @@ var ColorPicker = ({
2971
3060
  }, [value, contrastAgainst]);
2972
3061
  const currentHex = (0, import_color.pickerStateToHex)(pickerState, alpha);
2973
3062
  const liveDescription = `Selected color: ${value}${contrastResult ? `, contrast ${contrastResult.ratio.toFixed(1)}:1 against ${contrastAgainst}, ${contrastResult.aa ? "passes AA" : "fails AA"}` : ""}`;
2974
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3063
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
2975
3064
  "div",
2976
3065
  {
2977
3066
  id: pickerId,
@@ -2995,7 +3084,7 @@ var ColorPicker = ({
2995
3084
  pointerEvents: disabled ? "none" : "auto"
2996
3085
  },
2997
3086
  children: [
2998
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3087
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2999
3088
  "span",
3000
3089
  {
3001
3090
  role: "status",
@@ -3014,7 +3103,7 @@ var ColorPicker = ({
3014
3103
  children: liveDescription
3015
3104
  }
3016
3105
  ),
3017
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3106
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3018
3107
  "div",
3019
3108
  {
3020
3109
  role: "slider",
@@ -3036,7 +3125,7 @@ var ColorPicker = ({
3036
3125
  touchAction: "none",
3037
3126
  outline: "none"
3038
3127
  },
3039
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3128
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3040
3129
  "div",
3041
3130
  {
3042
3131
  style: {
@@ -3056,7 +3145,7 @@ var ColorPicker = ({
3056
3145
  )
3057
3146
  }
3058
3147
  ),
3059
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3148
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3060
3149
  "div",
3061
3150
  {
3062
3151
  role: "slider",
@@ -3079,7 +3168,7 @@ var ColorPicker = ({
3079
3168
  touchAction: "none",
3080
3169
  outline: "none"
3081
3170
  },
3082
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3171
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3083
3172
  "div",
3084
3173
  {
3085
3174
  style: {
@@ -3099,7 +3188,7 @@ var ColorPicker = ({
3099
3188
  )
3100
3189
  }
3101
3190
  ),
3102
- alpha && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3191
+ alpha && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3103
3192
  "div",
3104
3193
  {
3105
3194
  role: "slider",
@@ -3125,7 +3214,7 @@ var ColorPicker = ({
3125
3214
  overflow: "hidden"
3126
3215
  },
3127
3216
  children: [
3128
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3217
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3129
3218
  "div",
3130
3219
  {
3131
3220
  style: {
@@ -3135,7 +3224,7 @@ var ColorPicker = ({
3135
3224
  }
3136
3225
  }
3137
3226
  ),
3138
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3227
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3139
3228
  "div",
3140
3229
  {
3141
3230
  style: {
@@ -3156,8 +3245,8 @@ var ColorPicker = ({
3156
3245
  ]
3157
3246
  }
3158
3247
  ),
3159
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "2px" }, children: [
3160
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3248
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "2px" }, children: [
3249
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3161
3250
  "div",
3162
3251
  {
3163
3252
  style: {
@@ -3171,7 +3260,7 @@ var ColorPicker = ({
3171
3260
  flexShrink: 0,
3172
3261
  border: "1px solid rgba(255,255,255,0.15)"
3173
3262
  },
3174
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3263
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3175
3264
  "div",
3176
3265
  {
3177
3266
  style: {
@@ -3183,7 +3272,7 @@ var ColorPicker = ({
3183
3272
  )
3184
3273
  }
3185
3274
  ),
3186
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3275
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3187
3276
  "input",
3188
3277
  {
3189
3278
  type: "text",
@@ -3213,7 +3302,7 @@ var ColorPicker = ({
3213
3302
  }
3214
3303
  }
3215
3304
  ),
3216
- hasEyeDropper && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3305
+ hasEyeDropper && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3217
3306
  "button",
3218
3307
  {
3219
3308
  type: "button",
@@ -3233,7 +3322,7 @@ var ColorPicker = ({
3233
3322
  color: "inherit",
3234
3323
  cursor: disabled ? "default" : "pointer"
3235
3324
  },
3236
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3325
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3237
3326
  "svg",
3238
3327
  {
3239
3328
  width: "14",
@@ -3245,16 +3334,16 @@ var ColorPicker = ({
3245
3334
  strokeLinecap: "round",
3246
3335
  strokeLinejoin: "round",
3247
3336
  children: [
3248
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("path", { d: "m19 11-8-8-8.5 8.5a2.12 2.12 0 0 0 0 3l2.5 2.5 1.5-1.5" }),
3249
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("path", { d: "m5 16-3 3 1 1 3-3" }),
3250
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("path", { d: "m14 6 4 4" })
3337
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "m19 11-8-8-8.5 8.5a2.12 2.12 0 0 0 0 3l2.5 2.5 1.5-1.5" }),
3338
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "m5 16-3 3 1 1 3-3" }),
3339
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "m14 6 4 4" })
3251
3340
  ]
3252
3341
  }
3253
3342
  )
3254
3343
  }
3255
3344
  )
3256
3345
  ] }),
3257
- isClipped && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3346
+ isClipped && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3258
3347
  "div",
3259
3348
  {
3260
3349
  role: "note",
@@ -3270,10 +3359,10 @@ var ColorPicker = ({
3270
3359
  borderRadius: "4px",
3271
3360
  alignSelf: "flex-start"
3272
3361
  },
3273
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "\u26A0 Clipped to sRGB" })
3362
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "\u26A0 Clipped to sRGB" })
3274
3363
  }
3275
3364
  ),
3276
- contrastResult && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3365
+ contrastResult && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3277
3366
  "div",
3278
3367
  {
3279
3368
  style: {
@@ -3287,15 +3376,15 @@ var ColorPicker = ({
3287
3376
  border: "1px solid rgba(255,255,255,0.1)"
3288
3377
  },
3289
3378
  children: [
3290
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { children: [
3379
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { children: [
3291
3380
  "Contrast: ",
3292
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("strong", { children: [
3381
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("strong", { children: [
3293
3382
  contrastResult.ratio.toFixed(2),
3294
3383
  ":1"
3295
3384
  ] })
3296
3385
  ] }),
3297
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
3298
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3386
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
3387
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3299
3388
  "span",
3300
3389
  {
3301
3390
  style: {
@@ -3308,7 +3397,7 @@ var ColorPicker = ({
3308
3397
  ]
3309
3398
  }
3310
3399
  ),
3311
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3400
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3312
3401
  "span",
3313
3402
  {
3314
3403
  style: {
@@ -3325,9 +3414,9 @@ var ColorPicker = ({
3325
3414
  ]
3326
3415
  }
3327
3416
  ),
3328
- swatches && swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
3329
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Palette" }),
3330
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: swatches.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3417
+ swatches && swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
3418
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Palette" }),
3419
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: swatches.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3331
3420
  "button",
3332
3421
  {
3333
3422
  type: "button",
@@ -3353,9 +3442,9 @@ var ColorPicker = ({
3353
3442
  `${color}-${idx}`
3354
3443
  )) })
3355
3444
  ] }),
3356
- activeRecent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
3357
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Recent" }),
3358
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: activeRecent.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3445
+ activeRecent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
3446
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Recent" }),
3447
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: activeRecent.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3359
3448
  "button",
3360
3449
  {
3361
3450
  type: "button",
@@ -3388,7 +3477,7 @@ var ColorPicker = ({
3388
3477
  // src/color/DualColorPicker.tsx
3389
3478
  var import_react26 = require("react");
3390
3479
  var import_color2 = require("@pixerate/editor/color");
3391
- var import_jsx_runtime28 = require("react/jsx-runtime");
3480
+ var import_jsx_runtime29 = require("react/jsx-runtime");
3392
3481
  function DualColorPicker({
3393
3482
  value,
3394
3483
  onChange,
@@ -3447,7 +3536,7 @@ function DualColorPicker({
3447
3536
  const activeColor = activeScheme === "dark" ? dual.dark : dual.light;
3448
3537
  const activeContrastTarget = contrastAgainst ? (0, import_color2.resolveColor)(contrastAgainst, activeScheme) ?? void 0 : void 0;
3449
3538
  const dualContrast = contrastAgainst && (0, import_color2.normalizeDualColor)(contrastAgainst) ? (0, import_color2.checkDualColorContrast)(dual, contrastAgainst) : null;
3450
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3539
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3451
3540
  "div",
3452
3541
  {
3453
3542
  className: `pixerate-dual-color-picker ${className}`,
@@ -3466,7 +3555,7 @@ function DualColorPicker({
3466
3555
  boxSizing: "border-box"
3467
3556
  },
3468
3557
  children: [
3469
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3558
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3470
3559
  "div",
3471
3560
  {
3472
3561
  role: "tablist",
@@ -3479,7 +3568,7 @@ function DualColorPicker({
3479
3568
  gap: "2px"
3480
3569
  },
3481
3570
  children: [
3482
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3571
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3483
3572
  "button",
3484
3573
  {
3485
3574
  type: "button",
@@ -3502,7 +3591,7 @@ function DualColorPicker({
3502
3591
  children: "Light"
3503
3592
  }
3504
3593
  ),
3505
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3594
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3506
3595
  "button",
3507
3596
  {
3508
3597
  type: "button",
@@ -3528,8 +3617,8 @@ function DualColorPicker({
3528
3617
  ]
3529
3618
  }
3530
3619
  ),
3531
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
3532
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3620
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
3621
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3533
3622
  "button",
3534
3623
  {
3535
3624
  type: "button",
@@ -3551,7 +3640,7 @@ function DualColorPicker({
3551
3640
  outline: "none"
3552
3641
  },
3553
3642
  children: [
3554
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3643
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3555
3644
  "span",
3556
3645
  {
3557
3646
  style: {
@@ -3563,11 +3652,11 @@ function DualColorPicker({
3563
3652
  }
3564
3653
  }
3565
3654
  ),
3566
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Light" })
3655
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Light" })
3567
3656
  ]
3568
3657
  }
3569
3658
  ),
3570
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3659
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3571
3660
  "button",
3572
3661
  {
3573
3662
  type: "button",
@@ -3589,7 +3678,7 @@ function DualColorPicker({
3589
3678
  outline: "none"
3590
3679
  },
3591
3680
  children: [
3592
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3681
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3593
3682
  "span",
3594
3683
  {
3595
3684
  style: {
@@ -3601,12 +3690,12 @@ function DualColorPicker({
3601
3690
  }
3602
3691
  }
3603
3692
  ),
3604
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Dark" })
3693
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Dark" })
3605
3694
  ]
3606
3695
  }
3607
3696
  )
3608
3697
  ] }),
3609
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3698
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3610
3699
  "div",
3611
3700
  {
3612
3701
  style: {
@@ -3617,7 +3706,7 @@ function DualColorPicker({
3617
3706
  padding: "2px 0"
3618
3707
  },
3619
3708
  children: [
3620
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3709
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3621
3710
  "label",
3622
3711
  {
3623
3712
  htmlFor: sameId,
@@ -3631,7 +3720,7 @@ function DualColorPicker({
3631
3720
  color: "#c4cad4"
3632
3721
  },
3633
3722
  children: [
3634
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3723
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3635
3724
  "input",
3636
3725
  {
3637
3726
  id: sameId,
@@ -3642,11 +3731,11 @@ function DualColorPicker({
3642
3731
  style: { cursor: disabled ? "not-allowed" : "pointer" }
3643
3732
  }
3644
3733
  ),
3645
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Same in both" })
3734
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children: "Same in both" })
3646
3735
  ]
3647
3736
  }
3648
3737
  ),
3649
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3738
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3650
3739
  "button",
3651
3740
  {
3652
3741
  type: "button",
@@ -3668,7 +3757,7 @@ function DualColorPicker({
3668
3757
  ]
3669
3758
  }
3670
3759
  ),
3671
- dualContrast && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3760
+ dualContrast && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3672
3761
  "div",
3673
3762
  {
3674
3763
  "data-testid": "dual-contrast-summary",
@@ -3682,20 +3771,20 @@ function DualColorPicker({
3682
3771
  color: "#8c95a6"
3683
3772
  },
3684
3773
  children: [
3685
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { children: [
3774
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { children: [
3686
3775
  "Light:",
3687
3776
  " ",
3688
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("strong", { style: { color: dualContrast.light.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
3777
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("strong", { style: { color: dualContrast.light.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
3689
3778
  dualContrast.light.ratio.toFixed(2),
3690
3779
  " (",
3691
3780
  dualContrast.light.level,
3692
3781
  ")"
3693
3782
  ] })
3694
3783
  ] }),
3695
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { children: [
3784
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { children: [
3696
3785
  "Dark:",
3697
3786
  " ",
3698
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("strong", { style: { color: dualContrast.dark.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
3787
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("strong", { style: { color: dualContrast.dark.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
3699
3788
  dualContrast.dark.ratio.toFixed(2),
3700
3789
  " (",
3701
3790
  dualContrast.dark.level,
@@ -3705,7 +3794,7 @@ function DualColorPicker({
3705
3794
  ]
3706
3795
  }
3707
3796
  ),
3708
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3797
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3709
3798
  ColorPicker,
3710
3799
  {
3711
3800
  value: activeColor,
@@ -3793,7 +3882,7 @@ __reExport(color_exports, require("@pixerate/editor/color"));
3793
3882
 
3794
3883
  // src/parameters/controls.tsx
3795
3884
  var import_react28 = require("react");
3796
- var import_jsx_runtime29 = require("react/jsx-runtime");
3885
+ var import_jsx_runtime30 = require("react/jsx-runtime");
3797
3886
  var ParameterComponentsContext = (0, import_react28.createContext)({});
3798
3887
  function useParameterComponents() {
3799
3888
  return (0, import_react28.useContext)(ParameterComponentsContext);
@@ -3808,7 +3897,7 @@ function resolveParameterComponents(explicit, context) {
3808
3897
  }
3809
3898
 
3810
3899
  // src/parameters/fields.tsx
3811
- var import_jsx_runtime30 = require("react/jsx-runtime");
3900
+ var import_jsx_runtime31 = require("react/jsx-runtime");
3812
3901
  var parameterInputStyle = import_parameters.parameterThemeStyles.input;
3813
3902
  var parameterSelectStyle = import_parameters.parameterThemeStyles.select;
3814
3903
  var parameterButtonStyle = import_parameters.parameterThemeStyles.button;
@@ -3863,7 +3952,7 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
3863
3952
  if (typeof forwarded === "function") forwarded(el);
3864
3953
  else if (forwarded) forwarded.current = el;
3865
3954
  };
3866
- return multiline ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("textarea", { ...props, ref: setRef, className: `${props.className} h-auto min-h-[3.5rem] py-1` }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("input", { type: "text", ...props, ref: setRef });
3955
+ return multiline ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("textarea", { ...props, ref: setRef, className: `${props.className} h-auto min-h-[3.5rem] py-1` }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("input", { type: "text", ...props, ref: setRef });
3867
3956
  }
3868
3957
  var plainNumber = (field, value) => (0, import_parameters.formatParameterNumber)({ ...field, unit: void 0 }, value);
3869
3958
  function ParameterNumberInput(props) {
@@ -3897,9 +3986,9 @@ function ParameterNumberInput(props) {
3897
3986
  onCommit: handleCommit,
3898
3987
  onKeyDown: handleKeyDown
3899
3988
  };
3900
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
3901
- CustomInput ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CustomInput, { ...inputProps, label: (0, import_parameters.parameterLabel)(field) }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ParameterCommitInput, { ...inputProps }),
3902
- field.unit && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
3989
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
3990
+ CustomInput ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CustomInput, { ...inputProps, label: (0, import_parameters.parameterLabel)(field) }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterCommitInput, { ...inputProps }),
3991
+ field.unit && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
3903
3992
  ] });
3904
3993
  }
3905
3994
  function ParameterSlider(props) {
@@ -3918,7 +4007,7 @@ function ParameterSlider(props) {
3918
4007
  dragging.current = false;
3919
4008
  onGestureEnd?.();
3920
4009
  };
3921
- if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ParameterNumberInput, { ...props });
4010
+ if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterNumberInput, { ...props });
3922
4011
  const step = (0, import_parameters.parameterStep)(field);
3923
4012
  const sliderProps = {
3924
4013
  "aria-label": (0, import_parameters.parameterLabel)(field),
@@ -3932,8 +4021,8 @@ function ParameterSlider(props) {
3932
4021
  className: rangeClass,
3933
4022
  style: parameterRangeStyle
3934
4023
  };
3935
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-2", children: [
3936
- CustomSlider ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4024
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-2", children: [
4025
+ CustomSlider ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
3937
4026
  CustomSlider,
3938
4027
  {
3939
4028
  ...sliderProps,
@@ -3943,7 +4032,7 @@ function ParameterSlider(props) {
3943
4032
  onGestureStart: start,
3944
4033
  onGestureEnd: end
3945
4034
  }
3946
- ) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4035
+ ) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
3947
4036
  "input",
3948
4037
  {
3949
4038
  type: "range",
@@ -3955,11 +4044,11 @@ function ParameterSlider(props) {
3955
4044
  onChange: (e) => onChange((0, import_parameters.clampParameterNumber)(field, Number(e.target.value)))
3956
4045
  }
3957
4046
  ),
3958
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
4047
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
3959
4048
  ] });
3960
4049
  }
3961
4050
  function ParameterToggle({ field, value, onChange, disabled, id }) {
3962
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4051
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
3963
4052
  "button",
3964
4053
  {
3965
4054
  type: "button",
@@ -3970,7 +4059,7 @@ function ParameterToggle({ field, value, onChange, disabled, id }) {
3970
4059
  disabled: disabled || field.readOnly,
3971
4060
  onClick: () => onChange(!value),
3972
4061
  className: `relative inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:opacity-50 ${value ? "bg-primary" : "bg-muted"}`,
3973
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4062
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
3974
4063
  "span",
3975
4064
  {
3976
4065
  className: `pointer-events-none block h-4 w-4 rounded-full bg-background shadow transition-transform ${value ? "translate-x-4" : "translate-x-0.5"}`
@@ -3987,7 +4076,7 @@ function ParameterSelect(props) {
3987
4076
  const options = (0, import_parameters.getChoiceOptions)(field);
3988
4077
  const off = disabled || field.readOnly;
3989
4078
  if (field.control === "segmented") {
3990
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { role: "radiogroup", "aria-label": (0, import_parameters.parameterLabel)(field), className: "inline-flex flex-wrap rounded-md border border-input bg-muted p-0.5", children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4079
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { role: "radiogroup", "aria-label": (0, import_parameters.parameterLabel)(field), className: "inline-flex flex-wrap rounded-md border border-input bg-muted p-0.5", children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
3991
4080
  "button",
3992
4081
  {
3993
4082
  type: "button",
@@ -4004,7 +4093,7 @@ function ParameterSelect(props) {
4004
4093
  }
4005
4094
  if (CustomSelect) {
4006
4095
  const customOptions = options.map((o) => ({ value: o.value, label: (0, import_parameters.choiceOptionLabel)(o), description: o.description }));
4007
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4096
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4008
4097
  CustomSelect,
4009
4098
  {
4010
4099
  id,
@@ -4020,7 +4109,7 @@ function ParameterSelect(props) {
4020
4109
  );
4021
4110
  }
4022
4111
  const index = options.findIndex((o) => o.value === value);
4023
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4112
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4024
4113
  "select",
4025
4114
  {
4026
4115
  id,
@@ -4033,7 +4122,7 @@ function ParameterSelect(props) {
4033
4122
  },
4034
4123
  className: parameterInputClass,
4035
4124
  style: parameterSelectStyle,
4036
- children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: String(i), title: o.description, style: parameterSelectStyle, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
4125
+ children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: String(i), title: o.description, style: parameterSelectStyle, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
4037
4126
  }
4038
4127
  );
4039
4128
  }
@@ -4071,7 +4160,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
4071
4160
  };
4072
4161
  }, [open]);
4073
4162
  if (CustomColor) {
4074
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4163
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4075
4164
  CustomColor,
4076
4165
  {
4077
4166
  id,
@@ -4086,9 +4175,9 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
4086
4175
  }
4087
4176
  );
4088
4177
  }
4089
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
4090
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-2", children: [
4091
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4178
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
4179
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-2", children: [
4180
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4092
4181
  "button",
4093
4182
  {
4094
4183
  ref: buttonRef,
@@ -4099,10 +4188,10 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
4099
4188
  disabled: off,
4100
4189
  onClick: () => setOpen((prev) => !prev),
4101
4190
  className: "relative h-7 w-9 shrink-0 overflow-hidden rounded-md border border-input bg-[repeating-conic-gradient(#d4d4d8_0_25%,#fff_0_50%)] bg-[length:8px_8px] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-50",
4102
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
4191
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
4103
4192
  }
4104
4193
  ),
4105
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4194
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4106
4195
  ParameterCommitInput,
4107
4196
  {
4108
4197
  id,
@@ -4118,7 +4207,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
4118
4207
  }
4119
4208
  )
4120
4209
  ] }),
4121
- open && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4210
+ open && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4122
4211
  "div",
4123
4212
  {
4124
4213
  ref: popoverRef,
@@ -4132,7 +4221,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
4132
4221
  },
4133
4222
  className: "absolute left-0 top-full z-50 mt-1 w-64 rounded-lg border border-border bg-popover p-2 text-popover-foreground shadow-xl",
4134
4223
  style: { background: "var(--popover, var(--background, #fff))" },
4135
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4224
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4136
4225
  ColorPicker,
4137
4226
  {
4138
4227
  value: shown,
@@ -4150,11 +4239,11 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
4150
4239
  }
4151
4240
  function ParameterVector({ field, value, onChange, disabled, id, components }) {
4152
4241
  const size = (0, import_parameters.vectorSize)(field);
4153
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
4242
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
4154
4243
  const component = (0, import_parameters.vectorComponentField)(field, i);
4155
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
4156
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
4157
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4244
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
4245
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
4246
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4158
4247
  ParameterNumberInput,
4159
4248
  {
4160
4249
  field: component,
@@ -4172,11 +4261,11 @@ function ParameterVector({ field, value, onChange, disabled, id, components }) {
4172
4261
  function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
4173
4262
  const off = disabled || field.readOnly;
4174
4263
  const name = (0, import_parameters.parameterLabel)(field);
4175
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "space-y-1.5", children: [
4176
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-2", children: [
4177
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "flex h-12 w-16 shrink-0 items-center justify-center overflow-hidden rounded-md border border-input bg-muted", children: value ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
4178
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
4179
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4264
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "space-y-1.5", children: [
4265
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-2", children: [
4266
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "flex h-12 w-16 shrink-0 items-center justify-center overflow-hidden rounded-md border border-input bg-muted", children: value ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
4267
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
4268
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4180
4269
  ParameterCommitInput,
4181
4270
  {
4182
4271
  id,
@@ -4187,15 +4276,15 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
4187
4276
  onCommit: (text) => onChange(text.trim())
4188
4277
  }
4189
4278
  ),
4190
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex gap-1", children: [
4191
- resolveFile && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
4279
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex gap-1", children: [
4280
+ resolveFile && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
4192
4281
  "label",
4193
4282
  {
4194
4283
  style: parameterButtonStyle,
4195
4284
  className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`,
4196
4285
  children: [
4197
4286
  "Choose file\u2026",
4198
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4287
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4199
4288
  "input",
4200
4289
  {
4201
4290
  type: "file",
@@ -4213,7 +4302,7 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
4213
4302
  ]
4214
4303
  }
4215
4304
  ),
4216
- value && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4305
+ value && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4217
4306
  "button",
4218
4307
  {
4219
4308
  type: "button",
@@ -4228,7 +4317,7 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
4228
4317
  ] })
4229
4318
  ] })
4230
4319
  ] }),
4231
- field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4320
+ field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4232
4321
  "button",
4233
4322
  {
4234
4323
  type: "button",
@@ -4238,14 +4327,14 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
4238
4327
  disabled: off,
4239
4328
  onClick: () => onChange(o.url),
4240
4329
  className: "h-9 w-12 overflow-hidden rounded border border-input aria-pressed:ring-2 aria-pressed:ring-primary",
4241
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
4330
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
4242
4331
  },
4243
4332
  o.url
4244
4333
  )) })
4245
4334
  ] });
4246
4335
  }
4247
4336
  function ParameterText({ field, value, onChange, disabled, id }) {
4248
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4337
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4249
4338
  ParameterCommitInput,
4250
4339
  {
4251
4340
  id,
@@ -4264,24 +4353,24 @@ function ParameterFieldControl({ field, value, onChange, resolveFile, ...rest })
4264
4353
  switch (field.type) {
4265
4354
  case "number":
4266
4355
  case "int":
4267
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
4356
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
4268
4357
  case "boolean":
4269
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
4358
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
4270
4359
  case "choice":
4271
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
4360
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
4272
4361
  case "color":
4273
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
4362
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
4274
4363
  case "vector":
4275
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
4364
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
4276
4365
  case "image":
4277
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
4366
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
4278
4367
  case "text":
4279
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ParameterText, { field, value, onChange: set, ...rest });
4368
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ParameterText, { field, value, onChange: set, ...rest });
4280
4369
  }
4281
4370
  }
4282
4371
 
4283
4372
  // src/effects/EffectParameters.tsx
4284
- var import_jsx_runtime31 = require("react/jsx-runtime");
4373
+ var import_jsx_runtime32 = require("react/jsx-runtime");
4285
4374
  function EffectParameters({
4286
4375
  description,
4287
4376
  values,
@@ -4310,8 +4399,8 @@ function EffectParameters({
4310
4399
  if (preset) onPreset({ ...description.defaults, ...preset.values });
4311
4400
  }
4312
4401
  };
4313
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
4314
- (onPreset || onPresetName) && description.presets.length > 0 && (CustomPresetSelect ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4402
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
4403
+ (onPreset || onPresetName) && description.presets.length > 0 && (CustomPresetSelect ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4315
4404
  CustomPresetSelect,
4316
4405
  {
4317
4406
  "aria-label": `${description.name} presets`,
@@ -4326,7 +4415,7 @@ function EffectParameters({
4326
4415
  ],
4327
4416
  onChange: (name) => handlePresetSelect(String(name))
4328
4417
  }
4329
- ) : /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
4418
+ ) : /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
4330
4419
  "select",
4331
4420
  {
4332
4421
  className: "w-full rounded border border-border px-1 py-0.5 text-xs",
@@ -4336,8 +4425,8 @@ function EffectParameters({
4336
4425
  disabled,
4337
4426
  onChange: (e) => handlePresetSelect(e.currentTarget.value),
4338
4427
  children: [
4339
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: "", style: parameterSelectStyle, children: "Presets\u2026" }),
4340
- description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: p.name, style: parameterSelectStyle, children: p.name }, p.name))
4428
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: "", style: parameterSelectStyle, children: "Presets\u2026" }),
4429
+ description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: p.name, style: parameterSelectStyle, children: p.name }, p.name))
4341
4430
  ]
4342
4431
  }
4343
4432
  )),
@@ -4347,14 +4436,14 @@ function EffectParameters({
4347
4436
  const keyed = keyframed?.has(field.id) ?? false;
4348
4437
  const value = (0, import_effects3.effectFieldValue)(field, values[field.id]);
4349
4438
  const changed = !keyed && !(0, import_parameters2.parameterValuesEqual)(value, field.default);
4350
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
4351
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-1.5", children: [
4352
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
4353
- keyed && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
4439
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
4440
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-1.5", children: [
4441
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
4442
+ keyed && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
4354
4443
  renderControlAddon?.(field.id),
4355
- onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: "rounded px-1 text-[11px] text-muted-foreground hover:text-foreground", "aria-label": `Reset ${label}`, onClick: () => onReset(field.id), children: "\u21BA" })
4444
+ onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: "rounded px-1 text-[11px] text-muted-foreground hover:text-foreground", "aria-label": `Reset ${label}`, onClick: () => onReset(field.id), children: "\u21BA" })
4356
4445
  ] }),
4357
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4446
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4358
4447
  ParameterFieldControl,
4359
4448
  {
4360
4449
  field,
@@ -4369,12 +4458,12 @@ function EffectParameters({
4369
4458
  )
4370
4459
  ] }, field.id);
4371
4460
  }),
4372
- !fields.length && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
4461
+ !fields.length && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
4373
4462
  ] });
4374
4463
  }
4375
4464
 
4376
4465
  // src/paint-editor/PaintEffectsPanel.tsx
4377
- var import_jsx_runtime32 = require("react/jsx-runtime");
4466
+ var import_jsx_runtime33 = require("react/jsx-runtime");
4378
4467
  function usePaintEffectsProvider(controller) {
4379
4468
  const [provider, setProvider] = (0, import_react31.useState)(controller.effectsProvider);
4380
4469
  (0, import_react31.useEffect)(() => {
@@ -4387,25 +4476,25 @@ function usePaintEffectsTools(registry, controller, options = {}) {
4387
4476
  const { id, namespace, readOnly, playbackSurface } = options;
4388
4477
  (0, import_react31.useEffect)(() => {
4389
4478
  if (!registry) return;
4390
- return registry.register((0, import_paint_editor17.createPaintEffectsToolProvider)(controller, { id, namespace, readOnly, playbackSurface }));
4479
+ return registry.register((0, import_paint_editor18.createPaintEffectsToolProvider)(controller, { id, namespace, readOnly, playbackSurface }));
4391
4480
  }, [registry, controller, id, namespace, readOnly, playbackSurface]);
4392
4481
  }
4393
4482
  function Controls({ provider, effect, name, values, apply }) {
4394
4483
  const { description, error } = useEffectDescription(provider, effect);
4395
4484
  const drags = (0, import_react31.useRef)(/* @__PURE__ */ new Set());
4396
- if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("p", { className: "text-[11px] text-slate-400", children: [
4485
+ if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("p", { className: "text-[11px] text-slate-400", children: [
4397
4486
  'No effects provider: "',
4398
4487
  name ?? effect,
4399
4488
  '" is kept as it was drawn.'
4400
4489
  ] });
4401
- if (error) return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-[11px] text-amber-400", children: error });
4402
- if (!description) return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
4490
+ if (error) return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-[11px] text-amber-400", children: error });
4491
+ if (!description) return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
4403
4492
  const commit = (gesture) => {
4404
4493
  if (!gesture || drags.current.has(gesture)) return !gesture;
4405
4494
  drags.current.add(gesture);
4406
4495
  return true;
4407
4496
  };
4408
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4497
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4409
4498
  EffectParameters,
4410
4499
  {
4411
4500
  description,
@@ -4458,28 +4547,28 @@ var PaintEffectsPanel = ({ controller, className }) => {
4458
4547
  };
4459
4548
  const toggle = (b) => setBrowse(browse === b ? null : b);
4460
4549
  const pixel = active?.type === "pixel";
4461
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-effects-panel", "aria-busy": busy, children: [
4462
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
4463
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "flex-1 font-medium text-slate-300", children: "Effects" }),
4464
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paper", onClick: () => toggle("paper"), children: "Paper\u2026" }),
4465
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => toggle("layer"), children: "Layer\u2026" }),
4466
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "fill", onClick: () => toggle("fill"), children: "Fill\u2026" }),
4467
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "light", onClick: () => toggle("light"), title: "Bake a light, glow or grade into the active layer's dried paint", children: "Light\u2026" }),
4468
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paint", onClick: () => toggle("paint"), title: "Paint with an effect: brushes take each pixel's colour from it", children: "Paint\u2026" })
4550
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-effects-panel", "aria-busy": busy, children: [
4551
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
4552
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "flex-1 font-medium text-slate-300", children: "Effects" }),
4553
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paper", onClick: () => toggle("paper"), children: "Paper\u2026" }),
4554
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => toggle("layer"), children: "Layer\u2026" }),
4555
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "fill", onClick: () => toggle("fill"), children: "Fill\u2026" }),
4556
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "light", onClick: () => toggle("light"), title: "Bake a light, glow or grade into the active layer's dried paint", children: "Light\u2026" }),
4557
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paint", onClick: () => toggle("paint"), title: "Paint with an effect: brushes take each pixel's colour from it", children: "Paint\u2026" })
4469
4558
  ] }),
4470
- !provider && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the painting are kept." }),
4471
- browse && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(EffectsBrowser, { provider, uses: BROWSERS[browse].uses, title: BROWSERS[browse].title, onPick: (e) => pick(e.id) }),
4472
- paper && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paper", children: [
4473
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-1", children: [
4474
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "flex-1 truncate", children: [
4559
+ !provider && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the painting are kept." }),
4560
+ browse && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(EffectsBrowser, { provider, uses: BROWSERS[browse].uses, title: BROWSERS[browse].title, onPick: (e) => pick(e.id) }),
4561
+ paper && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paper", children: [
4562
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-1", children: [
4563
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "flex-1 truncate", children: [
4475
4564
  "Paper: ",
4476
4565
  paper.name ?? paper.effect
4477
4566
  ] }),
4478
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button, "aria-label": "Remove the effect paper", onClick: () => run(() => controller.setPaperEffect(null)), children: "\u2715" })
4567
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: button, "aria-label": "Remove the effect paper", onClick: () => run(() => controller.setPaperEffect(null)), children: "\u2715" })
4479
4568
  ] }),
4480
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
4481
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Opacity" }),
4482
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4569
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
4570
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Opacity" }),
4571
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4483
4572
  "input",
4484
4573
  {
4485
4574
  type: "range",
@@ -4501,43 +4590,43 @@ var PaintEffectsPanel = ({ controller, className }) => {
4501
4590
  `o${paper.opacity}`
4502
4591
  )
4503
4592
  ] }),
4504
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
4505
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Blend" }),
4506
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("select", { className: "flex-1 rounded bg-slate-800 px-1 py-0.5 text-[11px]", "aria-label": "Effect paper blend", value: paper.blend, onChange: (e) => {
4593
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
4594
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Blend" }),
4595
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("select", { className: "flex-1 rounded bg-slate-800 px-1 py-0.5 text-[11px]", "aria-label": "Effect paper blend", value: paper.blend, onChange: (e) => {
4507
4596
  const blend = e.currentTarget.value;
4508
4597
  run(() => controller.updatePaperEffect({ blend }));
4509
- }, children: import_paint_editor17.PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: b, children: b }, b)) })
4598
+ }, children: import_paint_editor18.PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("option", { value: b, children: b }, b)) })
4510
4599
  ] }),
4511
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Controls, { provider, effect: paper.effect, name: paper.name, values: paper.values, apply: (values, commit) => run(() => controller.updatePaperEffect({ values }, commit)) })
4600
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Controls, { provider, effect: paper.effect, name: paper.name, values: paper.values, apply: (values, commit) => run(() => controller.updatePaperEffect({ values }, commit)) })
4512
4601
  ] }),
4513
- effectPaint && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paint", children: [
4514
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-1", children: [
4515
- thumbnail ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("img", { src: thumbnail, alt: "", className: "h-5 w-8 rounded object-cover ring-1 ring-slate-700", "data-testid": "effect-paint-thumbnail" }) : null,
4516
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "flex-1 truncate", children: [
4602
+ effectPaint && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paint", children: [
4603
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-1", children: [
4604
+ thumbnail ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("img", { src: thumbnail, alt: "", className: "h-5 w-8 rounded object-cover ring-1 ring-slate-700", "data-testid": "effect-paint-thumbnail" }) : null,
4605
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "flex-1 truncate", children: [
4517
4606
  "Paint: ",
4518
4607
  effectPaint.effect,
4519
4608
  state.effectPaintRendering ? " (rendering\u2026)" : ""
4520
4609
  ] }),
4521
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button, "aria-label": "Stop painting with the effect", onClick: () => attempt(() => controller.setColor(state.color)), children: "\u2715" })
4610
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: button, "aria-label": "Stop painting with the effect", onClick: () => attempt(() => controller.setColor(state.color)), children: "\u2715" })
4522
4611
  ] }),
4523
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-wrap items-center gap-2", "data-testid": "effect-paint-placement", children: [
4524
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", title: "Lay the effect along each stroke instead of fixing it to the canvas", children: [
4525
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("input", { type: "checkbox", checked: effectPaint.map?.by === "stroke", onChange: (e) => repaint({ map: e.target.checked ? { by: "stroke", length: 300, repeat: "repeat" } : { by: "canvas" } }) }),
4612
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-wrap items-center gap-2", "data-testid": "effect-paint-placement", children: [
4613
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", title: "Lay the effect along each stroke instead of fixing it to the canvas", children: [
4614
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("input", { type: "checkbox", checked: effectPaint.map?.by === "stroke", onChange: (e) => repaint({ map: e.target.checked ? { by: "stroke", length: 300, repeat: "repeat" } : { by: "canvas" } }) }),
4526
4615
  "Along the stroke"
4527
4616
  ] }),
4528
- hasPathControl && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", title: "Pass each stroke's centreline to the effect's own path control", children: [
4529
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("input", { type: "checkbox", checked: effectPaint.map?.by === "path", onChange: (e) => repaint({ map: e.target.checked ? { by: "path" } : { by: "canvas" } }) }),
4617
+ hasPathControl && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", title: "Pass each stroke's centreline to the effect's own path control", children: [
4618
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("input", { type: "checkbox", checked: effectPaint.map?.by === "path", onChange: (e) => repaint({ map: e.target.checked ? { by: "path" } : { by: "canvas" } }) }),
4530
4619
  "Along the stroke (native)"
4531
4620
  ] }),
4532
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", title: "Strokes on a stroke layer keep playing the effect", children: [
4533
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("input", { type: "checkbox", checked: Boolean(effectPaint.live), onChange: (e) => repaint({ live: e.target.checked }) }),
4621
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", title: "Strokes on a stroke layer keep playing the effect", children: [
4622
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("input", { type: "checkbox", checked: Boolean(effectPaint.live), onChange: (e) => repaint({ live: e.target.checked }) }),
4534
4623
  "Live"
4535
4624
  ] })
4536
4625
  ] }),
4537
- effectPaint.map?.by === "stroke" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
4538
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
4539
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-slate-400", children: "Length" }),
4540
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4626
+ effectPaint.map?.by === "stroke" && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
4627
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
4628
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-slate-400", children: "Length" }),
4629
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4541
4630
  "input",
4542
4631
  {
4543
4632
  type: "number",
@@ -4551,43 +4640,43 @@ var PaintEffectsPanel = ({ controller, className }) => {
4551
4640
  effectPaint.map.length
4552
4641
  )
4553
4642
  ] }),
4554
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("select", { "aria-label": "Effect repeat", value: effectPaint.map.repeat, onChange: (e) => repaint({ map: { ...effectPaint.map, repeat: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: [
4555
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: "repeat", children: "Repeat" }),
4556
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: "mirror", children: "Mirror" }),
4557
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: "clamp", children: "Clamp" })
4643
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("select", { "aria-label": "Effect repeat", value: effectPaint.map.repeat, onChange: (e) => repaint({ map: { ...effectPaint.map, repeat: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: [
4644
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("option", { value: "repeat", children: "Repeat" }),
4645
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("option", { value: "mirror", children: "Mirror" }),
4646
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("option", { value: "clamp", children: "Clamp" })
4558
4647
  ] })
4559
4648
  ] }),
4560
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Controls, { provider, effect: effectPaint.effect, values: effectPaint.values, apply: (values) => repaint({ values: { ...effectPaint.values, ...values } }) })
4649
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Controls, { provider, effect: effectPaint.effect, values: effectPaint.values, apply: (values) => repaint({ values: { ...effectPaint.values, ...values } }) })
4561
4650
  ] }),
4562
- animation && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-2 rounded border border-slate-700 p-1", "data-effect-part": "playback", children: [
4563
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "flex-1 truncate", children: [
4651
+ animation && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-2 rounded border border-slate-700 p-1", "data-effect-part": "playback", children: [
4652
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "flex-1 truncate", children: [
4564
4653
  "Live paint: ",
4565
4654
  animation.strokes,
4566
4655
  " ",
4567
4656
  animation.strokes === 1 ? "stroke" : "strokes"
4568
4657
  ] }),
4569
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button, "aria-pressed": playback.playing, onClick: () => attempt(() => controller.setEffectPlayback({ playing: !playback.playing })), children: playback.playing ? "Pause" : "Play" }),
4570
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "flex items-center gap-1", children: [
4571
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-slate-400", children: "fps" }),
4572
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("input", { type: "number", "aria-label": "Live paint frame rate", min: 1, max: 60, value: playback.fps, onChange: (e) => attempt(() => controller.setEffectPlayback({ fps: Math.round(Number(e.target.value)) })), className: "w-12 rounded bg-slate-800 px-1 py-0.5" })
4658
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: button, "aria-pressed": playback.playing, onClick: () => attempt(() => controller.setEffectPlayback({ playing: !playback.playing })), children: playback.playing ? "Pause" : "Play" }),
4659
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: "flex items-center gap-1", children: [
4660
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-slate-400", children: "fps" }),
4661
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("input", { type: "number", "aria-label": "Live paint frame rate", min: 1, max: 60, value: playback.fps, onChange: (e) => attempt(() => controller.setEffectPlayback({ fps: Math.round(Number(e.target.value)) })), className: "w-12 rounded bg-slate-800 px-1 py-0.5" })
4573
4662
  ] })
4574
4663
  ] }),
4575
- layerEffect && activeId && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "layer", children: [
4576
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-1", children: [
4577
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "flex-1 truncate", children: [
4664
+ layerEffect && activeId && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "layer", children: [
4665
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-1", children: [
4666
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "flex-1 truncate", children: [
4578
4667
  "Layer: ",
4579
4668
  layerEffect.name ?? layerEffect.effect
4580
4669
  ] }),
4581
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { type: "button", className: button, title: "Keep the pixels as a plain layer", onClick: () => attempt(() => controller.rasterizeEffectLayer(activeId)), children: "Rasterize" })
4670
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: button, title: "Keep the pixels as a plain layer", onClick: () => attempt(() => controller.rasterizeEffectLayer(activeId)), children: "Rasterize" })
4582
4671
  ] }),
4583
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Controls, { provider, effect: layerEffect.effect, name: layerEffect.name, values: layerEffect.values, apply: (values, commit) => run(() => controller.updateEffectLayer(activeId, { values }, commit)) })
4672
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Controls, { provider, effect: layerEffect.effect, name: layerEffect.name, values: layerEffect.values, apply: (values, commit) => run(() => controller.updateEffectLayer(activeId, { values }, commit)) })
4584
4673
  ] }),
4585
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ErrorLine, { error })
4674
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ErrorLine, { error })
4586
4675
  ] });
4587
4676
  };
4588
4677
 
4589
4678
  // src/paint-editor/PaintEditor.tsx
4590
- var import_jsx_runtime33 = require("react/jsx-runtime");
4679
+ var import_jsx_runtime34 = require("react/jsx-runtime");
4591
4680
  var PAINT_CONTROLS = {
4592
4681
  "mixing-pad": '[data-testid="mixing-pad"]',
4593
4682
  lighting: '[data-testid="light-panel"]',
@@ -4600,7 +4689,7 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, ag
4600
4689
  const tabRef = (0, import_react32.useRef)(tab);
4601
4690
  tabRef.current = tab;
4602
4691
  const rootRef = (0, import_react32.useRef)(null);
4603
- const [ownPresence] = (0, import_react32.useState)(() => new import_paint_editor18.PaintPresence());
4692
+ const [ownPresence] = (0, import_react32.useState)(() => new import_paint_editor19.PaintPresence());
4604
4693
  const ambientPlayback = useAgentPlayback();
4605
4694
  const playing = (playback === void 0 ? ambientPlayback : playback) ?? null;
4606
4695
  const viewBox = () => {
@@ -4611,12 +4700,12 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, ag
4611
4700
  const docToClient = (p) => {
4612
4701
  const r = viewBox();
4613
4702
  if (!r) return null;
4614
- const q = (0, import_paint_editor18.documentToScreen)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x, p.y);
4703
+ const q = (0, import_paint_editor19.documentToScreen)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x, p.y);
4615
4704
  return { x: r.left + q.x, y: r.top + q.y };
4616
4705
  };
4617
4706
  const clientToDoc = (p) => {
4618
4707
  const r = viewBox();
4619
- return r ? (0, import_paint_editor18.screenToDocument)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x - r.left, p.y - r.top) : null;
4708
+ return r ? (0, import_paint_editor19.screenToDocument)(controller.getState().view, controller.document.canvas, { width: r.width, height: r.height }, p.x - r.left, p.y - r.top) : null;
4620
4709
  };
4621
4710
  const elementRect = (selector) => {
4622
4711
  const r = rootRef.current?.querySelector(selector)?.getBoundingClientRect();
@@ -4659,27 +4748,27 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, ag
4659
4748
  const [error, setError] = (0, import_react32.useState)(null);
4660
4749
  const effects = usePaintEffectsProvider(controller);
4661
4750
  const tabs = effects ? ["color", "wet", "paper", "layers", "effects"] : ["color", "wet", "paper", "layers"];
4662
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { ref: rootRef, className: `relative flex flex-col gap-2 rounded-xl border border-slate-800 bg-slate-900 p-2 ${className ?? ""}`, style: { height }, "data-testid": "paint-editor", children: [
4663
- playing && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PresenceLayer, { presence: agentPresence, viewport: docToRoot }),
4664
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PaintToolbar, { controller, tool, onToolChange: setTool, fillOptions, onFillOptionsChange: setFillOptions, fileName }),
4665
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex min-h-0 flex-1 gap-2", children: [
4666
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(BrushPanel, { controller, className: "w-60 shrink-0 overflow-y-auto pr-1" }),
4667
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
4668
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PaintCanvas, { controller, tool, fillOptions, onError: setError, presence: playing ? void 0 : presence, proposals, agentStrokes, deviceTilt, className: "flex-1 rounded-lg" }),
4669
- error && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { role: "alert", className: "mt-1 text-[11px] text-rose-400", children: error })
4751
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { ref: rootRef, className: `relative flex flex-col gap-2 rounded-xl border border-slate-800 bg-slate-900 p-2 ${className ?? ""}`, style: { height }, "data-testid": "paint-editor", children: [
4752
+ playing && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PresenceLayer, { presence: agentPresence, viewport: docToRoot }),
4753
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PaintToolbar, { controller, tool, onToolChange: setTool, fillOptions, onFillOptionsChange: setFillOptions, fileName }),
4754
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex min-h-0 flex-1 gap-2", children: [
4755
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(BrushPanel, { controller, className: "w-60 shrink-0 overflow-y-auto pr-1" }),
4756
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
4757
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PaintCanvas, { controller, tool, fillOptions, onError: setError, presence: playing ? void 0 : presence, proposals, agentStrokes, deviceTilt, className: "flex-1 rounded-lg" }),
4758
+ error && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { role: "alert", className: "mt-1 text-[11px] text-rose-400", children: error })
4670
4759
  ] }),
4671
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex w-64 shrink-0 flex-col gap-2 overflow-y-auto pr-1", children: [
4672
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex gap-1", role: "tablist", "aria-label": "Paint panels", children: tabs.map((t) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", role: "tab", "aria-selected": tab === t, "data-paint-tab": t, className: chip(tab === t), onClick: () => setTab(t), children: t === "color" ? "Colour" : t === "wet" ? "Wet" : t === "paper" ? "Paper" : t === "layers" ? "Layers" : "Effects" }, t)) }),
4673
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col gap-2", "data-paint-panel": tab, children: [
4674
- tab === "color" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ColorPanel, { controller }),
4675
- tab === "wet" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(WetPanel, { controller }),
4676
- tab === "paper" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PaperPanel, { controller }),
4677
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PaintLayersPanel, { controller }),
4678
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(StrokePanel, { controller }),
4679
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PathStrokePanel, { controller }),
4680
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(EvolutionPanel, { controller, proposals }),
4681
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(StickerPanel, { controller }),
4682
- tab === "effects" && effects && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PaintEffectsPanel, { controller })
4760
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex w-64 shrink-0 flex-col gap-2 overflow-y-auto pr-1", children: [
4761
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex gap-1", role: "tablist", "aria-label": "Paint panels", children: tabs.map((t) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", role: "tab", "aria-selected": tab === t, "data-paint-tab": t, className: chip(tab === t), onClick: () => setTab(t), children: t === "color" ? "Colour" : t === "wet" ? "Wet" : t === "paper" ? "Paper" : t === "layers" ? "Layers" : "Effects" }, t)) }),
4762
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-2", "data-paint-panel": tab, children: [
4763
+ tab === "color" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ColorPanel, { controller }),
4764
+ tab === "wet" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(WetPanel, { controller }),
4765
+ tab === "paper" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PaperPanel, { controller }),
4766
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PaintLayersPanel, { controller }),
4767
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(StrokePanel, { controller }),
4768
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PathStrokePanel, { controller }),
4769
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(EvolutionPanel, { controller, proposals }),
4770
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(StickerPanel, { controller }),
4771
+ tab === "effects" && effects && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PaintEffectsPanel, { controller })
4683
4772
  ] })
4684
4773
  ] })
4685
4774
  ] })
@@ -4691,6 +4780,7 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, proposals, ag
4691
4780
  BrushLibraryBrowser,
4692
4781
  BrushPanel,
4693
4782
  ColorPanel,
4783
+ CulturePanel,
4694
4784
  EvolutionPanel,
4695
4785
  FerroPanel,
4696
4786
  PaintCanvas,