@pixerate/editor-react 0.166.0 → 0.169.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.
@@ -803,6 +803,33 @@ var BrushPanel = ({ controller, thumbnailWidth = 112, thumbnailHeight = 32, clas
803
803
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
804
804
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-slate-400", children: "Drawn as" }),
805
805
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("select", { "aria-label": "Particle render", value: brush.particle.render, onChange: (e) => controller.setBrush({ particle: { render: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor5.PARTICLE_RENDERS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: k, children: import_paint_editor5.PARTICLE_RENDER_LABELS[k] }, k)) })
806
+ ] }),
807
+ brush.particle.render === "ribbon" && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
808
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-slate-400", children: "Ribbon joins" }),
809
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("select", { "aria-label": "Ribbon pairs", value: brush.particle.ribbonPairs, onChange: (e) => controller.setBrush({ particle: { ribbonPairs: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor5.RIBBON_PAIRS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: k, children: import_paint_editor5.RIBBON_PAIR_LABELS[k] }, k)) })
810
+ ] }),
811
+ (brush.particle.render === "dot" || brush.particle.render === "sequence") && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
812
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex flex-wrap gap-1", role: "group", "aria-label": "Dot textures", title: "Stamps drawn instead of round dots (up to 4; none: round)", children: import_paint_editor5.STAMP_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
813
+ "button",
814
+ {
815
+ type: "button",
816
+ "aria-pressed": brush.particle.dotTextures.includes(k),
817
+ className: `px-1.5 py-0.5 rounded text-[10px] ${brush.particle.dotTextures.includes(k) ? "bg-indigo-600 text-white" : "bg-slate-800 text-slate-300"}`,
818
+ onClick: () => controller.setBrush({ particle: { dotTextures: (0, import_paint_editor5.toggleDotTexture)(brush.particle.dotTextures, k) } }),
819
+ children: import_paint_editor5.STAMP_LABELS[k]
820
+ },
821
+ k
822
+ )) }),
823
+ brush.particle.dotTextures.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
824
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
825
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-slate-400", children: "Texture order" }),
826
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("select", { "aria-label": "Dot texture order", value: brush.particle.dotTextureOrder, onChange: (e) => controller.setBrush({ particle: { dotTextureOrder: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor5.DOT_TEXTURE_ORDERS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: k, children: import_paint_editor5.DOT_TEXTURE_ORDER_LABELS[k] }, k)) })
827
+ ] }),
828
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
829
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-slate-400", children: "Texture turn" }),
830
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("select", { "aria-label": "Dot rotation", value: brush.particle.dotRotation, onChange: (e) => controller.setBrush({ particle: { dotRotation: e.target.value } }), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor5.DOT_ROTATIONS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: k, children: import_paint_editor5.DOT_ROTATION_LABELS[k] }, k)) })
831
+ ] })
832
+ ] })
806
833
  ] })
807
834
  ] }),
808
835
  engine.stickerStamps && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex flex-wrap gap-1", role: "group", "aria-label": "Sticker stamps", children: import_paint_editor5.STAMP_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
@@ -1152,9 +1179,246 @@ var ColorPanel = ({ controller, wheelSize = 168, mixingPad = true, className })
1152
1179
  };
1153
1180
 
1154
1181
  // src/paint-editor/PaintLayersPanel.tsx
1155
- var import_react9 = require("react");
1182
+ var import_react11 = require("react");
1156
1183
  var import_paint_editor10 = require("@pixerate/editor/paint-editor");
1184
+
1185
+ // src/image-editor/LayerEffectsPanel.tsx
1186
+ var import_react10 = require("react");
1187
+ var import_raster = require("@pixerate/editor/raster");
1188
+
1189
+ // src/image-editor/styles.ts
1190
+ var imageIconButtonClass = "px-1.5 py-0.5 rounded text-[10px] bg-muted text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
1191
+ var imageSelectClass = "rounded border border-input bg-background px-1.5 py-1 text-foreground";
1192
+ var imageColorInputClass = "h-6 w-8 rounded border border-border bg-transparent";
1193
+
1194
+ // src/image-editor/controls/controls.tsx
1195
+ var import_react9 = require("react");
1157
1196
  var import_jsx_runtime9 = require("react/jsx-runtime");
1197
+ var ControlsContext = (0, import_react9.createContext)({});
1198
+ function useImageEditorControls() {
1199
+ return (0, import_react9.useContext)(ControlsContext);
1200
+ }
1201
+ function ImageCheckbox(props) {
1202
+ const Host = useImageEditorControls().Checkbox;
1203
+ if (Host) return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Host, { ...props });
1204
+ const { checked, label, disabled, onChange, className = "" } = props;
1205
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1206
+ "input",
1207
+ {
1208
+ type: "checkbox",
1209
+ "aria-label": label,
1210
+ checked,
1211
+ disabled,
1212
+ onChange: (e) => onChange(e.target.checked),
1213
+ className: `accent-primary ${className}`
1214
+ }
1215
+ );
1216
+ }
1217
+ function ImageRange(props) {
1218
+ const Host = useImageEditorControls().Range;
1219
+ if (Host) return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Host, { ...props });
1220
+ const { value, min, max, step, label, disabled, onChange, onStart, onEnd, className = "" } = props;
1221
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1222
+ "input",
1223
+ {
1224
+ type: "range",
1225
+ "aria-label": label,
1226
+ min,
1227
+ max,
1228
+ step,
1229
+ value,
1230
+ disabled,
1231
+ onPointerDown: () => onStart?.(),
1232
+ onPointerUp: () => onEnd?.(),
1233
+ onKeyDown: () => onStart?.(),
1234
+ onKeyUp: () => onEnd?.(),
1235
+ onChange: (e) => onChange(Number(e.target.value)),
1236
+ className: `w-full accent-primary disabled:opacity-40 ${className}`
1237
+ }
1238
+ );
1239
+ }
1240
+ function ImageSelect(props) {
1241
+ const Host = useImageEditorControls().Select;
1242
+ if (Host) return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Host, { ...props });
1243
+ const { value, options, label, placeholder, disabled, onChange, className = "" } = props;
1244
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("select", { "aria-label": label, value, disabled, onChange: (e) => onChange(e.target.value), className: `${imageSelectClass} ${className}`, children: [
1245
+ placeholder !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "", children: placeholder }),
1246
+ options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: o.value, children: o.label }, o.value))
1247
+ ] });
1248
+ }
1249
+ function ImageColor(props) {
1250
+ const Host = useImageEditorControls().Color;
1251
+ if (Host) return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Host, { ...props });
1252
+ const { value, label, alpha, disabled, onChange, className = "" } = props;
1253
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1254
+ "input",
1255
+ {
1256
+ type: "color",
1257
+ "aria-label": label,
1258
+ value: value.slice(0, 7),
1259
+ disabled,
1260
+ onChange: (e) => onChange(e.target.value + (alpha ? value.slice(7, 9) : "")),
1261
+ className: `${imageColorInputClass} ${className}`
1262
+ }
1263
+ );
1264
+ }
1265
+
1266
+ // src/image-editor/LayerEffectsPanel.tsx
1267
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1268
+ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) => {
1269
+ const [, setTick] = (0, import_react10.useState)(0);
1270
+ (0, import_react10.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
1271
+ const [open, setOpen] = (0, import_react10.useState)(null);
1272
+ const [error, setError] = (0, import_react10.useState)(null);
1273
+ const commitNext = (0, import_react10.useRef)(true);
1274
+ const layer = layerId ? controller.getLayer(layerId) : controller.getActiveLayer();
1275
+ const model = (0, import_raster.layerEffectsPanel)(layer);
1276
+ const id = layer?.id;
1277
+ const attempt = (fn) => {
1278
+ try {
1279
+ setError(null);
1280
+ fn();
1281
+ } catch (err) {
1282
+ setError(err instanceof Error ? err.message : String(err));
1283
+ }
1284
+ };
1285
+ if (!model.available || !id) {
1286
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: `text-xs text-muted-foreground ${className ?? ""}`, "data-testid": "layer-effects", children: model.reason });
1287
+ }
1288
+ const effects = controller.getLayerEffects(id);
1289
+ const patterns = controller.getDocumentPatterns();
1290
+ const change = (effectId, control, value, drag = false) => attempt(() => {
1291
+ const effect = controller.getLayerEffects(id).items.find((e) => e.id === effectId);
1292
+ controller.updateLayerEffect(id, effectId, (0, import_raster.effectControlChange)(effect, control.key, value, patterns), drag ? commitNext.current : true);
1293
+ if (drag) commitNext.current = false;
1294
+ });
1295
+ const renderControl = (effectId, c) => {
1296
+ const label = `${c.label}`;
1297
+ switch (c.type) {
1298
+ case "range": {
1299
+ const k = c.percent ? 100 : 1;
1300
+ const shown = Math.round(c.value * k * 100) / 100;
1301
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1302
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-muted-foreground", children: [
1303
+ label,
1304
+ " ",
1305
+ shown,
1306
+ c.unit
1307
+ ] }),
1308
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1309
+ ImageRange,
1310
+ {
1311
+ label,
1312
+ min: c.min * k,
1313
+ max: c.max * k,
1314
+ step: c.step * k,
1315
+ value: shown,
1316
+ disabled: model.readOnly,
1317
+ onStart: () => commitNext.current = true,
1318
+ onEnd: () => commitNext.current = true,
1319
+ onChange: (v) => change(effectId, c, v / k, true)
1320
+ }
1321
+ )
1322
+ ] }, c.key);
1323
+ }
1324
+ case "color":
1325
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
1326
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ImageColor, { label, value: c.value, disabled: model.readOnly, onChange: (v) => change(effectId, c, v) }),
1327
+ label
1328
+ ] }, c.key);
1329
+ case "checkbox":
1330
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
1331
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ImageCheckbox, { label, checked: c.value, disabled: model.readOnly, onChange: (on) => change(effectId, c, on) }),
1332
+ label
1333
+ ] }, c.key);
1334
+ case "select":
1335
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex flex-col gap-0.5", children: [
1336
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-muted-foreground", children: label }),
1337
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1338
+ ImageSelect,
1339
+ {
1340
+ label,
1341
+ value: String(c.value),
1342
+ disabled: model.readOnly,
1343
+ options: c.options.map((o) => ({ value: String(o.value), label: o.label })),
1344
+ onChange: (v) => change(effectId, c, v)
1345
+ }
1346
+ )
1347
+ ] }, c.key);
1348
+ }
1349
+ };
1350
+ return /* @__PURE__ */ (0, import_jsx_runtime10.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: [
1351
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
1352
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "font-semibold text-foreground", children: heading ? "Layer Style" : "Styles" }),
1353
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex items-center gap-1 text-foreground", children: [
1354
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ImageCheckbox, { label: "Effects on", checked: model.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.setLayerEffectsEnabled(id, on)) }),
1355
+ "On"
1356
+ ] }),
1357
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
1358
+ "Scale",
1359
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1360
+ "input",
1361
+ {
1362
+ type: "number",
1363
+ "aria-label": "Scale effects",
1364
+ min: 1,
1365
+ max: 1e3,
1366
+ step: 1,
1367
+ value: Math.round(model.scale * 100),
1368
+ disabled: model.readOnly,
1369
+ onChange: (e) => {
1370
+ const v = Number(e.target.value);
1371
+ if (v >= 1 && v <= 1e3) attempt(() => controller.setLayerEffectsEnabled(id, model.enabled, v / 100));
1372
+ },
1373
+ className: "w-14 bg-muted border border-border rounded px-1"
1374
+ }
1375
+ ),
1376
+ "%"
1377
+ ] }),
1378
+ heading && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1379
+ ImageSelect,
1380
+ {
1381
+ label: "Add style",
1382
+ value: "",
1383
+ placeholder: "Add style\u2026",
1384
+ disabled: model.readOnly,
1385
+ options: import_raster.LAYER_EFFECT_MENU.map((m) => ({ value: m.kind, label: m.label })),
1386
+ onChange: (v) => {
1387
+ const kind = v;
1388
+ if (!kind) return;
1389
+ attempt(() => setOpen(controller.addLayerEffect(id, kind).effect.id));
1390
+ }
1391
+ }
1392
+ )
1393
+ ] }),
1394
+ model.readOnly && model.reason && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-muted-foreground", children: model.reason }),
1395
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { className: "flex flex-col gap-1", "aria-label": "Effects", children: model.rows.map((row) => {
1396
+ const effect = effects.items.find((e) => e.id === row.id);
1397
+ const expanded = open === row.id;
1398
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("li", { "data-effect-id": row.id, className: "rounded bg-background/60 ring-1 ring-border", children: [
1399
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1.5 px-1.5 py-1", children: [
1400
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ImageCheckbox, { label: `${row.label} on`, checked: row.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.updateLayerEffect(id, row.id, { enabled: on })) }),
1401
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1402
+ "button",
1403
+ {
1404
+ type: "button",
1405
+ "aria-expanded": expanded,
1406
+ className: `flex-1 text-left ${row.enabled && model.enabled ? "" : "text-muted-foreground"}`,
1407
+ onClick: () => setOpen(expanded ? null : row.id),
1408
+ children: row.label
1409
+ }
1410
+ ),
1411
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: imageIconButtonClass, "aria-label": `Remove ${row.label}`, disabled: model.readOnly, onClick: () => attempt(() => controller.removeLayerEffect(id, row.id)), children: "\u2715" })
1412
+ ] }),
1413
+ expanded && /* @__PURE__ */ (0, import_jsx_runtime10.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)) })
1414
+ ] }, row.id);
1415
+ }) }),
1416
+ error && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { role: "alert", className: "text-destructive", children: error })
1417
+ ] });
1418
+ };
1419
+
1420
+ // src/paint-editor/PaintLayersPanel.tsx
1421
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1158
1422
  function siblingIndex(layers, l) {
1159
1423
  const sibs = layers.filter((x) => x.parentId === l.parentId).reverse();
1160
1424
  return { index: sibs.findIndex((x) => x.id === l.id), count: sibs.length };
@@ -1162,7 +1426,7 @@ function siblingIndex(layers, l) {
1162
1426
  var PaintLayersPanel = ({ controller, className }) => {
1163
1427
  usePaintEditorState(controller);
1164
1428
  const [error, attempt] = useAttempt();
1165
- const [renaming, setRenaming] = (0, import_react9.useState)(null);
1429
+ const [renaming, setRenaming] = (0, import_react11.useState)(null);
1166
1430
  const layers = controller.listLayers();
1167
1431
  const active = layers.find((l) => l.active) ?? null;
1168
1432
  const light = active?.type === "pixel" ? controller.lightOf(active.id) : null;
@@ -1172,18 +1436,18 @@ var PaintLayersPanel = ({ controller, className }) => {
1172
1436
  const to = Math.min(count - 1, Math.max(0, index + delta));
1173
1437
  if (to !== index) attempt(() => controller.moveLayer(active.id, to));
1174
1438
  };
1175
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-layers-panel", children: [
1176
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1177
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer()), children: "New layer" }),
1178
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer({ type: "group" })), children: "New group" }),
1179
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: button, title: "A layer whose strokes stay editable", onClick: () => attempt(() => controller.addLayer({ type: "strokes" })), children: "New stroke layer" }),
1180
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.duplicateLayer(active.id)), children: "Duplicate" }),
1181
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer up", onClick: () => move(1), children: "\u2191" }),
1182
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer down", onClick: () => move(-1), children: "\u2193" }),
1183
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.mergeDown(active.id)), children: "Merge down" }),
1184
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: button, disabled: !active || layers.length < 2, onClick: () => active && attempt(() => controller.removeLayer(active.id)), children: "Delete" })
1439
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-layers-panel", children: [
1440
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1441
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer()), children: "New layer" }),
1442
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.addLayer({ type: "group" })), children: "New group" }),
1443
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: button, title: "A layer whose strokes stay editable", onClick: () => attempt(() => controller.addLayer({ type: "strokes" })), children: "New stroke layer" }),
1444
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.duplicateLayer(active.id)), children: "Duplicate" }),
1445
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer up", onClick: () => move(1), children: "\u2191" }),
1446
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: button, disabled: !active, "aria-label": "Move layer down", onClick: () => move(-1), children: "\u2193" }),
1447
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: button, disabled: !active, onClick: () => active && attempt(() => controller.mergeDown(active.id)), children: "Merge down" }),
1448
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: button, disabled: !active || layers.length < 2, onClick: () => active && attempt(() => controller.removeLayer(active.id)), children: "Delete" })
1185
1449
  ] }),
1186
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ul", { role: "tree", "aria-label": "Layers", className: "flex flex-col gap-0.5", children: layers.map((l) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1450
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("ul", { role: "tree", "aria-label": "Layers", className: "flex flex-col gap-0.5", children: layers.map((l) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1187
1451
  "li",
1188
1452
  {
1189
1453
  role: "treeitem",
@@ -1192,7 +1456,7 @@ var PaintLayersPanel = ({ controller, className }) => {
1192
1456
  style: { paddingLeft: 6 + l.depth * 12 },
1193
1457
  onClick: () => controller.setActiveLayer(l.id),
1194
1458
  children: [
1195
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1459
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1196
1460
  "button",
1197
1461
  {
1198
1462
  type: "button",
@@ -1205,7 +1469,7 @@ var PaintLayersPanel = ({ controller, className }) => {
1205
1469
  children: l.visible ? "\u25CF" : "\u25CB"
1206
1470
  }
1207
1471
  ),
1208
- renaming === l.id ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1472
+ renaming === l.id ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1209
1473
  "input",
1210
1474
  {
1211
1475
  autoFocus: true,
@@ -1222,23 +1486,23 @@ var PaintLayersPanel = ({ controller, className }) => {
1222
1486
  if (e.key === "Escape") setRenaming(null);
1223
1487
  }
1224
1488
  }
1225
- ) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex-1 truncate", onDoubleClick: () => setRenaming(l.id), children: [
1489
+ ) : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "flex-1 truncate", onDoubleClick: () => setRenaming(l.id), children: [
1226
1490
  l.type === "group" ? "\u25B8 " : "",
1227
- l.liveStrokes !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { "aria-label": "Stroke layer", title: `Stroke layer: ${l.liveStrokes} editable strokes`, children: [
1491
+ l.liveStrokes !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { "aria-label": "Stroke layer", title: `Stroke layer: ${l.liveStrokes} editable strokes`, children: [
1228
1492
  "\u270E",
1229
1493
  " "
1230
1494
  ] }),
1231
1495
  l.name
1232
1496
  ] }),
1233
- l.locks.pixels || l.locks.all ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { title: "Locked", children: "\u{1F512}" }) : null
1497
+ l.locks.pixels || l.locks.all ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { title: "Locked", children: "\u{1F512}" }) : null
1234
1498
  ]
1235
1499
  },
1236
1500
  l.id
1237
1501
  )) }),
1238
- active && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
1239
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex items-center gap-2", children: [
1240
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "w-14 text-slate-400", children: "Opacity" }),
1241
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1502
+ active && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
1503
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "flex items-center gap-2", children: [
1504
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w-14 text-slate-400", children: "Opacity" }),
1505
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1242
1506
  "input",
1243
1507
  {
1244
1508
  type: "range",
@@ -1252,39 +1516,40 @@ var PaintLayersPanel = ({ controller, className }) => {
1252
1516
  }
1253
1517
  )
1254
1518
  ] }),
1255
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex items-center gap-2", children: [
1256
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "w-14 text-slate-400", children: "Blend" }),
1257
- /* @__PURE__ */ (0, import_jsx_runtime9.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: [
1258
- active.type === "group" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "pass-through", children: "Pass through" }),
1259
- import_paint_editor10.BLEND_MENU_GROUPS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("optgroup", { label: g.label, children: g.modes.map((m) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: m.id, title: m.description, children: m.label }, m.id)) }, g.label))
1519
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "flex items-center gap-2", children: [
1520
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w-14 text-slate-400", children: "Blend" }),
1521
+ /* @__PURE__ */ (0, import_jsx_runtime11.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: [
1522
+ active.type === "group" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "pass-through", children: "Pass through" }),
1523
+ import_paint_editor10.BLEND_MENU_GROUPS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("optgroup", { label: g.label, children: g.modes.map((m) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: m.id, title: m.description, children: m.label }, m.id)) }, g.label))
1260
1524
  ] })
1261
1525
  ] }),
1262
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex gap-1", children: [
1263
- ["pixels", "transparency"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime9.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)),
1264
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", "aria-pressed": active.clipped, className: chip(active.clipped), onClick: () => attempt(() => controller.updateLayer(active.id, { clipped: !active.clipped })), children: "Clip" })
1526
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex gap-1", children: [
1527
+ ["pixels", "transparency"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime11.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)),
1528
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", "aria-pressed": active.clipped, className: chip(active.clipped), onClick: () => attempt(() => controller.updateLayer(active.id, { clipped: !active.clipped })), children: "Clip" })
1265
1529
  ] }),
1266
- light?.hasLight && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col gap-1.5 border-t border-slate-800 pt-1.5", "data-testid": "layer-light", children: [
1267
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center justify-between", children: [
1268
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "font-medium text-slate-300", title: "This layer's paint gives off light", children: "Light" }),
1269
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.clearLight(active.id)), children: "Clear light" })
1530
+ light?.hasLight && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col gap-1.5 border-t border-slate-800 pt-1.5", "data-testid": "layer-light", children: [
1531
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center justify-between", children: [
1532
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "font-medium text-slate-300", title: "This layer's paint gives off light", children: "Light" }),
1533
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.clearLight(active.id)), children: "Clear light" })
1270
1534
  ] }),
1271
- /* @__PURE__ */ (0, import_jsx_runtime9.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: [
1272
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "w-14 text-slate-400", children: "Spill" }),
1273
- /* @__PURE__ */ (0, import_jsx_runtime9.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" })
1535
+ /* @__PURE__ */ (0, import_jsx_runtime11.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: [
1536
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w-14 text-slate-400", children: "Spill" }),
1537
+ /* @__PURE__ */ (0, import_jsx_runtime11.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" })
1274
1538
  ] }),
1275
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex items-center gap-2", children: [
1276
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "w-14 text-slate-400", children: "Strength" }),
1277
- /* @__PURE__ */ (0, import_jsx_runtime9.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" })
1539
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "flex items-center gap-2", children: [
1540
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w-14 text-slate-400", children: "Strength" }),
1541
+ /* @__PURE__ */ (0, import_jsx_runtime11.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" })
1278
1542
  ] })
1279
- ] })
1543
+ ] }),
1544
+ /* @__PURE__ */ (0, import_jsx_runtime11.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_runtime11.jsx)(LayerEffectsPanel, { controller, layerId: active.id }) })
1280
1545
  ] }),
1281
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ErrorLine, { error })
1546
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ErrorLine, { error })
1282
1547
  ] });
1283
1548
  };
1284
1549
 
1285
1550
  // src/paint-editor/WetPanel.tsx
1286
1551
  var import_paint_editor11 = require("@pixerate/editor/paint-editor");
1287
- var import_jsx_runtime10 = require("react/jsx-runtime");
1552
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1288
1553
  var FLOW_LABELS = { none: "None", linear: "One way", swirl: "Swirl", radial: "Outwards", turbulent: "Eddies" };
1289
1554
  var WetPanel = ({ controller, className }) => {
1290
1555
  const state = usePaintEditorState(controller);
@@ -1293,31 +1558,31 @@ var WetPanel = ({ controller, className }) => {
1293
1558
  const layerId = state.document.activeLayerId;
1294
1559
  const info = layerId ? controller.wetLayerInfo(layerId) : null;
1295
1560
  const backend = controller.wetState();
1296
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "wet-panel", children: [
1297
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center justify-between", children: [
1298
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: wet.wet ? "text-sky-300" : "text-slate-400", "data-testid": "wet-status", children: wet.wet ? wet.paused ? "Wet (paused)" : "Wet" : "Dry" }),
1299
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-[10px] text-slate-500", children: [
1561
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "wet-panel", children: [
1562
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center justify-between", children: [
1563
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: wet.wet ? "text-sky-300" : "text-slate-400", "data-testid": "wet-status", children: wet.wet ? wet.paused ? "Wet (paused)" : "Wet" : "Dry" }),
1564
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "text-[10px] text-slate-500", children: [
1300
1565
  "step ",
1301
1566
  wet.clock
1302
1567
  ] })
1303
1568
  ] }),
1304
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1305
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: button, disabled: !wet.layerIds.length, onClick: () => attempt(async () => (await controller.wetIdle(), controller.dryPaint())), children: "Dry now" }),
1306
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: chip(wet.paused), "aria-pressed": wet.paused, onClick: () => controller.setWetPaused(!wet.paused), children: wet.paused ? "Resume" : "Pause" }),
1307
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: chip(wet.overlay), "aria-pressed": wet.overlay, onClick: () => controller.setWaterOverlay(!wet.overlay), children: "Water" }),
1308
- /* @__PURE__ */ (0, import_jsx_runtime10.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" }),
1309
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: button, disabled: !layerId, onClick: () => attempt(async () => (await controller.wetIdle(), controller.wetPaper({}))), children: "Wet paper" })
1569
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1570
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, disabled: !wet.layerIds.length, onClick: () => attempt(async () => (await controller.wetIdle(), controller.dryPaint())), children: "Dry now" }),
1571
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: chip(wet.paused), "aria-pressed": wet.paused, onClick: () => controller.setWetPaused(!wet.paused), children: wet.paused ? "Resume" : "Pause" }),
1572
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: chip(wet.overlay), "aria-pressed": wet.overlay, onClick: () => controller.setWaterOverlay(!wet.overlay), children: "Water" }),
1573
+ /* @__PURE__ */ (0, import_jsx_runtime12.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" }),
1574
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, disabled: !layerId, onClick: () => attempt(async () => (await controller.wetIdle(), controller.wetPaper({}))), children: "Wet paper" })
1310
1575
  ] }),
1311
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PaintSlider, { control: import_paint_editor11.WET_SPEED_SLIDER, value: wet.speed, onChange: (v) => controller.setWetSpeed(v) }),
1312
- import_paint_editor11.WET_TILT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor11.readPath)(wet.tilt, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setCanvasTilt({ [c.path]: v }))) }, c.path)),
1313
- info && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "wet-layer", children: [
1314
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "font-medium text-slate-300", children: "This layer" }),
1315
- import_paint_editor11.WET_PARAM_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor11.readPath)(info.params, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setWetParams(layerId, { [c.path]: v }))) }, c.path)),
1316
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
1317
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-slate-400", children: "Flow map" }),
1318
- /* @__PURE__ */ (0, import_jsx_runtime10.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_editor11.WET_FLOW_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: k, children: FLOW_LABELS[k] }, k)) })
1576
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PaintSlider, { control: import_paint_editor11.WET_SPEED_SLIDER, value: wet.speed, onChange: (v) => controller.setWetSpeed(v) }),
1577
+ import_paint_editor11.WET_TILT_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor11.readPath)(wet.tilt, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setCanvasTilt({ [c.path]: v }))) }, c.path)),
1578
+ info && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "wet-layer", children: [
1579
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "font-medium text-slate-300", children: "This layer" }),
1580
+ import_paint_editor11.WET_PARAM_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor11.readPath)(info.params, c.path), onCommit: (v) => attempt(async () => (await controller.wetIdle(), controller.setWetParams(layerId, { [c.path]: v }))) }, c.path)),
1581
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
1582
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-slate-400", children: "Flow map" }),
1583
+ /* @__PURE__ */ (0, import_jsx_runtime12.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_editor11.WET_FLOW_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: k, children: FLOW_LABELS[k] }, k)) })
1319
1584
  ] }),
1320
- info.flow.kind !== "none" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1585
+ info.flow.kind !== "none" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1321
1586
  PaintSlider,
1322
1587
  {
1323
1588
  control: { path: "strength", label: "Flow strength", min: 0, max: 1, step: 0.01 },
@@ -1326,20 +1591,20 @@ var WetPanel = ({ controller, className }) => {
1326
1591
  }
1327
1592
  )
1328
1593
  ] }),
1329
- backend.message && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-[10px] text-amber-300", "data-testid": "wet-message", children: backend.message }),
1330
- backend.backend && /* @__PURE__ */ (0, import_jsx_runtime10.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" }),
1331
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
1332
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-slate-400", children: "Engine" }),
1333
- /* @__PURE__ */ (0, import_jsx_runtime10.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_editor11.WET_GPU_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: o.value, children: o.label }, o.value)) })
1594
+ backend.message && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-[10px] text-amber-300", "data-testid": "wet-message", children: backend.message }),
1595
+ backend.backend && /* @__PURE__ */ (0, import_jsx_runtime12.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" }),
1596
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
1597
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-slate-400", children: "Engine" }),
1598
+ /* @__PURE__ */ (0, import_jsx_runtime12.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_editor11.WET_GPU_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: o.value, children: o.label }, o.value)) })
1334
1599
  ] }),
1335
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: `text-[10px] ${backend.engine.state === "active" ? "text-emerald-300" : "text-slate-500"}`, "data-testid": "wet-engine", children: (0, import_paint_editor11.wetEngineSummary)(backend.engine) }),
1336
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ErrorLine, { error })
1600
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: `text-[10px] ${backend.engine.state === "active" ? "text-emerald-300" : "text-slate-500"}`, "data-testid": "wet-engine", children: (0, import_paint_editor11.wetEngineSummary)(backend.engine) }),
1601
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ErrorLine, { error })
1337
1602
  ] });
1338
1603
  };
1339
1604
 
1340
1605
  // src/paint-editor/StickerPanel.tsx
1341
1606
  var import_paint_editor12 = require("@pixerate/editor/paint-editor");
1342
- var import_jsx_runtime11 = require("react/jsx-runtime");
1607
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1343
1608
  var StickerPanel = ({ controller, className }) => {
1344
1609
  const state = usePaintEditorState(controller);
1345
1610
  const [error, attempt] = useAttempt();
@@ -1349,21 +1614,21 @@ var StickerPanel = ({ controller, className }) => {
1349
1614
  const stickers = layerId ? state.document.stickers?.[layerId] ?? [] : [];
1350
1615
  if (!stickers.length) return null;
1351
1616
  const sel = stickers.find((s) => s.id === picked) ?? null;
1352
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "sticker-panel", children: [
1353
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "font-medium text-slate-300", children: [
1617
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "sticker-panel", children: [
1618
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "font-medium text-slate-300", children: [
1354
1619
  "Stickers (",
1355
1620
  stickers.length,
1356
1621
  ")"
1357
1622
  ] }),
1358
- /* @__PURE__ */ (0, import_jsx_runtime11.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_runtime11.jsx)("button", { type: "button", role: "option", "aria-selected": s.id === picked, title: `${import_paint_editor12.STAMP_LABELS[s.stamp]} ${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)) }),
1359
- sel && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "sticker-edit", children: [
1360
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
1361
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-slate-400", children: "Stamp" }),
1362
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("select", { "aria-label": "Sticker stamp", value: sel.stamp, onChange: (e) => attempt(() => controller.updateSticker(layerId, sel.id, { stamp: e.target.value })), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor12.STAMP_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: k, children: import_paint_editor12.STAMP_LABELS[k] }, k)) })
1623
+ /* @__PURE__ */ (0, import_jsx_runtime13.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_runtime13.jsx)("button", { type: "button", role: "option", "aria-selected": s.id === picked, title: `${import_paint_editor12.STAMP_LABELS[s.stamp]} ${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)) }),
1624
+ sel && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "sticker-edit", children: [
1625
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
1626
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-slate-400", children: "Stamp" }),
1627
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("select", { "aria-label": "Sticker stamp", value: sel.stamp, onChange: (e) => attempt(() => controller.updateSticker(layerId, sel.id, { stamp: e.target.value })), className: "rounded bg-slate-800 px-1 py-0.5", children: import_paint_editor12.STAMP_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: k, children: import_paint_editor12.STAMP_LABELS[k] }, k)) })
1363
1628
  ] }),
1364
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
1365
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-slate-400", children: "Position" }),
1366
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "flex gap-1", children: ["x", "y"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1629
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
1630
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-slate-400", children: "Position" }),
1631
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "flex gap-1", children: ["x", "y"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1367
1632
  "input",
1368
1633
  {
1369
1634
  type: "number",
@@ -1377,24 +1642,24 @@ var StickerPanel = ({ controller, className }) => {
1377
1642
  `${sel.id}-${k}-${sel[k]}`
1378
1643
  )) })
1379
1644
  ] }),
1380
- import_paint_editor12.STICKER_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor12.readPath)(sel, c.path), onCommit: (v) => attempt(() => controller.updateSticker(layerId, sel.id, { [c.path]: v })) }, c.path)),
1381
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "flex items-center justify-between", children: [
1382
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-slate-400", children: "Colour" }),
1383
- /* @__PURE__ */ (0, import_jsx_runtime11.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" })
1645
+ import_paint_editor12.STICKER_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor12.readPath)(sel, c.path), onCommit: (v) => attempt(() => controller.updateSticker(layerId, sel.id, { [c.path]: v })) }, c.path)),
1646
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "flex items-center justify-between", children: [
1647
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-slate-400", children: "Colour" }),
1648
+ /* @__PURE__ */ (0, import_jsx_runtime13.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" })
1384
1649
  ] }),
1385
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1386
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "front")), children: "To front" }),
1387
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "back")), children: "To back" }),
1388
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStickers(layerId, [sel.id]), setPicked(null))), children: "Delete" })
1650
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1651
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "front")), children: "To front" }),
1652
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.arrangeStickers(layerId, [sel.id], "back")), children: "To back" }),
1653
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStickers(layerId, [sel.id]), setPicked(null))), children: "Delete" })
1389
1654
  ] })
1390
1655
  ] }),
1391
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ErrorLine, { error })
1656
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ErrorLine, { error })
1392
1657
  ] });
1393
1658
  };
1394
1659
 
1395
1660
  // src/paint-editor/StrokePanel.tsx
1396
1661
  var import_paint_editor13 = require("@pixerate/editor/paint-editor");
1397
- var import_jsx_runtime12 = require("react/jsx-runtime");
1662
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1398
1663
  var StrokePanel = ({ controller, className }) => {
1399
1664
  const state = usePaintEditorState(controller);
1400
1665
  const [error, attempt] = useAttempt();
@@ -1404,16 +1669,16 @@ var StrokePanel = ({ controller, className }) => {
1404
1669
  const index = strokes.findIndex((s) => s.id === state.selectedStroke);
1405
1670
  const sel = index >= 0 ? strokes[index] : null;
1406
1671
  const brushes = state.brushes.filter((b) => !(0, import_paint_editor13.liveStrokeRefusal)(b));
1407
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "stroke-panel", children: [
1408
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center justify-between", children: [
1409
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "font-medium text-slate-300", children: [
1672
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "stroke-panel", children: [
1673
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center justify-between", children: [
1674
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "font-medium text-slate-300", children: [
1410
1675
  "Strokes (",
1411
1676
  strokes.length,
1412
1677
  ")"
1413
1678
  ] }),
1414
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.rasterizeLiveStrokes(layerId)), children: "Rasterize" })
1679
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.rasterizeLiveStrokes(layerId)), children: "Rasterize" })
1415
1680
  ] }),
1416
- /* @__PURE__ */ (0, import_jsx_runtime12.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_runtime12.jsx)(
1681
+ /* @__PURE__ */ (0, import_jsx_runtime14.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_runtime14.jsx)(
1417
1682
  "button",
1418
1683
  {
1419
1684
  type: "button",
@@ -1426,10 +1691,10 @@ var StrokePanel = ({ controller, className }) => {
1426
1691
  },
1427
1692
  s.id
1428
1693
  )) }),
1429
- sel && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "stroke-edit", children: [
1430
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
1431
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-slate-400", children: "Brush" }),
1432
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1694
+ sel && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-col gap-1.5", "data-testid": "stroke-edit", children: [
1695
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center justify-between gap-2", children: [
1696
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-slate-400", children: "Brush" }),
1697
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
1433
1698
  "select",
1434
1699
  {
1435
1700
  "aria-label": "Stroke brush",
@@ -1437,51 +1702,51 @@ var StrokePanel = ({ controller, className }) => {
1437
1702
  onChange: (e) => e.target.value && attempt(() => controller.updateStroke(sel.id, { brushId: e.target.value })),
1438
1703
  className: "max-w-[10rem] rounded bg-slate-800 px-1 py-0.5",
1439
1704
  children: [
1440
- !brushes.some((b) => b.id === sel.brush.id) && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "", children: sel.brush.name }),
1441
- brushes.map((b) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: b.id, children: b.name }, b.id))
1705
+ !brushes.some((b) => b.id === sel.brush.id) && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "", children: sel.brush.name }),
1706
+ brushes.map((b) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: b.id, children: b.name }, b.id))
1442
1707
  ]
1443
1708
  }
1444
1709
  )
1445
1710
  ] }),
1446
- import_paint_editor13.STROKE_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor13.readPath)(sel.brush, c.path), onCommit: (v) => attempt(() => controller.updateStroke(sel.id, { brush: { tip: { [c.path.split(".")[1]]: v } } })) }, c.path)),
1447
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center justify-between", children: [
1448
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-slate-400", children: "Colour" }),
1449
- /* @__PURE__ */ (0, import_jsx_runtime12.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" })
1711
+ import_paint_editor13.STROKE_SLIDERS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PaintSlider, { control: c, value: (0, import_paint_editor13.readPath)(sel.brush, c.path), onCommit: (v) => attempt(() => controller.updateStroke(sel.id, { brush: { tip: { [c.path.split(".")[1]]: v } } })) }, c.path)),
1712
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center justify-between", children: [
1713
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-slate-400", children: "Colour" }),
1714
+ /* @__PURE__ */ (0, import_jsx_runtime14.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" })
1450
1715
  ] }),
1451
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1452
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.updateStroke(sel.id, { seed: (sel.seed + 1) % 2147483647 })), children: "New seed" }),
1453
- /* @__PURE__ */ (0, import_jsx_runtime12.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" }),
1454
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, disabled: index === 0, "aria-label": "Move stroke down", onClick: () => attempt(() => controller.reorderStroke(sel.id, index - 1)), children: "\u2193" }),
1455
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStrokes([sel.id]), controller.selectStroke(null))), children: "Delete" })
1716
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1717
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => controller.updateStroke(sel.id, { seed: (sel.seed + 1) % 2147483647 })), children: "New seed" }),
1718
+ /* @__PURE__ */ (0, import_jsx_runtime14.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" }),
1719
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button, disabled: index === 0, "aria-label": "Move stroke down", onClick: () => attempt(() => controller.reorderStroke(sel.id, index - 1)), children: "\u2193" }),
1720
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: button, onClick: () => attempt(() => (controller.removeStrokes([sel.id]), controller.selectStroke(null))), children: "Delete" })
1456
1721
  ] })
1457
1722
  ] }),
1458
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ErrorLine, { error })
1723
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ErrorLine, { error })
1459
1724
  ] });
1460
1725
  };
1461
1726
 
1462
1727
  // src/paint-editor/PaintEditor.tsx
1463
- var import_react23 = require("react");
1728
+ var import_react25 = require("react");
1464
1729
  var import_paint_editor15 = require("@pixerate/editor/paint-editor");
1465
1730
 
1466
1731
  // src/playback/AgentPlaybackContext.tsx
1467
- var import_react10 = require("react");
1468
- var import_jsx_runtime13 = require("react/jsx-runtime");
1469
- var AgentPlaybackContext = (0, import_react10.createContext)(null);
1732
+ var import_react12 = require("react");
1733
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1734
+ var AgentPlaybackContext = (0, import_react12.createContext)(null);
1470
1735
  function useAgentPlayback() {
1471
- return (0, import_react10.useContext)(AgentPlaybackContext);
1736
+ return (0, import_react12.useContext)(AgentPlaybackContext);
1472
1737
  }
1473
1738
 
1474
1739
  // src/playback/usePlaybackSurface.ts
1475
- var import_react11 = require("react");
1740
+ var import_react13 = require("react");
1476
1741
  var import_tools = require("@pixerate/editor/tools");
1477
1742
  function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
1478
1743
  const ambient = useAgentPlayback();
1479
1744
  const target = playback === void 0 ? ambient : playback;
1480
- const [ownPresence] = (0, import_react11.useState)(() => new import_tools.PresenceStore());
1745
+ const [ownPresence] = (0, import_react13.useState)(() => new import_tools.PresenceStore());
1481
1746
  const presence = sharedPresence ?? ownPresence;
1482
- const latest = (0, import_react11.useRef)(options);
1747
+ const latest = (0, import_react13.useRef)(options);
1483
1748
  latest.current = options;
1484
- (0, import_react11.useEffect)(() => {
1749
+ (0, import_react13.useEffect)(() => {
1485
1750
  if (!target || !id) return;
1486
1751
  const o = () => latest.current;
1487
1752
  const surface = {
@@ -1513,13 +1778,13 @@ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
1513
1778
  }
1514
1779
 
1515
1780
  // src/playback/PresenceLayer.tsx
1516
- var import_react12 = __toESM(require("react"), 1);
1517
- var import_jsx_runtime14 = require("react/jsx-runtime");
1781
+ var import_react14 = __toESM(require("react"), 1);
1782
+ var import_jsx_runtime16 = require("react/jsx-runtime");
1518
1783
  function PresenceLayer({ presence, viewport, clip = true, renderCursor, className = "" }) {
1519
- const { actors } = (0, import_react12.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
1784
+ const { actors } = (0, import_react14.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
1520
1785
  if (!actors.length) return null;
1521
1786
  const map = typeof viewport === "function" ? viewport : viewport ? (p) => ({ x: p.x * viewport.zoom + viewport.x, y: p.y * viewport.zoom + viewport.y }) : (p) => p;
1522
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1787
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1523
1788
  "div",
1524
1789
  {
1525
1790
  className: `pixerate-presence ${className}`.trim(),
@@ -1533,19 +1798,19 @@ function PresenceLayer({ presence, viewport, clip = true, renderCursor, classNam
1533
1798
  const br = map({ x: a.focus.x + a.focus.width, y: a.focus.y + a.focus.height });
1534
1799
  return { left: tl.x - 4, top: tl.y - 4, width: br.x - tl.x + 8, height: br.y - tl.y + 8 };
1535
1800
  })();
1536
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react12.default.Fragment, { children: [
1537
- ring && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1801
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_react14.default.Fragment, { children: [
1802
+ ring && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1538
1803
  "div",
1539
1804
  {
1540
1805
  "data-actor-focus": a.id,
1541
1806
  style: { position: "absolute", ...ring, borderRadius: 8, border: `2px solid ${a.color}`, background: `${a.color}14`, transition: "all 160ms ease-out" }
1542
1807
  }
1543
1808
  ),
1544
- /* @__PURE__ */ (0, import_jsx_runtime14.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_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
1545
- /* @__PURE__ */ (0, import_jsx_runtime14.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_runtime14.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 } }) }),
1546
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
1547
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
1548
- a.message && /* @__PURE__ */ (0, import_jsx_runtime14.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 })
1809
+ /* @__PURE__ */ (0, import_jsx_runtime16.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_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
1810
+ /* @__PURE__ */ (0, import_jsx_runtime16.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_runtime16.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 } }) }),
1811
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
1812
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
1813
+ a.message && /* @__PURE__ */ (0, import_jsx_runtime16.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 })
1549
1814
  ] })
1550
1815
  ] }) })
1551
1816
  ] }, a.id);
@@ -1555,15 +1820,15 @@ function PresenceLayer({ presence, viewport, clip = true, renderCursor, classNam
1555
1820
  }
1556
1821
 
1557
1822
  // src/paint-editor/PaintEffectsPanel.tsx
1558
- var import_react22 = require("react");
1823
+ var import_react24 = require("react");
1559
1824
  var import_paint_editor14 = require("@pixerate/editor/paint-editor");
1560
1825
 
1561
1826
  // src/effects/useEffects.ts
1562
- var import_react13 = require("react");
1827
+ var import_react15 = require("react");
1563
1828
  function useEffectDescription(provider, effect) {
1564
- const [state, setState] = (0, import_react13.useState)({ key: "", description: null, error: null });
1829
+ const [state, setState] = (0, import_react15.useState)({ key: "", description: null, error: null });
1565
1830
  const key = provider && effect ? `${provider.id}:${effect}` : "";
1566
- (0, import_react13.useEffect)(() => {
1831
+ (0, import_react15.useEffect)(() => {
1567
1832
  if (!provider || !effect) return;
1568
1833
  let live = true;
1569
1834
  Promise.resolve().then(() => provider.describe(effect)).then(
@@ -1578,14 +1843,14 @@ function useEffectDescription(provider, effect) {
1578
1843
  }
1579
1844
 
1580
1845
  // src/effects/EffectThumbnail.tsx
1581
- var import_react14 = require("react");
1846
+ var import_react16 = require("react");
1582
1847
  var import_effects = require("@pixerate/editor/effects");
1583
- var import_jsx_runtime15 = require("react/jsx-runtime");
1848
+ var import_jsx_runtime17 = require("react/jsx-runtime");
1584
1849
  var LABELS = { motion: "Motion", camera: "Camera" };
1585
1850
  function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
1586
- const ref = (0, import_react14.useRef)(null);
1587
- const [failed, setFailed] = (0, import_react14.useState)(effect.kind in LABELS);
1588
- (0, import_react14.useEffect)(() => {
1851
+ const ref = (0, import_react16.useRef)(null);
1852
+ const [failed, setFailed] = (0, import_react16.useState)(effect.kind in LABELS);
1853
+ (0, import_react16.useEffect)(() => {
1589
1854
  if (effect.kind in LABELS) return;
1590
1855
  let live = true;
1591
1856
  (0, import_effects.renderEffectThumbnail)(provider, effect, { width, height }).then(
@@ -1600,28 +1865,28 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
1600
1865
  live = false;
1601
1866
  };
1602
1867
  }, [provider, effect, width, height]);
1603
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1868
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1604
1869
  "div",
1605
1870
  {
1606
1871
  className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
1607
1872
  style: { aspectRatio: `${width} / ${height}` },
1608
1873
  "data-effect-thumbnail": effect.id,
1609
- children: failed ? /* @__PURE__ */ (0, import_jsx_runtime15.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_runtime15.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
1874
+ children: failed ? /* @__PURE__ */ (0, import_jsx_runtime17.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_runtime17.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
1610
1875
  }
1611
1876
  );
1612
1877
  }
1613
1878
 
1614
1879
  // src/effects/EffectsBrowser.tsx
1615
- var import_react15 = require("react");
1880
+ var import_react17 = require("react");
1616
1881
  var import_effects2 = require("@pixerate/editor/effects");
1617
- var import_jsx_runtime16 = require("react/jsx-runtime");
1882
+ var import_jsx_runtime18 = require("react/jsx-runtime");
1618
1883
  function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
1619
- const [all, setAll] = (0, import_react15.useState)([]);
1620
- const [query, setQuery] = (0, import_react15.useState)("");
1621
- const [category, setCategory] = (0, import_react15.useState)("");
1622
- const [use, setUse] = (0, import_react15.useState)("");
1623
- const [error, setError] = (0, import_react15.useState)(null);
1624
- (0, import_react15.useEffect)(() => {
1884
+ const [all, setAll] = (0, import_react17.useState)([]);
1885
+ const [query, setQuery] = (0, import_react17.useState)("");
1886
+ const [category, setCategory] = (0, import_react17.useState)("");
1887
+ const [use, setUse] = (0, import_react17.useState)("");
1888
+ const [error, setError] = (0, import_react17.useState)(null);
1889
+ (0, import_react17.useEffect)(() => {
1625
1890
  if (!provider) return setAll([]);
1626
1891
  let live = true;
1627
1892
  Promise.resolve().then(() => provider.list()).then(
@@ -1632,8 +1897,8 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1632
1897
  live = false;
1633
1898
  };
1634
1899
  }, [provider]);
1635
- const [found, setFound] = (0, import_react15.useState)([]);
1636
- (0, import_react15.useEffect)(() => {
1900
+ const [found, setFound] = (0, import_react17.useState)([]);
1901
+ (0, import_react17.useEffect)(() => {
1637
1902
  if (!provider) return setFound([]);
1638
1903
  let live = true;
1639
1904
  Promise.resolve().then(() => provider.search(query, { ...category ? { category } : {}, ...use ? { use } : {} })).then((list) => live && setFound(list), () => live && setFound([]));
@@ -1642,14 +1907,14 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1642
1907
  };
1643
1908
  }, [provider, query, category, use]);
1644
1909
  const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses);
1645
- const categories = (0, import_react15.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
1910
+ const categories = (0, import_react17.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
1646
1911
  const shown = found.filter(allowed);
1647
1912
  if (!provider)
1648
- return /* @__PURE__ */ (0, import_jsx_runtime16.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." });
1649
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
1650
- title && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h3", { className: "text-xs font-semibold", children: title }),
1651
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1652
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1913
+ return /* @__PURE__ */ (0, import_jsx_runtime18.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." });
1914
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("section", { className: `flex flex-col gap-2 ${className}`, "data-effects-browser": "", "aria-label": "Effects browser", children: [
1915
+ title && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h3", { className: "text-xs font-semibold", children: title }),
1916
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
1917
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1653
1918
  "input",
1654
1919
  {
1655
1920
  type: "search",
@@ -1660,17 +1925,17 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1660
1925
  onChange: (e) => setQuery(e.currentTarget.value)
1661
1926
  }
1662
1927
  ),
1663
- /* @__PURE__ */ (0, import_jsx_runtime16.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: [
1664
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "", children: "All categories" }),
1665
- categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: c, children: c }, c))
1928
+ /* @__PURE__ */ (0, import_jsx_runtime18.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: [
1929
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "", children: "All categories" }),
1930
+ categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: c, children: c }, c))
1666
1931
  ] }),
1667
- uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime16.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: [
1668
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "", children: "Any use" }),
1669
- uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
1932
+ uses && uses.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime18.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: [
1933
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "", children: "Any use" }),
1934
+ uses.map((u) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: u, children: import_effects2.EFFECT_USE_LABELS[u] }, u))
1670
1935
  ] })
1671
1936
  ] }),
1672
- error && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
1673
- /* @__PURE__ */ (0, import_jsx_runtime16.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_runtime16.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
1937
+ error && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: error }),
1938
+ /* @__PURE__ */ (0, import_jsx_runtime18.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_runtime18.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1674
1939
  "button",
1675
1940
  {
1676
1941
  type: "button",
@@ -1679,23 +1944,23 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1679
1944
  "data-effect-id": e.id,
1680
1945
  onClick: () => onPick(e),
1681
1946
  children: [
1682
- thumbnails && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(EffectThumbnail, { provider, effect: e }),
1683
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
1684
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
1947
+ thumbnails && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(EffectThumbnail, { provider, effect: e }),
1948
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "truncate text-[11px] font-medium", children: e.name }),
1949
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "truncate text-[10px] text-muted-foreground", children: e.uses.map((u) => import_effects2.EFFECT_USE_LABELS[u]).join(" \xB7 ") })
1685
1950
  ]
1686
1951
  }
1687
1952
  ) }, e.id)) }),
1688
- !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
1953
+ !shown.length && !error && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects match." })
1689
1954
  ] });
1690
1955
  }
1691
1956
 
1692
1957
  // src/effects/EffectParameters.tsx
1693
- var import_react21 = __toESM(require("react"), 1);
1958
+ var import_react23 = __toESM(require("react"), 1);
1694
1959
  var import_effects3 = require("@pixerate/editor/effects");
1695
1960
  var import_parameters2 = require("@pixerate/editor/parameters");
1696
1961
 
1697
1962
  // src/parameters/fields.tsx
1698
- var import_react20 = require("react");
1963
+ var import_react22 = require("react");
1699
1964
  var import_parameters = require("@pixerate/editor/parameters");
1700
1965
 
1701
1966
  // src/color/index.ts
@@ -1708,9 +1973,9 @@ __export(color_exports, {
1708
1973
  });
1709
1974
 
1710
1975
  // src/color/ColorPicker.tsx
1711
- var import_react16 = require("react");
1976
+ var import_react18 = require("react");
1712
1977
  var import_color = require("@pixerate/editor/color");
1713
- var import_jsx_runtime17 = require("react/jsx-runtime");
1978
+ var import_jsx_runtime19 = require("react/jsx-runtime");
1714
1979
  var LOCAL_STORAGE_KEY = "pixerate:color:recent";
1715
1980
  function readLocalRecents() {
1716
1981
  try {
@@ -1748,24 +2013,24 @@ var ColorPicker = ({
1748
2013
  id,
1749
2014
  "aria-label": ariaLabel = "Color picker"
1750
2015
  }) => {
1751
- const generatedId = (0, import_react16.useId)();
2016
+ const generatedId = (0, import_react18.useId)();
1752
2017
  const pickerId = id || generatedId;
1753
- const [pickerState, setPickerState] = (0, import_react16.useState)(
2018
+ const [pickerState, setPickerState] = (0, import_react18.useState)(
1754
2019
  () => (0, import_color.pickerStateFromColor)(value) ?? DEFAULT_PICKER_STATE
1755
2020
  );
1756
- const stateRef = (0, import_react16.useRef)(pickerState);
2021
+ const stateRef = (0, import_react18.useRef)(pickerState);
1757
2022
  stateRef.current = pickerState;
1758
- (0, import_react16.useEffect)(() => {
2023
+ (0, import_react18.useEffect)(() => {
1759
2024
  const next = (0, import_color.pickerStateFromColor)(value, stateRef.current);
1760
2025
  if (next) {
1761
2026
  setPickerState(next);
1762
2027
  }
1763
2028
  }, [value]);
1764
- const [internalRecent, setInternalRecent] = (0, import_react16.useState)(
2029
+ const [internalRecent, setInternalRecent] = (0, import_react18.useState)(
1765
2030
  () => controlledRecent ? [] : readLocalRecents()
1766
2031
  );
1767
2032
  const activeRecent = controlledRecent ?? internalRecent;
1768
- const recordRecent = (0, import_react16.useCallback)(
2033
+ const recordRecent = (0, import_react18.useCallback)(
1769
2034
  (color) => {
1770
2035
  const updated = (0, import_color.pushRecentColor)(activeRecent, color, 12);
1771
2036
  if (!controlledRecent) {
@@ -1776,11 +2041,11 @@ var ColorPicker = ({
1776
2041
  },
1777
2042
  [activeRecent, controlledRecent, onRecentChange]
1778
2043
  );
1779
- const [textDraft, setTextDraft] = (0, import_react16.useState)(value);
1780
- const [isInvalid, setIsInvalid] = (0, import_react16.useState)(false);
1781
- const [isClipped, setIsClipped] = (0, import_react16.useState)(false);
1782
- const isTypingRef = (0, import_react16.useRef)(false);
1783
- (0, import_react16.useEffect)(() => {
2044
+ const [textDraft, setTextDraft] = (0, import_react18.useState)(value);
2045
+ const [isInvalid, setIsInvalid] = (0, import_react18.useState)(false);
2046
+ const [isClipped, setIsClipped] = (0, import_react18.useState)(false);
2047
+ const isTypingRef = (0, import_react18.useRef)(false);
2048
+ (0, import_react18.useEffect)(() => {
1784
2049
  if (!isTypingRef.current) {
1785
2050
  setTextDraft(value);
1786
2051
  setIsInvalid(false);
@@ -1788,11 +2053,11 @@ var ColorPicker = ({
1788
2053
  setIsClipped(Boolean(parsed && !(0, import_color.inSrgbGamut)(parsed)));
1789
2054
  }
1790
2055
  }, [value]);
1791
- const [hasEyeDropper, setHasEyeDropper] = (0, import_react16.useState)(false);
1792
- (0, import_react16.useEffect)(() => {
2056
+ const [hasEyeDropper, setHasEyeDropper] = (0, import_react18.useState)(false);
2057
+ (0, import_react18.useEffect)(() => {
1793
2058
  setHasEyeDropper(typeof window !== "undefined" && "EyeDropper" in window);
1794
2059
  }, []);
1795
- const emitColorChange = (0, import_react16.useCallback)(
2060
+ const emitColorChange = (0, import_react18.useCallback)(
1796
2061
  (nextState) => {
1797
2062
  setPickerState(nextState);
1798
2063
  const hex = (0, import_color.pickerStateToHex)(nextState, alpha);
@@ -1800,10 +2065,10 @@ var ColorPicker = ({
1800
2065
  },
1801
2066
  [alpha, onChange]
1802
2067
  );
1803
- const latest = (0, import_react16.useRef)({ emitColorChange, recordRecent, onGestureEnd, alpha });
2068
+ const latest = (0, import_react18.useRef)({ emitColorChange, recordRecent, onGestureEnd, alpha });
1804
2069
  latest.current = { emitColorChange, recordRecent, onGestureEnd, alpha };
1805
- const endDragRef = (0, import_react16.useRef)(null);
1806
- (0, import_react16.useEffect)(() => () => endDragRef.current?.(), []);
2070
+ const endDragRef = (0, import_react18.useRef)(null);
2071
+ (0, import_react18.useEffect)(() => () => endDragRef.current?.(), []);
1807
2072
  const startDrag = (e, next) => {
1808
2073
  if (disabled) return;
1809
2074
  e.preventDefault();
@@ -1905,7 +2170,7 @@ var ColorPicker = ({
1905
2170
  } catch {
1906
2171
  }
1907
2172
  };
1908
- const contrastResult = (0, import_react16.useMemo)(() => {
2173
+ const contrastResult = (0, import_react18.useMemo)(() => {
1909
2174
  if (!contrastAgainst) return null;
1910
2175
  const fg = (0, import_color.parseColor)(value);
1911
2176
  const bg = (0, import_color.parseColor)(contrastAgainst);
@@ -1917,7 +2182,7 @@ var ColorPicker = ({
1917
2182
  }, [value, contrastAgainst]);
1918
2183
  const currentHex = (0, import_color.pickerStateToHex)(pickerState, alpha);
1919
2184
  const liveDescription = `Selected color: ${value}${contrastResult ? `, contrast ${contrastResult.ratio.toFixed(1)}:1 against ${contrastAgainst}, ${contrastResult.aa ? "passes AA" : "fails AA"}` : ""}`;
1920
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2185
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
1921
2186
  "div",
1922
2187
  {
1923
2188
  id: pickerId,
@@ -1941,7 +2206,7 @@ var ColorPicker = ({
1941
2206
  pointerEvents: disabled ? "none" : "auto"
1942
2207
  },
1943
2208
  children: [
1944
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2209
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1945
2210
  "span",
1946
2211
  {
1947
2212
  role: "status",
@@ -1960,7 +2225,7 @@ var ColorPicker = ({
1960
2225
  children: liveDescription
1961
2226
  }
1962
2227
  ),
1963
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2228
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1964
2229
  "div",
1965
2230
  {
1966
2231
  role: "slider",
@@ -1982,7 +2247,7 @@ var ColorPicker = ({
1982
2247
  touchAction: "none",
1983
2248
  outline: "none"
1984
2249
  },
1985
- children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2250
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1986
2251
  "div",
1987
2252
  {
1988
2253
  style: {
@@ -2002,7 +2267,7 @@ var ColorPicker = ({
2002
2267
  )
2003
2268
  }
2004
2269
  ),
2005
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2270
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2006
2271
  "div",
2007
2272
  {
2008
2273
  role: "slider",
@@ -2025,7 +2290,7 @@ var ColorPicker = ({
2025
2290
  touchAction: "none",
2026
2291
  outline: "none"
2027
2292
  },
2028
- children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2293
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2029
2294
  "div",
2030
2295
  {
2031
2296
  style: {
@@ -2045,7 +2310,7 @@ var ColorPicker = ({
2045
2310
  )
2046
2311
  }
2047
2312
  ),
2048
- alpha && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2313
+ alpha && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
2049
2314
  "div",
2050
2315
  {
2051
2316
  role: "slider",
@@ -2071,7 +2336,7 @@ var ColorPicker = ({
2071
2336
  overflow: "hidden"
2072
2337
  },
2073
2338
  children: [
2074
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2339
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2075
2340
  "div",
2076
2341
  {
2077
2342
  style: {
@@ -2081,7 +2346,7 @@ var ColorPicker = ({
2081
2346
  }
2082
2347
  }
2083
2348
  ),
2084
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2349
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2085
2350
  "div",
2086
2351
  {
2087
2352
  style: {
@@ -2102,8 +2367,8 @@ var ColorPicker = ({
2102
2367
  ]
2103
2368
  }
2104
2369
  ),
2105
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "2px" }, children: [
2106
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2370
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "2px" }, children: [
2371
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2107
2372
  "div",
2108
2373
  {
2109
2374
  style: {
@@ -2117,7 +2382,7 @@ var ColorPicker = ({
2117
2382
  flexShrink: 0,
2118
2383
  border: "1px solid rgba(255,255,255,0.15)"
2119
2384
  },
2120
- children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2385
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2121
2386
  "div",
2122
2387
  {
2123
2388
  style: {
@@ -2129,7 +2394,7 @@ var ColorPicker = ({
2129
2394
  )
2130
2395
  }
2131
2396
  ),
2132
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2397
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2133
2398
  "input",
2134
2399
  {
2135
2400
  type: "text",
@@ -2159,7 +2424,7 @@ var ColorPicker = ({
2159
2424
  }
2160
2425
  }
2161
2426
  ),
2162
- hasEyeDropper && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2427
+ hasEyeDropper && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2163
2428
  "button",
2164
2429
  {
2165
2430
  type: "button",
@@ -2179,7 +2444,7 @@ var ColorPicker = ({
2179
2444
  color: "inherit",
2180
2445
  cursor: disabled ? "default" : "pointer"
2181
2446
  },
2182
- children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2447
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
2183
2448
  "svg",
2184
2449
  {
2185
2450
  width: "14",
@@ -2191,16 +2456,16 @@ var ColorPicker = ({
2191
2456
  strokeLinecap: "round",
2192
2457
  strokeLinejoin: "round",
2193
2458
  children: [
2194
- /* @__PURE__ */ (0, import_jsx_runtime17.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" }),
2195
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "m5 16-3 3 1 1 3-3" }),
2196
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "m14 6 4 4" })
2459
+ /* @__PURE__ */ (0, import_jsx_runtime19.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" }),
2460
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "m5 16-3 3 1 1 3-3" }),
2461
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "m14 6 4 4" })
2197
2462
  ]
2198
2463
  }
2199
2464
  )
2200
2465
  }
2201
2466
  )
2202
2467
  ] }),
2203
- isClipped && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2468
+ isClipped && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2204
2469
  "div",
2205
2470
  {
2206
2471
  role: "note",
@@ -2216,10 +2481,10 @@ var ColorPicker = ({
2216
2481
  borderRadius: "4px",
2217
2482
  alignSelf: "flex-start"
2218
2483
  },
2219
- children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: "\u26A0 Clipped to sRGB" })
2484
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "\u26A0 Clipped to sRGB" })
2220
2485
  }
2221
2486
  ),
2222
- contrastResult && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2487
+ contrastResult && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
2223
2488
  "div",
2224
2489
  {
2225
2490
  style: {
@@ -2233,15 +2498,15 @@ var ColorPicker = ({
2233
2498
  border: "1px solid rgba(255,255,255,0.1)"
2234
2499
  },
2235
2500
  children: [
2236
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { children: [
2501
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { children: [
2237
2502
  "Contrast: ",
2238
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("strong", { children: [
2503
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("strong", { children: [
2239
2504
  contrastResult.ratio.toFixed(2),
2240
2505
  ":1"
2241
2506
  ] })
2242
2507
  ] }),
2243
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
2244
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2508
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
2509
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
2245
2510
  "span",
2246
2511
  {
2247
2512
  style: {
@@ -2254,7 +2519,7 @@ var ColorPicker = ({
2254
2519
  ]
2255
2520
  }
2256
2521
  ),
2257
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2522
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
2258
2523
  "span",
2259
2524
  {
2260
2525
  style: {
@@ -2271,9 +2536,9 @@ var ColorPicker = ({
2271
2536
  ]
2272
2537
  }
2273
2538
  ),
2274
- swatches && swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2275
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Palette" }),
2276
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: swatches.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2539
+ swatches && swatches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2540
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Palette" }),
2541
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: swatches.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2277
2542
  "button",
2278
2543
  {
2279
2544
  type: "button",
@@ -2299,9 +2564,9 @@ var ColorPicker = ({
2299
2564
  `${color}-${idx}`
2300
2565
  )) })
2301
2566
  ] }),
2302
- activeRecent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2303
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Recent" }),
2304
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: activeRecent.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2567
+ activeRecent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2568
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { style: { fontSize: "10px", textTransform: "uppercase", opacity: 0.6 }, children: "Recent" }),
2569
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: activeRecent.map((color, idx) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2305
2570
  "button",
2306
2571
  {
2307
2572
  type: "button",
@@ -2332,9 +2597,9 @@ var ColorPicker = ({
2332
2597
  };
2333
2598
 
2334
2599
  // src/color/DualColorPicker.tsx
2335
- var import_react17 = require("react");
2600
+ var import_react19 = require("react");
2336
2601
  var import_color2 = require("@pixerate/editor/color");
2337
- var import_jsx_runtime18 = require("react/jsx-runtime");
2602
+ var import_jsx_runtime20 = require("react/jsx-runtime");
2338
2603
  function DualColorPicker({
2339
2604
  value,
2340
2605
  onChange,
@@ -2349,8 +2614,8 @@ function DualColorPicker({
2349
2614
  disabled = false,
2350
2615
  className = ""
2351
2616
  }) {
2352
- const sameId = (0, import_react17.useId)();
2353
- const [internalScheme, setInternalScheme] = (0, import_react17.useState)("light");
2617
+ const sameId = (0, import_react19.useId)();
2618
+ const [internalScheme, setInternalScheme] = (0, import_react19.useState)("light");
2354
2619
  const activeScheme = controlledScheme ?? internalScheme;
2355
2620
  const handleSchemeSelect = (nextScheme) => {
2356
2621
  if (onSchemeChange) {
@@ -2361,7 +2626,7 @@ function DualColorPicker({
2361
2626
  };
2362
2627
  const dual = (0, import_color2.normalizeDualColor)(value) ?? { light: "#000000", dark: "#000000" };
2363
2628
  const isSame = dual.light.toLowerCase() === dual.dark.toLowerCase();
2364
- const [sameInBoth, setSameInBoth] = (0, import_react17.useState)(isSame);
2629
+ const [sameInBoth, setSameInBoth] = (0, import_react19.useState)(isSame);
2365
2630
  const handleSameToggle = (e) => {
2366
2631
  const nextSame = e.target.checked;
2367
2632
  setSameInBoth(nextSame);
@@ -2393,7 +2658,7 @@ function DualColorPicker({
2393
2658
  const activeColor = activeScheme === "dark" ? dual.dark : dual.light;
2394
2659
  const activeContrastTarget = contrastAgainst ? (0, import_color2.resolveColor)(contrastAgainst, activeScheme) ?? void 0 : void 0;
2395
2660
  const dualContrast = contrastAgainst && (0, import_color2.normalizeDualColor)(contrastAgainst) ? (0, import_color2.checkDualColorContrast)(dual, contrastAgainst) : null;
2396
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2661
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2397
2662
  "div",
2398
2663
  {
2399
2664
  className: `pixerate-dual-color-picker ${className}`,
@@ -2412,7 +2677,7 @@ function DualColorPicker({
2412
2677
  boxSizing: "border-box"
2413
2678
  },
2414
2679
  children: [
2415
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2680
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2416
2681
  "div",
2417
2682
  {
2418
2683
  role: "tablist",
@@ -2425,7 +2690,7 @@ function DualColorPicker({
2425
2690
  gap: "2px"
2426
2691
  },
2427
2692
  children: [
2428
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2693
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2429
2694
  "button",
2430
2695
  {
2431
2696
  type: "button",
@@ -2448,7 +2713,7 @@ function DualColorPicker({
2448
2713
  children: "Light"
2449
2714
  }
2450
2715
  ),
2451
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2716
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2452
2717
  "button",
2453
2718
  {
2454
2719
  type: "button",
@@ -2474,8 +2739,8 @@ function DualColorPicker({
2474
2739
  ]
2475
2740
  }
2476
2741
  ),
2477
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
2478
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2742
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
2743
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2479
2744
  "button",
2480
2745
  {
2481
2746
  type: "button",
@@ -2497,7 +2762,7 @@ function DualColorPicker({
2497
2762
  outline: "none"
2498
2763
  },
2499
2764
  children: [
2500
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2765
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2501
2766
  "span",
2502
2767
  {
2503
2768
  style: {
@@ -2509,11 +2774,11 @@ function DualColorPicker({
2509
2774
  }
2510
2775
  }
2511
2776
  ),
2512
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Light" })
2777
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Light" })
2513
2778
  ]
2514
2779
  }
2515
2780
  ),
2516
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2781
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2517
2782
  "button",
2518
2783
  {
2519
2784
  type: "button",
@@ -2535,7 +2800,7 @@ function DualColorPicker({
2535
2800
  outline: "none"
2536
2801
  },
2537
2802
  children: [
2538
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2803
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2539
2804
  "span",
2540
2805
  {
2541
2806
  style: {
@@ -2547,12 +2812,12 @@ function DualColorPicker({
2547
2812
  }
2548
2813
  }
2549
2814
  ),
2550
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Dark" })
2815
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { style: { fontSize: "11px", fontWeight: 600 }, children: "Dark" })
2551
2816
  ]
2552
2817
  }
2553
2818
  )
2554
2819
  ] }),
2555
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2820
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2556
2821
  "div",
2557
2822
  {
2558
2823
  style: {
@@ -2563,7 +2828,7 @@ function DualColorPicker({
2563
2828
  padding: "2px 0"
2564
2829
  },
2565
2830
  children: [
2566
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2831
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2567
2832
  "label",
2568
2833
  {
2569
2834
  htmlFor: sameId,
@@ -2577,7 +2842,7 @@ function DualColorPicker({
2577
2842
  color: "#c4cad4"
2578
2843
  },
2579
2844
  children: [
2580
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2845
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2581
2846
  "input",
2582
2847
  {
2583
2848
  id: sameId,
@@ -2588,11 +2853,11 @@ function DualColorPicker({
2588
2853
  style: { cursor: disabled ? "not-allowed" : "pointer" }
2589
2854
  }
2590
2855
  ),
2591
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: "Same in both" })
2856
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: "Same in both" })
2592
2857
  ]
2593
2858
  }
2594
2859
  ),
2595
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2860
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2596
2861
  "button",
2597
2862
  {
2598
2863
  type: "button",
@@ -2614,7 +2879,7 @@ function DualColorPicker({
2614
2879
  ]
2615
2880
  }
2616
2881
  ),
2617
- dualContrast && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2882
+ dualContrast && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2618
2883
  "div",
2619
2884
  {
2620
2885
  "data-testid": "dual-contrast-summary",
@@ -2628,20 +2893,20 @@ function DualColorPicker({
2628
2893
  color: "#8c95a6"
2629
2894
  },
2630
2895
  children: [
2631
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { children: [
2896
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { children: [
2632
2897
  "Light:",
2633
2898
  " ",
2634
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("strong", { style: { color: dualContrast.light.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
2899
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("strong", { style: { color: dualContrast.light.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
2635
2900
  dualContrast.light.ratio.toFixed(2),
2636
2901
  " (",
2637
2902
  dualContrast.light.level,
2638
2903
  ")"
2639
2904
  ] })
2640
2905
  ] }),
2641
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { children: [
2906
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { children: [
2642
2907
  "Dark:",
2643
2908
  " ",
2644
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("strong", { style: { color: dualContrast.dark.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
2909
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("strong", { style: { color: dualContrast.dark.level === "fail" ? "#ef4444" : "#22c55e" }, children: [
2645
2910
  dualContrast.dark.ratio.toFixed(2),
2646
2911
  " (",
2647
2912
  dualContrast.dark.level,
@@ -2651,7 +2916,7 @@ function DualColorPicker({
2651
2916
  ]
2652
2917
  }
2653
2918
  ),
2654
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2919
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2655
2920
  ColorPicker,
2656
2921
  {
2657
2922
  value: activeColor,
@@ -2670,7 +2935,7 @@ function DualColorPicker({
2670
2935
  }
2671
2936
 
2672
2937
  // src/color/useColorScheme.ts
2673
- var import_react18 = require("react");
2938
+ var import_react20 = require("react");
2674
2939
  var import_color3 = require("@pixerate/editor/color");
2675
2940
  function getSnapshot(attribute) {
2676
2941
  if (typeof window === "undefined" || typeof document === "undefined") {
@@ -2695,7 +2960,7 @@ function getServerSnapshot() {
2695
2960
  function useColorScheme(options) {
2696
2961
  const override = options?.override;
2697
2962
  const attribute = options?.attribute;
2698
- const subscribe = (0, import_react18.useMemo)(() => {
2963
+ const subscribe = (0, import_react20.useMemo)(() => {
2699
2964
  return (callback) => {
2700
2965
  if (typeof window === "undefined" || typeof document === "undefined") {
2701
2966
  return () => {
@@ -2721,7 +2986,7 @@ function useColorScheme(options) {
2721
2986
  };
2722
2987
  };
2723
2988
  }, [attribute]);
2724
- const detected = (0, import_react18.useSyncExternalStore)(
2989
+ const detected = (0, import_react20.useSyncExternalStore)(
2725
2990
  subscribe,
2726
2991
  () => getSnapshot(attribute),
2727
2992
  getServerSnapshot
@@ -2738,11 +3003,11 @@ function useResolvedColor(value, scheme) {
2738
3003
  __reExport(color_exports, require("@pixerate/editor/color"));
2739
3004
 
2740
3005
  // src/parameters/controls.tsx
2741
- var import_react19 = require("react");
2742
- var import_jsx_runtime19 = require("react/jsx-runtime");
2743
- var ParameterComponentsContext = (0, import_react19.createContext)({});
3006
+ var import_react21 = require("react");
3007
+ var import_jsx_runtime21 = require("react/jsx-runtime");
3008
+ var ParameterComponentsContext = (0, import_react21.createContext)({});
2744
3009
  function useParameterComponents() {
2745
- return (0, import_react19.useContext)(ParameterComponentsContext);
3010
+ return (0, import_react21.useContext)(ParameterComponentsContext);
2746
3011
  }
2747
3012
  function resolveParameterComponents(explicit, context) {
2748
3013
  return {
@@ -2754,7 +3019,7 @@ function resolveParameterComponents(explicit, context) {
2754
3019
  }
2755
3020
 
2756
3021
  // src/parameters/fields.tsx
2757
- var import_jsx_runtime20 = require("react/jsx-runtime");
3022
+ var import_jsx_runtime22 = require("react/jsx-runtime");
2758
3023
  var parameterInputStyle = import_parameters.parameterThemeStyles.input;
2759
3024
  var parameterSelectStyle = import_parameters.parameterThemeStyles.select;
2760
3025
  var parameterButtonStyle = import_parameters.parameterThemeStyles.button;
@@ -2763,9 +3028,9 @@ var parameterInputClass = "h-7 w-full min-w-0 rounded-md border border-input bg-
2763
3028
  var parameterButtonClass = "inline-flex h-7 items-center justify-center gap-1 rounded-md border border-input bg-background px-2 text-xs text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:pointer-events-none disabled:opacity-50";
2764
3029
  var rangeClass = "h-4 w-full min-w-0 flex-1 cursor-pointer accent-primary disabled:cursor-not-allowed disabled:opacity-50";
2765
3030
  function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown, style, ...rest }) {
2766
- const inputRef = (0, import_react20.useRef)(null);
2767
- const lastCommitted = (0, import_react20.useRef)(null);
2768
- (0, import_react20.useLayoutEffect)(() => {
3031
+ const inputRef = (0, import_react22.useRef)(null);
3032
+ const lastCommitted = (0, import_react22.useRef)(null);
3033
+ (0, import_react22.useLayoutEffect)(() => {
2769
3034
  lastCommitted.current = null;
2770
3035
  const el = inputRef.current;
2771
3036
  if (el && el.value !== value) el.value = value;
@@ -2776,9 +3041,9 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
2776
3041
  onCommit(text, el);
2777
3042
  lastCommitted.current = el.value === text ? text : null;
2778
3043
  };
2779
- const commitRef = (0, import_react20.useRef)(commit);
3044
+ const commitRef = (0, import_react22.useRef)(commit);
2780
3045
  commitRef.current = commit;
2781
- (0, import_react20.useEffect)(() => {
3046
+ (0, import_react22.useEffect)(() => {
2782
3047
  const el = inputRef.current;
2783
3048
  if (!el) return;
2784
3049
  const change = () => commitRef.current(el);
@@ -2809,7 +3074,7 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
2809
3074
  if (typeof forwarded === "function") forwarded(el);
2810
3075
  else if (forwarded) forwarded.current = el;
2811
3076
  };
2812
- return multiline ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("textarea", { ...props, ref: setRef, className: `${props.className} h-auto min-h-[3.5rem] py-1` }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("input", { type: "text", ...props, ref: setRef });
3077
+ return multiline ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("textarea", { ...props, ref: setRef, className: `${props.className} h-auto min-h-[3.5rem] py-1` }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("input", { type: "text", ...props, ref: setRef });
2813
3078
  }
2814
3079
  var plainNumber = (field, value) => (0, import_parameters.formatParameterNumber)({ ...field, unit: void 0 }, value);
2815
3080
  function ParameterNumberInput(props) {
@@ -2843,9 +3108,9 @@ function ParameterNumberInput(props) {
2843
3108
  onCommit: handleCommit,
2844
3109
  onKeyDown: handleKeyDown
2845
3110
  };
2846
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
2847
- CustomInput ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CustomInput, { ...inputProps, label: (0, import_parameters.parameterLabel)(field) }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ParameterCommitInput, { ...inputProps }),
2848
- field.unit && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
3111
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
3112
+ CustomInput ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CustomInput, { ...inputProps, label: (0, import_parameters.parameterLabel)(field) }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ParameterCommitInput, { ...inputProps }),
3113
+ field.unit && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
2849
3114
  ] });
2850
3115
  }
2851
3116
  function ParameterSlider(props) {
@@ -2853,7 +3118,7 @@ function ParameterSlider(props) {
2853
3118
  const ctx = useParameterComponents();
2854
3119
  const resolved = resolveParameterComponents(components, ctx);
2855
3120
  const CustomSlider = resolved.slider;
2856
- const dragging = (0, import_react20.useRef)(false);
3121
+ const dragging = (0, import_react22.useRef)(false);
2857
3122
  const start = () => {
2858
3123
  if (dragging.current) return;
2859
3124
  dragging.current = true;
@@ -2864,7 +3129,7 @@ function ParameterSlider(props) {
2864
3129
  dragging.current = false;
2865
3130
  onGestureEnd?.();
2866
3131
  };
2867
- if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ParameterNumberInput, { ...props });
3132
+ if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ParameterNumberInput, { ...props });
2868
3133
  const step = (0, import_parameters.parameterStep)(field);
2869
3134
  const sliderProps = {
2870
3135
  "aria-label": (0, import_parameters.parameterLabel)(field),
@@ -2878,8 +3143,8 @@ function ParameterSlider(props) {
2878
3143
  className: rangeClass,
2879
3144
  style: parameterRangeStyle
2880
3145
  };
2881
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2", children: [
2882
- CustomSlider ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3146
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-2", children: [
3147
+ CustomSlider ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2883
3148
  CustomSlider,
2884
3149
  {
2885
3150
  ...sliderProps,
@@ -2889,7 +3154,7 @@ function ParameterSlider(props) {
2889
3154
  onGestureStart: start,
2890
3155
  onGestureEnd: end
2891
3156
  }
2892
- ) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3157
+ ) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2893
3158
  "input",
2894
3159
  {
2895
3160
  type: "range",
@@ -2901,11 +3166,11 @@ function ParameterSlider(props) {
2901
3166
  onChange: (e) => onChange((0, import_parameters.clampParameterNumber)(field, Number(e.target.value)))
2902
3167
  }
2903
3168
  ),
2904
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
3169
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
2905
3170
  ] });
2906
3171
  }
2907
3172
  function ParameterToggle({ field, value, onChange, disabled, id }) {
2908
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3173
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2909
3174
  "button",
2910
3175
  {
2911
3176
  type: "button",
@@ -2916,7 +3181,7 @@ function ParameterToggle({ field, value, onChange, disabled, id }) {
2916
3181
  disabled: disabled || field.readOnly,
2917
3182
  onClick: () => onChange(!value),
2918
3183
  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"}`,
2919
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3184
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2920
3185
  "span",
2921
3186
  {
2922
3187
  className: `pointer-events-none block h-4 w-4 rounded-full bg-background shadow transition-transform ${value ? "translate-x-4" : "translate-x-0.5"}`
@@ -2933,7 +3198,7 @@ function ParameterSelect(props) {
2933
3198
  const options = (0, import_parameters.getChoiceOptions)(field);
2934
3199
  const off = disabled || field.readOnly;
2935
3200
  if (field.control === "segmented") {
2936
- return /* @__PURE__ */ (0, import_jsx_runtime20.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_runtime20.jsx)(
3201
+ return /* @__PURE__ */ (0, import_jsx_runtime22.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_runtime22.jsx)(
2937
3202
  "button",
2938
3203
  {
2939
3204
  type: "button",
@@ -2950,7 +3215,7 @@ function ParameterSelect(props) {
2950
3215
  }
2951
3216
  if (CustomSelect) {
2952
3217
  const customOptions = options.map((o) => ({ value: o.value, label: (0, import_parameters.choiceOptionLabel)(o), description: o.description }));
2953
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3218
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2954
3219
  CustomSelect,
2955
3220
  {
2956
3221
  id,
@@ -2966,7 +3231,7 @@ function ParameterSelect(props) {
2966
3231
  );
2967
3232
  }
2968
3233
  const index = options.findIndex((o) => o.value === value);
2969
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3234
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2970
3235
  "select",
2971
3236
  {
2972
3237
  id,
@@ -2979,23 +3244,23 @@ function ParameterSelect(props) {
2979
3244
  },
2980
3245
  className: parameterInputClass,
2981
3246
  style: parameterSelectStyle,
2982
- children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: String(i), title: o.description, style: parameterSelectStyle, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
3247
+ children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: String(i), title: o.description, style: parameterSelectStyle, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
2983
3248
  }
2984
3249
  );
2985
3250
  }
2986
3251
  function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id, components }) {
2987
3252
  const CustomColor = resolveParameterComponents(components, useParameterComponents()).color;
2988
- const [open, setOpen] = (0, import_react20.useState)(false);
2989
- const containerRef = (0, import_react20.useRef)(null);
2990
- const buttonRef = (0, import_react20.useRef)(null);
2991
- const popoverRef = (0, import_react20.useRef)(null);
3253
+ const [open, setOpen] = (0, import_react22.useState)(false);
3254
+ const containerRef = (0, import_react22.useRef)(null);
3255
+ const buttonRef = (0, import_react22.useRef)(null);
3256
+ const popoverRef = (0, import_react22.useRef)(null);
2992
3257
  const alpha = !!field.alpha;
2993
3258
  const hex = (0, import_parameters.normalizeHexColor)(value, true) ?? "#000000ff";
2994
3259
  const rgb = hex.slice(0, 7);
2995
3260
  const shown = alpha ? hex : rgb;
2996
3261
  const off = disabled || field.readOnly;
2997
3262
  const name = (0, import_parameters.parameterLabel)(field);
2998
- (0, import_react20.useEffect)(() => {
3263
+ (0, import_react22.useEffect)(() => {
2999
3264
  if (!open) return;
3000
3265
  const onPointerDown = (e) => {
3001
3266
  if (containerRef.current && !containerRef.current.contains(e.target)) {
@@ -3017,7 +3282,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3017
3282
  };
3018
3283
  }, [open]);
3019
3284
  if (CustomColor) {
3020
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3285
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3021
3286
  CustomColor,
3022
3287
  {
3023
3288
  id,
@@ -3032,9 +3297,9 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3032
3297
  }
3033
3298
  );
3034
3299
  }
3035
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
3036
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2", children: [
3037
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3300
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
3301
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-2", children: [
3302
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3038
3303
  "button",
3039
3304
  {
3040
3305
  ref: buttonRef,
@@ -3045,10 +3310,10 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3045
3310
  disabled: off,
3046
3311
  onClick: () => setOpen((prev) => !prev),
3047
3312
  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",
3048
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
3313
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
3049
3314
  }
3050
3315
  ),
3051
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3316
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3052
3317
  ParameterCommitInput,
3053
3318
  {
3054
3319
  id,
@@ -3064,7 +3329,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3064
3329
  }
3065
3330
  )
3066
3331
  ] }),
3067
- open && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3332
+ open && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3068
3333
  "div",
3069
3334
  {
3070
3335
  ref: popoverRef,
@@ -3078,7 +3343,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3078
3343
  },
3079
3344
  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",
3080
3345
  style: { background: "var(--popover, var(--background, #fff))" },
3081
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3346
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3082
3347
  ColorPicker,
3083
3348
  {
3084
3349
  value: shown,
@@ -3096,11 +3361,11 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
3096
3361
  }
3097
3362
  function ParameterVector({ field, value, onChange, disabled, id, components }) {
3098
3363
  const size = (0, import_parameters.vectorSize)(field);
3099
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
3364
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
3100
3365
  const component = (0, import_parameters.vectorComponentField)(field, i);
3101
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
3102
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
3103
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3366
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
3367
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
3368
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3104
3369
  ParameterNumberInput,
3105
3370
  {
3106
3371
  field: component,
@@ -3118,11 +3383,11 @@ function ParameterVector({ field, value, onChange, disabled, id, components }) {
3118
3383
  function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3119
3384
  const off = disabled || field.readOnly;
3120
3385
  const name = (0, import_parameters.parameterLabel)(field);
3121
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1.5", children: [
3122
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2", children: [
3123
- /* @__PURE__ */ (0, import_jsx_runtime20.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_runtime20.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
3124
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
3125
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3386
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "space-y-1.5", children: [
3387
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-2", children: [
3388
+ /* @__PURE__ */ (0, import_jsx_runtime22.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_runtime22.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
3389
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
3390
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3126
3391
  ParameterCommitInput,
3127
3392
  {
3128
3393
  id,
@@ -3133,15 +3398,15 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3133
3398
  onCommit: (text) => onChange(text.trim())
3134
3399
  }
3135
3400
  ),
3136
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex gap-1", children: [
3137
- resolveFile && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
3401
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex gap-1", children: [
3402
+ resolveFile && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
3138
3403
  "label",
3139
3404
  {
3140
3405
  style: parameterButtonStyle,
3141
3406
  className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`,
3142
3407
  children: [
3143
3408
  "Choose file\u2026",
3144
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3409
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3145
3410
  "input",
3146
3411
  {
3147
3412
  type: "file",
@@ -3159,7 +3424,7 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3159
3424
  ]
3160
3425
  }
3161
3426
  ),
3162
- value && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3427
+ value && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3163
3428
  "button",
3164
3429
  {
3165
3430
  type: "button",
@@ -3174,7 +3439,7 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3174
3439
  ] })
3175
3440
  ] })
3176
3441
  ] }),
3177
- field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3442
+ field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3178
3443
  "button",
3179
3444
  {
3180
3445
  type: "button",
@@ -3184,14 +3449,14 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
3184
3449
  disabled: off,
3185
3450
  onClick: () => onChange(o.url),
3186
3451
  className: "h-9 w-12 overflow-hidden rounded border border-input aria-pressed:ring-2 aria-pressed:ring-primary",
3187
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
3452
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
3188
3453
  },
3189
3454
  o.url
3190
3455
  )) })
3191
3456
  ] });
3192
3457
  }
3193
3458
  function ParameterText({ field, value, onChange, disabled, id }) {
3194
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3459
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3195
3460
  ParameterCommitInput,
3196
3461
  {
3197
3462
  id,
@@ -3210,24 +3475,24 @@ function ParameterFieldControl({ field, value, onChange, resolveFile, ...rest })
3210
3475
  switch (field.type) {
3211
3476
  case "number":
3212
3477
  case "int":
3213
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
3478
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
3214
3479
  case "boolean":
3215
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
3480
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
3216
3481
  case "choice":
3217
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
3482
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
3218
3483
  case "color":
3219
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
3484
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
3220
3485
  case "vector":
3221
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
3486
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
3222
3487
  case "image":
3223
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
3488
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
3224
3489
  case "text":
3225
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ParameterText, { field, value, onChange: set, ...rest });
3490
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ParameterText, { field, value, onChange: set, ...rest });
3226
3491
  }
3227
3492
  }
3228
3493
 
3229
3494
  // src/effects/EffectParameters.tsx
3230
- var import_jsx_runtime21 = require("react/jsx-runtime");
3495
+ var import_jsx_runtime23 = require("react/jsx-runtime");
3231
3496
  function EffectParameters({
3232
3497
  description,
3233
3498
  values,
@@ -3242,10 +3507,10 @@ function EffectParameters({
3242
3507
  className = "",
3243
3508
  components
3244
3509
  }) {
3245
- const fields = (0, import_react21.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
3246
- const idBase = (0, import_react21.useId)();
3247
- const gesture = import_react21.default.useRef(null);
3248
- const count = import_react21.default.useRef(0);
3510
+ const fields = (0, import_react23.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
3511
+ const idBase = (0, import_react23.useId)();
3512
+ const gesture = import_react23.default.useRef(null);
3513
+ const count = import_react23.default.useRef(0);
3249
3514
  const CustomPresetSelect = resolveParameterComponents(components, useParameterComponents()).select;
3250
3515
  const handlePresetSelect = (name) => {
3251
3516
  if (!name) return;
@@ -3256,8 +3521,8 @@ function EffectParameters({
3256
3521
  if (preset) onPreset({ ...description.defaults, ...preset.values });
3257
3522
  }
3258
3523
  };
3259
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
3260
- (onPreset || onPresetName) && description.presets.length > 0 && (CustomPresetSelect ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3524
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
3525
+ (onPreset || onPresetName) && description.presets.length > 0 && (CustomPresetSelect ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3261
3526
  CustomPresetSelect,
3262
3527
  {
3263
3528
  "aria-label": `${description.name} presets`,
@@ -3272,7 +3537,7 @@ function EffectParameters({
3272
3537
  ],
3273
3538
  onChange: (name) => handlePresetSelect(String(name))
3274
3539
  }
3275
- ) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
3540
+ ) : /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
3276
3541
  "select",
3277
3542
  {
3278
3543
  className: "w-full rounded border border-border px-1 py-0.5 text-xs",
@@ -3282,8 +3547,8 @@ function EffectParameters({
3282
3547
  disabled,
3283
3548
  onChange: (e) => handlePresetSelect(e.currentTarget.value),
3284
3549
  children: [
3285
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "", style: parameterSelectStyle, children: "Presets\u2026" }),
3286
- description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: p.name, style: parameterSelectStyle, children: p.name }, p.name))
3550
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "", style: parameterSelectStyle, children: "Presets\u2026" }),
3551
+ description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: p.name, style: parameterSelectStyle, children: p.name }, p.name))
3287
3552
  ]
3288
3553
  }
3289
3554
  )),
@@ -3293,14 +3558,14 @@ function EffectParameters({
3293
3558
  const keyed = keyframed?.has(field.id) ?? false;
3294
3559
  const value = (0, import_effects3.effectFieldValue)(field, values[field.id]);
3295
3560
  const changed = !keyed && !(0, import_parameters2.parameterValuesEqual)(value, field.default);
3296
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
3297
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5", children: [
3298
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
3299
- keyed && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
3561
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
3562
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-1.5", children: [
3563
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
3564
+ keyed && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
3300
3565
  renderControlAddon?.(field.id),
3301
- onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime21.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" })
3566
+ onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime23.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" })
3302
3567
  ] }),
3303
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3568
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3304
3569
  ParameterFieldControl,
3305
3570
  {
3306
3571
  field,
@@ -3315,15 +3580,15 @@ function EffectParameters({
3315
3580
  )
3316
3581
  ] }, field.id);
3317
3582
  }),
3318
- !fields.length && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
3583
+ !fields.length && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
3319
3584
  ] });
3320
3585
  }
3321
3586
 
3322
3587
  // src/paint-editor/PaintEffectsPanel.tsx
3323
- var import_jsx_runtime22 = require("react/jsx-runtime");
3588
+ var import_jsx_runtime24 = require("react/jsx-runtime");
3324
3589
  function usePaintEffectsProvider(controller) {
3325
- const [provider, setProvider] = (0, import_react22.useState)(controller.effectsProvider);
3326
- (0, import_react22.useEffect)(() => {
3590
+ const [provider, setProvider] = (0, import_react24.useState)(controller.effectsProvider);
3591
+ (0, import_react24.useEffect)(() => {
3327
3592
  setProvider(controller.effectsProvider);
3328
3593
  return controller.effects.subscribe(setProvider);
3329
3594
  }, [controller]);
@@ -3331,27 +3596,27 @@ function usePaintEffectsProvider(controller) {
3331
3596
  }
3332
3597
  function usePaintEffectsTools(registry, controller, options = {}) {
3333
3598
  const { id, namespace, readOnly, playbackSurface } = options;
3334
- (0, import_react22.useEffect)(() => {
3599
+ (0, import_react24.useEffect)(() => {
3335
3600
  if (!registry) return;
3336
3601
  return registry.register((0, import_paint_editor14.createPaintEffectsToolProvider)(controller, { id, namespace, readOnly, playbackSurface }));
3337
3602
  }, [registry, controller, id, namespace, readOnly, playbackSurface]);
3338
3603
  }
3339
3604
  function Controls({ provider, effect, name, values, apply }) {
3340
3605
  const { description, error } = useEffectDescription(provider, effect);
3341
- const drags = (0, import_react22.useRef)(/* @__PURE__ */ new Set());
3342
- if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("p", { className: "text-[11px] text-slate-400", children: [
3606
+ const drags = (0, import_react24.useRef)(/* @__PURE__ */ new Set());
3607
+ if (!provider) return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("p", { className: "text-[11px] text-slate-400", children: [
3343
3608
  'No effects provider: "',
3344
3609
  name ?? effect,
3345
3610
  '" is kept as it was drawn.'
3346
3611
  ] });
3347
- if (error) return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] text-amber-400", children: error });
3348
- if (!description) return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
3612
+ if (error) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-[11px] text-amber-400", children: error });
3613
+ if (!description) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-[11px] text-slate-400", children: "Loading\u2026" });
3349
3614
  const commit = (gesture) => {
3350
3615
  if (!gesture || drags.current.has(gesture)) return !gesture;
3351
3616
  drags.current.add(gesture);
3352
3617
  return true;
3353
3618
  };
3354
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3619
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3355
3620
  EffectParameters,
3356
3621
  {
3357
3622
  description,
@@ -3373,8 +3638,8 @@ var PaintEffectsPanel = ({ controller, className }) => {
3373
3638
  const state = usePaintEditorState(controller);
3374
3639
  const provider = usePaintEffectsProvider(controller);
3375
3640
  const [error, attempt] = useAttempt();
3376
- const [browse, setBrowse] = (0, import_react22.useState)(null);
3377
- const [busy, setBusy] = (0, import_react22.useState)(false);
3641
+ const [browse, setBrowse] = (0, import_react24.useState)(null);
3642
+ const [busy, setBusy] = (0, import_react24.useState)(false);
3378
3643
  const paper = controller.getPaperEffect();
3379
3644
  const activeId = state.document.activeLayerId;
3380
3645
  const layerEffect = activeId ? controller.getEffectLayer(activeId) : void 0;
@@ -3386,7 +3651,7 @@ var PaintEffectsPanel = ({ controller, className }) => {
3386
3651
  if (!effectPaint) return;
3387
3652
  run(() => controller.setEffectPaint({ effect: effectPaint.effect, values: effectPaint.values, time: effectPaint.time, map: effectPaint.map, live: effectPaint.live, ...patch }));
3388
3653
  };
3389
- const thumbnail = (0, import_react22.useMemo)(() => effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(48) : null, [controller, effectPaint, state.effectPaintRendering]);
3654
+ const thumbnail = (0, import_react24.useMemo)(() => effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(48) : null, [controller, effectPaint, state.effectPaintRendering]);
3390
3655
  const run = (work) => attempt(() => {
3391
3656
  setBusy(true);
3392
3657
  return work().finally(() => setBusy(false));
@@ -3402,28 +3667,28 @@ var PaintEffectsPanel = ({ controller, className }) => {
3402
3667
  };
3403
3668
  const toggle = (b) => setBrowse(browse === b ? null : b);
3404
3669
  const pixel = active?.type === "pixel";
3405
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-effects-panel", "aria-busy": busy, children: [
3406
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
3407
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "flex-1 font-medium text-slate-300", children: "Effects" }),
3408
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paper", onClick: () => toggle("paper"), children: "Paper\u2026" }),
3409
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => toggle("layer"), children: "Layer\u2026" }),
3410
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "fill", onClick: () => toggle("fill"), children: "Fill\u2026" }),
3411
- /* @__PURE__ */ (0, import_jsx_runtime22.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" }),
3412
- /* @__PURE__ */ (0, import_jsx_runtime22.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" })
3670
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-effects-panel", "aria-busy": busy, children: [
3671
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
3672
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "flex-1 font-medium text-slate-300", children: "Effects" }),
3673
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paper", onClick: () => toggle("paper"), children: "Paper\u2026" }),
3674
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => toggle("layer"), children: "Layer\u2026" }),
3675
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: button, disabled: !provider || !pixel, "aria-pressed": browse === "fill", onClick: () => toggle("fill"), children: "Fill\u2026" }),
3676
+ /* @__PURE__ */ (0, import_jsx_runtime24.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" }),
3677
+ /* @__PURE__ */ (0, import_jsx_runtime24.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" })
3413
3678
  ] }),
3414
- !provider && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the painting are kept." }),
3415
- browse && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(EffectsBrowser, { provider, uses: BROWSERS[browse].uses, title: BROWSERS[browse].title, onPick: (e) => pick(e.id) }),
3416
- paper && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paper", children: [
3417
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1", children: [
3418
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "flex-1 truncate", children: [
3679
+ !provider && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the painting are kept." }),
3680
+ browse && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(EffectsBrowser, { provider, uses: BROWSERS[browse].uses, title: BROWSERS[browse].title, onPick: (e) => pick(e.id) }),
3681
+ paper && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paper", children: [
3682
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-1", children: [
3683
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "flex-1 truncate", children: [
3419
3684
  "Paper: ",
3420
3685
  paper.name ?? paper.effect
3421
3686
  ] }),
3422
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: button, "aria-label": "Remove the effect paper", onClick: () => run(() => controller.setPaperEffect(null)), children: "\u2715" })
3687
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: button, "aria-label": "Remove the effect paper", onClick: () => run(() => controller.setPaperEffect(null)), children: "\u2715" })
3423
3688
  ] }),
3424
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1", children: [
3425
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Opacity" }),
3426
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3689
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1", children: [
3690
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Opacity" }),
3691
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3427
3692
  "input",
3428
3693
  {
3429
3694
  type: "range",
@@ -3445,39 +3710,39 @@ var PaintEffectsPanel = ({ controller, className }) => {
3445
3710
  `o${paper.opacity}`
3446
3711
  )
3447
3712
  ] }),
3448
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1", children: [
3449
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Blend" }),
3450
- /* @__PURE__ */ (0, import_jsx_runtime22.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) => {
3713
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1", children: [
3714
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "w-14 text-[11px] text-slate-400", children: "Blend" }),
3715
+ /* @__PURE__ */ (0, import_jsx_runtime24.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) => {
3451
3716
  const blend = e.currentTarget.value;
3452
3717
  run(() => controller.updatePaperEffect({ blend }));
3453
- }, children: import_paint_editor14.PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: b, children: b }, b)) })
3718
+ }, children: import_paint_editor14.PAPER_EFFECT_BLENDS.map((b) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: b, children: b }, b)) })
3454
3719
  ] }),
3455
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Controls, { provider, effect: paper.effect, name: paper.name, values: paper.values, apply: (values, commit) => run(() => controller.updatePaperEffect({ values }, commit)) })
3720
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Controls, { provider, effect: paper.effect, name: paper.name, values: paper.values, apply: (values, commit) => run(() => controller.updatePaperEffect({ values }, commit)) })
3456
3721
  ] }),
3457
- effectPaint && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paint", children: [
3458
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1", children: [
3459
- thumbnail ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("img", { src: thumbnail, alt: "", className: "h-5 w-8 rounded object-cover ring-1 ring-slate-700", "data-testid": "effect-paint-thumbnail" }) : null,
3460
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "flex-1 truncate", children: [
3722
+ effectPaint && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paint", children: [
3723
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-1", children: [
3724
+ thumbnail ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("img", { src: thumbnail, alt: "", className: "h-5 w-8 rounded object-cover ring-1 ring-slate-700", "data-testid": "effect-paint-thumbnail" }) : null,
3725
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "flex-1 truncate", children: [
3461
3726
  "Paint: ",
3462
3727
  effectPaint.effect,
3463
3728
  state.effectPaintRendering ? " (rendering\u2026)" : ""
3464
3729
  ] }),
3465
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: button, "aria-label": "Stop painting with the effect", onClick: () => attempt(() => controller.setColor(state.color)), children: "\u2715" })
3730
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: button, "aria-label": "Stop painting with the effect", onClick: () => attempt(() => controller.setColor(state.color)), children: "\u2715" })
3466
3731
  ] }),
3467
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap items-center gap-2", "data-testid": "effect-paint-placement", children: [
3468
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1", title: "Lay the effect along each stroke instead of fixing it to the canvas", children: [
3469
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("input", { type: "checkbox", checked: Boolean(effectPaint.map), onChange: (e) => repaint({ map: e.target.checked ? { by: "stroke", length: 300, repeat: "repeat" } : { by: "canvas" } }) }),
3732
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-wrap items-center gap-2", "data-testid": "effect-paint-placement", children: [
3733
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1", title: "Lay the effect along each stroke instead of fixing it to the canvas", children: [
3734
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("input", { type: "checkbox", checked: Boolean(effectPaint.map), onChange: (e) => repaint({ map: e.target.checked ? { by: "stroke", length: 300, repeat: "repeat" } : { by: "canvas" } }) }),
3470
3735
  "Along the stroke"
3471
3736
  ] }),
3472
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1", title: "Strokes on a stroke layer keep playing the effect", children: [
3473
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("input", { type: "checkbox", checked: Boolean(effectPaint.live), onChange: (e) => repaint({ live: e.target.checked }) }),
3737
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1", title: "Strokes on a stroke layer keep playing the effect", children: [
3738
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("input", { type: "checkbox", checked: Boolean(effectPaint.live), onChange: (e) => repaint({ live: e.target.checked }) }),
3474
3739
  "Live"
3475
3740
  ] })
3476
3741
  ] }),
3477
- effectPaint.map && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
3478
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1", children: [
3479
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-slate-400", children: "Length" }),
3480
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3742
+ effectPaint.map && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
3743
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1", children: [
3744
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-slate-400", children: "Length" }),
3745
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3481
3746
  "input",
3482
3747
  {
3483
3748
  type: "number",
@@ -3491,55 +3756,55 @@ var PaintEffectsPanel = ({ controller, className }) => {
3491
3756
  effectPaint.map.length
3492
3757
  )
3493
3758
  ] }),
3494
- /* @__PURE__ */ (0, import_jsx_runtime22.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: [
3495
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "repeat", children: "Repeat" }),
3496
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "mirror", children: "Mirror" }),
3497
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "clamp", children: "Clamp" })
3759
+ /* @__PURE__ */ (0, import_jsx_runtime24.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: [
3760
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: "repeat", children: "Repeat" }),
3761
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: "mirror", children: "Mirror" }),
3762
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: "clamp", children: "Clamp" })
3498
3763
  ] })
3499
3764
  ] }),
3500
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Controls, { provider, effect: effectPaint.effect, values: effectPaint.values, apply: (values) => repaint({ values: { ...effectPaint.values, ...values } }) })
3765
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Controls, { provider, effect: effectPaint.effect, values: effectPaint.values, apply: (values) => repaint({ values: { ...effectPaint.values, ...values } }) })
3501
3766
  ] }),
3502
- animation && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-2 rounded border border-slate-700 p-1", "data-effect-part": "playback", children: [
3503
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "flex-1 truncate", children: [
3767
+ animation && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-2 rounded border border-slate-700 p-1", "data-effect-part": "playback", children: [
3768
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "flex-1 truncate", children: [
3504
3769
  "Live paint: ",
3505
3770
  animation.strokes,
3506
3771
  " ",
3507
3772
  animation.strokes === 1 ? "stroke" : "strokes"
3508
3773
  ] }),
3509
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: button, "aria-pressed": playback.playing, onClick: () => attempt(() => controller.setEffectPlayback({ playing: !playback.playing })), children: playback.playing ? "Pause" : "Play" }),
3510
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1", children: [
3511
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-slate-400", children: "fps" }),
3512
- /* @__PURE__ */ (0, import_jsx_runtime22.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" })
3774
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: button, "aria-pressed": playback.playing, onClick: () => attempt(() => controller.setEffectPlayback({ playing: !playback.playing })), children: playback.playing ? "Pause" : "Play" }),
3775
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1", children: [
3776
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-slate-400", children: "fps" }),
3777
+ /* @__PURE__ */ (0, import_jsx_runtime24.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" })
3513
3778
  ] })
3514
3779
  ] }),
3515
- layerEffect && activeId && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "layer", children: [
3516
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1", children: [
3517
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "flex-1 truncate", children: [
3780
+ layerEffect && activeId && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "layer", children: [
3781
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-1", children: [
3782
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "flex-1 truncate", children: [
3518
3783
  "Layer: ",
3519
3784
  layerEffect.name ?? layerEffect.effect
3520
3785
  ] }),
3521
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: button, title: "Keep the pixels as a plain layer", onClick: () => attempt(() => controller.rasterizeEffectLayer(activeId)), children: "Rasterize" })
3786
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: button, title: "Keep the pixels as a plain layer", onClick: () => attempt(() => controller.rasterizeEffectLayer(activeId)), children: "Rasterize" })
3522
3787
  ] }),
3523
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Controls, { provider, effect: layerEffect.effect, name: layerEffect.name, values: layerEffect.values, apply: (values, commit) => run(() => controller.updateEffectLayer(activeId, { values }, commit)) })
3788
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Controls, { provider, effect: layerEffect.effect, name: layerEffect.name, values: layerEffect.values, apply: (values, commit) => run(() => controller.updateEffectLayer(activeId, { values }, commit)) })
3524
3789
  ] }),
3525
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ErrorLine, { error })
3790
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ErrorLine, { error })
3526
3791
  ] });
3527
3792
  };
3528
3793
 
3529
3794
  // src/paint-editor/PaintEditor.tsx
3530
- var import_jsx_runtime23 = require("react/jsx-runtime");
3795
+ var import_jsx_runtime25 = require("react/jsx-runtime");
3531
3796
  var PAINT_CONTROLS = {
3532
3797
  "mixing-pad": '[data-testid="mixing-pad"]',
3533
3798
  lighting: '[data-testid="light-panel"]',
3534
3799
  symmetry: '[aria-label="Symmetry"]'
3535
3800
  };
3536
3801
  var PaintEditor = ({ controller, fileName, height = 720, presence, className, playback, playbackId = "paint", onPlaybackReveal }) => {
3537
- const [tool, setTool] = (0, import_react23.useState)("brush");
3538
- const [tab, setTab] = (0, import_react23.useState)("color");
3539
- const tabRef = (0, import_react23.useRef)(tab);
3802
+ const [tool, setTool] = (0, import_react25.useState)("brush");
3803
+ const [tab, setTab] = (0, import_react25.useState)("color");
3804
+ const tabRef = (0, import_react25.useRef)(tab);
3540
3805
  tabRef.current = tab;
3541
- const rootRef = (0, import_react23.useRef)(null);
3542
- const [ownPresence] = (0, import_react23.useState)(() => new import_paint_editor15.PaintPresence());
3806
+ const rootRef = (0, import_react25.useRef)(null);
3807
+ const [ownPresence] = (0, import_react25.useState)(() => new import_paint_editor15.PaintPresence());
3543
3808
  const ambientPlayback = useAgentPlayback();
3544
3809
  const playing = (playback === void 0 ? ambientPlayback : playback) ?? null;
3545
3810
  const viewBox = () => {
@@ -3595,28 +3860,28 @@ var PaintEditor = ({ controller, fileName, height = 720, presence, className, pl
3595
3860
  const box = rootRef.current?.getBoundingClientRect();
3596
3861
  return c && box ? { x: c.x - box.left, y: c.y - box.top } : p;
3597
3862
  };
3598
- const [error, setError] = (0, import_react23.useState)(null);
3863
+ const [error, setError] = (0, import_react25.useState)(null);
3599
3864
  const effects = usePaintEffectsProvider(controller);
3600
3865
  const tabs = effects ? ["color", "wet", "paper", "layers", "effects"] : ["color", "wet", "paper", "layers"];
3601
- return /* @__PURE__ */ (0, import_jsx_runtime23.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: [
3602
- playing && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PresenceLayer, { presence: agentPresence, viewport: docToRoot }),
3603
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PaintToolbar, { controller, tool, onToolChange: setTool, fileName }),
3604
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex min-h-0 flex-1 gap-2", children: [
3605
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(BrushPanel, { controller, className: "w-60 shrink-0 overflow-y-auto pr-1" }),
3606
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
3607
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PaintCanvas, { controller, tool, onError: setError, presence: playing ? void 0 : presence, className: "flex-1 rounded-lg" }),
3608
- error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { role: "alert", className: "mt-1 text-[11px] text-rose-400", children: error })
3866
+ return /* @__PURE__ */ (0, import_jsx_runtime25.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: [
3867
+ playing && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(PresenceLayer, { presence: agentPresence, viewport: docToRoot }),
3868
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(PaintToolbar, { controller, tool, onToolChange: setTool, fileName }),
3869
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex min-h-0 flex-1 gap-2", children: [
3870
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(BrushPanel, { controller, className: "w-60 shrink-0 overflow-y-auto pr-1" }),
3871
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
3872
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(PaintCanvas, { controller, tool, onError: setError, presence: playing ? void 0 : presence, className: "flex-1 rounded-lg" }),
3873
+ error && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { role: "alert", className: "mt-1 text-[11px] text-rose-400", children: error })
3609
3874
  ] }),
3610
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex w-64 shrink-0 flex-col gap-2 overflow-y-auto pr-1", children: [
3611
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex gap-1", role: "tablist", "aria-label": "Paint panels", children: tabs.map((t) => /* @__PURE__ */ (0, import_jsx_runtime23.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)) }),
3612
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-2", "data-paint-panel": tab, children: [
3613
- tab === "color" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ColorPanel, { controller }),
3614
- tab === "wet" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(WetPanel, { controller }),
3615
- tab === "paper" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PaperPanel, { controller }),
3616
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PaintLayersPanel, { controller }),
3617
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(StrokePanel, { controller }),
3618
- tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(StickerPanel, { controller }),
3619
- tab === "effects" && effects && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PaintEffectsPanel, { controller })
3875
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex w-64 shrink-0 flex-col gap-2 overflow-y-auto pr-1", children: [
3876
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex gap-1", role: "tablist", "aria-label": "Paint panels", children: tabs.map((t) => /* @__PURE__ */ (0, import_jsx_runtime25.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)) }),
3877
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col gap-2", "data-paint-panel": tab, children: [
3878
+ tab === "color" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ColorPanel, { controller }),
3879
+ tab === "wet" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(WetPanel, { controller }),
3880
+ tab === "paper" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(PaperPanel, { controller }),
3881
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(PaintLayersPanel, { controller }),
3882
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(StrokePanel, { controller }),
3883
+ tab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(StickerPanel, { controller }),
3884
+ tab === "effects" && effects && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(PaintEffectsPanel, { controller })
3620
3885
  ] })
3621
3886
  ] })
3622
3887
  ] })