@pixerate/editor 0.271.0 → 0.272.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.
Files changed (56) hide show
  1. package/dist/animation-editor/index.cjs +60 -60
  2. package/dist/animation-editor/index.js +4 -4
  3. package/dist/brushes/index.cjs +69 -66
  4. package/dist/brushes/index.js +6 -3
  5. package/dist/brushes/patch.d.cts +1 -1
  6. package/dist/brushes/patch.d.ts +1 -1
  7. package/dist/brushes/schema.d.cts +1 -0
  8. package/dist/brushes/schema.d.ts +1 -0
  9. package/dist/brushes/types.d.cts +8 -0
  10. package/dist/brushes/types.d.ts +8 -0
  11. package/dist/{brushstrokeRender-WR2N5HHY.cjs → brushstrokeRender-5YBCLFDQ.cjs} +15 -15
  12. package/dist/{brushstrokeRender-A727TTNQ.js → brushstrokeRender-DZGFU3J4.js} +3 -3
  13. package/dist/canvas/index.cjs +13 -13
  14. package/dist/canvas/index.js +1 -1
  15. package/dist/{chunk-YNFSH72F.js → chunk-2F3YDXCN.js} +1 -1
  16. package/dist/{chunk-QYXUE37Q.js → chunk-2XDNF73E.js} +1 -1
  17. package/dist/{chunk-3KNQ2W6X.cjs → chunk-3JKCREEU.cjs} +59 -53
  18. package/dist/{chunk-B5W677L7.js → chunk-5HP2VSAS.js} +1 -1
  19. package/dist/{chunk-BPJSI4NT.cjs → chunk-7W2EQQBP.cjs} +2 -2
  20. package/dist/{chunk-LETF75CA.js → chunk-CLB2I2FU.js} +1 -1
  21. package/dist/{chunk-BAZMCFVL.js → chunk-DZVRH63Y.js} +1 -1
  22. package/dist/{chunk-U2ASNGO6.cjs → chunk-FXVCB6YG.cjs} +35 -35
  23. package/dist/{chunk-EU2ZZA6L.cjs → chunk-GHGBIAWQ.cjs} +126 -39
  24. package/dist/{chunk-2WOGXEDX.cjs → chunk-M3RZOF3G.cjs} +1 -1
  25. package/dist/{chunk-GSTSZPSR.js → chunk-N3SKPQEH.js} +225 -18
  26. package/dist/{chunk-J5VQYK7T.cjs → chunk-N5IMDAHM.cjs} +251 -44
  27. package/dist/{chunk-ININNHLM.js → chunk-NAHJV3O6.js} +11 -5
  28. package/dist/{chunk-JJ2H25JG.cjs → chunk-SNAFFCAX.cjs} +200 -174
  29. package/dist/{chunk-M2ZVPU7L.cjs → chunk-TNLKFW7D.cjs} +23 -23
  30. package/dist/{chunk-KZI3YWKW.js → chunk-UXYCY3HP.js} +93 -6
  31. package/dist/{chunk-DDL3ZBHK.cjs → chunk-YJANF2BL.cjs} +86 -86
  32. package/dist/{chunk-TNHDCP4R.js → chunk-ZEI7ZEA4.js} +31 -5
  33. package/dist/image-editor/index.cjs +789 -789
  34. package/dist/image-editor/index.js +5 -5
  35. package/dist/paint/index.cjs +2 -2
  36. package/dist/paint/index.js +1 -1
  37. package/dist/paint/wet/world.d.cts +37 -1
  38. package/dist/paint/wet/world.d.ts +37 -1
  39. package/dist/paint-editor/brush-controls.d.cts +2 -0
  40. package/dist/paint-editor/brush-controls.d.ts +2 -0
  41. package/dist/paint-editor/brush-model.d.cts +14 -1
  42. package/dist/paint-editor/brush-model.d.ts +14 -1
  43. package/dist/paint-editor/index.cjs +343 -306
  44. package/dist/paint-editor/index.js +48 -11
  45. package/dist/paint-editor/ui.d.cts +1 -1
  46. package/dist/paint-editor/ui.d.ts +1 -1
  47. package/dist/paint-editor/wet.d.cts +8 -1
  48. package/dist/paint-editor/wet.d.ts +8 -1
  49. package/dist/vector/index.cjs +999 -999
  50. package/dist/vector/index.js +5 -5
  51. package/package.json +1 -1
  52. package/skills/pixerate-brushes/SKILL.md +1 -0
  53. package/skills/pixerate-paint-editor/SKILL.md +4 -11
  54. package/skills/pixerate-paint-editor/references/brush-facets.md +1 -0
  55. package/skills/pixerate-paint-editor/references/ghost.md +47 -0
  56. package/skills/pixerate-paint-watercolour/SKILL.md +1 -0
@@ -11,7 +11,8 @@ var _chunk3VHH6V67cjs = require('../chunk-3VHH6V67.cjs');
11
11
 
12
12
 
13
13
 
14
- var _chunk3KNQ2W6Xcjs = require('../chunk-3KNQ2W6X.cjs');
14
+
15
+ var _chunk3JKCREEUcjs = require('../chunk-3JKCREEU.cjs');
15
16
 
16
17
 
17
18
 
@@ -19,7 +20,7 @@ var _chunkPFHJS4HEcjs = require('../chunk-PFHJS4HE.cjs');
19
20
 
20
21
 
21
22
 
22
- var _chunkBPJSI4NTcjs = require('../chunk-BPJSI4NT.cjs');
23
+ var _chunk7W2EQQBPcjs = require('../chunk-7W2EQQBP.cjs');
23
24
 
24
25
 
25
26
  var _chunkLBDC5434cjs = require('../chunk-LBDC5434.cjs');
@@ -34,7 +35,7 @@ var _chunk7TD63DZPcjs = require('../chunk-7TD63DZP.cjs');
34
35
 
35
36
 
36
37
 
37
- var _chunkDDL3ZBHKcjs = require('../chunk-DDL3ZBHK.cjs');
38
+ var _chunkYJANF2BLcjs = require('../chunk-YJANF2BL.cjs');
38
39
  require('../chunk-YZWM6ZIP.cjs');
39
40
  require('../chunk-3ZRNK3RO.cjs');
40
41
 
@@ -117,7 +118,8 @@ var _chunkK7ENM55Pcjs = require('../chunk-K7ENM55P.cjs');
117
118
 
118
119
 
119
120
 
120
- var _chunkJJ2H25JGcjs = require('../chunk-JJ2H25JG.cjs');
121
+ var _chunkSNAFFCAXcjs = require('../chunk-SNAFFCAX.cjs');
122
+
121
123
 
122
124
 
123
125
 
@@ -180,7 +182,8 @@ var _chunkJJ2H25JGcjs = require('../chunk-JJ2H25JG.cjs');
180
182
 
181
183
 
182
184
 
183
- var _chunkEU2ZZA6Lcjs = require('../chunk-EU2ZZA6L.cjs');
185
+
186
+ var _chunkGHGBIAWQcjs = require('../chunk-GHGBIAWQ.cjs');
184
187
 
185
188
 
186
189
 
@@ -228,7 +231,7 @@ require('../chunk-WOFXZ3XU.cjs');
228
231
 
229
232
 
230
233
 
231
- var _chunkJ5VQYK7Tcjs = require('../chunk-J5VQYK7T.cjs');
234
+ var _chunkN5IMDAHMcjs = require('../chunk-N5IMDAHM.cjs');
232
235
  require('../chunk-STLTOISW.cjs');
233
236
 
234
237
 
@@ -385,7 +388,7 @@ function normalizeCanvas(raw) {
385
388
  function createPaintDocument(options = {}) {
386
389
  const canvas = normalizeCanvas({ width: _nullishCoalesce(options.width, () => ( 2048)), height: _nullishCoalesce(options.height, () => ( 1536)), dpi: options.dpi });
387
390
  const layer = createPaintLayer("Layer 1");
388
- return { canvas, paper: _chunkJJ2H25JGcjs.normalizePaper.call(void 0, _nullishCoalesce(options.paper, () => ( {}))), layers: [layer], activeLayerId: layer.id, strokes: [] };
391
+ return { canvas, paper: _chunkSNAFFCAXcjs.normalizePaper.call(void 0, _nullishCoalesce(options.paper, () => ( {}))), layers: [layer], activeLayerId: layer.id, strokes: [] };
389
392
  }
390
393
 
391
394
  // src/paint-editor/thick.ts
@@ -453,10 +456,10 @@ function lightTile(color, height, heightAround, material, light) {
453
456
  const nh = Math.max(0, nx * hx + ny * hy + nz * hz);
454
457
  const spec = Math.max(0, Math.pow(nh, shininess) - Math.pow(hz, shininess)) * (0.25 + 0.75 * gloss) * light.relief;
455
458
  for (let c = 0; c < 3; c++) {
456
- const a = _chunkJ5VQYK7Tcjs.SRGB_TO_LINEAR[color[i + c]];
459
+ const a = _chunkN5IMDAHMcjs.SRGB_TO_LINEAR[color[i + c]];
457
460
  const tint = metal * a + (1 - metal);
458
461
  const v = a * shade * (1 - 0.35 * metal) + spec * tint * (1 + metal);
459
- out[i + c] = _chunkJ5VQYK7Tcjs.linearToSrgb8.call(void 0, v);
462
+ out[i + c] = _chunkN5IMDAHMcjs.linearToSrgb8.call(void 0, v);
460
463
  }
461
464
  }
462
465
  }
@@ -516,12 +519,12 @@ var ThickStrokeDriver = (_class2 = class {
516
519
  constructor(init) {;_class2.prototype.__init2.call(this);_class2.prototype.__init3.call(this);_class2.prototype.__init4.call(this);_class2.prototype.__init5.call(this);_class2.prototype.__init6.call(this);_class2.prototype.__init7.call(this);_class2.prototype.__init8.call(this);_class2.prototype.__init9.call(this);_class2.prototype.__init10.call(this);_class2.prototype.__init11.call(this);
517
520
  this.init = init;
518
521
  const b = init.brush;
519
- this.smoother = new (0, _chunkJJ2H25JGcjs.PenSmoother)(b.tip.smoothing, b.pressureSmoothing);
520
- const copies = init.copies.length ? init.copies : [_chunkJJ2H25JGcjs.IDENTITY_COPY];
522
+ this.smoother = new (0, _chunkSNAFFCAXcjs.PenSmoother)(b.tip.smoothing, b.pressureSmoothing);
523
+ const copies = init.copies.length ? init.copies : [_chunkSNAFFCAXcjs.IDENTITY_COPY];
521
524
  this.copies = copies;
522
525
  const rates = _chunkNIBFKXMDcjs.exchangeRates.call(void 0, b.behavior.pickup, b.behavior.mix, 1, b.behavior.mixing);
523
526
  this.states = copies.map((c, i) => ({
524
- walker: new (0, _chunkJJ2H25JGcjs.PenDabWalker)(b, init.seed + i * 7919 | 0, c.linear),
527
+ walker: new (0, _chunkSNAFFCAXcjs.PenDabWalker)(b, init.seed + i * 7919 | 0, c.linear),
525
528
  exchange: new (0, _chunkNIBFKXMDcjs.PaintExchange)(rates, init.load),
526
529
  smudge: b.impasto.tool === "knife" ? new (0, _chunkNIBFKXMDcjs.SmudgeTip)({ strength: 0.85, length: 0.6 + 0.38 * b.impasto.drag, mixing: b.behavior.mixing }, b.tip.size * 1.2) : null,
527
530
  carried: null,
@@ -667,7 +670,7 @@ var ThickStrokeDriver = (_class2 = class {
667
670
  let flow = 1;
668
671
  const effect = this.init.effect;
669
672
  if (effect) {
670
- _chunkJJ2H25JGcjs.sampleEffectAt.call(void 0, effect, d.x, d.y, this.centre, d);
673
+ _chunkSNAFFCAXcjs.sampleEffectAt.call(void 0, effect, d.x, d.y, this.centre, d);
671
674
  ex.setReservoirColor(this.centre[0], this.centre[1], this.centre[2]);
672
675
  } else if (this.sampler) {
673
676
  const g = this.sampler.dab(d, this.sample);
@@ -684,7 +687,7 @@ var ThickStrokeDriver = (_class2 = class {
684
687
  let field = null;
685
688
  if (effect) {
686
689
  field = new Float32Array(n * 3);
687
- _chunkJJ2H25JGcjs.effectDabField.call(void 0, effect, rect, cov, this.centre, this.paint, field, 0, d);
690
+ _chunkSNAFFCAXcjs.effectDabField.call(void 0, effect, rect, cov, this.centre, this.paint, field, 0, d);
688
691
  }
689
692
  this.medium.deposit(rect, cov, dep, this.paint, ex.paintPigment, field);
690
693
  }
@@ -861,7 +864,7 @@ function shadowToLight(shadow) {
861
864
  return new (0, _chunk474IQG74cjs.TiledSurface)(1, tiles, 0);
862
865
  }
863
866
  function lightTwinBrush(brush) {
864
- return _chunkEU2ZZA6Lcjs.normalizePaintBrush.call(void 0,
867
+ return _chunkGHGBIAWQcjs.normalizePaintBrush.call(void 0,
865
868
  {
866
869
  tip: { ...brush.tip, blend: "normal", pressureOpacity: brush.tip.pressureOpacity || brush.light.pressure },
867
870
  behavior: { ...brush.behavior, mixing: "rgb" },
@@ -1073,11 +1076,11 @@ var MarkStroke = (_class4 = class {
1073
1076
  this.options = options;
1074
1077
  this.sampler = options.paint ? new (0, _chunkNIBFKXMDcjs.PaintGradientSampler)(options.paint, _nullishCoalesce(options.seed, () => ( 0))) : null;
1075
1078
  this.tipTable = _optionalChain([this, 'access', _29 => _29.sampler, 'optionalAccess', _30 => _30.acrossTip]) ? this.sampler.tipTable(_chunkNIBFKXMDcjs.TIP_GRADIENT_STEPS) : null;
1076
- this.smoother = new (0, _chunkJJ2H25JGcjs.PenSmoother)(brush.tip.smoothing, brush.pressureSmoothing);
1077
- this.copies = _optionalChain([options, 'access', _31 => _31.copies, 'optionalAccess', _32 => _32.length]) ? options.copies : [_chunkJJ2H25JGcjs.IDENTITY_COPY];
1079
+ this.smoother = new (0, _chunkSNAFFCAXcjs.PenSmoother)(brush.tip.smoothing, brush.pressureSmoothing);
1080
+ this.copies = _optionalChain([options, 'access', _31 => _31.copies, 'optionalAccess', _32 => _32.length]) ? options.copies : [_chunkSNAFFCAXcjs.IDENTITY_COPY];
1078
1081
  this.seed = _nullishCoalesce(options.seed, () => ( 0));
1079
1082
  const fine = { ...brush, tip: { ...brush.tip, spacing: Math.max(0.01, Math.min(0.25, STEP_PX / Math.max(1, brush.tip.size))) } };
1080
- this.walkers = this.copies.map((c, i) => new (0, _chunkJJ2H25JGcjs.PenDabWalker)(fine, (_nullishCoalesce(options.seed, () => ( 0))) + i * 7919 | 0, c.linear));
1083
+ this.walkers = this.copies.map((c, i) => new (0, _chunkSNAFFCAXcjs.PenDabWalker)(fine, (_nullishCoalesce(options.seed, () => ( 0))) + i * 7919 | 0, c.linear));
1081
1084
  this.depth = options.grain && !options.grain.flat ? Math.min(1, Math.max(0, options.paperDepth * brush.grain)) : 0;
1082
1085
  }
1083
1086
 
@@ -1156,7 +1159,7 @@ var MarkStroke = (_class4 = class {
1156
1159
  */
1157
1160
  stamp(x, y, r, kind, rotation, seed, alpha, opacity, pressure, rects) {
1158
1161
  if (!(r > 0.05) || !(alpha > 0)) return;
1159
- const sample = _chunkJJ2H25JGcjs.stampSampler.call(void 0, kind, this.options.stampArt);
1162
+ const sample = _chunkSNAFFCAXcjs.stampSampler.call(void 0, kind, this.options.stampArt);
1160
1163
  if (!sample) return this.mark(x, y, r, alpha, opacity, pressure, rects);
1161
1164
  const reach = Math.max(0.5, r) * Math.SQRT2 + 1;
1162
1165
  const rect = { x: Math.floor(x - reach), y: Math.floor(y - reach), width: 0, height: 0 };
@@ -1206,7 +1209,7 @@ var MarkStroke = (_class4 = class {
1206
1209
  if (this.options.effect) {
1207
1210
  if (this.field.length < n * 3) this.field = new Float32Array(n * 3);
1208
1211
  const field = this.field.subarray(0, n * 3);
1209
- _chunkJJ2H25JGcjs.sampleEffectField.call(void 0, this.options.effect, rect, vals, field, this.pen);
1212
+ _chunkSNAFFCAXcjs.sampleEffectField.call(void 0, this.options.effect, rect, vals, field, this.pen);
1210
1213
  this.coverage.accumulate(rect, vals, opacity, null, field);
1211
1214
  } else {
1212
1215
  const color = this.markColor(x, y);
@@ -1885,11 +1888,11 @@ var StickerSpray = (_class7 = class {
1885
1888
  constructor(init) {;_class7.prototype.__init29.call(this);_class7.prototype.__init30.call(this);_class7.prototype.__init31.call(this);_class7.prototype.__init32.call(this);_class7.prototype.__init33.call(this);
1886
1889
  this.init = init;
1887
1890
  const b = init.brush;
1888
- this.smoother = new (0, _chunkJJ2H25JGcjs.PenSmoother)(b.tip.smoothing, b.pressureSmoothing);
1889
- this.copies = init.copies.length ? init.copies : [_chunkJJ2H25JGcjs.IDENTITY_COPY];
1891
+ this.smoother = new (0, _chunkSNAFFCAXcjs.PenSmoother)(b.tip.smoothing, b.pressureSmoothing);
1892
+ this.copies = init.copies.length ? init.copies : [_chunkSNAFFCAXcjs.IDENTITY_COPY];
1890
1893
  const spacing = Math.max(0.05, 1 / Math.max(0.05, b.sticker.density * 4));
1891
1894
  const walk = { ...b, tip: { ...b.tip, spacing }, dynamics: { ...b.dynamics, scatter: 0, sizeJitter: 0, angleJitter: 0 } };
1892
- this.walkers = this.copies.map((c, i) => new (0, _chunkJJ2H25JGcjs.PenDabWalker)(walk, init.seed + i * 7919 | 0, c.linear));
1895
+ this.walkers = this.copies.map((c, i) => new (0, _chunkSNAFFCAXcjs.PenDabWalker)(walk, init.seed + i * 7919 | 0, c.linear));
1893
1896
  this.medium = new (0, _chunkNIBFKXMDcjs.TileMedium)(init.target, {});
1894
1897
  this.next = init.nextId;
1895
1898
  }
@@ -1975,7 +1978,7 @@ var StickerSpray = (_class7 = class {
1975
1978
  const effect = this.init.effect;
1976
1979
  if (effect) {
1977
1980
  const rgb = [0, 0, 0];
1978
- const alpha = _chunkJJ2H25JGcjs.sampleEffectAt.call(void 0, effect, d.x + dx, d.y + dy, rgb, d);
1981
+ const alpha = _chunkSNAFFCAXcjs.sampleEffectAt.call(void 0, effect, d.x + dx, d.y + dy, rgb, d);
1979
1982
  return { color: "#" + rgb.map((c) => Math.round(c * 255).toString(16).padStart(2, "0")).join(""), alpha };
1980
1983
  }
1981
1984
  const g = this.init.paint;
@@ -2104,7 +2107,7 @@ var PaintStrokeSession = (_class8 = class _PaintStrokeSession {
2104
2107
  this.layerId = init.layerId;
2105
2108
  this.base = init.surface;
2106
2109
  this.live = new Map(this.base.tiles);
2107
- this.copies = init.copies.length ? init.copies : [_chunkJJ2H25JGcjs.IDENTITY_COPY];
2110
+ this.copies = init.copies.length ? init.copies : [_chunkSNAFFCAXcjs.IDENTITY_COPY];
2108
2111
  const brush = init.brush;
2109
2112
  if (init.wet) this.wetDriver = init.wet.driver;
2110
2113
  if (init.light && !init.wet && !init.sticker) this.lightTwin = this.makeLightTwin(init.light.surface);
@@ -2157,9 +2160,9 @@ var PaintStrokeSession = (_class8 = class _PaintStrokeSession {
2157
2160
  } else if (init.thick) {
2158
2161
  const rgb = (c) => [c[0] / 255, c[1] / 255, c[2] / 255];
2159
2162
  this.thickDriver = new ThickStrokeDriver({ brush, target: this.tileTarget(), channels: init.thick.channels, color: rgb(init.color), load: init.mixerLoad, seed: init.seed, copies: this.copies, paint: _nullishCoalesce(init.paint, () => ( null)), effect });
2160
- } else if (brush.engine === "mixer" || brush.engine === "blender" || brush.engine === "smudge" || _chunkEU2ZZA6Lcjs.usesPaintExchange.call(void 0, brush, Boolean(init.paint))) {
2163
+ } else if (brush.engine === "mixer" || brush.engine === "blender" || brush.engine === "smudge" || _chunkGHGBIAWQcjs.usesPaintExchange.call(void 0, brush, Boolean(init.paint))) {
2161
2164
  const rgb = (c) => [c[0] / 255, c[1] / 255, c[2] / 255];
2162
- this.wet = new (0, _chunkJJ2H25JGcjs.PaintDabStroke)(brush, {
2165
+ this.wet = new (0, _chunkSNAFFCAXcjs.PaintDabStroke)(brush, {
2163
2166
  target: this.tileTarget(),
2164
2167
  color: rgb(init.color),
2165
2168
  secondary: rgb(_nullishCoalesce(init.secondary, () => ( init.background))),
@@ -2174,7 +2177,7 @@ var PaintStrokeSession = (_class8 = class _PaintStrokeSession {
2174
2177
  });
2175
2178
  } else {
2176
2179
  const opts = { grain: init.grain, paperDepth: init.paperDepth, seed: init.seed, copies: this.copies, paint: _nullishCoalesce(init.paint, () => ( null)), effect, stampArt: init.stampArt };
2177
- this.dry = brush.engine === "particle" ? new ParticleStroke(brush, opts) : brush.engine === "bristle" ? new BristleStroke(brush, opts) : new (0, _chunkJJ2H25JGcjs.DryStroke)(brush, opts);
2180
+ this.dry = brush.engine === "particle" ? new ParticleStroke(brush, opts) : brush.engine === "bristle" ? new BristleStroke(brush, opts) : new (0, _chunkSNAFFCAXcjs.DryStroke)(brush, opts);
2178
2181
  }
2179
2182
  }
2180
2183
  /**
@@ -2386,7 +2389,7 @@ function brushLoadForStroke(brush, current, color) {
2386
2389
  if (brush.engine === "mixer") return mixerLoadForStroke(brush, current, color);
2387
2390
  if (brush.engine === "impasto") return { reservoir: [color[0], color[1], color[2]], amount: 1, pickup: brush.behavior.dirty ? current.pickup : null };
2388
2391
  if (brush.engine === "wet") return brush.wet.tool === "paint" ? { reservoir: [color[0], color[1], color[2]], amount: 1, pickup: brush.behavior.dirty ? current.pickup : null } : _chunkNIBFKXMDcjs.EMPTY_MIXER_LOAD;
2389
- if (_chunkEU2ZZA6Lcjs.usesPaintExchange.call(void 0, brush)) return { reservoir: [color[0], color[1], color[2]], amount: 1, pickup: brush.behavior.dirty ? current.pickup : null };
2392
+ if (_chunkGHGBIAWQcjs.usesPaintExchange.call(void 0, brush)) return { reservoir: [color[0], color[1], color[2]], amount: 1, pickup: brush.behavior.dirty ? current.pickup : null };
2390
2393
  return _chunkNIBFKXMDcjs.EMPTY_MIXER_LOAD;
2391
2394
  }
2392
2395
 
@@ -2648,15 +2651,15 @@ function readLoad(raw) {
2648
2651
  function readStrokeBrush(raw) {
2649
2652
  if (raw && typeof raw === "object" && "kind" in raw && !("engine" in raw)) {
2650
2653
  try {
2651
- return _chunkEU2ZZA6Lcjs.resolveBrush.call(void 0, _chunkEU2ZZA6Lcjs.normalizeBrushSpec.call(void 0, raw));
2654
+ return _chunkGHGBIAWQcjs.resolveBrush.call(void 0, _chunkGHGBIAWQcjs.normalizeBrushSpec.call(void 0, raw));
2652
2655
  } catch (e3) {
2653
2656
  }
2654
2657
  }
2655
- return _chunkEU2ZZA6Lcjs.normalizePaintBrush.call(void 0, _nullishCoalesce(raw, () => ( {})));
2658
+ return _chunkGHGBIAWQcjs.normalizePaintBrush.call(void 0, _nullishCoalesce(raw, () => ( {})));
2656
2659
  }
2657
2660
  function strokeToJSON(stroke) {
2658
2661
  const { brush, ...rest } = stroke;
2659
- return { ...JSON.parse(JSON.stringify(rest)), brush: _chunkEU2ZZA6Lcjs.migrateBrushV1.call(void 0, brush) };
2662
+ return { ...JSON.parse(JSON.stringify(rest)), brush: _chunkGHGBIAWQcjs.migrateBrushV1.call(void 0, brush) };
2660
2663
  }
2661
2664
  function normalizeBrushStroke(raw) {
2662
2665
  if (!raw || typeof raw !== "object") return null;
@@ -2686,7 +2689,7 @@ function normalizeBrushStroke(raw) {
2686
2689
  }
2687
2690
  if (st.length) out.stencils = st;
2688
2691
  }
2689
- const effect = _chunkJJ2H25JGcjs.readPaintEffectPaint.call(void 0, r.paint);
2692
+ const effect = _chunkSNAFFCAXcjs.readPaintEffectPaint.call(void 0, r.paint);
2690
2693
  const paint = effect ? null : _chunkNIBFKXMDcjs.readPaintSource.call(void 0, r.paint);
2691
2694
  if (effect) out.paint = effect;
2692
2695
  else if (paint && paint.type === "gradient") out.paint = paint;
@@ -2726,11 +2729,11 @@ function varyStroke(stroke, m, v) {
2726
2729
  if (ps !== 1) q.pressure = Math.min(1, Math.max(0, (_nullishCoalesce(p.pressure, () => ( 1))) * ps));
2727
2730
  return q;
2728
2731
  });
2729
- const brush = s !== 1 ? _chunkEU2ZZA6Lcjs.normalizePaintBrush.call(void 0, { ...stroke.brush, tip: { ...stroke.brush.tip, size: stroke.brush.tip.size * s } }) : stroke.brush;
2732
+ const brush = s !== 1 ? _chunkGHGBIAWQcjs.normalizePaintBrush.call(void 0, { ...stroke.brush, tip: { ...stroke.brush.tip, size: stroke.brush.tip.size * s } }) : stroke.brush;
2730
2733
  const out = { ...stroke, brush, points };
2731
2734
  if (_optionalChain([stroke, 'access', _107 => _107.paint, 'optionalAccess', _108 => _108.type]) === "gradient" && s !== 1) out.paint = _chunkNIBFKXMDcjs.scalePaintGradient.call(void 0, stroke.paint, s);
2732
2735
  if (_optionalChain([stroke, 'access', _109 => _109.paint, 'optionalAccess', _110 => _110.type]) === "effect" && _optionalChain([stroke, 'access', _111 => _111.paint, 'access', _112 => _112.map, 'optionalAccess', _113 => _113.by]) === "stroke" && s !== 1) out.paint = { ...stroke.paint, map: { ...stroke.paint.map, length: Math.min(4096, Math.max(16, Math.round(stroke.paint.map.length * s))) } };
2733
- if (_optionalChain([stroke, 'access', _114 => _114.paint, 'optionalAccess', _115 => _115.type]) === "effect" && _optionalChain([stroke, 'access', _116 => _116.paint, 'access', _117 => _117.map, 'optionalAccess', _118 => _118.by]) === "path") out.paint = _chunkJJ2H25JGcjs.withStrokePath.call(void 0, stroke.paint, points);
2736
+ if (_optionalChain([stroke, 'access', _114 => _114.paint, 'optionalAccess', _115 => _115.type]) === "effect" && _optionalChain([stroke, 'access', _116 => _116.paint, 'access', _117 => _117.map, 'optionalAccess', _118 => _118.by]) === "path") out.paint = _chunkSNAFFCAXcjs.withStrokePath.call(void 0, stroke.paint, points);
2734
2737
  if (_optionalChain([stroke, 'access', _119 => _119.copies, 'optionalAccess', _120 => _120.length])) {
2735
2738
  const inv = invertAffine(m);
2736
2739
  out.copies = stroke.copies.map((c) => composeAffine(m, composeAffine(c, inv)));
@@ -2772,7 +2775,7 @@ function paperTile(paper, r, light) {
2772
2775
  const key = `${paperKey(paper, light)}|${r.x},${r.y},${r.width},${r.height}`;
2773
2776
  let t = tileCache.get(key);
2774
2777
  if (!t) {
2775
- t = _chunkJJ2H25JGcjs.renderPaper.call(void 0, paper, r, paperGrain(paper), light);
2778
+ t = _chunkSNAFFCAXcjs.renderPaper.call(void 0, paper, r, paperGrain(paper), light);
2776
2779
  if (tileCache.size > 512) tileCache.delete(tileCache.keys().next().value);
2777
2780
  tileCache.set(key, t);
2778
2781
  }
@@ -2877,11 +2880,11 @@ function header(state, options) {
2877
2880
  return out;
2878
2881
  }
2879
2882
  function serializePaintDocument(state, options = {}) {
2880
- const { layers, assets } = _chunkDDL3ZBHKcjs.serializeLayers.call(void 0, state.layers);
2883
+ const { layers, assets } = _chunkYJANF2BLcjs.serializeLayers.call(void 0, state.layers);
2881
2884
  return { ...header(state, options), layers, assets };
2882
2885
  }
2883
2886
  async function serializePaintDocumentExternal(state, store, options = {}) {
2884
- const { layers, assets } = await _chunkDDL3ZBHKcjs.serializeLayersExternal.call(void 0, state.layers, store);
2887
+ const { layers, assets } = await _chunkYJANF2BLcjs.serializeLayersExternal.call(void 0, state.layers, store);
2885
2888
  return { ...header(state, options), layers, assets };
2886
2889
  }
2887
2890
  function paintLayersOnly(layers, problems) {
@@ -2916,9 +2919,9 @@ function deserializePaintDocument(raw) {
2916
2919
  }
2917
2920
  const problems = [];
2918
2921
  const canvas = normalizeCanvas({ width: r.width, height: r.height, dpi: _nullishCoalesce(r.dpi, () => ( void 0)) });
2919
- const paper = _chunkJJ2H25JGcjs.normalizePaper.call(void 0, _nullishCoalesce(r.paper, () => ( {})));
2922
+ const paper = _chunkSNAFFCAXcjs.normalizePaper.call(void 0, _nullishCoalesce(r.paper, () => ( {})));
2920
2923
  const assets = r.assets && typeof r.assets === "object" ? r.assets : {};
2921
- const layers = paintLayersOnly(_chunkDDL3ZBHKcjs.deserializeLayers.call(void 0, r.layers, { assets, problems }), problems);
2924
+ const layers = paintLayersOnly(_chunkYJANF2BLcjs.deserializeLayers.call(void 0, r.layers, { assets, problems }), problems);
2922
2925
  const wanted = typeof r.activeLayerId === "string" ? r.activeLayerId : null;
2923
2926
  const activeLayerId = wanted && _chunkPVJMTLPJcjs.findLayer.call(void 0, layers, wanted) ? wanted : _nullishCoalesce(_optionalChain([_chunkPVJMTLPJcjs.flattenLayers.call(void 0, layers), 'access', _132 => _132.filter, 'call', _133 => _133((l) => l.type === "pixel"), 'access', _134 => _134.pop, 'call', _135 => _135(), 'optionalAccess', _136 => _136.id]), () => ( null));
2924
2927
  const wetEvents = Array.isArray(r.wetEvents) ? r.wetEvents.filter((e) => e && typeof e === "object" && Number.isInteger(e.clock) && typeof e.kind === "string") : [];
@@ -2934,7 +2937,7 @@ async function deserializePaintDocumentAsync(raw, store) {
2934
2937
  if (!raw || typeof raw !== "object") throw new Error("Not a paint document: expected a JSON object.");
2935
2938
  const r = raw;
2936
2939
  const problems = [];
2937
- const assets = await _chunkDDL3ZBHKcjs.resolveExternalAssets.call(void 0, _nullishCoalesce(r.assets, () => ( {})), store, problems);
2940
+ const assets = await _chunkYJANF2BLcjs.resolveExternalAssets.call(void 0, _nullishCoalesce(r.assets, () => ( {})), store, problems);
2938
2941
  const loaded = deserializePaintDocument({ ...r, assets });
2939
2942
  return { ...loaded, problems: [...problems, ...loaded.problems] };
2940
2943
  }
@@ -3017,7 +3020,7 @@ function pointerToPenPoint(e, x, y, view) {
3017
3020
  const p = { x, y, pressure: samplePressure(e) };
3018
3021
  if (typeof e.timeStamp === "number" && Number.isFinite(e.timeStamp)) p.t = e.timeStamp;
3019
3022
  if (e.pointerType !== "pen") return p;
3020
- const o = _chunkJJ2H25JGcjs.penOrientation.call(void 0, {
3023
+ const o = _chunkSNAFFCAXcjs.penOrientation.call(void 0, {
3021
3024
  x,
3022
3025
  y,
3023
3026
  altitude: typeof e.altitudeAngle === "number" ? e.altitudeAngle : void 0,
@@ -3084,18 +3087,18 @@ var thumbWorld = null;
3084
3087
  function paintWetTestStroke(brush, paper, color, width, height) {
3085
3088
  if (!thumbWorld || thumbWorld.width !== width || thumbWorld.height !== height) {
3086
3089
  _optionalChain([thumbWorld, 'optionalAccess', _139 => _139.destroy, 'call', _140 => _140()]);
3087
- thumbWorld = new (0, _chunkJ5VQYK7Tcjs.WetWorld)(width, height, _chunkJJ2H25JGcjs.wetPaperInput.call(void 0, paper), { kernel: "typescript", threads: 0 });
3088
- } else thumbWorld.setPaper(_chunkJJ2H25JGcjs.wetPaperInput.call(void 0, paper));
3090
+ thumbWorld = new (0, _chunkN5IMDAHMcjs.WetWorld)(width, height, _chunkSNAFFCAXcjs.wetPaperInput.call(void 0, paper), { kernel: "typescript", threads: 0 });
3091
+ } else thumbWorld.setPaper(_chunkSNAFFCAXcjs.wetPaperInput.call(void 0, paper));
3089
3092
  const w = thumbWorld;
3090
3093
  if (w.hasLane("thumb")) w.removeLane("thumb");
3091
3094
  w.ensureLane("thumb");
3092
- const [r, g, b] = _chunkJJ2H25JGcjs.hexToRgb8.call(void 0, color);
3095
+ const [r, g, b] = _chunkSNAFFCAXcjs.hexToRgb8.call(void 0, color);
3093
3096
  if (brush.wet.tool !== "paint" && brush.wet.tool !== "water") {
3094
3097
  const half = Math.ceil(height / 2);
3095
- w.paint("thumb", { x: 0, y: 0, width, height: half }, null, 0.4, Array.from(_chunkJ5VQYK7Tcjs.pigmentOf.call(void 0, [r / 255, g / 255, b / 255], 0), (v) => v * 0.05));
3096
- w.paint("thumb", { x: 0, y: half, width, height: height - half }, null, 0.4, Array.from(_chunkJ5VQYK7Tcjs.pigmentOf.call(void 0, [232 / 255, 196 / 255, 64 / 255], 0), (v) => v * 0.05));
3098
+ w.paint("thumb", { x: 0, y: 0, width, height: half }, null, 0.4, Array.from(_chunkN5IMDAHMcjs.pigmentOf.call(void 0, [r / 255, g / 255, b / 255], 0), (v) => v * 0.05));
3099
+ w.paint("thumb", { x: 0, y: half, width, height: height - half }, null, 0.4, Array.from(_chunkN5IMDAHMcjs.pigmentOf.call(void 0, [232 / 255, 196 / 255, 64 / 255], 0), (v) => v * 0.05));
3097
3100
  }
3098
- const driver = new (0, _chunkJJ2H25JGcjs.WetStrokeDriver)({
3101
+ const driver = new (0, _chunkSNAFFCAXcjs.WetStrokeDriver)({
3099
3102
  world: w,
3100
3103
  laneId: "thumb",
3101
3104
  brush,
@@ -3103,9 +3106,9 @@ function paintWetTestStroke(brush, paper, color, width, height) {
3103
3106
  load: brushLoadForStroke(brush, _chunkNIBFKXMDcjs.EMPTY_MIXER_LOAD, [r / 255, g / 255, b / 255]),
3104
3107
  grain: paperGrain(paper),
3105
3108
  paperDepth: paper.depth,
3106
- paperColor: _chunkJJ2H25JGcjs.hexToRgb8.call(void 0, paper.color),
3109
+ paperColor: _chunkSNAFFCAXcjs.hexToRgb8.call(void 0, paper.color),
3107
3110
  seed: 7,
3108
- copies: [_chunkJJ2H25JGcjs.IDENTITY_COPY]
3111
+ copies: [_chunkSNAFFCAXcjs.IDENTITY_COPY]
3109
3112
  });
3110
3113
  driver.push(thumbnailStroke(width, height));
3111
3114
  driver.finish();
@@ -3125,7 +3128,7 @@ function thumbnailStroke(width, height) {
3125
3128
  return pts;
3126
3129
  }
3127
3130
  function paintTestStroke(surface, brush, paper, color, width, height, stampArt) {
3128
- const [r, g, b] = _chunkJJ2H25JGcjs.hexToRgb8.call(void 0, color);
3131
+ const [r, g, b] = _chunkSNAFFCAXcjs.hexToRgb8.call(void 0, color);
3129
3132
  let result = surface;
3130
3133
  let thick = null;
3131
3134
  let light = null;
@@ -3146,13 +3149,13 @@ function paintTestStroke(surface, brush, paper, color, width, height, stampArt)
3146
3149
  lockTransparency: false,
3147
3150
  brush,
3148
3151
  color: [r, g, b, 255],
3149
- background: [..._chunkJJ2H25JGcjs.hexToRgb8.call(void 0, paper.color), 255],
3152
+ background: [..._chunkSNAFFCAXcjs.hexToRgb8.call(void 0, paper.color), 255],
3150
3153
  grain: paperGrain(paper),
3151
3154
  paperDepth: paper.depth,
3152
3155
  seed: 7,
3153
3156
  colorHex: color,
3154
3157
  affineCopies: [],
3155
- copies: [_chunkJJ2H25JGcjs.IDENTITY_COPY],
3158
+ copies: [_chunkSNAFFCAXcjs.IDENTITY_COPY],
3156
3159
  mixerLoad: brushLoadForStroke(brush, _chunkNIBFKXMDcjs.EMPTY_MIXER_LOAD, [r / 255, g / 255, b / 255]),
3157
3160
  thick: brush.engine === "impasto" ? { channels: emptyThickChannels() } : void 0,
3158
3161
  sticker: brush.engine === "sticker" ? { nextId: 1 } : void 0,
@@ -3169,8 +3172,8 @@ function renderBrushThumbnail(brush, options) {
3169
3172
  const width = Math.max(16, Math.min(512, Math.round(_nullishCoalesce(options.width, () => ( 160)))));
3170
3173
  const height = Math.max(16, Math.min(512, Math.round(_nullishCoalesce(options.height, () => ( 48)))));
3171
3174
  const maxSize = height * 0.42;
3172
- const b = brush.tip.size > maxSize ? _chunkEU2ZZA6Lcjs.normalizePaintBrush.call(void 0, { tip: { ...brush.tip, size: maxSize } }, brush) : brush;
3173
- const rgba = [..._chunkJJ2H25JGcjs.hexToRgb8.call(void 0, options.color), 255];
3175
+ const b = brush.tip.size > maxSize ? _chunkGHGBIAWQcjs.normalizePaintBrush.call(void 0, { tip: { ...brush.tip, size: maxSize } }, brush) : brush;
3176
+ const rgba = [..._chunkSNAFFCAXcjs.hexToRgb8.call(void 0, options.color), 255];
3174
3177
  let surface = _chunk474IQG74cjs.emptySurface.call(void 0, 4);
3175
3178
  if (b.engine === "eraser") {
3176
3179
  surface = _chunk474IQG74cjs.fillRect.call(void 0, surface, { x: 0, y: 0, width, height }, rgba);
@@ -3184,7 +3187,7 @@ function renderBrushThumbnail(brush, options) {
3184
3187
  if (b.engine === "wet") surface = paintWetTestStroke(b, options.paper, options.color, width, height);
3185
3188
  else ({ surface, light } = paintTestStroke(surface, b, options.paper, options.color, width, height, options.stampArt));
3186
3189
  const layer = { type: "pixel", id: "thumbnail", name: "thumbnail", visible: true, opacity: 1, blend: "normal", surface, offset: { x: 0, y: 0 } };
3187
- const paper = light && _chunkBPJSI4NTcjs.brushPreviewsOnDark.call(void 0, b) ? { ...options.paper, color: _chunkBPJSI4NTcjs.BRUSH_PREVIEW_DARK_PAPER } : options.paper;
3190
+ const paper = light && _chunk7W2EQQBPcjs.brushPreviewsOnDark.call(void 0, b) ? { ...options.paper, color: _chunk7W2EQQBPcjs.BRUSH_PREVIEW_DARK_PAPER } : options.paper;
3188
3191
  const spill = light ? computeSpill(surface, light, { radius: Math.max(4, height / 6), strength: 1 }) : null;
3189
3192
  const layers = [paperNode(paper), layer];
3190
3193
  if (spill) layers.push({ type: "pixel", id: "thumbnail-light", name: "light", visible: true, opacity: 1, blend: "linear-dodge", surface: spill, offset: { x: 0, y: 0 } });
@@ -3452,7 +3455,7 @@ var DEFAULT_SWATCHES = [
3452
3455
  // src/paint-editor/mixing-pad.ts
3453
3456
  var MIXING_PAD_WIDTH = 360;
3454
3457
  var MIXING_PAD_HEIGHT = 220;
3455
- var PAD_PAINT = _chunkEU2ZZA6Lcjs.normalizePaintBrush.call(void 0, {
3458
+ var PAD_PAINT = _chunkGHGBIAWQcjs.normalizePaintBrush.call(void 0, {
3456
3459
  id: "pad-paint",
3457
3460
  name: "Pad paint",
3458
3461
  category: "mixer",
@@ -3460,7 +3463,7 @@ var PAD_PAINT = _chunkEU2ZZA6Lcjs.normalizePaintBrush.call(void 0, {
3460
3463
  tip: { size: 28, hardness: 0.75, spacing: 0.1, opacity: 1, flow: 0.7, pressureSize: false, pressureOpacity: false },
3461
3464
  mixer: { wet: 0.45, load: 1, mix: 0.4, loadEachStroke: true, cleanEachStroke: true, mixing: "pigment" }
3462
3465
  });
3463
- var PAD_KNIFE = _chunkEU2ZZA6Lcjs.normalizePaintBrush.call(void 0, {
3466
+ var PAD_KNIFE = _chunkGHGBIAWQcjs.normalizePaintBrush.call(void 0, {
3464
3467
  id: "pad-knife",
3465
3468
  name: "Palette knife",
3466
3469
  category: "smudge",
@@ -3470,7 +3473,7 @@ var PAD_KNIFE = _chunkEU2ZZA6Lcjs.normalizePaintBrush.call(void 0, {
3470
3473
  // A knife drags streaks of paint and folds them into each other, mixing them as pigment.
3471
3474
  smudge: { strength: 0.6, length: 0.8, mixing: "pigment" }
3472
3475
  });
3473
- var PAD_BLOB = _chunkEU2ZZA6Lcjs.normalizePaintBrush.call(void 0, {
3476
+ var PAD_BLOB = _chunkGHGBIAWQcjs.normalizePaintBrush.call(void 0, {
3474
3477
  id: "pad-blob",
3475
3478
  name: "Pad blob",
3476
3479
  category: "custom",
@@ -3492,12 +3495,12 @@ var MixingPad = (_class10 = class {constructor() { _class10.prototype.__init52.c
3492
3495
  }
3493
3496
  }
3494
3497
  let brush = options.tool === "knife" ? PAD_KNIFE : PAD_PAINT;
3495
- if (options.size !== void 0) brush = _chunkEU2ZZA6Lcjs.normalizePaintBrush.call(void 0, { tip: { ...brush.tip, size: options.size } }, brush);
3498
+ if (options.size !== void 0) brush = _chunkGHGBIAWQcjs.normalizePaintBrush.call(void 0, { tip: { ...brush.tip, size: options.size } }, brush);
3496
3499
  return this.run(brush, points, options.color);
3497
3500
  }
3498
3501
  /** Paints `points` with `brush` in `color` on the pad. */
3499
3502
  run(brush, points, color) {
3500
- const [r, g, b] = _chunkJJ2H25JGcjs.hexToRgb8.call(void 0, color);
3503
+ const [r, g, b] = _chunkSNAFFCAXcjs.hexToRgb8.call(void 0, color);
3501
3504
  let result = null;
3502
3505
  const session = new PaintStrokeSession(
3503
3506
  { update: () => {
@@ -3515,7 +3518,7 @@ var MixingPad = (_class10 = class {constructor() { _class10.prototype.__init52.c
3515
3518
  seed: 1,
3516
3519
  colorHex: color,
3517
3520
  affineCopies: [],
3518
- copies: [_chunkJJ2H25JGcjs.IDENTITY_COPY],
3521
+ copies: [_chunkSNAFFCAXcjs.IDENTITY_COPY],
3519
3522
  mixerLoad: brushLoadForStroke(brush, _chunkNIBFKXMDcjs.EMPTY_MIXER_LOAD, [r / 255, g / 255, b / 255])
3520
3523
  }
3521
3524
  );
@@ -3591,10 +3594,10 @@ var MixingPad = (_class10 = class {constructor() { _class10.prototype.__init52.c
3591
3594
  const off = used.length === 1 ? 0 : 0.45 * R;
3592
3595
  const x = Math.min(cx + R - r, Math.max(cx - R + r, cx + Math.cos(a) * off));
3593
3596
  const y = Math.min(cy + R - r, Math.max(cy - R + r, cy + Math.sin(a) * off));
3594
- const blob = _chunkEU2ZZA6Lcjs.normalizePaintBrush.call(void 0, { tip: { ...PAD_BLOB.tip, size: Math.max(2, 2 * r) } }, PAD_BLOB);
3597
+ const blob = _chunkGHGBIAWQcjs.normalizePaintBrush.call(void 0, { tip: { ...PAD_BLOB.tip, size: Math.max(2, 2 * r) } }, PAD_BLOB);
3595
3598
  this.run(blob, [{ x, y }], p.color.toLowerCase());
3596
3599
  });
3597
- const knife = _chunkEU2ZZA6Lcjs.normalizePaintBrush.call(void 0, { tip: { ...PAD_KNIFE.tip, size: Math.max(12, R * 0.5) } }, PAD_KNIFE);
3600
+ const knife = _chunkGHGBIAWQcjs.normalizePaintBrush.call(void 0, { tip: { ...PAD_KNIFE.tip, size: Math.max(12, R * 0.5) } }, PAD_KNIFE);
3598
3601
  for (let k = 0; k < passes; k++) {
3599
3602
  const stir = [];
3600
3603
  const turns = 1.6;
@@ -3606,10 +3609,10 @@ var MixingPad = (_class10 = class {constructor() { _class10.prototype.__init52.c
3606
3609
  this.run(knife, stir, "#000000");
3607
3610
  }
3608
3611
  const mixed = _chunk2VX55NFMcjs.mixPigments.call(void 0,
3609
- paints2.map((p) => _chunkJJ2H25JGcjs.hexToRgb8.call(void 0, p.color).map((v) => v / 255)),
3612
+ paints2.map((p) => _chunkSNAFFCAXcjs.hexToRgb8.call(void 0, p.color).map((v) => v / 255)),
3610
3613
  paints2.map((p) => p.parts)
3611
3614
  );
3612
- const core = _chunkEU2ZZA6Lcjs.normalizePaintBrush.call(void 0, { tip: { ...PAD_BLOB.tip, size: R * 1.1, hardness: 0.55 } }, PAD_BLOB);
3615
+ const core = _chunkGHGBIAWQcjs.normalizePaintBrush.call(void 0, { tip: { ...PAD_BLOB.tip, size: R * 1.1, hardness: 0.55 } }, PAD_BLOB);
3613
3616
  const hex2 = "#" + mixed.map((v) => Math.round(v * 255).toString(16).padStart(2, "0")).join("");
3614
3617
  this.run(core, [{ x: cx, y: cy }], hex2);
3615
3618
  return { color: this.pick(cx, cy, 2), bounds };
@@ -3649,21 +3652,21 @@ var MixingPad = (_class10 = class {constructor() { _class10.prototype.__init52.c
3649
3652
  var copyJSON = (v) => JSON.parse(JSON.stringify(v));
3650
3653
  var isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
3651
3654
  function libraryBrush(spec, builtin, resolved) {
3652
- const brush = resolved ? _chunkEU2ZZA6Lcjs.normalizePaintBrush.call(void 0, resolved, resolved) : _chunkEU2ZZA6Lcjs.resolveBrush.call(void 0, spec);
3655
+ const brush = resolved ? _chunkGHGBIAWQcjs.normalizePaintBrush.call(void 0, resolved, resolved) : _chunkGHGBIAWQcjs.resolveBrush.call(void 0, spec);
3653
3656
  if (builtin) brush.builtin = true;
3654
3657
  else delete brush.builtin;
3655
3658
  return { spec, brush, builtin };
3656
3659
  }
3657
3660
  var builtins = null;
3658
3661
  function builtinLibraryBrushes() {
3659
- return builtins ??= _chunkEU2ZZA6Lcjs.BRUSH_PRESETS.map((spec) => {
3660
- const resolved = _chunkEU2ZZA6Lcjs.BUILTIN_BRUSHES.find((b) => b.id === spec.id);
3662
+ return builtins ??= _chunkGHGBIAWQcjs.BRUSH_PRESETS.map((spec) => {
3663
+ const resolved = _chunkGHGBIAWQcjs.BUILTIN_BRUSHES.find((b) => b.id === spec.id);
3661
3664
  return libraryBrush(spec, true, resolved);
3662
3665
  });
3663
3666
  }
3664
3667
  function seededStorage(brushes) {
3665
3668
  if (!brushes.length) return void 0;
3666
- let stored = JSON.stringify({ format: "pixerate-brushes", version: 1, brushes: brushes.map(_chunkEU2ZZA6Lcjs.brushToJSON) });
3669
+ let stored = JSON.stringify({ format: "pixerate-brushes", version: 1, brushes: brushes.map(_chunkGHGBIAWQcjs.brushToJSON) });
3667
3670
  return {
3668
3671
  get: async () => stored,
3669
3672
  set: async (_key, value) => {
@@ -3676,7 +3679,7 @@ var paints = (b) => {
3676
3679
  return JSON.stringify(rest);
3677
3680
  };
3678
3681
  function brushSpecOf(next, from) {
3679
- const plain = _chunkEU2ZZA6Lcjs.migrateBrushV1.call(void 0, next);
3682
+ const plain = _chunkGHGBIAWQcjs.migrateBrushV1.call(void 0, next);
3680
3683
  const out = copyJSON(plain);
3681
3684
  if (from.description) out.description = from.description;
3682
3685
  if (_optionalChain([from, 'access', _144 => _144.tags, 'optionalAccess', _145 => _145.length])) out.tags = [...from.tags];
@@ -3696,8 +3699,8 @@ function brushSpecOf(next, from) {
3696
3699
  out.motion = { ..._nullishCoalesce(out.motion, () => ( {})), ...from.motion.live !== void 0 ? { live: from.motion.live } : {}, ...from.motion.fps !== void 0 ? { fps: from.motion.fps } : {} };
3697
3700
  }
3698
3701
  try {
3699
- const hinted = _chunkEU2ZZA6Lcjs.normalizeBrushSpec.call(void 0, out, []);
3700
- if (paints(_chunkEU2ZZA6Lcjs.resolveBrush.call(void 0, hinted)) === paints(_chunkEU2ZZA6Lcjs.resolveBrush.call(void 0, plain))) return hinted;
3702
+ const hinted = _chunkGHGBIAWQcjs.normalizeBrushSpec.call(void 0, out, []);
3703
+ if (paints(_chunkGHGBIAWQcjs.resolveBrush.call(void 0, hinted)) === paints(_chunkGHGBIAWQcjs.resolveBrush.call(void 0, plain))) return hinted;
3701
3704
  } catch (e5) {
3702
3705
  }
3703
3706
  return plain;
@@ -3795,14 +3798,14 @@ var BrushSourceArtCache = (_class11 = class {constructor() { _class11.prototype.
3795
3798
  }
3796
3799
  /** The art of a `source:<id>` ref (alpha = the mask), or `undefined` when the source is unknown or its image can't be read. */
3797
3800
  __init58() {this.get = (ref2) => {
3798
- const id = _chunkEU2ZZA6Lcjs.brushSourceIdOf.call(void 0, ref2);
3801
+ const id = _chunkGHGBIAWQcjs.brushSourceIdOf.call(void 0, ref2);
3799
3802
  if (id === null) return void 0;
3800
3803
  if (this.art.has(id)) return _nullishCoalesce(this.art.get(id), () => ( void 0));
3801
3804
  const source = this.sources.get(id);
3802
3805
  if (!source) return void 0;
3803
3806
  let art = null;
3804
3807
  try {
3805
- const { width, height, mask } = _chunkEU2ZZA6Lcjs.decodeBrushSource.call(void 0, source);
3808
+ const { width, height, mask } = _chunkGHGBIAWQcjs.decodeBrushSource.call(void 0, source);
3806
3809
  const data = new Uint8ClampedArray(width * height * 4);
3807
3810
  for (let i = 0; i < mask.length; i++) {
3808
3811
  data[i * 4] = data[i * 4 + 1] = data[i * 4 + 2] = 255;
@@ -3817,12 +3820,12 @@ var BrushSourceArtCache = (_class11 = class {constructor() { _class11.prototype.
3817
3820
  }}
3818
3821
  /** A lookup that reads sources from here and every other ref from `stickers`. */
3819
3822
  with(stickers) {
3820
- return (ref2, variant) => _chunkEU2ZZA6Lcjs.isBrushSourceRef.call(void 0, ref2) ? this.get(ref2) : stickers(ref2, variant);
3823
+ return (ref2, variant) => _chunkGHGBIAWQcjs.isBrushSourceRef.call(void 0, ref2) ? this.get(ref2) : stickers(ref2, variant);
3821
3824
  }
3822
3825
  }, _class11);
3823
3826
  function engineBrushSourceIds(brush) {
3824
3827
  const refs = [brush.stamp, _optionalChain([brush, 'access', _158 => _158.tipGrain, 'optionalAccess', _159 => _159.source]), ..._nullishCoalesce(_optionalChain([brush, 'access', _160 => _160.particle, 'optionalAccess', _161 => _161.dotTextures]), () => ( []))];
3825
- return [...new Set(refs.filter((r) => !!r && _chunkEU2ZZA6Lcjs.isBrushSourceRef.call(void 0, r)).map((r) => _chunkEU2ZZA6Lcjs.brushSourceIdOf.call(void 0, r)))];
3828
+ return [...new Set(refs.filter((r) => !!r && _chunkGHGBIAWQcjs.isBrushSourceRef.call(void 0, r)).map((r) => _chunkGHGBIAWQcjs.brushSourceIdOf.call(void 0, r)))];
3826
3829
  }
3827
3830
 
3828
3831
  // src/paint-editor/live-strokes.ts
@@ -3995,10 +3998,10 @@ function addTiles(a, b) {
3995
3998
  }
3996
3999
  function computeTile(paper, grain, amount, rect, layers) {
3997
4000
  const n = rect.width * rect.height;
3998
- const [p0, p1, p2] = _chunkJJ2H25JGcjs.hexToRgb8.call(void 0, paper.color);
4001
+ const [p0, p1, p2] = _chunkSNAFFCAXcjs.hexToRgb8.call(void 0, paper.color);
3999
4002
  const pb = [p0, p1, p2];
4000
4003
  const pl = [Math.max(1e-4, LIN[p0]), Math.max(1e-4, LIN[p1]), Math.max(1e-4, LIN[p2])];
4001
- const [c0, c1, c2] = _chunkJJ2H25JGcjs.hexToRgb8.call(void 0, _nullishCoalesce(paper.backlightColor, () => ( DEFAULT_BACKLIGHT_COLOR)));
4004
+ const [c0, c1, c2] = _chunkSNAFFCAXcjs.hexToRgb8.call(void 0, _nullishCoalesce(paper.backlightColor, () => ( DEFAULT_BACKLIGHT_COLOR)));
4002
4005
  const t0 = new Float32Array(n).fill(amount * LIN[c0]);
4003
4006
  const t1 = new Float32Array(n).fill(amount * LIN[c1]);
4004
4007
  const t2 = new Float32Array(n).fill(amount * LIN[c2]);
@@ -4419,7 +4422,7 @@ async function libraryCall(call) {
4419
4422
  try {
4420
4423
  return await call();
4421
4424
  } catch (e) {
4422
- throw e instanceof _chunkEU2ZZA6Lcjs.BrushLibraryError ? new PaintEditorError(e.message) : e;
4425
+ throw e instanceof _chunkGHGBIAWQcjs.BrushLibraryError ? new PaintEditorError(e.message) : e;
4423
4426
  }
4424
4427
  }
4425
4428
  var HEX2 = /^#[0-9a-f]{6}$/i;
@@ -4429,7 +4432,7 @@ function parseColor(value, what = "color") {
4429
4432
  return value.trim().toLowerCase();
4430
4433
  }
4431
4434
  function rgbaOf(hex2) {
4432
- const [r, g, b] = _chunkJJ2H25JGcjs.hexToRgb8.call(void 0, hex2);
4435
+ const [r, g, b] = _chunkSNAFFCAXcjs.hexToRgb8.call(void 0, hex2);
4433
4436
  return [r, g, b, 255];
4434
4437
  }
4435
4438
  function rgbToHex(r, g, b) {
@@ -4555,7 +4558,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
4555
4558
  /** Image sources strokes draw with: the brush library's and the open painting's (saved with it). */
4556
4559
  __init128() {this.brushSources = new BrushSourceArtCache()}
4557
4560
  /** Art for stamp tips and tip grain: image sources from `brushSources`, stickers from the sticker library. */
4558
- __init129() {this.stampArt = (ref2, variant) => _chunkEU2ZZA6Lcjs.isBrushSourceRef.call(void 0, ref2) ? this.brushSources.get(ref2) : this.stickerArt.get(ref2, variant)}
4561
+ __init129() {this.stampArt = (ref2, variant) => _chunkGHGBIAWQcjs.isBrushSourceRef.call(void 0, ref2) ? this.brushSources.get(ref2) : this.stickerArt.get(ref2, variant)}
4559
4562
 
4560
4563
  __init130() {this.effectsRenderer = new PaintEffectsRenderer()}
4561
4564
  __init131() {this.paperEffectNodeCache = null}
@@ -4564,15 +4567,15 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
4564
4567
  this.rasterizeSticker = _nullishCoalesce(options.rasterizeSticker, () => ( defaultStickerRasterizer));
4565
4568
  if (options.stickers) this.stickers.set(options.stickers);
4566
4569
  this.doc = createPaintDocument({ width: options.width, height: options.height, dpi: options.dpi, paper: this.resolvePaper(options.paper) });
4567
- const seed = (_nullishCoalesce(options.brushes, () => ( []))).map((b) => _chunkEU2ZZA6Lcjs.normalizePaintBrush.call(void 0, { ...b, builtin: false }));
4568
- this.brushLibrary = _nullishCoalesce(options.brushLibrary, () => ( _chunkEU2ZZA6Lcjs.createBrushLibrary.call(void 0, { storage: seededStorage(seed) })));
4569
- this.brushEntries = [...builtinLibraryBrushes(), ...seed.map((b) => libraryBrush(_chunkEU2ZZA6Lcjs.migrateBrushV1.call(void 0, b), false, b))];
4570
- const wanted = _nullishCoalesce(options.brushId, () => ( _chunkEU2ZZA6Lcjs.DEFAULT_BRUSH_ID));
4571
- const start = _nullishCoalesce(this.findEntry(wanted), () => ( this.findEntry(_chunkEU2ZZA6Lcjs.DEFAULT_BRUSH_ID)));
4572
- this.brush = _chunkEU2ZZA6Lcjs.normalizePaintBrush.call(void 0, start.brush);
4570
+ const seed = (_nullishCoalesce(options.brushes, () => ( []))).map((b) => _chunkGHGBIAWQcjs.normalizePaintBrush.call(void 0, { ...b, builtin: false }));
4571
+ this.brushLibrary = _nullishCoalesce(options.brushLibrary, () => ( _chunkGHGBIAWQcjs.createBrushLibrary.call(void 0, { storage: seededStorage(seed) })));
4572
+ this.brushEntries = [...builtinLibraryBrushes(), ...seed.map((b) => libraryBrush(_chunkGHGBIAWQcjs.migrateBrushV1.call(void 0, b), false, b))];
4573
+ const wanted = _nullishCoalesce(options.brushId, () => ( _chunkGHGBIAWQcjs.DEFAULT_BRUSH_ID));
4574
+ const start = _nullishCoalesce(this.findEntry(wanted), () => ( this.findEntry(_chunkGHGBIAWQcjs.DEFAULT_BRUSH_ID)));
4575
+ this.brush = _chunkGHGBIAWQcjs.normalizePaintBrush.call(void 0, start.brush);
4573
4576
  this.brushSpec = copyJSON(start.spec);
4574
4577
  this.unsubscribeLibrary = this.brushLibrary.subscribe(() => void this.refreshBrushes().catch(() => void 0));
4575
- if (options.brushLibrary && seed.length) void this.brushLibrary.importFile(seed.map(_chunkEU2ZZA6Lcjs.brushToJSON)).catch(() => void 0);
4578
+ if (options.brushLibrary && seed.length) void this.brushLibrary.importFile(seed.map(_chunkGHGBIAWQcjs.brushToJSON)).catch(() => void 0);
4576
4579
  void this.refreshBrushes().catch(() => void 0);
4577
4580
  this.pendingBrushId = start.brush.id === wanted ? null : wanted;
4578
4581
  this.color = options.color ? parseColor(options.color) : "#1f2937";
@@ -4581,7 +4584,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
4581
4584
  this.encodeImage = options.encodeImage;
4582
4585
  this.guides = defaultGuides(this.doc.canvas);
4583
4586
  this.wetOptions = options.wet;
4584
- this.wet = new (0, _chunkJJ2H25JGcjs.PaintWetLayers)(
4587
+ this.wet = new (0, _chunkSNAFFCAXcjs.PaintWetLayers)(
4585
4588
  {
4586
4589
  canvas: () => this.doc.canvas,
4587
4590
  paper: () => this.doc.paper,
@@ -5024,7 +5027,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
5024
5027
  // --- Canvas and paper ----------------------------------------------------------
5025
5028
  resolvePaper(paper) {
5026
5029
  if (typeof paper === "string") {
5027
- const p = _chunkJJ2H25JGcjs.paperPreset.call(void 0, paper);
5030
+ const p = _chunkSNAFFCAXcjs.paperPreset.call(void 0, paper);
5028
5031
  if (!p) throw new PaintEditorError(`Unknown paper "${paper}". Call list_papers for the ids.`);
5029
5032
  return p;
5030
5033
  }
@@ -5135,19 +5138,19 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
5135
5138
  this.requireIdle("changing the paper");
5136
5139
  let base = this.doc.paper;
5137
5140
  if (update.preset !== void 0 && update.preset !== this.doc.paper.preset) {
5138
- const p = _chunkJJ2H25JGcjs.paperPreset.call(void 0, update.preset);
5141
+ const p = _chunkSNAFFCAXcjs.paperPreset.call(void 0, update.preset);
5139
5142
  if (!p) throw new PaintEditorError(`Unknown paper "${update.preset}". Call list_papers for the ids.`);
5140
5143
  base = p;
5141
5144
  }
5142
5145
  const { preset: _p, ...rest } = update;
5143
5146
  if (rest.color !== void 0) parseColor(rest.color, "paper color");
5144
- const paper = _chunkJJ2H25JGcjs.normalizePaper.call(void 0, { ...rest, preset: base.preset, offset: _nullishCoalesce(rest.offset, () => ( this.doc.paper.offset)) }, base);
5147
+ const paper = _chunkSNAFFCAXcjs.normalizePaper.call(void 0, { ...rest, preset: base.preset, offset: _nullishCoalesce(rest.offset, () => ( this.doc.paper.offset)) }, base);
5145
5148
  const changedKeys = Object.keys(rest).filter((k) => k !== "name");
5146
5149
  if (changedKeys.length && update.preset === void 0) paper.preset = base.preset;
5147
5150
  if (this.wet.world) this.beginWetOp();
5148
5151
  this.commit("Paper", { ...this.doc, paper });
5149
5152
  this.wet.paperChanged();
5150
- return _chunkJJ2H25JGcjs.clonePaper.call(void 0, paper);
5153
+ return _chunkSNAFFCAXcjs.clonePaper.call(void 0, paper);
5151
5154
  }
5152
5155
  // --- Layers --------------------------------------------------------------------
5153
5156
  getLayer(id) {
@@ -5755,7 +5758,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
5755
5758
  this.checkTime(source.time);
5756
5759
  let map;
5757
5760
  try {
5758
- map = _chunkJJ2H25JGcjs.readEffectStrokeMap.call(void 0, source.map);
5761
+ map = _chunkSNAFFCAXcjs.readEffectStrokeMap.call(void 0, source.map);
5759
5762
  } catch (e) {
5760
5763
  throw new PaintEditorError(e.message);
5761
5764
  }
@@ -5789,9 +5792,9 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
5789
5792
  }
5790
5793
  /** The rendered pixels of an effect paint at the current canvas size, or `null` when it has not been rendered. */
5791
5794
  effectPaintImage(p) {
5792
- const key = _chunkJJ2H25JGcjs.effectPaintKey.call(void 0, p);
5795
+ const key = _chunkSNAFFCAXcjs.effectPaintKey.call(void 0, p);
5793
5796
  const img = this.effectPaintPixels.get(key);
5794
- const size = _chunkJJ2H25JGcjs.effectPaintSize.call(void 0, p, this.doc.canvas);
5797
+ const size = _chunkSNAFFCAXcjs.effectPaintSize.call(void 0, p, this.doc.canvas);
5795
5798
  if (!img || img.width !== size.width || img.height !== size.height) return null;
5796
5799
  this.effectPaintPixels.delete(key);
5797
5800
  this.effectPaintPixels.set(key, img);
@@ -5801,7 +5804,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
5801
5804
  return this.cacheEffectPaintImage(p, toEffectPaintPixels(p, pixels));
5802
5805
  }
5803
5806
  cacheEffectPaintImage(p, img) {
5804
- this.effectPaintPixels.set(_chunkJJ2H25JGcjs.effectPaintKey.call(void 0, p), img);
5807
+ this.effectPaintPixels.set(_chunkSNAFFCAXcjs.effectPaintKey.call(void 0, p), img);
5805
5808
  this.trimEffectPaints();
5806
5809
  return img;
5807
5810
  }
@@ -5817,7 +5820,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
5817
5820
  if (have) return have;
5818
5821
  const provider = this.effects.provider;
5819
5822
  if (!provider || p.provider && provider.id !== p.provider) return null;
5820
- const size = _chunkJJ2H25JGcjs.effectPaintSize.call(void 0, p, this.doc.canvas);
5823
+ const size = _chunkSNAFFCAXcjs.effectPaintSize.call(void 0, p, this.doc.canvas);
5821
5824
  const pixels = this.effectsRenderer.renderSync(provider, p.effect, size, { time: p.time, values: p.values });
5822
5825
  return pixels ? this.cacheEffectPaintPixels(p, pixels) : null;
5823
5826
  }
@@ -5833,7 +5836,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
5833
5836
  const what = `the effect "${p.effect}"${p.provider ? ` from provider "${p.provider}"` : ""}`;
5834
5837
  if (!provider) throw new PaintEditorError(`Effect paint needs ${what}, but no effects provider is registered; register it (setEffectsProvider) and try again.`);
5835
5838
  if (p.provider && provider.id !== p.provider) throw new PaintEditorError(`Effect paint needs ${what}, but the registered provider is "${provider.id}"; register "${p.provider}" (setEffectsProvider) and try again.`);
5836
- const { width, height } = _chunkJJ2H25JGcjs.effectPaintSize.call(void 0, p, this.doc.canvas);
5839
+ const { width, height } = _chunkSNAFFCAXcjs.effectPaintSize.call(void 0, p, this.doc.canvas);
5837
5840
  let pixels;
5838
5841
  try {
5839
5842
  pixels = await this.effectsRenderer.render(provider, p.effect, { width, height }, { time: p.time, values: p.values });
@@ -5848,10 +5851,10 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
5848
5851
  */
5849
5852
  async prepareEffectPaints(paints2) {
5850
5853
  const list = [...paints2];
5851
- this.effectPaintBatch = new Set(list.map(_chunkJJ2H25JGcjs.effectPaintKey)).size;
5854
+ this.effectPaintBatch = new Set(list.map(_chunkSNAFFCAXcjs.effectPaintKey)).size;
5852
5855
  const seen = /* @__PURE__ */ new Set();
5853
5856
  for (const p of list) {
5854
- const key = _chunkJJ2H25JGcjs.effectPaintKey.call(void 0, p);
5857
+ const key = _chunkSNAFFCAXcjs.effectPaintKey.call(void 0, p);
5855
5858
  if (seen.has(key)) continue;
5856
5859
  seen.add(key);
5857
5860
  await this.renderEffectPaint(p);
@@ -5864,18 +5867,18 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
5864
5867
  */
5865
5868
  async prepareStrokePathEffect(init, pointsList) {
5866
5869
  const brush = this.strokeBrush(init);
5867
- if (!_chunkEU2ZZA6Lcjs.brushTakesPaint.call(void 0, brush)) return;
5870
+ if (!_chunkGHGBIAWQcjs.brushTakesPaint.call(void 0, brush)) return;
5868
5871
  let source = null;
5869
5872
  if (init.paint !== void 0) {
5870
- if (!_chunkJJ2H25JGcjs.isPaintEffectPaint.call(void 0, init.paint)) return;
5871
- source = _chunkJJ2H25JGcjs.readPaintEffectPaint.call(void 0, init.paint);
5873
+ if (!_chunkSNAFFCAXcjs.isPaintEffectPaint.call(void 0, init.paint)) return;
5874
+ source = _chunkSNAFFCAXcjs.readPaintEffectPaint.call(void 0, init.paint);
5872
5875
  } else if (init.color === void 0 && !brush.paint && !this.effectPaintPending) {
5873
5876
  source = this.effectPaint;
5874
5877
  }
5875
5878
  if (!source || _optionalChain([source, 'access', _310 => _310.map, 'optionalAccess', _311 => _311.by]) !== "path") return;
5876
5879
  if (!this.effectPathControls.has(source.effect)) await this.describeEffect(source.effect);
5877
5880
  const control = this.effectPathControls.get(source.effect);
5878
- const paints2 = pointsList.filter((pts) => pts.length > 0).map((pts) => _chunkJJ2H25JGcjs.withStrokePath.call(void 0, source, pts, control));
5881
+ const paints2 = pointsList.filter((pts) => pts.length > 0).map((pts) => _chunkSNAFFCAXcjs.withStrokePath.call(void 0, source, pts, control));
5879
5882
  if (paints2.length) await this.prepareEffectPaints(paints2);
5880
5883
  }
5881
5884
  /**
@@ -5899,12 +5902,12 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
5899
5902
  if (!was) return null;
5900
5903
  try {
5901
5904
  if (edit.paint !== void 0) {
5902
- if (!_chunkJJ2H25JGcjs.isPaintEffectPaint.call(void 0, edit.paint)) return null;
5903
- const p = _chunkJJ2H25JGcjs.readPaintEffectPaint.call(void 0, edit.paint);
5904
- return p && _chunkJJ2H25JGcjs.withStrokePath.call(void 0, p, was.points, this.effectPathControls.get(p.effect));
5905
+ if (!_chunkSNAFFCAXcjs.isPaintEffectPaint.call(void 0, edit.paint)) return null;
5906
+ const p = _chunkSNAFFCAXcjs.readPaintEffectPaint.call(void 0, edit.paint);
5907
+ return p && _chunkSNAFFCAXcjs.withStrokePath.call(void 0, p, was.points, this.effectPathControls.get(p.effect));
5905
5908
  }
5906
5909
  if (_optionalChain([was, 'access', _314 => _314.paint, 'optionalAccess', _315 => _315.type]) !== "effect" || _optionalChain([was, 'access', _316 => _316.paint, 'access', _317 => _317.map, 'optionalAccess', _318 => _318.by]) !== "path") return null;
5907
- if (edit.points !== void 0) return _chunkJJ2H25JGcjs.withStrokePath.call(void 0, was.paint, this.checkPoints(edit.points), this.effectPathControls.get(was.paint.effect));
5910
+ if (edit.points !== void 0) return _chunkSNAFFCAXcjs.withStrokePath.call(void 0, was.paint, this.checkPoints(edit.points), this.effectPathControls.get(was.paint.effect));
5908
5911
  if (!edit.transform) return null;
5909
5912
  const varied = varyStroke(was, this.strokeTransform(was, edit.transform), {}).paint;
5910
5913
  return _optionalChain([varied, 'optionalAccess', _319 => _319.type]) === "effect" ? varied : null;
@@ -5969,11 +5972,11 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
5969
5972
  * its pixels are not rendered.
5970
5973
  */
5971
5974
  strokeEffect(init, brush, points) {
5972
- if (!_chunkEU2ZZA6Lcjs.brushTakesPaint.call(void 0, brush)) return null;
5975
+ if (!_chunkGHGBIAWQcjs.brushTakesPaint.call(void 0, brush)) return null;
5973
5976
  let source = null;
5974
5977
  if (init.paint !== void 0) {
5975
- if (!_chunkJJ2H25JGcjs.isPaintEffectPaint.call(void 0, init.paint)) return null;
5976
- source = _chunkJJ2H25JGcjs.readPaintEffectPaint.call(void 0, init.paint);
5978
+ if (!_chunkSNAFFCAXcjs.isPaintEffectPaint.call(void 0, init.paint)) return null;
5979
+ source = _chunkSNAFFCAXcjs.readPaintEffectPaint.call(void 0, init.paint);
5977
5980
  if (!source) throw new PaintEditorError("The stroke's effect paint needs an effect id and values (getEffectPaint returns one).");
5978
5981
  } else if (init.color === void 0 && !brush.paint) {
5979
5982
  if (this.effectPaintPending) throw new PaintEditorError(`The effect paint "${this.effectPaintPending.effect}" is still rendering; wait for set_effect_paint to finish, then paint.`);
@@ -5981,7 +5984,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
5981
5984
  }
5982
5985
  if (!source) return null;
5983
5986
  const path = _optionalChain([source, 'access', _324 => _324.map, 'optionalAccess', _325 => _325.by]) === "path";
5984
- if (path && _optionalChain([points, 'optionalAccess', _326 => _326.length])) source = _chunkJJ2H25JGcjs.withStrokePath.call(void 0, source, points, this.effectPathControls.get(source.effect));
5987
+ if (path && _optionalChain([points, 'optionalAccess', _326 => _326.length])) source = _chunkSNAFFCAXcjs.withStrokePath.call(void 0, source, points, this.effectPathControls.get(source.effect));
5985
5988
  const pixels = _nullishCoalesce(this.effectPaintImage(source), () => ( (path ? this.renderEffectPaintSync(source) : null)));
5986
5989
  if (!pixels) throw new PaintEditorError(`The effect paint "${source.effect}"${source.provider ? ` from provider "${source.provider}"` : ""} is not rendered at this canvas size; call ${path ? "prepareStrokePathEffect (the paint_stroke tool does this) or prepareStrokeEdit" : "set_effect_paint (or prepareEffectPaints)"} first.`);
5987
5990
  return { source, pixels };
@@ -6032,7 +6035,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6032
6035
  }
6033
6036
  requireEntry(id) {
6034
6037
  const e = this.findEntry(id);
6035
- if (!e) throw new PaintEditorError(`Unknown brush "${id}". ${_chunkEU2ZZA6Lcjs.closest.call(void 0, id, this.brushEntries.map((x) => x.brush.id))}Call list_brush_presets for the ids.`);
6038
+ if (!e) throw new PaintEditorError(`Unknown brush "${id}". ${_chunkGHGBIAWQcjs.closest.call(void 0, id, this.brushEntries.map((x) => x.brush.id))}Call list_brush_presets for the ids.`);
6036
6039
  return e;
6037
6040
  }
6038
6041
  requireBrush(id) {
@@ -6061,7 +6064,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6061
6064
  /** A library brush by id, as the engine paints it (`undefined` when unknown). */
6062
6065
  getBrush(id) {
6063
6066
  const b = this.findBrush(id);
6064
- return b ? _chunkEU2ZZA6Lcjs.normalizePaintBrush.call(void 0, b, b) : void 0;
6067
+ return b ? _chunkGHGBIAWQcjs.normalizePaintBrush.call(void 0, b, b) : void 0;
6065
6068
  }
6066
6069
  /** A library brush by id as stored (its facets), or without an id the active brush as edited. */
6067
6070
  getBrushSpec(id) {
@@ -6079,7 +6082,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6079
6082
  const baseSpec = entry ? entry.spec : this.brushSpec;
6080
6083
  if (changes.paint !== void 0 && changes.paint !== null) this.readStrokePaint(changes.paint);
6081
6084
  const unchanged = !Object.keys(changes).length;
6082
- const next = _chunkEU2ZZA6Lcjs.normalizePaintBrush.call(void 0, { ...changes, id: base.id }, base);
6085
+ const next = _chunkGHGBIAWQcjs.normalizePaintBrush.call(void 0, { ...changes, id: base.id }, base);
6083
6086
  if (entry) this.takeBrushColour(entry.spec);
6084
6087
  this.useBrush(next, unchanged ? baseSpec : brushSpecOf(next, baseSpec), unchanged && base.builtin === true);
6085
6088
  return this.brush;
@@ -6098,7 +6101,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6098
6101
  for (const k of unset) delete base[k];
6099
6102
  const spec = this.readBrushPatch(base, patch, problems);
6100
6103
  if (entry || _optionalChain([patch, 'access', _341 => _341.colour, 'optionalAccess', _342 => _342.default]) !== void 0) this.takeBrushColour(spec);
6101
- this.useBrush(unchanged && entry ? entry.brush : _chunkEU2ZZA6Lcjs.resolveBrush.call(void 0, spec), spec, unchanged && _optionalChain([entry, 'optionalAccess', _343 => _343.builtin]) === true);
6104
+ this.useBrush(unchanged && entry ? entry.brush : _chunkGHGBIAWQcjs.resolveBrush.call(void 0, spec), spec, unchanged && _optionalChain([entry, 'optionalAccess', _343 => _343.builtin]) === true);
6102
6105
  return { brush: this.brush, spec: copyJSON(this.brushSpec), problems };
6103
6106
  }
6104
6107
  /**
@@ -6112,11 +6115,11 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6112
6115
  if (paint && typeof paint === "object" && "type" in paint && paint.type === "gradient") this.readStrokePaint(paint);
6113
6116
  let next;
6114
6117
  try {
6115
- next = _chunkEU2ZZA6Lcjs.normalizeBrushSpec.call(void 0, { ...spec, id: this.brush.id }, problems);
6118
+ next = _chunkGHGBIAWQcjs.normalizeBrushSpec.call(void 0, { ...spec, id: this.brush.id }, problems);
6116
6119
  } catch (e) {
6117
6120
  throw new PaintEditorError(e.message);
6118
6121
  }
6119
- this.useBrush(_chunkEU2ZZA6Lcjs.resolveBrush.call(void 0, next), next, false);
6122
+ this.useBrush(_chunkGHGBIAWQcjs.resolveBrush.call(void 0, next), next, false);
6120
6123
  return { brush: this.brush, spec: copyJSON(this.brushSpec), problems };
6121
6124
  }
6122
6125
  /**
@@ -6125,29 +6128,29 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6125
6128
  */
6126
6129
  brushChanges(patch, from) {
6127
6130
  const entry = typeof from === "string" ? this.requireEntry(from) : null;
6128
- const base = entry ? entry.brush : typeof from === "object" ? _chunkEU2ZZA6Lcjs.normalizePaintBrush.call(void 0, from, from) : this.brush;
6129
- const spec = entry ? entry.spec : typeof from === "object" ? _chunkEU2ZZA6Lcjs.migrateBrushV1.call(void 0, base) : this.brushSpec;
6130
- return engineChanges(base, _chunkEU2ZZA6Lcjs.resolveBrush.call(void 0, this.readBrushPatch(spec, patch, [])));
6131
+ const base = entry ? entry.brush : typeof from === "object" ? _chunkGHGBIAWQcjs.normalizePaintBrush.call(void 0, from, from) : this.brush;
6132
+ const spec = entry ? entry.spec : typeof from === "object" ? _chunkGHGBIAWQcjs.migrateBrushV1.call(void 0, base) : this.brushSpec;
6133
+ return engineChanges(base, _chunkGHGBIAWQcjs.resolveBrush.call(void 0, this.readBrushPatch(spec, patch, [])));
6131
6134
  }
6132
6135
  readBrushPatch(base, patch, problems) {
6133
6136
  const { id: _id, name, ...rest } = patch;
6134
6137
  const paint = _optionalChain([rest, 'access', _346 => _346.colour, 'optionalAccess', _347 => _347.default]);
6135
6138
  if (paint && typeof paint === "object" && "type" in paint && paint.type === "gradient") this.readStrokePaint(paint);
6136
6139
  try {
6137
- return _chunkEU2ZZA6Lcjs.normalizeBrushSpec.call(void 0, _chunk3KNQ2W6Xcjs.mergeBrushPatch.call(void 0, base, { ...rest, ...name !== void 0 ? { name } : {} }), problems);
6140
+ return _chunkGHGBIAWQcjs.normalizeBrushSpec.call(void 0, _chunk3JKCREEUcjs.mergeBrushPatch.call(void 0, base, { ...rest, ...name !== void 0 ? { name } : {} }), problems);
6138
6141
  } catch (e) {
6139
6142
  throw new PaintEditorError(e.message);
6140
6143
  }
6141
6144
  }
6142
6145
  useBrush(next, spec, builtin) {
6143
- next = _chunkEU2ZZA6Lcjs.normalizePaintBrush.call(void 0, next, next);
6146
+ next = _chunkGHGBIAWQcjs.normalizePaintBrush.call(void 0, next, next);
6144
6147
  if (builtin) next.builtin = true;
6145
6148
  else delete next.builtin;
6146
6149
  this.brush = next;
6147
6150
  this.brushSpec = { ...copyJSON(spec), id: next.id, name: next.name };
6148
6151
  this.pendingBrushId = null;
6149
6152
  this.emit([]);
6150
- const refs = _chunkJJ2H25JGcjs.brushStickerRefs.call(void 0, next);
6153
+ const refs = _chunkSNAFFCAXcjs.brushStickerRefs.call(void 0, next);
6151
6154
  if (refs.length) void this.prepareStickers(refs).catch(() => this.emit([]));
6152
6155
  }
6153
6156
  /**
@@ -6156,9 +6159,9 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6156
6159
  * saved brush.
6157
6160
  */
6158
6161
  async saveBrush(options) {
6159
- if (!_chunkEU2ZZA6Lcjs.BRUSH_ID.test(options.id)) throw new PaintEditorError(`Brush id "${options.id}" is invalid; use lowercase letters, digits and dashes (e.g. "my-pencil").`);
6162
+ if (!_chunkGHGBIAWQcjs.BRUSH_ID.test(options.id)) throw new PaintEditorError(`Brush id "${options.id}" is invalid; use lowercase letters, digits and dashes (e.g. "my-pencil").`);
6160
6163
  if (this.brushLibrary.isBuiltin(options.id)) throw new PaintEditorError(`"${options.id}" is a built-in brush; save under another id.`);
6161
- const spec = options.brush ? brushSpecOf(_chunkEU2ZZA6Lcjs.normalizePaintBrush.call(void 0, options.brush, this.brush), this.brushSpec) : this.brushSpec;
6164
+ const spec = options.brush ? brushSpecOf(_chunkGHGBIAWQcjs.normalizePaintBrush.call(void 0, options.brush, this.brush), this.brushSpec) : this.brushSpec;
6162
6165
  const { brush } = await libraryCall(() => this.brushLibrary.save({ ...spec, id: options.id, name: _nullishCoalesce(options.name, () => ( spec.name)) }, { overwrite: true }));
6163
6166
  await this.refreshBrushes();
6164
6167
  return this.requireBrush(brush.id);
@@ -6171,7 +6174,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6171
6174
  }
6172
6175
  /** The user's saved brushes, as the engine paints them. */
6173
6176
  getUserBrushes() {
6174
- return this.brushEntries.filter((e) => !e.builtin).map((e) => _chunkEU2ZZA6Lcjs.normalizePaintBrush.call(void 0, e.brush, e.brush));
6177
+ return this.brushEntries.filter((e) => !e.builtin).map((e) => _chunkGHGBIAWQcjs.normalizePaintBrush.call(void 0, e.brush, e.brush));
6175
6178
  }
6176
6179
  /** A brush library file (version 2) of the given brushes (default: the user's brushes). */
6177
6180
  exportBrushes(ids) {
@@ -6207,7 +6210,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6207
6210
  this.colorScheme = next;
6208
6211
  const hex2 = this.brushColour ? _chunkJBZRVLXVcjs.brushColourHex.call(void 0, this.brushColour, next) : null;
6209
6212
  if (hex2) this.color = hex2;
6210
- const refs = _chunkJJ2H25JGcjs.brushStickerRefs.call(void 0, this.brush);
6213
+ const refs = _chunkSNAFFCAXcjs.brushStickerRefs.call(void 0, this.brush);
6211
6214
  if (refs.some((r) => !_chunkRDFHWAHLcjs.editorStampOf.call(void 0, r))) void this.prepareStickers(refs).catch(() => this.emit([]));
6212
6215
  this.emit([]);
6213
6216
  }
@@ -6279,10 +6282,10 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6279
6282
  * brush's gradient, else the editor's gradient paint. Erasers, blenders and smudges take none.
6280
6283
  */
6281
6284
  strokeGradient(init, brush, color) {
6282
- if (!_chunkEU2ZZA6Lcjs.brushTakesPaint.call(void 0, brush)) return null;
6285
+ if (!_chunkGHGBIAWQcjs.brushTakesPaint.call(void 0, brush)) return null;
6283
6286
  let g = null;
6284
6287
  if (init.paint !== void 0) {
6285
- if (_chunkJJ2H25JGcjs.isPaintEffectPaint.call(void 0, init.paint)) return null;
6288
+ if (_chunkSNAFFCAXcjs.isPaintEffectPaint.call(void 0, init.paint)) return null;
6286
6289
  const p = this.readStrokePaint(init.paint);
6287
6290
  g = p.type === "gradient" ? p : null;
6288
6291
  } else g = _nullishCoalesce(brush.paint, () => ( (init.color === void 0 ? this.gradient : null)));
@@ -6326,7 +6329,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6326
6329
  // --- Mixer Brush ---------------------------------------------------------------
6327
6330
  /** Fills the Mixer Brush reservoir with a colour (default the editor colour). */
6328
6331
  loadMixerBrush(color) {
6329
- const [r, g, b] = _chunkJJ2H25JGcjs.hexToRgb8.call(void 0, color === void 0 ? this.color : parseColor(color));
6332
+ const [r, g, b] = _chunkSNAFFCAXcjs.hexToRgb8.call(void 0, color === void 0 ? this.color : parseColor(color));
6330
6333
  this.mixerLoad = _chunkNIBFKXMDcjs.loadMixer.call(void 0, this.mixerLoad, [r / 255, g / 255, b / 255]);
6331
6334
  this.emit([]);
6332
6335
  return this.mixerLoad;
@@ -6356,7 +6359,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6356
6359
  // --- Strokes -------------------------------------------------------------------
6357
6360
  strokeBrush(init) {
6358
6361
  let brush = init.brushId !== void 0 ? this.requireBrush(init.brushId) : this.brush;
6359
- if (init.brush) brush = _chunkEU2ZZA6Lcjs.normalizePaintBrush.call(void 0, { ...init.brush, id: brush.id }, brush);
6362
+ if (init.brush) brush = _chunkGHGBIAWQcjs.normalizePaintBrush.call(void 0, { ...init.brush, id: brush.id }, brush);
6360
6363
  return brush;
6361
6364
  }
6362
6365
  /**
@@ -6372,7 +6375,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6372
6375
  return symmetryCopies(this.guides.symmetry);
6373
6376
  }
6374
6377
  sessionFor(doc, init, host, points) {
6375
- if (init.paint !== void 0 && !_chunkJJ2H25JGcjs.isPaintEffectPaint.call(void 0, init.paint)) {
6378
+ if (init.paint !== void 0 && !_chunkSNAFFCAXcjs.isPaintEffectPaint.call(void 0, init.paint)) {
6376
6379
  const p = this.readStrokePaint(init.paint);
6377
6380
  if (p.type === "color") init = { ...init, color: p.color, paint: void 0 };
6378
6381
  else init = { ...init, paint: p };
@@ -6389,33 +6392,48 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6389
6392
  return l;
6390
6393
  })();
6391
6394
  const brush = this.strokeBrush(init);
6392
- if (this.previewing && _chunkEU2ZZA6Lcjs.isWetBrush.call(void 0, brush)) throw new PaintEditorError(`Wet paint can't be previewed; the ${brush.name} brush paints wet media. Suggest it with a dry brush.`);
6395
+ if (this.previewing && _chunkGHGBIAWQcjs.isWetBrush.call(void 0, brush)) throw new PaintEditorError(`Wet paint can't be previewed; the ${brush.name} brush paints wet media. Suggest it with a dry brush.`);
6396
+ if (brush.ghost) {
6397
+ if (brush.light.amount > 0) throw new PaintEditorError(`Ghost paint (${brush.name}) shares the wet light channel and can't emit light; set light.amount to 0 or ghost to null (set_brush).`);
6398
+ if (_chunkSNAFFCAXcjs.isPaintEffectPaint.call(void 0, init.paint) || init.paint === void 0 && init.color === void 0 && Boolean(this.effectPaint)) {
6399
+ throw new PaintEditorError(`Ghost paint (${brush.name}) needs a single colour to subtract as it fades, so it can't paint with an effect; set a solid colour (set_color) or pass color to paint_stroke.`);
6400
+ }
6401
+ if (brush.behavior.multicolor.mode !== "off") throw new PaintEditorError(`Ghost paint (${brush.name}) needs a single colour to subtract as it fades, so it can't use multi-colour paint; set behavior.multicolor.mode to "off" (set_brush).`);
6402
+ const gCol = init.color === void 0 ? _nullishCoalesce(this.ownColour(init.brushId), () => ( this.color)) : parseColor(init.color);
6403
+ if (this.strokeGradient(init, brush, gCol)) throw new PaintEditorError(`Ghost paint (${brush.name}) needs a single colour to subtract as it fades, so it can't paint a gradient; set a solid colour (set_color) or pass color to paint_stroke.`);
6404
+ if (Boolean(_optionalChain([doc, 'access', _355 => _355.light, 'optionalAccess', _356 => _356[layer.id], 'optionalAccess', _357 => _357.tiles, 'access', _358 => _358.size])) || Boolean(_optionalChain([this, 'access', _359 => _359.wet, 'access', _360 => _360.world, 'optionalAccess', _361 => _361.hasLane, 'call', _362 => _362(layer.id)]) && this.wet.world.isLit(layer.id))) {
6405
+ throw new PaintEditorError(`Layer "${layer.name}" holds light paint, and ghost paint shares the wet light channel; paint on another layer (add_layer) or clear the light first (clear_light).`);
6406
+ }
6407
+ }
6393
6408
  const effect = this.strokeEffect(init, brush, points);
6394
- if (!points && init.paint === void 0 && _optionalChain([effect, 'optionalAccess', _355 => _355.source, 'access', _356 => _356.map, 'optionalAccess', _357 => _357.by]) === "path" && _chunkEU2ZZA6Lcjs.isWetBrush.call(void 0, brush)) {
6409
+ if (!points && init.paint === void 0 && _optionalChain([effect, 'optionalAccess', _363 => _363.source, 'access', _364 => _364.map, 'optionalAccess', _365 => _365.by]) === "path" && _chunkGHGBIAWQcjs.isWetBrush.call(void 0, brush)) {
6395
6410
  throw new PaintEditorError(`The ${brush.name} brush paints wet media, which can't follow a path that isn't known until the stroke ends; paint with a dry brush, set_effect_paint with by: "stroke", or give the points to paint_stroke.`);
6396
6411
  }
6397
6412
  if (brush.light.amount > 0) {
6398
6413
  if (brush.engine === "sticker") throw new PaintEditorError(`The ${brush.name} brush sprays stickers, which don't take light yet; paint light with a dab or particle light brush (glow-gel, neon-marker; list_brush_presets lists them), or set light.amount to 0 (set_brush).`);
6414
+ if (Boolean(_optionalChain([this, 'access', _366 => _366.wet, 'access', _367 => _367.world, 'optionalAccess', _368 => _368.hasLane, 'call', _369 => _369(layer.id)]) && this.wet.world.getGhost(layer.id)) || Boolean(_optionalChain([this, 'access', _370 => _370.wet, 'access', _371 => _371.settings, 'access', _372 => _372.get, 'call', _373 => _373(layer.id), 'optionalAccess', _374 => _374.ghost]))) {
6415
+ throw new PaintEditorError(`Layer "${layer.name}" has ghost paint fading on it, which uses the wet light channel; paint light on another layer (add_layer), or finish the ghost first (dry_paint).`);
6416
+ }
6399
6417
  }
6400
- if (_optionalChain([doc, 'access', _358 => _358.liveStrokes, 'optionalAccess', _359 => _359[layer.id]])) {
6418
+ if (_optionalChain([doc, 'access', _375 => _375.liveStrokes, 'optionalAccess', _376 => _376[layer.id]])) {
6401
6419
  const why = liveStrokeRefusal(brush);
6402
6420
  if (why) throw new PaintEditorError(`Layer "${layer.name}" is a stroke layer. ${why}`);
6403
6421
  }
6404
- if (_optionalChain([doc, 'access', _360 => _360.liveStrokes, 'optionalAccess', _361 => _361[layer.id]]) && _optionalChain([effect, 'optionalAccess', _362 => _362.source, 'access', _363 => _363.live])) {
6405
- const key = _chunkJJ2H25JGcjs.effectPaintKey.call(void 0, effect.source);
6422
+ if (_optionalChain([doc, 'access', _377 => _377.liveStrokes, 'optionalAccess', _378 => _378[layer.id]]) && _optionalChain([effect, 'optionalAccess', _379 => _379.source, 'access', _380 => _380.live])) {
6423
+ const key = _chunkSNAFFCAXcjs.effectPaintKey.call(void 0, effect.source);
6406
6424
  const { sources } = this.liveEffects(doc);
6407
- if (!sources.some((p) => _chunkJJ2H25JGcjs.effectPaintKey.call(void 0, p) === key) && sources.length >= MAX_LIVE_EFFECT_SOURCES) {
6425
+ if (!sources.some((p) => _chunkSNAFFCAXcjs.effectPaintKey.call(void 0, p) === key) && sources.length >= MAX_LIVE_EFFECT_SOURCES) {
6408
6426
  throw new PaintEditorError(`The painting already plays ${MAX_LIVE_EFFECT_SOURCES} live effects, the most it can; paint with one of them, or set_effect_paint with live false to bake this one.`);
6409
6427
  }
6410
6428
  }
6411
- const stickerLayer = Boolean(_optionalChain([doc, 'access', _364 => _364.stickers, 'optionalAccess', _365 => _365[layer.id], 'optionalAccess', _366 => _366.length]));
6429
+ const stickerLayer = Boolean(_optionalChain([doc, 'access', _381 => _381.stickers, 'optionalAccess', _382 => _382[layer.id], 'optionalAccess', _383 => _383.length]));
6412
6430
  if (brush.engine === "sticker") {
6413
6431
  if (!stickerLayer && _chunk474IQG74cjs.contentBounds.call(void 0, layer.surface)) throw new PaintEditorError(`Layer "${layer.name}" already has paint; spray stickers onto an empty layer (add_layer) so they stay editable.`);
6414
6432
  } else if (stickerLayer) {
6415
6433
  throw new PaintEditorError(`Layer "${layer.name}" is a sticker layer (its pixels are drawn from its stickers); paint on another layer (add_layer).`);
6416
6434
  }
6417
6435
  let wet;
6418
- if (_chunkEU2ZZA6Lcjs.isWetBrush.call(void 0, brush)) {
6436
+ if (_chunkGHGBIAWQcjs.isWetBrush.call(void 0, brush)) {
6419
6437
  this.requireWetIdle("painting");
6420
6438
  if (layer.offset.x || layer.offset.y) {
6421
6439
  const moved = { ...layer, surface: _chunk474IQG74cjs.translateSurface.call(void 0, layer.surface, layer.offset.x, layer.offset.y), offset: { x: 0, y: 0 } };
@@ -6423,19 +6441,19 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6423
6441
  if (doc !== this.doc) doc = { ...doc, layers: _chunkPVJMTLPJcjs.mapLayer.call(void 0, doc.layers, layer.id, () => moved) };
6424
6442
  layer = moved;
6425
6443
  }
6426
- if (!this.wet.wetLayerIds().includes(layer.id) && this.wet.wetLayerIds().length >= _chunkJ5VQYK7Tcjs.MAX_WET_LANES) {
6427
- throw new PaintEditorError(`At most ${_chunkJ5VQYK7Tcjs.MAX_WET_LANES} layers can hold wet paint at once; dry one first (dry_paint).`);
6444
+ if (!this.wet.wetLayerIds().includes(layer.id) && this.wet.wetLayerIds().length >= _chunkN5IMDAHMcjs.MAX_WET_LANES) {
6445
+ throw new PaintEditorError(`At most ${_chunkN5IMDAHMcjs.MAX_WET_LANES} layers can hold wet paint at once; dry one first (dry_paint).`);
6428
6446
  }
6429
6447
  this.beginWetOp();
6430
6448
  const world = this.wet.ensureLane(layer.id, brush.wet.medium);
6431
6449
  const id = layer.id;
6432
6450
  const wetColor = init.color === void 0 ? _nullishCoalesce(this.ownColour(init.brushId), () => ( this.color)) : parseColor(init.color);
6433
- const [r, g, b] = _chunkJJ2H25JGcjs.hexToRgb8.call(void 0, wetColor);
6451
+ const [r, g, b] = _chunkSNAFFCAXcjs.hexToRgb8.call(void 0, wetColor);
6434
6452
  const wetGradient = this.strokeGradient(init, brush, wetColor);
6435
6453
  const load = _nullishCoalesce(init.load, () => ( brushLoadForStroke(brush, this.mixerLoad, [r / 255, g / 255, b / 255])));
6436
6454
  const seedW = _nullishCoalesce(init.seed, () => ( _chunk3K6HWEXZcjs.mix32.call(void 0, this.seedCounter * 2654435761 >>> 0) & 2147483647));
6437
6455
  const copiesW = (_nullishCoalesce(init.copies, () => ( this.strokeCopies()))).filter((m) => m.some((v, i) => v !== IDENTITY_AFFINE[i]));
6438
- const driver = new (0, _chunkJJ2H25JGcjs.WetStrokeDriver)({
6456
+ const driver = new (0, _chunkSNAFFCAXcjs.WetStrokeDriver)({
6439
6457
  world,
6440
6458
  laneId: id,
6441
6459
  brush,
@@ -6443,12 +6461,13 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6443
6461
  load,
6444
6462
  grain: paperGrain(doc.paper),
6445
6463
  paperDepth: doc.paper.depth,
6446
- paperColor: _chunkJJ2H25JGcjs.hexToRgb8.call(void 0, doc.paper.color),
6464
+ paperColor: _chunkSNAFFCAXcjs.hexToRgb8.call(void 0, doc.paper.color),
6447
6465
  seed: seedW,
6448
6466
  copies: [IDENTITY_AFFINE, ...copiesW].map(affineCopy),
6449
6467
  mask: init.maskStencils ? this.stencilSelection(init.maskStencils) : init.stencils !== false ? this.stencilSelection() : null,
6450
6468
  paint: effect ? null : wetGradient,
6451
- effect: _nullishCoalesce(_optionalChain([effect, 'optionalAccess', _367 => _367.pixels]), () => ( null))
6469
+ effect: _nullishCoalesce(_optionalChain([effect, 'optionalAccess', _384 => _384.pixels]), () => ( null)),
6470
+ speed: this.wet.speed
6452
6471
  });
6453
6472
  init = { ...init, seed: seedW, load };
6454
6473
  wet = { driver, surface: () => world.display(id).surface };
@@ -6459,7 +6478,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6459
6478
  }
6460
6479
  let color = init.color === void 0 ? _nullishCoalesce(this.ownColour(init.brushId), () => ( this.color)) : parseColor(init.color);
6461
6480
  const tracing = this.guides.tracing;
6462
- if (init.color === void 0 && init.start && _optionalChain([tracing, 'optionalAccess', _368 => _368.visible]) && tracing.sampleColors) color = _nullishCoalesce(this.sampleTracingColor(init.start.x, init.start.y), () => ( color));
6481
+ if (init.color === void 0 && init.start && _optionalChain([tracing, 'optionalAccess', _385 => _385.visible]) && tracing.sampleColors) color = _nullishCoalesce(this.sampleTracingColor(init.start.x, init.start.y), () => ( color));
6463
6482
  const perspective = this.guides.perspective;
6464
6483
  const snapper = init.snapToPerspective && perspective.enabled && perspective.snap ? new PerspectiveSnapper(perspective) : null;
6465
6484
  const useStencils = init.stencils !== false;
@@ -6492,9 +6511,9 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6492
6511
  mixerLoad: _nullishCoalesce(init.load, () => ( brushLoadForStroke(brush, this.mixerLoad, [rgba[0] / 255, rgba[1] / 255, rgba[2] / 255]))),
6493
6512
  secondary: rgbaOf(this.secondaryColor),
6494
6513
  wet,
6495
- thick: brush.engine === "impasto" ? { channels: _nullishCoalesce(_optionalChain([doc, 'access', _369 => _369.thick, 'optionalAccess', _370 => _370[layer.id]]), () => ( emptyThickChannels())) } : void 0,
6514
+ thick: brush.engine === "impasto" ? { channels: _nullishCoalesce(_optionalChain([doc, 'access', _386 => _386.thick, 'optionalAccess', _387 => _387[layer.id]]), () => ( emptyThickChannels())) } : void 0,
6496
6515
  // Light paint: a twin of the stroke paints the light channel (laying, dimming, moving light).
6497
- light: !wet && brush.engine !== "sticker" && (brush.light.amount > 0 || _optionalChain([doc, 'access', _371 => _371.light, 'optionalAccess', _372 => _372[layer.id]])) ? { surface: _nullishCoalesce(_optionalChain([doc, 'access', _373 => _373.light, 'optionalAccess', _374 => _374[layer.id]]), () => ( emptyLight())) } : null,
6516
+ light: !wet && brush.engine !== "sticker" && (brush.light.amount > 0 || _optionalChain([doc, 'access', _388 => _388.light, 'optionalAccess', _389 => _389[layer.id]])) ? { surface: _nullishCoalesce(_optionalChain([doc, 'access', _390 => _390.light, 'optionalAccess', _391 => _391[layer.id]]), () => ( emptyLight())) } : null,
6498
6517
  sticker: brush.engine === "sticker" ? { nextId: this.nextStickerNumber(doc), art: this.stickerArt.get, variant: (ref2) => this.stickerArt.variantFor(ref2, this.colorScheme === "dark") } : void 0,
6499
6518
  stampArt: this.stampArt,
6500
6519
  paint: effect ? null : this.strokeGradient(init, brush, color),
@@ -6509,7 +6528,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6509
6528
  const stroke = {
6510
6529
  id: `s${this.strokeCounter++}`,
6511
6530
  layerId: session.layerId,
6512
- brush: _chunkEU2ZZA6Lcjs.brushToJSON.call(void 0, init.brush),
6531
+ brush: _chunkGHGBIAWQcjs.brushToJSON.call(void 0, init.brush),
6513
6532
  color: init.colorHex,
6514
6533
  points: session.points.map((p) => ({ ...p })),
6515
6534
  seed: init.seed
@@ -6534,12 +6553,12 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6534
6553
  const before = this.doc;
6535
6554
  const host = {
6536
6555
  update: (layerId, surface, rects) => {
6537
- if (_optionalChain([this, 'access', _375 => _375.session, 'optionalAccess', _376 => _376.init, 'access', _377 => _377.wet])) {
6556
+ if (_optionalChain([this, 'access', _392 => _392.session, 'optionalAccess', _393 => _393.init, 'access', _394 => _394.wet])) {
6538
6557
  this.wet.syncDisplays();
6539
6558
  return;
6540
6559
  }
6541
6560
  this.live = { layerId, surface };
6542
- const ch = _optionalChain([this, 'access', _378 => _378.session, 'optionalAccess', _379 => _379.thickChannels, 'call', _380 => _380()]);
6561
+ const ch = _optionalChain([this, 'access', _395 => _395.session, 'optionalAccess', _396 => _396.thickChannels, 'call', _397 => _397()]);
6543
6562
  this.liveThick = ch ? { layerId, channels: ch } : null;
6544
6563
  this.emit(rects);
6545
6564
  },
@@ -6549,7 +6568,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6549
6568
  },
6550
6569
  commit: (s, surface, cancelled) => {
6551
6570
  this.session = null;
6552
- const preview = _optionalChain([this, 'access', _381 => _381.pathPreview, 'optionalAccess', _382 => _382.session]) === s ? this.pathPreview : null;
6571
+ const preview = _optionalChain([this, 'access', _398 => _398.pathPreview, 'optionalAccess', _399 => _399.session]) === s ? this.pathPreview : null;
6553
6572
  this.pathPreview = null;
6554
6573
  const pathPaint = cancelled ? null : this.pathStrokePaint(s);
6555
6574
  if (pathPaint) {
@@ -6562,7 +6581,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6562
6581
  const wetStroke = Boolean(s.init.wet);
6563
6582
  if (wetStroke) this.wet.driver = null;
6564
6583
  const brush = s.init.brush;
6565
- if (!cancelled && _optionalChain([s, 'access', _383 => _383.result, 'optionalAccess', _384 => _384.mixerLoad])) this.keepLoad(brush, s.result.mixerLoad);
6584
+ if (!cancelled && _optionalChain([s, 'access', _400 => _400.result, 'optionalAccess', _401 => _401.mixerLoad])) this.keepLoad(brush, s.result.mixerLoad);
6566
6585
  if (cancelled || !surface) {
6567
6586
  if (this.wetOp) {
6568
6587
  const snap = this.wetOp.before;
@@ -6578,7 +6597,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6578
6597
  }
6579
6598
  const stroke = this.record(s);
6580
6599
  s.result.strokeId = stroke.id;
6581
- this.paintedBounds.set(stroke, _nullishCoalesce(_optionalChain([s, 'access', _385 => _385.result, 'optionalAccess', _386 => _386.bounds]), () => ( null)));
6600
+ this.paintedBounds.set(stroke, _nullishCoalesce(_optionalChain([s, 'access', _402 => _402.result, 'optionalAccess', _403 => _403.bounds]), () => ( null)));
6582
6601
  if (wetStroke && this.wet.instantDry) {
6583
6602
  this.wet.dry(s.layerId);
6584
6603
  this.logWet({ kind: "dry", layerId: s.layerId, at: this.doc.strokes.length + 1 });
@@ -6589,8 +6608,8 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6589
6608
  const ch = s.thickChannels();
6590
6609
  const thick = ch ? { ..._nullishCoalesce(this.doc.thick, () => ( {})), [l.id]: ch } : this.doc.thick;
6591
6610
  const sprayed = s.stickers();
6592
- const stickers = sprayed ? { ..._nullishCoalesce(this.doc.stickers, () => ( {})), [l.id]: [..._nullishCoalesce(_optionalChain([this, 'access', _387 => _387.doc, 'access', _388 => _388.stickers, 'optionalAccess', _389 => _389[l.id]]), () => ( [])), ...sprayed] } : this.doc.stickers;
6593
- const wetLight = wetStroke && _optionalChain([this, 'access', _390 => _390.wet, 'access', _391 => _391.world, 'optionalAccess', _392 => _392.hasLane, 'call', _393 => _393(l.id)]) ? this.wet.world.lightDisplay(l.id) : null;
6611
+ const stickers = sprayed ? { ..._nullishCoalesce(this.doc.stickers, () => ( {})), [l.id]: [..._nullishCoalesce(_optionalChain([this, 'access', _404 => _404.doc, 'access', _405 => _405.stickers, 'optionalAccess', _406 => _406[l.id]]), () => ( [])), ...sprayed] } : this.doc.stickers;
6612
+ const wetLight = wetStroke && _optionalChain([this, 'access', _407 => _407.wet, 'access', _408 => _408.world, 'optionalAccess', _409 => _409.hasLane, 'call', _410 => _410(l.id)]) ? this.wet.world.lightDisplay(l.id) : null;
6594
6613
  const light = withLayerLight(this.doc.light, l.id, _nullishCoalesce(s.lightChannel(), () => ( wetLight)));
6595
6614
  this.commit(`${brush.name} stroke`, this.withWetEvents(withLiveStroke({ ...this.doc, layers: _chunkPVJMTLPJcjs.mapLayer.call(void 0, this.doc.layers, l.id, () => ({ ...l, surface })), strokes: [...this.doc.strokes, stroke], ...thick ? { thick } : {}, ...stickers ? { stickers } : {}, ...light ? { light } : {} }, stroke)), wetStroke ? before : this.doc);
6596
6615
  this.notifySample("end", s, [], stroke.id);
@@ -6604,7 +6623,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6604
6623
  throw e;
6605
6624
  }
6606
6625
  this.session = session;
6607
- if (_optionalChain([session, 'access', _394 => _394.init, 'access', _395 => _395.effect, 'optionalAccess', _396 => _396.source, 'access', _397 => _397.map, 'optionalAccess', _398 => _398.by]) === "path" && !session.init.wet) this.pathPreview = { session, key: "", pending: null, landed: null };
6626
+ if (_optionalChain([session, 'access', _411 => _411.init, 'access', _412 => _412.effect, 'optionalAccess', _413 => _413.source, 'access', _414 => _414.map, 'optionalAccess', _415 => _415.by]) === "path" && !session.init.wet) this.pathPreview = { session, key: "", pending: null, landed: null };
6608
6627
  this.emit([]);
6609
6628
  this.notifySample("begin", session);
6610
6629
  return session;
@@ -6620,7 +6639,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6620
6639
  if (!pv || pv.session !== s || pv.pending || !s.open) return;
6621
6640
  const paint = this.pathStrokePaint(s);
6622
6641
  if (!paint) return;
6623
- const key = _chunkJJ2H25JGcjs.effectPaintKey.call(void 0, paint);
6642
+ const key = _chunkSNAFFCAXcjs.effectPaintKey.call(void 0, paint);
6624
6643
  if (key === pv.key) return;
6625
6644
  pv.key = key;
6626
6645
  const cached = this.effectPaintImage(paint);
@@ -6649,14 +6668,14 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6649
6668
  * the editor is busy, as during a stroke, and shows the stroke as it was painted.
6650
6669
  */
6651
6670
  get strokeRendering() {
6652
- return _nullishCoalesce(_optionalChain([this, 'access', _399 => _399.pathStroke, 'optionalAccess', _400 => _400.done]), () => ( null));
6671
+ return _nullishCoalesce(_optionalChain([this, 'access', _416 => _416.pathStroke, 'optionalAccess', _417 => _417.done]), () => ( null));
6653
6672
  }
6654
6673
  /** The paint a finished hand-painted stroke must be painted again with, or `null` when it already painted with it. */
6655
6674
  pathStrokePaint(s) {
6656
- const source = _optionalChain([s, 'access', _401 => _401.init, 'access', _402 => _402.effect, 'optionalAccess', _403 => _403.source]);
6657
- if (_optionalChain([source, 'optionalAccess', _404 => _404.map, 'optionalAccess', _405 => _405.by]) !== "path" || !s.points.length) return null;
6658
- const paint = _chunkJJ2H25JGcjs.withStrokePath.call(void 0, source, s.points, this.effectPathControls.get(source.effect));
6659
- return _chunkJJ2H25JGcjs.effectPaintKey.call(void 0, paint) === _chunkJJ2H25JGcjs.effectPaintKey.call(void 0, source) ? null : paint;
6675
+ const source = _optionalChain([s, 'access', _418 => _418.init, 'access', _419 => _419.effect, 'optionalAccess', _420 => _420.source]);
6676
+ if (_optionalChain([source, 'optionalAccess', _421 => _421.map, 'optionalAccess', _422 => _422.by]) !== "path" || !s.points.length) return null;
6677
+ const paint = _chunkSNAFFCAXcjs.withStrokePath.call(void 0, source, s.points, this.effectPathControls.get(source.effect));
6678
+ return _chunkSNAFFCAXcjs.effectPaintKey.call(void 0, paint) === _chunkSNAFFCAXcjs.effectPaintKey.call(void 0, source) ? null : paint;
6660
6679
  }
6661
6680
  /**
6662
6681
  * Ends a hand-painted stroke with a path-mapped effect. Its whole path isn't known until now, so
@@ -6672,17 +6691,17 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6672
6691
  this.liveThick = null;
6673
6692
  const masks = s.init.selection ? (_nullishCoalesce(s.maskStencils, () => ( this.guides.stencils))).filter((x) => x.enabled && x.mode === "mask") : [];
6674
6693
  const load = s.init.mixerLoad;
6675
- const result = this.paintStroke({ layerId: s.layerId, points: s.points, color: s.init.colorHex, brush: _chunkEU2ZZA6Lcjs.brushToJSON.call(void 0, s.init.brush), seed: s.init.seed, copies: s.init.affineCopies, ...load.reservoir || load.pickup ? { load } : {}, paint, snapToPerspective: false, stencils: false, maskStencils: masks });
6694
+ const result = this.paintStroke({ layerId: s.layerId, points: s.points, color: s.init.colorHex, brush: _chunkGHGBIAWQcjs.brushToJSON.call(void 0, s.init.brush), seed: s.init.seed, copies: s.init.affineCopies, ...load.reservoir || load.pickup ? { load } : {}, paint, snapToPerspective: false, stencils: false, maskStencils: masks });
6676
6695
  Object.assign(s.result, result);
6677
6696
  this.notifySample("end", s, [], result.strokeId);
6678
6697
  };
6679
- const key = _chunkJJ2H25JGcjs.effectPaintKey.call(void 0, paint);
6680
- if (_optionalChain([preview, 'optionalAccess', _406 => _406.landed, 'optionalAccess', _407 => _407.key]) === key) this.cacheEffectPaintImage(paint, preview.landed.pixels);
6698
+ const key = _chunkSNAFFCAXcjs.effectPaintKey.call(void 0, paint);
6699
+ if (_optionalChain([preview, 'optionalAccess', _423 => _423.landed, 'optionalAccess', _424 => _424.key]) === key) this.cacheEffectPaintImage(paint, preview.landed.pixels);
6681
6700
  if (this.effectPaintImage(paint) || this.renderEffectPaintSync(paint)) {
6682
6701
  finish();
6683
6702
  return;
6684
6703
  }
6685
- const render = _optionalChain([preview, 'optionalAccess', _408 => _408.pending]) && preview.key === key ? preview.pending.then((img) => this.cacheEffectPaintImage(paint, img)) : this.renderEffectPaint(paint);
6704
+ const render = _optionalChain([preview, 'optionalAccess', _425 => _425.pending]) && preview.key === key ? preview.pending.then((img) => this.cacheEffectPaintImage(paint, img)) : this.renderEffectPaint(paint);
6686
6705
  const done = render.then(finish, (e) => {
6687
6706
  this.pathStroke = null;
6688
6707
  this.live = null;
@@ -6707,18 +6726,18 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6707
6726
  if (cancelled || !surface) return;
6708
6727
  const stroke = this.record(s);
6709
6728
  s.result.strokeId = stroke.id;
6710
- this.paintedBounds.set(stroke, _nullishCoalesce(_optionalChain([s, 'access', _409 => _409.result, 'optionalAccess', _410 => _410.bounds]), () => ( null)));
6729
+ this.paintedBounds.set(stroke, _nullishCoalesce(_optionalChain([s, 'access', _426 => _426.result, 'optionalAccess', _427 => _427.bounds]), () => ( null)));
6711
6730
  const l = _chunkPVJMTLPJcjs.findLayer.call(void 0, out.layers, s.layerId).layer;
6712
6731
  const offset = s.init.wet ? { x: 0, y: 0 } : l.offset;
6713
6732
  const ch = s.thickChannels();
6714
6733
  const sprayed = s.stickers();
6715
- const lit = _nullishCoalesce(s.lightChannel(), () => ( (s.init.wet && _optionalChain([this, 'access', _411 => _411.wet, 'access', _412 => _412.world, 'optionalAccess', _413 => _413.hasLane, 'call', _414 => _414(l.id)]) ? this.wet.world.lightDisplay(l.id) : null)));
6734
+ const lit = _nullishCoalesce(s.lightChannel(), () => ( (s.init.wet && _optionalChain([this, 'access', _428 => _428.wet, 'access', _429 => _429.world, 'optionalAccess', _430 => _430.hasLane, 'call', _431 => _431(l.id)]) ? this.wet.world.lightDisplay(l.id) : null)));
6716
6735
  out = withLiveStroke({
6717
6736
  ...out,
6718
6737
  layers: _chunkPVJMTLPJcjs.mapLayer.call(void 0, out.layers, l.id, () => ({ ...l, surface, offset })),
6719
6738
  strokes: [...out.strokes, stroke],
6720
6739
  ...ch ? { thick: { ..._nullishCoalesce(out.thick, () => ( {})), [l.id]: ch } } : {},
6721
- ...sprayed ? { stickers: { ..._nullishCoalesce(out.stickers, () => ( {})), [l.id]: [..._nullishCoalesce(_optionalChain([out, 'access', _415 => _415.stickers, 'optionalAccess', _416 => _416[l.id]]), () => ( [])), ...sprayed] } } : {},
6740
+ ...sprayed ? { stickers: { ..._nullishCoalesce(out.stickers, () => ( {})), [l.id]: [..._nullishCoalesce(_optionalChain([out, 'access', _432 => _432.stickers, 'optionalAccess', _433 => _433[l.id]]), () => ( [])), ...sprayed] } } : {},
6722
6741
  ...lit ? { light: withLayerLight(out.light, l.id, lit) } : {}
6723
6742
  }, stroke);
6724
6743
  }
@@ -6791,11 +6810,11 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6791
6810
  throw e;
6792
6811
  }
6793
6812
  const run = last;
6794
- if (_optionalChain([run, 'optionalAccess', _417 => _417.result, 'access', _418 => _418.mixerLoad])) this.keepLoad(run.brush, run.result.mixerLoad);
6795
- if (doc !== before || this.wetOp) this.commit(`${_nullishCoalesce(_optionalChain([run, 'optionalAccess', _419 => _419.brush, 'access', _420 => _420.name]), () => ( "Brush"))} path stroke`, this.withWetEvents(doc), before);
6813
+ if (_optionalChain([run, 'optionalAccess', _434 => _434.result, 'access', _435 => _435.mixerLoad])) this.keepLoad(run.brush, run.result.mixerLoad);
6814
+ if (doc !== before || this.wetOp) this.commit(`${_nullishCoalesce(_optionalChain([run, 'optionalAccess', _436 => _436.brush, 'access', _437 => _437.name]), () => ( "Brush"))} path stroke`, this.withWetEvents(doc), before);
6796
6815
  else this.emit([]);
6797
- const layerId = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([run, 'optionalAccess', _421 => _421.result, 'access', _422 => _422.layerId]), () => ( stroke.layerId)), () => ( this.doc.activeLayerId)), () => ( ""));
6798
- return { layerId, bounds, dabs, strokeIds, ..._optionalChain([run, 'optionalAccess', _423 => _423.result, 'access', _424 => _424.mixerLoad]) ? { mixerLoad: run.result.mixerLoad } : {}, ..._optionalChain([run, 'optionalAccess', _425 => _425.result, 'access', _426 => _426.wet]) !== void 0 ? { wet: run.result.wet } : {} };
6816
+ const layerId = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([run, 'optionalAccess', _438 => _438.result, 'access', _439 => _439.layerId]), () => ( stroke.layerId)), () => ( this.doc.activeLayerId)), () => ( ""));
6817
+ return { layerId, bounds, dabs, strokeIds, ..._optionalChain([run, 'optionalAccess', _440 => _440.result, 'access', _441 => _441.mixerLoad]) ? { mixerLoad: run.result.mixerLoad } : {}, ..._optionalChain([run, 'optionalAccess', _442 => _442.result, 'access', _443 => _443.wet]) !== void 0 ? { wet: run.result.wet } : {} };
6799
6818
  }
6800
6819
  /** Checks stroke samples (finite x and y, pressure 0..1) and returns them; throws a sentence naming the bad point. */
6801
6820
  checkPoints(points) {
@@ -6818,7 +6837,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6818
6837
  */
6819
6838
  replayStrokes(options) {
6820
6839
  this.requireIdle("replaying");
6821
- if (!_optionalChain([options, 'access', _427 => _427.strokeIds, 'optionalAccess', _428 => _428.length])) throw new PaintEditorError("strokeIds is empty; pass ids from list_strokes.");
6840
+ if (!_optionalChain([options, 'access', _444 => _444.strokeIds, 'optionalAccess', _445 => _445.length])) throw new PaintEditorError("strokeIds is empty; pass ids from list_strokes.");
6822
6841
  const strokes = options.strokeIds.map((id) => {
6823
6842
  const s = this.doc.strokes.find((x) => x.id === id);
6824
6843
  if (!s) throw new PaintEditorError(`Unknown stroke "${id}". Call list_strokes for the ids.`);
@@ -6832,7 +6851,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6832
6851
  if (options.layerId !== void 0) this.paintTarget(options.layerId, "replay onto");
6833
6852
  if (options.color === void 0) {
6834
6853
  for (const s of strokes) {
6835
- if (_optionalChain([s, 'access', _429 => _429.paint, 'optionalAccess', _430 => _430.type]) === "effect" && !this.effectPaintImage(s.paint)) {
6854
+ if (_optionalChain([s, 'access', _446 => _446.paint, 'optionalAccess', _447 => _447.type]) === "effect" && !this.effectPaintImage(s.paint)) {
6836
6855
  throw new PaintEditorError(`Stroke "${s.id}" paints with the effect "${s.paint.effect}"${s.paint.provider ? ` from provider "${s.paint.provider}"` : ""}, which is not rendered in this editor; render it first (prepareStrokeEffects; the replay_strokes tool does this) or recolour the replay with color.`);
6837
6856
  }
6838
6857
  }
@@ -6855,13 +6874,13 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6855
6874
  let brush = v.brush;
6856
6875
  if (options.brushId !== void 0) {
6857
6876
  const b = this.requireBrush(options.brushId);
6858
- brush = _chunkEU2ZZA6Lcjs.normalizePaintBrush.call(void 0, { tip: { ...b.tip, size: b.tip.size * (v.brush.tip.size / s.brush.tip.size) } }, b);
6877
+ brush = _chunkGHGBIAWQcjs.normalizePaintBrush.call(void 0, { tip: { ...b.tip, size: b.tip.size * (v.brush.tip.size / s.brush.tip.size) } }, b);
6859
6878
  }
6860
6879
  const layerId = _nullishCoalesce(options.layerId, () => ( s.layerId));
6861
6880
  if (!_chunkPVJMTLPJcjs.findLayer.call(void 0, doc.layers, layerId)) throw new PaintEditorError(`Stroke "${s.id}" was painted on layer "${layerId}", which no longer exists; pass layerId to replay it elsewhere.`);
6862
6881
  let load = s.load;
6863
6882
  if (load && options.color !== void 0 && load.reservoir) {
6864
- const [r, g, b] = _chunkJJ2H25JGcjs.hexToRgb8.call(void 0, options.color);
6883
+ const [r, g, b] = _chunkSNAFFCAXcjs.hexToRgb8.call(void 0, options.color);
6865
6884
  load = { ...load, reservoir: [r / 255, g / 255, b / 255] };
6866
6885
  }
6867
6886
  const paint = v.paint && options.color === void 0 ? { paint: v.paint } : {};
@@ -6892,7 +6911,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6892
6911
  /** A layer's light paint: whether it has any, where (document pixels), its brightest value 0..255, and its spill. */
6893
6912
  lightOf(layerId) {
6894
6913
  const l = this.wetLayer(layerId, "read the light of");
6895
- const info = lightInfo(_optionalChain([this, 'access', _431 => _431.doc, 'access', _432 => _432.light, 'optionalAccess', _433 => _433[l.id]]));
6914
+ const info = lightInfo(_optionalChain([this, 'access', _448 => _448.doc, 'access', _449 => _449.light, 'optionalAccess', _450 => _450[l.id]]));
6896
6915
  const bounds = info.bounds ? { ...info.bounds, x: info.bounds.x + l.offset.x, y: info.bounds.y + l.offset.y } : null;
6897
6916
  return { layerId: l.id, hasLight: info.peak > 0, bounds, peak: info.peak, spill: { ...this.lightSpillOf(l.id) } };
6898
6917
  }
@@ -6943,7 +6962,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
6943
6962
  const id = _nullishCoalesce(layerId, () => ( this.doc.activeLayerId));
6944
6963
  if (!id) return null;
6945
6964
  this.requireLayer(id);
6946
- const ch = _optionalChain([this, 'access', _434 => _434.doc, 'access', _435 => _435.thick, 'optionalAccess', _436 => _436[id]]);
6965
+ const ch = _optionalChain([this, 'access', _451 => _451.doc, 'access', _452 => _452.thick, 'optionalAccess', _453 => _453[id]]);
6947
6966
  if (!ch) return null;
6948
6967
  const r = reliefInfo(ch);
6949
6968
  return { layerId: id, bounds: r.bounds, maxHeight: r.maxHeight };
@@ -7054,7 +7073,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
7054
7073
  wetState() {
7055
7074
  const st = this.getState().wet;
7056
7075
  const backend = this.wet.backend();
7057
- return { ...st, layers: this.wet.wetLayerIds().map((id) => this.wet.info(id)), backend, message: _nullishCoalesce(_optionalChain([backend, 'optionalAccess', _437 => _437.message]), () => ( _chunkJ5VQYK7Tcjs.wetSupport.call(void 0, ).message)), engine: this.wet.engineInfo() };
7076
+ return { ...st, layers: this.wet.wetLayerIds().map((id) => this.wet.info(id)), backend, message: _nullishCoalesce(_optionalChain([backend, 'optionalAccess', _454 => _454.message]), () => ( _chunkN5IMDAHMcjs.wetSupport.call(void 0, ).message)), engine: this.wet.engineInfo() };
7058
7077
  }
7059
7078
  /**
7060
7079
  * Engine B, the WebGPU accelerator for large wet areas: whether it may run, its state (`off`,
@@ -7072,7 +7091,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
7072
7091
  */
7073
7092
  async setWetEngine(options) {
7074
7093
  const gpu = _nullishCoalesce(options.gpu, () => ( this.wet.gpuMode));
7075
- if (!_chunkJJ2H25JGcjs.WET_GPU_MODES.includes(gpu)) throw new PaintEditorError(`gpu must be ${_chunkJJ2H25JGcjs.WET_GPU_MODES.join(" or ")}, not ${JSON.stringify(gpu)}.`);
7094
+ if (!_chunkSNAFFCAXcjs.WET_GPU_MODES.includes(gpu)) throw new PaintEditorError(`gpu must be ${_chunkSNAFFCAXcjs.WET_GPU_MODES.join(" or ")}, not ${JSON.stringify(gpu)}.`);
7076
7095
  if (options.minTiles !== void 0 && !(Number.isInteger(options.minTiles) && options.minTiles >= 1 && options.minTiles <= 1024)) throw new PaintEditorError(`minTiles ${options.minTiles} is out of range; use 1..1024 tiles of 256 px.`);
7077
7096
  this.wet.setGpu(gpu, options.minTiles);
7078
7097
  this.emit();
@@ -7127,7 +7146,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
7127
7146
  const amount = _nullishCoalesce(options.amount, () => ( 1));
7128
7147
  if (!(amount > 0 && amount <= 1)) throw new PaintEditorError(`amount ${amount} is out of range; use above 0 up to 1.`);
7129
7148
  const rect = _nullishCoalesce(this.checkRect(options.rect), () => ( { x: 0, y: 0, width: this.doc.canvas.width, height: this.doc.canvas.height }));
7130
- if (!this.wet.wetLayerIds().includes(l.id) && this.wet.wetLayerIds().length >= _chunkJ5VQYK7Tcjs.MAX_WET_LANES) throw new PaintEditorError(`At most ${_chunkJ5VQYK7Tcjs.MAX_WET_LANES} layers can hold wet paint at once; dry one first (dry_paint).`);
7149
+ if (!this.wet.wetLayerIds().includes(l.id) && this.wet.wetLayerIds().length >= _chunkN5IMDAHMcjs.MAX_WET_LANES) throw new PaintEditorError(`At most ${_chunkN5IMDAHMcjs.MAX_WET_LANES} layers can hold wet paint at once; dry one first (dry_paint).`);
7131
7150
  const before = this.doc;
7132
7151
  this.beginWetOp();
7133
7152
  const world = this.wet.ensureLane(l.id);
@@ -7139,7 +7158,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
7139
7158
  }
7140
7159
  /** Records a settings change as a wet event (not an undo step). */
7141
7160
  recordWetSetting(e) {
7142
- this.doc = { ...this.doc, wetEvents: [..._nullishCoalesce(this.doc.wetEvents, () => ( [])), { clock: _nullishCoalesce(_optionalChain([this, 'access', _438 => _438.wet, 'access', _439 => _439.world, 'optionalAccess', _440 => _440.clock]), () => ( 0)), at: this.doc.strokes.length, ...e }] };
7161
+ this.doc = { ...this.doc, wetEvents: [..._nullishCoalesce(this.doc.wetEvents, () => ( [])), { clock: _nullishCoalesce(_optionalChain([this, 'access', _455 => _455.wet, 'access', _456 => _456.world, 'optionalAccess', _457 => _457.clock]), () => ( 0)), at: this.doc.strokes.length, ...e }] };
7143
7162
  }
7144
7163
  /** Changes a layer's wet settings (viscosity, evaporation, granulation…). Editor settings saved with the document, not an undo step. */
7145
7164
  setWetParams(layerId, update) {
@@ -7208,7 +7227,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
7208
7227
  if (override) return Array.from(override).reduce((ls, [id, surface]) => _chunkPVJMTLPJcjs.mapLayer.call(void 0, ls, id, (l) => ({ ...l, surface })), this.doc.layers);
7209
7228
  const live = this.live;
7210
7229
  if (!live) return this.animatedView();
7211
- if (_optionalChain([this, 'access', _441 => _441.liveLayers, 'optionalAccess', _442 => _442.key]) === live.surface) return this.liveLayers.layers;
7230
+ if (_optionalChain([this, 'access', _458 => _458.liveLayers, 'optionalAccess', _459 => _459.key]) === live.surface) return this.liveLayers.layers;
7212
7231
  const layers = _chunkPVJMTLPJcjs.mapLayer.call(void 0, this.doc.layers, live.layerId, (l) => ({ ...l, surface: live.surface }));
7213
7232
  this.liveLayers = { key: live.surface, layers };
7214
7233
  return layers;
@@ -7231,7 +7250,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
7231
7250
  tracingNode(t) {
7232
7251
  const { width, height } = this.doc.canvas;
7233
7252
  const key = this.tracingVersion * 100003 + width * 7 + height;
7234
- if (_optionalChain([this, 'access', _443 => _443.tracingCache, 'optionalAccess', _444 => _444.key]) === key && this.tracingCache.node.opacity === t.opacity) return this.tracingCache.node;
7253
+ if (_optionalChain([this, 'access', _460 => _460.tracingCache, 'optionalAccess', _461 => _461.key]) === key && this.tracingCache.node.opacity === t.opacity) return this.tracingCache.node;
7235
7254
  const src = _nullishCoalesce(this.imagePixels.get(t.src), () => ( this.decodeImage(t.src)));
7236
7255
  const image = resampleInto(src, t.rect, width, height);
7237
7256
  const node = { type: "image", id: TRACING_NODE_ID, name: "Tracing", visible: true, opacity: t.opacity, blend: "normal", image, version: key + Math.round(t.opacity * 1e3) / 1e4 };
@@ -7258,8 +7277,8 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
7258
7277
  let out = layers;
7259
7278
  const ids = /* @__PURE__ */ new Set([...Object.keys(_nullishCoalesce(thick, () => ( {}))), ...live ? [live.layerId] : []]);
7260
7279
  for (const id of ids) {
7261
- const ch = _optionalChain([live, 'optionalAccess', _445 => _445.layerId]) === id ? live.channels : _optionalChain([thick, 'optionalAccess', _446 => _446[id]]);
7262
- const l = ch && _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, out, id), 'optionalAccess', _447 => _447.layer]);
7280
+ const ch = _optionalChain([live, 'optionalAccess', _462 => _462.layerId]) === id ? live.channels : _optionalChain([thick, 'optionalAccess', _463 => _463[id]]);
7281
+ const l = ch && _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, out, id), 'optionalAccess', _464 => _464.layer]);
7263
7282
  if (!ch || !isPixelLayer(l)) continue;
7264
7283
  let cache = this.litCaches.get(id);
7265
7284
  if (!cache) this.litCaches.set(id, cache = new LitCache());
@@ -7279,13 +7298,13 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
7279
7298
  if (!ids.size) return layers;
7280
7299
  let out = layers;
7281
7300
  for (const id of ids) {
7282
- const l = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, out, id), 'optionalAccess', _448 => _448.layer]);
7301
+ const l = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, out, id), 'optionalAccess', _465 => _465.layer]);
7283
7302
  if (!isPixelLayer(l)) continue;
7284
7303
  let cache = this.lightCaches.get(id);
7285
7304
  if (!cache) this.lightCaches.set(id, cache = new LightCache());
7286
- const glowed = cache.glow(l.surface, light[id], _optionalChain([this, 'access', _449 => _449.liveThick, 'optionalAccess', _450 => _450.layerId]) === id ? this.liveThick.channels : _optionalChain([this, 'access', _451 => _451.doc, 'access', _452 => _452.thick, 'optionalAccess', _453 => _453[id]]));
7305
+ const glowed = cache.glow(l.surface, light[id], _optionalChain([this, 'access', _466 => _466.liveThick, 'optionalAccess', _467 => _467.layerId]) === id ? this.liveThick.channels : _optionalChain([this, 'access', _468 => _468.doc, 'access', _469 => _469.thick, 'optionalAccess', _470 => _470[id]]));
7287
7306
  if (glowed !== l.surface) out = _chunkPVJMTLPJcjs.mapLayer.call(void 0, out, id, () => ({ ...l, surface: glowed }));
7288
- const committed = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, id), 'optionalAccess', _454 => _454.layer]);
7307
+ const committed = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, id), 'optionalAccess', _471 => _471.layer]);
7289
7308
  const spill = light[id] && isPixelLayer(committed) ? cache.spill(committed.surface, light[id], this.lightSpillOf(id)) : null;
7290
7309
  if (spill) out = insertAfter(out, id, { type: "pixel", id: `${id}${SPILL_SUFFIX}`, name: `${l.name} light`, visible: l.visible, opacity: l.opacity, blend: "linear-dodge", surface: spill, offset: { ...l.offset } });
7291
7310
  }
@@ -7297,7 +7316,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
7297
7316
  if (!l.visible) continue;
7298
7317
  if (l.type === "group") this.backlitLayers(l.children, committed, opacity * l.opacity, out);
7299
7318
  else if (isPixelLayer(l)) {
7300
- const thick = !committed && _optionalChain([this, 'access', _455 => _455.liveThick, 'optionalAccess', _456 => _456.layerId]) === l.id ? this.liveThick.channels : _optionalChain([this, 'access', _457 => _457.doc, 'access', _458 => _458.thick, 'optionalAccess', _459 => _459[l.id]]);
7319
+ const thick = !committed && _optionalChain([this, 'access', _472 => _472.liveThick, 'optionalAccess', _473 => _473.layerId]) === l.id ? this.liveThick.channels : _optionalChain([this, 'access', _474 => _474.doc, 'access', _475 => _475.thick, 'optionalAccess', _476 => _476[l.id]]);
7301
7320
  out.push({ surface: l.surface, offset: l.offset, opacity: opacity * l.opacity, ...thick ? { thick } : {} });
7302
7321
  }
7303
7322
  }
@@ -7326,7 +7345,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
7326
7345
  if (backlight) layers = [...layers, backlight];
7327
7346
  if (options.layerIds) {
7328
7347
  const picked = [];
7329
- for (const id of options.layerIds) picked.push(_nullishCoalesce(_optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, layers, id), 'optionalAccess', _460 => _460.layer]), () => ( this.requireLayer(id))));
7348
+ for (const id of options.layerIds) picked.push(_nullishCoalesce(_optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, layers, id), 'optionalAccess', _477 => _477.layer]), () => ( this.requireLayer(id))));
7330
7349
  layers = picked.map((l) => ({ ...l, visible: true }));
7331
7350
  }
7332
7351
  const under = options.paper === false ? [] : [paperNode(this.doc.paper, this.lighting)];
@@ -7342,7 +7361,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
7342
7361
  */
7343
7362
  compositeTiles(rect, onTile, options = {}) {
7344
7363
  const dirty = options.dirty === "all" ? void 0 : options.dirty;
7345
- this.viewCompositor.compositeTiles(this.renderLayers({ paper: options.paper }, true), rect, this.sources(), onTile, { dirty, checkpointLayerId: _nullishCoalesce(_optionalChain([this, 'access', _461 => _461.live, 'optionalAccess', _462 => _462.layerId]), () => ( this.doc.activeLayerId)) });
7364
+ this.viewCompositor.compositeTiles(this.renderLayers({ paper: options.paper }, true), rect, this.sources(), onTile, { dirty, checkpointLayerId: _nullishCoalesce(_optionalChain([this, 'access', _478 => _478.live, 'optionalAccess', _479 => _479.layerId]), () => ( this.doc.activeLayerId)) });
7346
7365
  }
7347
7366
  /** The canvas as canvas-sized RGBA (paper included by default). */
7348
7367
  compositePixels(options = {}) {
@@ -7370,7 +7389,11 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
7370
7389
  /** Wet settings saved with the document (`null` when they are all defaults). */
7371
7390
  wetJSON() {
7372
7391
  const layers = {};
7373
- for (const [id, set] of this.wet.settings) if (_chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, id)) layers[id] = { params: { ...set.params }, flow: { ...set.flow } };
7392
+ for (const [id, set] of this.wet.settings) {
7393
+ if (!_chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, id)) continue;
7394
+ const ghost = _optionalChain([this, 'access', _480 => _480.wet, 'access', _481 => _481.world, 'optionalAccess', _482 => _482.hasLane, 'call', _483 => _483(id)]) ? this.wet.world.getGhost(id) : _nullishCoalesce(set.ghost, () => ( null));
7395
+ layers[id] = { params: { ...set.params }, flow: { ...set.flow }, ...ghost ? { ghost } : {} };
7396
+ }
7374
7397
  const flat = this.wet.tilt.angle === 0;
7375
7398
  if (!Object.keys(layers).length && flat) return void 0;
7376
7399
  return { tilt: { ...this.wet.tilt }, layers };
@@ -7379,7 +7402,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
7379
7402
  this.wet.reset();
7380
7403
  if (!raw || typeof raw !== "object") return;
7381
7404
  const r = raw;
7382
- this.wet.setTilt(_chunkJ5VQYK7Tcjs.normalizeTilt.call(void 0, _nullishCoalesce(r.tilt, () => ( {}))));
7405
+ this.wet.setTilt(_chunkN5IMDAHMcjs.normalizeTilt.call(void 0, _nullishCoalesce(r.tilt, () => ( {}))));
7383
7406
  if (r.layers && typeof r.layers === "object") {
7384
7407
  for (const [id, v] of Object.entries(r.layers)) {
7385
7408
  if (!v || typeof v !== "object") {
@@ -7387,7 +7410,8 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
7387
7410
  continue;
7388
7411
  }
7389
7412
  const x = v;
7390
- this.wet.settings.set(id, { params: _chunkJ5VQYK7Tcjs.normalizeWetParams.call(void 0, _nullishCoalesce(x.params, () => ( {}))), flow: _chunkJ5VQYK7Tcjs.normalizeFlow.call(void 0, _nullishCoalesce(x.flow, () => ( {}))) });
7413
+ const ghost = readWetGhost(x.ghost);
7414
+ this.wet.settings.set(id, { params: _chunkN5IMDAHMcjs.normalizeWetParams.call(void 0, _nullishCoalesce(x.params, () => ( {}))), flow: _chunkN5IMDAHMcjs.normalizeFlow.call(void 0, _nullishCoalesce(x.flow, () => ( {}))), ...ghost ? { ghost } : {} });
7391
7415
  }
7392
7416
  }
7393
7417
  }
@@ -7426,7 +7450,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
7426
7450
  const spills = Object.fromEntries(Object.entries(this.lightSpills).filter(([id]) => _chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, id)));
7427
7451
  if (Object.keys(spills).length) ext.lightSpill = spills;
7428
7452
  else delete ext.lightSpill;
7429
- const effectLayers = effectLayersToJSON(_nullishCoalesce(this.doc.effectLayers, () => ( {})), (id) => isPixelLayer(_optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, id), 'optionalAccess', _463 => _463.layer])));
7453
+ const effectLayers = effectLayersToJSON(_nullishCoalesce(this.doc.effectLayers, () => ( {})), (id) => isPixelLayer(_optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, id), 'optionalAccess', _484 => _484.layer])));
7430
7454
  if (effectLayers) ext.effectLayers = effectLayers;
7431
7455
  else delete ext.effectLayers;
7432
7456
  if (this.doc.paperEffect) ext.paperEffect = paperEffectToJSON(this.doc.paperEffect);
@@ -7437,7 +7461,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
7437
7461
  }
7438
7462
  /** Reads `layerChannels` and `lighting` from loaded extensions into the document. */
7439
7463
  readThick(state, ext, problems) {
7440
- if (Array.isArray(ext.brushSources)) this.brushSources.set(ext.brushSources.map((x, i) => _chunkEU2ZZA6Lcjs.readBrushSource.call(void 0, x, `brushSources[${i}]`, problems)).filter((x) => x !== null));
7464
+ if (Array.isArray(ext.brushSources)) this.brushSources.set(ext.brushSources.map((x, i) => _chunkGHGBIAWQcjs.readBrushSource.call(void 0, x, `brushSources[${i}]`, problems)).filter((x) => x !== null));
7441
7465
  this.lighting = normalizeLighting(_nullishCoalesce(ext.lighting, () => ( {})), DEFAULT_LIGHTING);
7442
7466
  this.litCaches.clear();
7443
7467
  if (ext.stickers && typeof ext.stickers === "object") {
@@ -7463,7 +7487,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
7463
7487
  if (ext.liveStrokes && typeof ext.liveStrokes === "object") {
7464
7488
  const liveStrokes = {};
7465
7489
  for (const [id, list] of Object.entries(ext.liveStrokes)) {
7466
- if (!isPixelLayer(_optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, state.layers, id), 'optionalAccess', _464 => _464.layer])) || !Array.isArray(list)) continue;
7490
+ if (!isPixelLayer(_optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, state.layers, id), 'optionalAccess', _485 => _485.layer])) || !Array.isArray(list)) continue;
7467
7491
  const ok = list.map(normalizeBrushStroke).filter((x) => x !== null).map((x) => ({ ...x, layerId: id }));
7468
7492
  if (ok.length !== list.length) problems.push(`Some strokes of stroke layer "${id}" could not be read; they were dropped (the layer's pixels are kept until a stroke is edited).`);
7469
7493
  liveStrokes[id] = ok;
@@ -7473,7 +7497,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
7473
7497
  if (ext.effectLayers && typeof ext.effectLayers === "object") {
7474
7498
  const effectLayers = {};
7475
7499
  for (const [id, v] of Object.entries(ext.effectLayers)) {
7476
- if (!isPixelLayer(_optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, state.layers, id), 'optionalAccess', _465 => _465.layer]))) continue;
7500
+ if (!isPixelLayer(_optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, state.layers, id), 'optionalAccess', _486 => _486.layer]))) continue;
7477
7501
  const source = readPaintEffectSource(v);
7478
7502
  if (source) effectLayers[id] = source;
7479
7503
  else problems.push(`The effect of layer "${id}" could not be read; it loads as a plain layer.`);
@@ -7501,7 +7525,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
7501
7525
  if (ext.light && typeof ext.light === "object") {
7502
7526
  const light = {};
7503
7527
  for (const [id, v] of Object.entries(ext.light)) {
7504
- if (!isPixelLayer(_optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, state.layers, id), 'optionalAccess', _466 => _466.layer]))) continue;
7528
+ if (!isPixelLayer(_optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, state.layers, id), 'optionalAccess', _487 => _487.layer]))) continue;
7505
7529
  try {
7506
7530
  light[id] = lightFromJSON(v);
7507
7531
  } catch (e) {
@@ -7537,7 +7561,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
7537
7561
  this.readGuides(loaded.guides, loaded.state, loaded.problems);
7538
7562
  if (Array.isArray(loaded.swatches)) this.swatches = loaded.swatches.map(readSwatch).filter((x) => x !== null);
7539
7563
  for (const s of loaded.state.strokes) {
7540
- const n = Number(_nullishCoalesce(_optionalChain([/^s(\d+)$/, 'access', _467 => _467.exec, 'call', _468 => _468(s.id), 'optionalAccess', _469 => _469[1]]), () => ( 0)));
7564
+ const n = Number(_nullishCoalesce(_optionalChain([/^s(\d+)$/, 'access', _488 => _488.exec, 'call', _489 => _489(s.id), 'optionalAccess', _490 => _490[1]]), () => ( 0)));
7541
7565
  if (n >= this.strokeCounter) this.strokeCounter = n + 1;
7542
7566
  }
7543
7567
  this.undoStack = [];
@@ -7545,7 +7569,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
7545
7569
  this.doc = this.readThick(loaded.state, loaded.extensions, loaded.problems);
7546
7570
  for (const list of Object.values(_nullishCoalesce(this.doc.liveStrokes, () => ( {})))) {
7547
7571
  for (const s of list) {
7548
- const n = Number(_nullishCoalesce(_optionalChain([/^s(\d+)$/, 'access', _470 => _470.exec, 'call', _471 => _471(s.id), 'optionalAccess', _472 => _472[1]]), () => ( 0)));
7572
+ const n = Number(_nullishCoalesce(_optionalChain([/^s(\d+)$/, 'access', _491 => _491.exec, 'call', _492 => _492(s.id), 'optionalAccess', _493 => _493[1]]), () => ( 0)));
7549
7573
  if (n >= this.strokeCounter) this.strokeCounter = n + 1;
7550
7574
  }
7551
7575
  }
@@ -7643,10 +7667,10 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
7643
7667
  return next.type === "group" ? { ...next, children: toStandard(next.children) } : next;
7644
7668
  });
7645
7669
  const layers = toStandard(dried);
7646
- const result = _chunkDDL3ZBHKcjs.exportPsd.call(void 0, { width, height, layers: [paperLayer, ...layers], merged, resolution: dpi });
7670
+ const result = _chunkYJANF2BLcjs.exportPsd.call(void 0, { width, height, layers: [paperLayer, ...layers], merged, resolution: dpi });
7647
7671
  for (const [mode, names] of changed) {
7648
- const label = _nullishCoalesce(_optionalChain([_chunk2VX55NFMcjs.BLEND_MODES, 'access', _473 => _473.find, 'call', _474 => _474((m) => m.id === mode), 'optionalAccess', _475 => _475.label]), () => ( mode));
7649
- const std = _nullishCoalesce(_optionalChain([_chunk2VX55NFMcjs.BLEND_MODES, 'access', _476 => _476.find, 'call', _477 => _477((m) => m.id === _chunk2VX55NFMcjs.standardBlendMode.call(void 0, mode)), 'optionalAccess', _478 => _478.label]), () => ( _chunk2VX55NFMcjs.standardBlendMode.call(void 0, mode)));
7672
+ const label = _nullishCoalesce(_optionalChain([_chunk2VX55NFMcjs.BLEND_MODES, 'access', _494 => _494.find, 'call', _495 => _495((m) => m.id === mode), 'optionalAccess', _496 => _496.label]), () => ( mode));
7673
+ const std = _nullishCoalesce(_optionalChain([_chunk2VX55NFMcjs.BLEND_MODES, 'access', _497 => _497.find, 'call', _498 => _498((m) => m.id === _chunk2VX55NFMcjs.standardBlendMode.call(void 0, mode)), 'optionalAccess', _499 => _499.label]), () => ( _chunk2VX55NFMcjs.standardBlendMode.call(void 0, mode)));
7650
7674
  const list = names.map((n) => `"${n}"`).join(", ");
7651
7675
  const one = names.length === 1;
7652
7676
  result.warnings.push(`${label} blending has no PSD equivalent; ${list} ${one ? "was" : "were"} written as ${std}, the nearest Photoshop mode, so ${one ? "it looks" : "they look"} different in Photoshop (the merged image is exact).`);
@@ -7768,7 +7792,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
7768
7792
  const { src, pixels } = this.importImage(options, "The reference image");
7769
7793
  const ref2 = {
7770
7794
  id: `ref${this.nextReferenceId++}`,
7771
- name: _optionalChain([options, 'access', _479 => _479.name, 'optionalAccess', _480 => _480.trim, 'call', _481 => _481()]) || `Reference ${this.guides.references.length + 1}`,
7795
+ name: _optionalChain([options, 'access', _500 => _500.name, 'optionalAccess', _501 => _501.trim, 'call', _502 => _502()]) || `Reference ${this.guides.references.length + 1}`,
7772
7796
  src,
7773
7797
  width: pixels.width,
7774
7798
  height: pixels.height,
@@ -7847,7 +7871,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
7847
7871
  try {
7848
7872
  const px = this.decodeImage(ref2.src, `Reference "${ref2.name}"`);
7849
7873
  guides.references.push({ id: ref2.id, name: String(_nullishCoalesce(ref2.name, () => ( ref2.id))), src: ref2.src, width: px.width, height: px.height, x: Number(ref2.x) || 0, y: Number(ref2.y) || 0, displayWidth: Number(ref2.displayWidth) || 240, visible: ref2.visible !== false });
7850
- const n = Number(_nullishCoalesce(_optionalChain([/^ref(\d+)$/, 'access', _482 => _482.exec, 'call', _483 => _483(ref2.id), 'optionalAccess', _484 => _484[1]]), () => ( 0)));
7874
+ const n = Number(_nullishCoalesce(_optionalChain([/^ref(\d+)$/, 'access', _503 => _503.exec, 'call', _504 => _504(ref2.id), 'optionalAccess', _505 => _505[1]]), () => ( 0)));
7851
7875
  if (n >= this.nextReferenceId) this.nextReferenceId = n + 1;
7852
7876
  } catch (e) {
7853
7877
  problems.push(e.message);
@@ -7858,7 +7882,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
7858
7882
  guides.stencils = [];
7859
7883
  r.stencils.forEach((raw2, i) => {
7860
7884
  try {
7861
- const id = typeof _optionalChain([raw2, 'optionalAccess', _485 => _485.id]) === "string" && /^stencil\d+$/.test(raw2.id) ? raw2.id : `stencil${this.nextStencilId}`;
7885
+ const id = typeof _optionalChain([raw2, 'optionalAccess', _506 => _506.id]) === "string" && /^stencil\d+$/.test(raw2.id) ? raw2.id : `stencil${this.nextStencilId}`;
7862
7886
  guides.stencils.push(normalizeStencil(raw2, id));
7863
7887
  const n = Number(id.slice(7));
7864
7888
  if (n >= this.nextStencilId) this.nextStencilId = n + 1;
@@ -7881,12 +7905,12 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
7881
7905
  /** The next free sticker number (ids `st<n>` are unique across the document). */
7882
7906
  nextStickerNumber(doc = this.doc) {
7883
7907
  let n = 0;
7884
- for (const list of Object.values(_nullishCoalesce(doc.stickers, () => ( {})))) for (const st of list) n = Math.max(n, Number(_nullishCoalesce(_optionalChain([/^st(\d+)$/, 'access', _486 => _486.exec, 'call', _487 => _487(st.id), 'optionalAccess', _488 => _488[1]]), () => ( 0))));
7908
+ for (const list of Object.values(_nullishCoalesce(doc.stickers, () => ( {})))) for (const st of list) n = Math.max(n, Number(_nullishCoalesce(_optionalChain([/^st(\d+)$/, 'access', _507 => _507.exec, 'call', _508 => _508(st.id), 'optionalAccess', _509 => _509[1]]), () => ( 0))));
7885
7909
  return n + 1;
7886
7910
  }
7887
7911
  stickerLayer(layerId) {
7888
7912
  const l = this.wetLayer(layerId, "edit the stickers of");
7889
- const stickers = _optionalChain([this, 'access', _489 => _489.doc, 'access', _490 => _490.stickers, 'optionalAccess', _491 => _491[l.id]]);
7913
+ const stickers = _optionalChain([this, 'access', _510 => _510.doc, 'access', _511 => _511.stickers, 'optionalAccess', _512 => _512[l.id]]);
7890
7914
  if (!stickers) throw new PaintEditorError(`Layer "${l.name}" has no stickers; spray some with a sticker brush (sticker-stars; list_brush_presets lists them).`);
7891
7915
  return { layer: l, stickers };
7892
7916
  }
@@ -7962,7 +7986,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
7962
7986
  const id = _nullishCoalesce(layerId, () => ( this.doc.activeLayerId));
7963
7987
  if (!id) return [];
7964
7988
  this.requireLayer(id);
7965
- return (_nullishCoalesce(_optionalChain([this, 'access', _492 => _492.doc, 'access', _493 => _493.stickers, 'optionalAccess', _494 => _494[id]]), () => ( []))).map((s) => ({ ...s }));
7989
+ return (_nullishCoalesce(_optionalChain([this, 'access', _513 => _513.doc, 'access', _514 => _514.stickers, 'optionalAccess', _515 => _515[id]]), () => ( []))).map((s) => ({ ...s }));
7966
7990
  }
7967
7991
  /**
7968
7992
  * Replaces a layer's stickers and redraws its pixels from them (one undo step). With `dirty`,
@@ -7983,7 +8007,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
7983
8007
  }
7984
8008
  /** The document from before the sticker preview on screen, or `null` when none is (anything else changed the document since). */
7985
8009
  previewBase() {
7986
- return _optionalChain([this, 'access', _495 => _495.stickerPreview, 'optionalAccess', _496 => _496.shown]) === this.doc ? this.stickerPreview.base : null;
8010
+ return _optionalChain([this, 'access', _516 => _516.stickerPreview, 'optionalAccess', _517 => _517.shown]) === this.doc ? this.stickerPreview.base : null;
7987
8011
  }
7988
8012
  readStickerUpdate(update) {
7989
8013
  try {
@@ -7998,7 +8022,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
7998
8022
  const id = _nullishCoalesce(layerId, () => ( this.doc.activeLayerId));
7999
8023
  if (!id) return null;
8000
8024
  this.requireLayer(id);
8001
- const hit = stickerAt(_nullishCoalesce(_optionalChain([this, 'access', _497 => _497.doc, 'access', _498 => _498.stickers, 'optionalAccess', _499 => _499[id]]), () => ( [])), x, y, this.stickerArt.get);
8025
+ const hit = stickerAt(_nullishCoalesce(_optionalChain([this, 'access', _518 => _518.doc, 'access', _519 => _519.stickers, 'optionalAccess', _520 => _520[id]]), () => ( [])), x, y, this.stickerArt.get);
8002
8026
  return hit ? { ...hit } : null;
8003
8027
  }
8004
8028
  /** Picks a sticker for the panel and canvas (`null` for none). Editor state, not an undo step. */
@@ -8055,8 +8079,8 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
8055
8079
  const layer = this.wetLayer(layerId, "add stickers to");
8056
8080
  if (!input.length) throw new PaintEditorError("Pass at least one sticker (ref, x, y).");
8057
8081
  if (input.length > MAX_ADD_STICKERS) throw new PaintEditorError(`At most ${MAX_ADD_STICKERS} stickers per call; split them over several calls.`);
8058
- const existing = _optionalChain([this, 'access', _500 => _500.doc, 'access', _501 => _501.stickers, 'optionalAccess', _502 => _502[layer.id]]);
8059
- if (!_optionalChain([existing, 'optionalAccess', _503 => _503.length])) {
8082
+ const existing = _optionalChain([this, 'access', _521 => _521.doc, 'access', _522 => _522.stickers, 'optionalAccess', _523 => _523[layer.id]]);
8083
+ if (!_optionalChain([existing, 'optionalAccess', _524 => _524.length])) {
8060
8084
  if (this.wet.wetLayerIds().includes(layer.id) || _chunk474IQG74cjs.contentBounds.call(void 0, layer.surface)) throw new PaintEditorError(`Layer "${layer.name}" already has paint; add stickers to an empty layer (add_layer) or a sticker layer so they stay editable.`);
8061
8085
  }
8062
8086
  let n = this.nextStickerNumber();
@@ -8073,7 +8097,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
8073
8097
  const id = n++;
8074
8098
  return this.withStickerVariant({ id: `st${id}`, size: 48, rotation: 0, color: this.color, opacity: 1, seed: _nullishCoalesce(raw.seed, () => ( _chunk3K6HWEXZcjs.mix32.call(void 0, id * 2654435761 >>> 0) & 2147483647)), ...u });
8075
8099
  });
8076
- this.commitStickers("Add stickers", layer, [..._nullishCoalesce(existing, () => ( [])), ...added], _optionalChain([existing, 'optionalAccess', _504 => _504.length]) ? added.map(stickerRect) : void 0);
8100
+ this.commitStickers("Add stickers", layer, [..._nullishCoalesce(existing, () => ( [])), ...added], _optionalChain([existing, 'optionalAccess', _525 => _525.length]) ? added.map(stickerRect) : void 0);
8077
8101
  return added.map((s) => ({ ...s }));
8078
8102
  }
8079
8103
  /** Brings stickers to the top (`front`) or bottom of their layer (one undo step). */
@@ -8112,20 +8136,20 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
8112
8136
  }
8113
8137
  liveStrokeLayer(layerId, what) {
8114
8138
  const l = this.wetLayer(layerId, what);
8115
- const strokes = _optionalChain([this, 'access', _505 => _505.doc, 'access', _506 => _506.liveStrokes, 'optionalAccess', _507 => _507[l.id]]);
8139
+ const strokes = _optionalChain([this, 'access', _526 => _526.doc, 'access', _527 => _527.liveStrokes, 'optionalAccess', _528 => _528[l.id]]);
8116
8140
  if (!strokes) throw new PaintEditorError(`Layer "${l.name}" is not a stroke layer; add one with add_layer {type: "strokes"} (or convert_to_stroke_layer on an empty layer), then paint on it.`);
8117
8141
  return { layer: l, strokes };
8118
8142
  }
8119
8143
  /** Whether a layer is a live stroke layer. */
8120
8144
  isLiveStrokeLayer(layerId) {
8121
- return Boolean(_optionalChain([this, 'access', _508 => _508.doc, 'access', _509 => _509.liveStrokes, 'optionalAccess', _510 => _510[layerId]]));
8145
+ return Boolean(_optionalChain([this, 'access', _529 => _529.doc, 'access', _530 => _530.liveStrokes, 'optionalAccess', _531 => _531[layerId]]));
8122
8146
  }
8123
8147
  /** Makes an empty pixel layer a live stroke layer (one undo step). */
8124
8148
  convertToLiveStrokes(layerId) {
8125
8149
  this.requireIdle("converting a layer");
8126
8150
  const l = this.paintTarget(layerId, "convert");
8127
- if (_optionalChain([this, 'access', _511 => _511.doc, 'access', _512 => _512.liveStrokes, 'optionalAccess', _513 => _513[l.id]])) return this.describeLayer(l);
8128
- if (_optionalChain([this, 'access', _514 => _514.doc, 'access', _515 => _515.stickers, 'optionalAccess', _516 => _516[l.id], 'optionalAccess', _517 => _517.length])) throw new PaintEditorError(`Layer "${l.name}" is a sticker layer; add a stroke layer instead (add_layer {type: "strokes"}).`);
8151
+ if (_optionalChain([this, 'access', _532 => _532.doc, 'access', _533 => _533.liveStrokes, 'optionalAccess', _534 => _534[l.id]])) return this.describeLayer(l);
8152
+ if (_optionalChain([this, 'access', _535 => _535.doc, 'access', _536 => _536.stickers, 'optionalAccess', _537 => _537[l.id], 'optionalAccess', _538 => _538.length])) throw new PaintEditorError(`Layer "${l.name}" is a sticker layer; add a stroke layer instead (add_layer {type: "strokes"}).`);
8129
8153
  if (_chunk474IQG74cjs.contentBounds.call(void 0, l.surface) || this.wet.wetLayerIds().includes(l.id)) throw new PaintEditorError(`Layer "${l.name}" already has paint, which isn't kept as strokes; convert an empty layer or add a stroke layer (add_layer {type: "strokes"}).`);
8130
8154
  this.commit("Convert to stroke layer", { ...this.doc, liveStrokes: { ..._nullishCoalesce(this.doc.liveStrokes, () => ( {})), [l.id]: [] } });
8131
8155
  return this.describeLayer(this.getLayer(l.id));
@@ -8138,7 +8162,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
8138
8162
  findLiveStroke(id) {
8139
8163
  for (const [layerId, strokes] of Object.entries(_nullishCoalesce(this.doc.liveStrokes, () => ( {})))) {
8140
8164
  const index = strokes.findIndex((x) => x.id === id);
8141
- const layer = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, layerId), 'optionalAccess', _518 => _518.layer]);
8165
+ const layer = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, this.doc.layers, layerId), 'optionalAccess', _539 => _539.layer]);
8142
8166
  if (index >= 0 && isPixelLayer(layer)) return { layer, strokes, index };
8143
8167
  }
8144
8168
  const baked = this.doc.strokes.some((x) => x.id === id);
@@ -8158,15 +8182,15 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
8158
8182
  let brush = was.brush;
8159
8183
  if (update.brushId !== void 0) {
8160
8184
  const b = this.requireBrush(update.brushId);
8161
- brush = _chunkEU2ZZA6Lcjs.normalizePaintBrush.call(void 0, { tip: { ...b.tip, size: was.brush.tip.size } }, b);
8185
+ brush = _chunkGHGBIAWQcjs.normalizePaintBrush.call(void 0, { tip: { ...b.tip, size: was.brush.tip.size } }, b);
8162
8186
  }
8163
8187
  if (update.brush !== void 0) {
8164
8188
  if (!update.brush || typeof update.brush !== "object") throw new PaintEditorError("brush must be an object of brush settings (as set_brush takes).");
8165
- brush = _chunkEU2ZZA6Lcjs.normalizePaintBrush.call(void 0, { ...update.brush, id: brush.id }, brush);
8189
+ brush = _chunkGHGBIAWQcjs.normalizePaintBrush.call(void 0, { ...update.brush, id: brush.id }, brush);
8166
8190
  }
8167
8191
  const why = liveStrokeRefusal(brush);
8168
8192
  if (why) throw new PaintEditorError(why);
8169
- const next = { ...was, brush: _chunkEU2ZZA6Lcjs.brushToJSON.call(void 0, brush) };
8193
+ const next = { ...was, brush: _chunkGHGBIAWQcjs.brushToJSON.call(void 0, brush) };
8170
8194
  if (update.seed !== void 0) {
8171
8195
  if (!Number.isInteger(update.seed) || update.seed < 0) throw new PaintEditorError(`seed ${update.seed} must be a whole number of 0 or more.`);
8172
8196
  next.seed = update.seed;
@@ -8177,8 +8201,8 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
8177
8201
  }
8178
8202
  if (update.paint !== void 0) {
8179
8203
  if (update.paint === null) delete next.paint;
8180
- else if (_chunkJJ2H25JGcjs.isPaintEffectPaint.call(void 0, update.paint)) {
8181
- const ep = _optionalChain([update, 'access', _519 => _519.paint, 'access', _520 => _520.map, 'optionalAccess', _521 => _521.by]) === "path" ? _chunkJJ2H25JGcjs.withStrokePath.call(void 0, update.paint, next.points, this.effectPathControls.get(update.paint.effect)) : update.paint;
8204
+ else if (_chunkSNAFFCAXcjs.isPaintEffectPaint.call(void 0, update.paint)) {
8205
+ const ep = _optionalChain([update, 'access', _540 => _540.paint, 'access', _541 => _541.map, 'optionalAccess', _542 => _542.by]) === "path" ? _chunkSNAFFCAXcjs.withStrokePath.call(void 0, update.paint, next.points, this.effectPathControls.get(update.paint.effect)) : update.paint;
8182
8206
  if (!this.effectPaintImage(ep) && !this.renderEffectPaintSync(ep)) throw new PaintEditorError(`The effect "${update.paint.effect}" is not rendered yet; render it first (prepareEffectPaints; the update_stroke tool does this).`);
8183
8207
  next.paint = JSON.parse(JSON.stringify(ep));
8184
8208
  } else {
@@ -8189,7 +8213,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
8189
8213
  } else next.paint = JSON.parse(JSON.stringify(p));
8190
8214
  }
8191
8215
  }
8192
- const rgb = _chunkJJ2H25JGcjs.hexToRgb8.call(void 0, next.color).map((v) => v / 255);
8216
+ const rgb = _chunkSNAFFCAXcjs.hexToRgb8.call(void 0, next.color).map((v) => v / 255);
8193
8217
  const load = brushLoadForStroke(brush, _chunkNIBFKXMDcjs.EMPTY_MIXER_LOAD, rgb);
8194
8218
  if (load.reservoir || load.pickup) next.load = load;
8195
8219
  else delete next.load;
@@ -8211,8 +8235,8 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
8211
8235
  if (edit.points !== void 0) {
8212
8236
  const points = this.checkPoints(edit.points);
8213
8237
  next = { ...was, points: points.map((p) => ({ ...p })) };
8214
- if (_optionalChain([next, 'access', _522 => _522.paint, 'optionalAccess', _523 => _523.type]) === "effect" && _optionalChain([next, 'access', _524 => _524.paint, 'access', _525 => _525.map, 'optionalAccess', _526 => _526.by]) === "path") {
8215
- next.paint = _chunkJJ2H25JGcjs.withStrokePath.call(void 0, next.paint, next.points, this.effectPathControls.get(next.paint.effect));
8238
+ if (_optionalChain([next, 'access', _543 => _543.paint, 'optionalAccess', _544 => _544.type]) === "effect" && _optionalChain([next, 'access', _545 => _545.paint, 'access', _546 => _546.map, 'optionalAccess', _547 => _547.by]) === "path") {
8239
+ next.paint = _chunkSNAFFCAXcjs.withStrokePath.call(void 0, next.paint, next.points, this.effectPathControls.get(next.paint.effect));
8216
8240
  }
8217
8241
  } else {
8218
8242
  next = varyStroke(was, this.strokeTransform(was, edit.transform), {});
@@ -8232,9 +8256,9 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
8232
8256
  const layers = /* @__PURE__ */ new Map();
8233
8257
  for (const f of found) layers.set(f.layer.id, f.layer);
8234
8258
  for (const [layerId, layer] of layers) {
8235
- const gone = (_nullishCoalesce(_optionalChain([doc, 'access', _527 => _527.liveStrokes, 'optionalAccess', _528 => _528[layerId]]), () => ( []))).filter((x) => ids.includes(x.id));
8259
+ const gone = (_nullishCoalesce(_optionalChain([doc, 'access', _548 => _548.liveStrokes, 'optionalAccess', _549 => _549[layerId]]), () => ( []))).filter((x) => ids.includes(x.id));
8236
8260
  for (const x of gone) bounds = unionRect(bounds, this.strokeArea(x));
8237
- doc = this.withLiveStrokes(doc, layer, (_nullishCoalesce(_optionalChain([doc, 'access', _529 => _529.liveStrokes, 'optionalAccess', _530 => _530[layerId]]), () => ( []))).filter((x) => !ids.includes(x.id)), this.strokeAreas(gone));
8261
+ doc = this.withLiveStrokes(doc, layer, (_nullishCoalesce(_optionalChain([doc, 'access', _550 => _550.liveStrokes, 'optionalAccess', _551 => _551[layerId]]), () => ( []))).filter((x) => !ids.includes(x.id)), this.strokeAreas(gone));
8238
8262
  }
8239
8263
  this.commit(ids.length === 1 ? "Remove stroke" : "Remove strokes", doc);
8240
8264
  return { removed: [...ids], bounds };
@@ -8302,7 +8326,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
8302
8326
  }
8303
8327
  withLiveStrokes(doc, layer, list, dirty) {
8304
8328
  if (_chunkPVJMTLPJcjs.isLayerLocked.call(void 0, layer, "pixels")) throw new PaintEditorError(`Layer "${layer.name}" has its pixels locked; unlock it (update_layer locks) first.`);
8305
- const current = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, doc.layers, layer.id), 'optionalAccess', _531 => _531.layer]);
8329
+ const current = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, doc.layers, layer.id), 'optionalAccess', _552 => _552.layer]);
8306
8330
  const surface = this.drawLiveStrokes(_nullishCoalesce(current, () => ( layer)), list, dirty);
8307
8331
  const next = { ...doc, layers: _chunkPVJMTLPJcjs.mapLayer.call(void 0, doc.layers, layer.id, (l) => ({ ...l, surface, offset: { x: 0, y: 0 } })), liveStrokes: { ..._nullishCoalesce(doc.liveStrokes, () => ( {})), [layer.id]: [...list] } };
8308
8332
  return this.withPaintEvent(next, { kind: "live-strokes", layerId: layer.id, data: { strokes: list.map((x) => JSON.parse(JSON.stringify(x))) } });
@@ -8380,7 +8404,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
8380
8404
  if (!this.animatedLayers.size) return this.doc.layers;
8381
8405
  let layers = this.doc.layers;
8382
8406
  for (const [id, a] of this.animatedLayers) {
8383
- const l = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, layers, id), 'optionalAccess', _532 => _532.layer]);
8407
+ const l = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, layers, id), 'optionalAccess', _553 => _553.layer]);
8384
8408
  if (isPixelLayer(l) && l.surface === a.base) layers = _chunkPVJMTLPJcjs.mapLayer.call(void 0, layers, id, () => ({ ...l, surface: a.surface }));
8385
8409
  }
8386
8410
  return layers;
@@ -8390,11 +8414,11 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
8390
8414
  const layers = [];
8391
8415
  const sources = /* @__PURE__ */ new Map();
8392
8416
  for (const [id, strokes] of Object.entries(_nullishCoalesce(doc.liveStrokes, () => ( {})))) {
8393
- const layer = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, doc.layers, id), 'optionalAccess', _533 => _533.layer]);
8417
+ const layer = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, doc.layers, id), 'optionalAccess', _554 => _554.layer]);
8394
8418
  const live = strokes.filter(isLiveEffect);
8395
8419
  if (!isPixelLayer(layer) || !live.length) continue;
8396
8420
  layers.push({ layer, strokes });
8397
- for (const st of live) sources.set(_chunkJJ2H25JGcjs.effectPaintKey.call(void 0, st.paint), st.paint);
8421
+ for (const st of live) sources.set(_chunkSNAFFCAXcjs.effectPaintKey.call(void 0, st.paint), st.paint);
8398
8422
  }
8399
8423
  return { layers, sources: [...sources.values()] };
8400
8424
  }
@@ -8521,7 +8545,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
8521
8545
  stencilSelection(stencils = this.guides.stencils) {
8522
8546
  const { width, height } = this.doc.canvas;
8523
8547
  const size = `${width}x${height}`;
8524
- if (_optionalChain([this, 'access', _534 => _534.stencilCache, 'optionalAccess', _535 => _535.key]) === stencils && this.stencilCache.size === size) return this.stencilCache.mask;
8548
+ if (_optionalChain([this, 'access', _555 => _555.stencilCache, 'optionalAccess', _556 => _556.key]) === stencils && this.stencilCache.size === size) return this.stencilCache.mask;
8525
8549
  const mask = stencilMask(stencils, width, height);
8526
8550
  this.stencilCache = { key: stencils, size, mask };
8527
8551
  return mask;
@@ -8583,7 +8607,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
8583
8607
  makeSwatch(color, name) {
8584
8608
  const p = typeof color === "string" ? { type: "color", color: parseColor(color) } : this.readStrokePaint(color);
8585
8609
  const out = { color: _chunkNIBFKXMDcjs.paintSourceColor.call(void 0, p, { paint: this.color, secondary: this.secondaryColor }) };
8586
- if (_optionalChain([name, 'optionalAccess', _536 => _536.trim, 'call', _537 => _537()])) out.name = name.trim();
8610
+ if (_optionalChain([name, 'optionalAccess', _557 => _557.trim, 'call', _558 => _558()])) out.name = name.trim();
8587
8611
  if (p.type === "gradient") out.paint = p;
8588
8612
  return out;
8589
8613
  }
@@ -8635,7 +8659,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
8635
8659
  * mix becomes the paint colour. Returns the mixed colour and the pile's bounds.
8636
8660
  */
8637
8661
  mixOnPad(paints2, options = {}) {
8638
- const parsed = (_nullishCoalesce(paints2, () => ( []))).map((p, i) => ({ color: parseColor(_optionalChain([p, 'optionalAccess', _538 => _538.color]), `paints[${i}].color`), parts: _optionalChain([p, 'optionalAccess', _539 => _539.parts]) }));
8662
+ const parsed = (_nullishCoalesce(paints2, () => ( []))).map((p, i) => ({ color: parseColor(_optionalChain([p, 'optionalAccess', _559 => _559.color]), `paints[${i}].color`), parts: _optionalChain([p, 'optionalAccess', _560 => _560.parts]) }));
8639
8663
  let r;
8640
8664
  try {
8641
8665
  r = this.pad.mix(parsed, options);
@@ -8724,7 +8748,7 @@ var PaintEditorController = (_class14 = class _PaintEditorController {
8724
8748
  }
8725
8749
  /** A layer's tile surface (live while stroking), for thumbnails. */
8726
8750
  layerSurface(id) {
8727
- const l = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, this.currentLayers(), id), 'optionalAccess', _540 => _540.layer]);
8751
+ const l = _optionalChain([_chunkPVJMTLPJcjs.findLayer.call(void 0, this.currentLayers(), id), 'optionalAccess', _561 => _561.layer]);
8728
8752
  return isPixelLayer(l) ? l.surface : null;
8729
8753
  }
8730
8754
  }, _class14.__initStatic(), _class14);
@@ -8746,7 +8770,7 @@ function insertAfter(layers, id, node) {
8746
8770
  return layers.map((l) => l.type === "group" ? { ...l, children: insertAfter(l.children, id, node) } : l);
8747
8771
  }
8748
8772
  function isLiveEffect(s) {
8749
- return _optionalChain([s, 'access', _541 => _541.paint, 'optionalAccess', _542 => _542.type]) === "effect" && s.paint.live === true;
8773
+ return _optionalChain([s, 'access', _562 => _562.paint, 'optionalAccess', _563 => _563.type]) === "effect" && s.paint.live === true;
8750
8774
  }
8751
8775
  function framePaint(p, t) {
8752
8776
  return { ...p, time: p.time + t };
@@ -8771,7 +8795,7 @@ function clipRect(r, width, height) {
8771
8795
  return x1 > x0 && y1 > y0 ? { x: x0, y: y0, width: x1 - x0, height: y1 - y0 } : null;
8772
8796
  }
8773
8797
  function withLiveStroke(doc, stroke) {
8774
- const list = _optionalChain([doc, 'access', _543 => _543.liveStrokes, 'optionalAccess', _544 => _544[stroke.layerId]]);
8798
+ const list = _optionalChain([doc, 'access', _564 => _564.liveStrokes, 'optionalAccess', _565 => _565[stroke.layerId]]);
8775
8799
  return list ? { ...doc, liveStrokes: { ...doc.liveStrokes, [stroke.layerId]: [...list, stroke] } } : doc;
8776
8800
  }
8777
8801
  function shiftDocument(doc, dx, dy) {
@@ -8798,9 +8822,9 @@ function shiftDocument(doc, dx, dy) {
8798
8822
  if (doc.liveStrokes) out.liveStrokes = Object.fromEntries(Object.entries(doc.liveStrokes).map(([id, list]) => [id, list.map(moveStroke)]));
8799
8823
  if (doc.paintEvents) {
8800
8824
  out.paintEvents = doc.paintEvents.map((e) => {
8801
- const list = e.kind === "stickers" ? _optionalChain([e, 'access', _545 => _545.data, 'optionalAccess', _546 => _546.stickers]) : void 0;
8825
+ const list = e.kind === "stickers" ? _optionalChain([e, 'access', _566 => _566.data, 'optionalAccess', _567 => _567.stickers]) : void 0;
8802
8826
  if (list) return { ...e, data: { ...e.data, stickers: moveStickers(list) } };
8803
- const strokes = e.kind === "live-strokes" ? _optionalChain([e, 'access', _547 => _547.data, 'optionalAccess', _548 => _548.strokes]) : void 0;
8827
+ const strokes = e.kind === "live-strokes" ? _optionalChain([e, 'access', _568 => _568.data, 'optionalAccess', _569 => _569.strokes]) : void 0;
8804
8828
  return strokes ? { ...e, data: { ...e.data, strokes: strokes.map(moveStroke) } } : e;
8805
8829
  });
8806
8830
  }
@@ -8872,7 +8896,17 @@ function clipToCanvas(rect, canvas) {
8872
8896
  return x1 > x0 && y1 > y0 ? { x: x0, y: y0, width: x1 - x0, height: y1 - y0 } : null;
8873
8897
  }
8874
8898
  function toEffectPaintPixels(p, pixels) {
8875
- return { width: pixels.width, height: pixels.height, data: new Uint8ClampedArray(pixels.data), ..._optionalChain([p, 'access', _549 => _549.map, 'optionalAccess', _550 => _550.by]) === "stroke" ? { map: p.map } : {} };
8899
+ return { width: pixels.width, height: pixels.height, data: new Uint8ClampedArray(pixels.data), ..._optionalChain([p, 'access', _570 => _570.map, 'optionalAccess', _571 => _571.by]) === "stroke" ? { map: p.map } : {} };
8900
+ }
8901
+ function readWetGhost(raw) {
8902
+ if (!raw || typeof raw !== "object") return null;
8903
+ const g = raw;
8904
+ if (!Array.isArray(g.pigment) || g.pigment.length !== 4 || !g.pigment.every((x) => typeof x === "number" && Number.isFinite(x))) return null;
8905
+ const remaining = typeof g.remaining === "number" && Number.isFinite(g.remaining) ? Math.max(0, Math.round(g.remaining)) : 0;
8906
+ if (remaining <= 0) return null;
8907
+ const total = typeof g.total === "number" && Number.isFinite(g.total) ? Math.max(1, Math.round(g.total)) : remaining;
8908
+ const linger = typeof g.linger === "number" && Number.isFinite(g.linger) ? Math.max(0.5, Math.min(60, g.linger)) : 4;
8909
+ return { pigment: [g.pigment[0], g.pigment[1], g.pigment[2], g.pigment[3]], remaining, total, linger };
8876
8910
  }
8877
8911
 
8878
8912
  // src/paint-editor/presence.ts
@@ -8892,8 +8926,8 @@ function strokeSchedule(points) {
8892
8926
  return total > 0 ? acc.map((d) => d / total) : points.map(() => 1);
8893
8927
  }
8894
8928
  function strokeDuration(points, max = 1800) {
8895
- const t0 = _optionalChain([points, 'access', _551 => _551[0], 'optionalAccess', _552 => _552.t]);
8896
- const t1 = _optionalChain([points, 'access', _553 => _553[points.length - 1], 'optionalAccess', _554 => _554.t]);
8929
+ const t0 = _optionalChain([points, 'access', _572 => _572[0], 'optionalAccess', _573 => _573.t]);
8930
+ const t1 = _optionalChain([points, 'access', _574 => _574[points.length - 1], 'optionalAccess', _575 => _575.t]);
8897
8931
  let ms;
8898
8932
  if (points.every((p) => Number.isFinite(p.t)) && t1 > t0) ms = t1 - t0;
8899
8933
  else {
@@ -8947,7 +8981,7 @@ var PaintDirector = class {
8947
8981
  }
8948
8982
  where(id) {
8949
8983
  const a = this.presence.get(id);
8950
- return { x: _nullishCoalesce(_optionalChain([a, 'optionalAccess', _555 => _555.x]), () => ( 0)), y: _nullishCoalesce(_optionalChain([a, 'optionalAccess', _556 => _556.y]), () => ( 0)) };
8984
+ return { x: _nullishCoalesce(_optionalChain([a, 'optionalAccess', _576 => _576.x]), () => ( 0)), y: _nullishCoalesce(_optionalChain([a, 'optionalAccess', _577 => _577.y]), () => ( 0)) };
8951
8985
  }
8952
8986
  /** Glides to `to`; an actor that just appeared starts there instead of the corner. */
8953
8987
  async glide(id, to, ms = 380) {
@@ -8997,8 +9031,8 @@ var PaintDirector = class {
8997
9031
  }
8998
9032
  case "replay": {
8999
9033
  await this.say(id, command.note, 500);
9000
- const source = c.getStrokes().filter((s) => _optionalChain([command, 'access', _557 => _557.replay, 'access', _558 => _558.strokeIds, 'optionalAccess', _559 => _559.includes, 'call', _560 => _560(s.id)]));
9001
- const first = _optionalChain([source, 'access', _561 => _561[0], 'optionalAccess', _562 => _562.points, 'access', _563 => _563[0]]);
9034
+ const source = c.getStrokes().filter((s) => _optionalChain([command, 'access', _578 => _578.replay, 'access', _579 => _579.strokeIds, 'optionalAccess', _580 => _580.includes, 'call', _581 => _581(s.id)]));
9035
+ const first = _optionalChain([source, 'access', _582 => _582[0], 'optionalAccess', _583 => _583.points, 'access', _584 => _584[0]]);
9002
9036
  if (first) await this.glide(id, first);
9003
9037
  const result = c.replayStrokes(command.replay);
9004
9038
  if (result.bounds) await this.glide(id, centre(result.bounds), 520);
@@ -9046,7 +9080,7 @@ var PaintDirector = class {
9046
9080
  const checked = inits.map((s) => ({ ...s, points: c.checkPoints(s.points) }));
9047
9081
  const first = checked[0];
9048
9082
  const base = first.brushId ? c.getBrush(first.brushId) : c.getState().brush;
9049
- const stepLabel = _nullishCoalesce(label, () => ( `${_nullishCoalesce(_optionalChain([base, 'optionalAccess', _564 => _564.name]), () => ( "Brush"))} path stroke`));
9083
+ const stepLabel = _nullishCoalesce(label, () => ( `${_nullishCoalesce(_optionalChain([base, 'optionalAccess', _585 => _585.name]), () => ( "Brush"))} path stroke`));
9050
9084
  return c.group(stepLabel, async (within) => {
9051
9085
  let layerId = _nullishCoalesce(_nullishCoalesce(first.layerId, () => ( c.document.activeLayerId)), () => ( ""));
9052
9086
  let bounds = null;
@@ -9066,8 +9100,8 @@ var PaintDirector = class {
9066
9100
  bounds,
9067
9101
  dabs,
9068
9102
  strokeIds,
9069
- ..._optionalChain([last, 'optionalAccess', _565 => _565.mixerLoad]) ? { mixerLoad: last.mixerLoad } : {},
9070
- ..._optionalChain([last, 'optionalAccess', _566 => _566.wet]) !== void 0 ? { wet: last.wet } : {}
9103
+ ..._optionalChain([last, 'optionalAccess', _586 => _586.mixerLoad]) ? { mixerLoad: last.mixerLoad } : {},
9104
+ ..._optionalChain([last, 'optionalAccess', _587 => _587.wet]) !== void 0 ? { wet: last.wet } : {}
9071
9105
  };
9072
9106
  });
9073
9107
  }
@@ -9796,7 +9830,7 @@ function createPaintWetTools(c) {
9796
9830
  {
9797
9831
  name: "get_wet_paint",
9798
9832
  title: "Get the wet paint",
9799
- description: "Reads the wet media: whether any paint is still wet, the simulation clock (steps), whether time is paused, its speed (steps per second), the canvas tilt, the kernel running it (typescript, wasm, wasm-threads with the thread count, and a message when it runs slower than it could, e.g. without cross-origin isolation), and each wet layer: wet cells, where the water is (wetBounds), live tiles, its settings and flow map. Also engine: Engine B, the GPU accelerator: WebGPU in browsers, Metal in the Swift editors (mode auto/off, state, reason, adapter, minTiles, activeTiles). Call it after wet strokes to see what is still wet.",
9833
+ description: "Reads the wet media: whether any paint is still wet, the simulation clock (steps), whether time is paused, its speed (steps per second), the canvas tilt, the kernel running it (typescript, wasm, wasm-threads with the thread count, and a message when it runs slower than it could, e.g. without cross-origin isolation), and each wet layer: wet cells, where the water is (wetBounds), live tiles, its settings, flow map, and ghost: { remaining } (seconds of simulated time left when ghost paint is fading on the layer). Also engine: Engine B, the GPU accelerator: WebGPU in browsers, Metal in the Swift editors (mode auto/off, state, reason, adapter, minTiles, activeTiles). Call it after wet strokes to see what is still wet.",
9800
9834
  inputSchema: EMPTY2,
9801
9835
  annotations: { title: "Get the wet paint", ...READ3 },
9802
9836
  coordinates: { out: ["layers[].wetBounds", "layers[].flow.center"] },
@@ -9867,7 +9901,7 @@ function createPaintWetTools(c) {
9867
9901
  type: "object",
9868
9902
  properties: {
9869
9903
  layerId: LAYER_ID2,
9870
- kind: { type: "string", enum: [..._chunkJ5VQYK7Tcjs.WET_FLOW_KINDS], description: "none, linear, swirl, radial or turbulent." },
9904
+ kind: { type: "string", enum: [..._chunkN5IMDAHMcjs.WET_FLOW_KINDS], description: "none, linear, swirl, radial or turbulent." },
9871
9905
  strength: UNIT("How hard it pushes, 0..1 (1 is about a 25\xB0 tilt; default 0.5)."),
9872
9906
  angle: { type: "number", minimum: -360, maximum: 360, description: "linear: direction in degrees clockwise from canvas down (default 0)." },
9873
9907
  center: {
@@ -10239,8 +10273,8 @@ function createPaintEditorToolProvider(controller, options = {}) {
10239
10273
  inputSchema: EMPTY3,
10240
10274
  annotations: { title: "List papers", ...READ6 },
10241
10275
  handler: () => ({
10242
- papers: _chunkJJ2H25JGcjs.PAPER_LIBRARY.map((p) => ({ id: p.preset, name: p.name, family: p.family, pattern: p.pattern, color: p.color, depth: p.depth, absorption: p.absorption, permeability: p.permeability, roughness: p.roughness })),
10243
- families: [..._chunkJJ2H25JGcjs.PAPER_FAMILIES],
10276
+ papers: _chunkSNAFFCAXcjs.PAPER_LIBRARY.map((p) => ({ id: p.preset, name: p.name, family: p.family, pattern: p.pattern, color: p.color, depth: p.depth, absorption: p.absorption, permeability: p.permeability, roughness: p.roughness })),
10277
+ families: [..._chunkSNAFFCAXcjs.PAPER_FAMILIES],
10244
10278
  patterns: [..._chunkNIBFKXMDcjs.GRAIN_PATTERNS]
10245
10279
  })
10246
10280
  });
@@ -10472,10 +10506,10 @@ function createPaintEditorToolProvider(controller, options = {}) {
10472
10506
  name: "set_brush",
10473
10507
  title: "Set the brush",
10474
10508
  description: "Chooses the active brush (id, from list_brush_presets) and / or changes it with facets laid over it (objects merge, lists and values replace, marks of another kind replace the marks; the brush library's create_brush fields); unset removes whole facets first (unset colour drops a brush's own gradient). Strokes without a brush use it. Editor state, not an undo step: the changes stay on the active brush until the library's create_brush or update_brush stores a brush. Returns the active brush as facets, the engine it paints with, and problems (values clamped or dropped).",
10475
- inputSchema: { type: "object", properties: { id: { type: "string", description: "Brush id from list_brush_presets to start from (default the active brush)." }, name: { type: "string", minLength: 1, maxLength: 80, description: "Display name." }, ..._chunk3KNQ2W6Xcjs.BRUSH_PATCH_PROPERTIES, unset: _chunk3KNQ2W6Xcjs.BRUSH_UNSET_PROPERTY }, additionalProperties: false },
10509
+ inputSchema: { type: "object", properties: { id: { type: "string", description: "Brush id from list_brush_presets to start from (default the active brush)." }, name: { type: "string", minLength: 1, maxLength: 80, description: "Display name." }, ..._chunk3JKCREEUcjs.BRUSH_PATCH_PROPERTIES, unset: _chunk3JKCREEUcjs.BRUSH_UNSET_PROPERTY }, additionalProperties: false },
10476
10510
  annotations: { title: "Set the brush", ...SET4 },
10477
10511
  handler: async ({ id, unset, ...patch }) => {
10478
- const stamps = _optionalChain([patch, 'access', _567 => _567.tip, 'optionalAccess', _568 => _568.stamps]);
10512
+ const stamps = _optionalChain([patch, 'access', _588 => _588.tip, 'optionalAccess', _589 => _589.stamps]);
10479
10513
  if (stamps) await c.prepareStickers(stamps);
10480
10514
  const r = c.setBrushFacets(patch, id, unset);
10481
10515
  return { brush: r.spec, engine: r.brush.engine, problems: r.problems };
@@ -10568,7 +10602,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
10568
10602
  points: POINTS,
10569
10603
  layerId: LAYER_ID4,
10570
10604
  brushId: { type: "string", description: "Brush id from list_brush_presets (default the active brush)." },
10571
- brush: { type: "object", description: "Facets to change for this stroke only, laid over brushId or the active brush (as set_brush takes them).", properties: _chunk3KNQ2W6Xcjs.BRUSH_PATCH_PROPERTIES, additionalProperties: false },
10605
+ brush: { type: "object", description: "Facets to change for this stroke only, laid over brushId or the active brush (as set_brush takes them).", properties: _chunk3JKCREEUcjs.BRUSH_PATCH_PROPERTIES, additionalProperties: false },
10572
10606
  color: { ...COLOR3, description: "Paint colour #rrggbb (default the paint colour)." },
10573
10607
  paint: { ..._chunkNIBFKXMDcjs.PAINT_SOURCE_JSON_SCHEMA, description: "What this stroke paints with instead of the editor's paint: a colour, or gradient paint that changes colour as the stroke goes (by distance, pressure, tilt, speed, direction, time, across the tip or at random). Wins over the brush's own gradient." },
10574
10608
  seed: { type: "integer", minimum: 0, description: "Jitter seed (default a new one); the same seed and points give the same marks." },
@@ -10584,7 +10618,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
10584
10618
  const base = a.brushId ? c.getBrush(a.brushId) : c.getState().brush;
10585
10619
  const brush = a.brush ? c.brushChanges(a.brush, a.brushId) : void 0;
10586
10620
  if (base) {
10587
- const refs = _chunkJJ2H25JGcjs.brushStickerRefs.call(void 0, _chunkEU2ZZA6Lcjs.normalizePaintBrush.call(void 0, { ..._nullishCoalesce(brush, () => ( {})), id: base.id }, base));
10621
+ const refs = _chunkSNAFFCAXcjs.brushStickerRefs.call(void 0, _chunkGHGBIAWQcjs.normalizePaintBrush.call(void 0, { ..._nullishCoalesce(brush, () => ( {})), id: base.id }, base));
10588
10622
  if (refs.length) await c.prepareStickers(refs);
10589
10623
  }
10590
10624
  const stroke = { points: a.points, layerId: a.layerId, brushId: a.brushId, brush, color: a.color, paint: a.paint, seed: a.seed, snapToPerspective: a.snapToPerspective };
@@ -10606,7 +10640,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
10606
10640
  speed: { type: "number", minimum: 0.01, maximum: 100, description: "Drawing speed in document pixels per millisecond (optional; gives each sample a time t so playback has a pace and speed-sensitive brushes respond)." },
10607
10641
  layerId: LAYER_ID4,
10608
10642
  brushId: { type: "string", description: "Brush id from list_brush_presets (default the active brush)." },
10609
- brush: { type: "object", description: "Facets to change for this stroke only, laid over brushId or the active brush (as set_brush takes them).", properties: _chunk3KNQ2W6Xcjs.BRUSH_PATCH_PROPERTIES, additionalProperties: false },
10643
+ brush: { type: "object", description: "Facets to change for this stroke only, laid over brushId or the active brush (as set_brush takes them).", properties: _chunk3JKCREEUcjs.BRUSH_PATCH_PROPERTIES, additionalProperties: false },
10610
10644
  color: { ...COLOR3, description: "Paint colour #rrggbb (default the paint colour)." },
10611
10645
  paint: { ..._chunkNIBFKXMDcjs.PAINT_SOURCE_JSON_SCHEMA, description: "What the strokes paint with instead of the editor's paint: a colour, or gradient paint that changes colour as each stroke goes." },
10612
10646
  seed: { type: "integer", minimum: 0, description: "Jitter seed of the first subpath, the next ones take the following seeds (default new ones); the same seed and path give the same marks." }
@@ -10621,7 +10655,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
10621
10655
  const base = a.brushId ? c.getBrush(a.brushId) : c.getState().brush;
10622
10656
  const brush = a.brush ? c.brushChanges(a.brush, a.brushId) : void 0;
10623
10657
  if (base) {
10624
- const refs = _chunkJJ2H25JGcjs.brushStickerRefs.call(void 0, _chunkEU2ZZA6Lcjs.normalizePaintBrush.call(void 0, { ..._nullishCoalesce(brush, () => ( {})), id: base.id }, base));
10658
+ const refs = _chunkSNAFFCAXcjs.brushStickerRefs.call(void 0, _chunkGHGBIAWQcjs.normalizePaintBrush.call(void 0, { ..._nullishCoalesce(brush, () => ( {})), id: base.id }, base));
10625
10659
  if (refs.length) await c.prepareStickers(refs);
10626
10660
  }
10627
10661
  const path = options.origin && typeof a.path === "string" && a.path.trim() ? _chunkGF2RBSDMcjs.bezierPathToSvg.call(void 0, a.path, { offset: { x: -options.origin.x, y: -options.origin.y } }) : a.path;
@@ -10645,7 +10679,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
10645
10679
  const { path: _path, spacing: _spacing, pressure: _pressure, speed: _speed, ...stroke } = init;
10646
10680
  return {
10647
10681
  kind: "strokes",
10648
- label: `${_nullishCoalesce(_optionalChain([base, 'optionalAccess', _569 => _569.name]), () => ( "Brush"))} path stroke`,
10682
+ label: `${_nullishCoalesce(_optionalChain([base, 'optionalAccess', _590 => _590.name]), () => ( "Brush"))} path stroke`,
10649
10683
  strokes: subpaths.map((points, i) => ({
10650
10684
  ...stroke,
10651
10685
  ...stroke.seed !== void 0 ? { seed: stroke.seed + i } : {},
@@ -10702,7 +10736,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
10702
10736
  if (ids) {
10703
10737
  for (const id of ids) if (!all.some((s) => s.id === id)) throw new Error(`Unknown stroke "${id}". Call list_strokes without ids for the ids.`);
10704
10738
  }
10705
- return { total: all.length, strokes: picked.map((s) => strokeSummary(s, Boolean(ids), live ? true : liveIds.has(s.id) && _optionalChain([c, 'access', _570 => _570.document, 'access', _571 => _571.liveStrokes, 'optionalAccess', _572 => _572[s.layerId], 'optionalAccess', _573 => _573.includes, 'call', _574 => _574(s)]) === true)) };
10739
+ return { total: all.length, strokes: picked.map((s) => strokeSummary(s, Boolean(ids), live ? true : liveIds.has(s.id) && _optionalChain([c, 'access', _591 => _591.document, 'access', _592 => _592.liveStrokes, 'optionalAccess', _593 => _593[s.layerId], 'optionalAccess', _594 => _594.includes, 'call', _595 => _595(s)]) === true)) };
10706
10740
  }
10707
10741
  });
10708
10742
  add({
@@ -10735,7 +10769,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
10735
10769
  properties: {
10736
10770
  id: { type: "string", description: "Stroke id from list_strokes {live: true}." },
10737
10771
  brushId: { type: "string", description: "Brush id from list_brush_presets; the stroke keeps its size." },
10738
- brush: { type: "object", properties: _chunk3KNQ2W6Xcjs.BRUSH_PATCH_PROPERTIES, additionalProperties: false, description: "Facets to change on top of brushId or the stroke\u2019s brush (as set_brush takes them); missing fields keep their values." },
10772
+ brush: { type: "object", properties: _chunk3JKCREEUcjs.BRUSH_PATCH_PROPERTIES, additionalProperties: false, description: "Facets to change on top of brushId or the stroke\u2019s brush (as set_brush takes them); missing fields keep their values." },
10739
10773
  color: { type: "string", pattern: "^#[0-9a-fA-F]{6}$", description: "New colour #rrggbb (replaces gradient paint)." },
10740
10774
  paint: { anyOf: [_chunkNIBFKXMDcjs.PAINT_SOURCE_JSON_SCHEMA, { type: "null", description: "Back to the stroke\u2019s plain colour." }], description: "A colour or gradient paint for the stroke; null drops its gradient." },
10741
10775
  seed: { type: "integer", minimum: 0, description: "Another jitter seed: particles, scatter and texture fall differently." }
@@ -10987,7 +11021,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
10987
11021
  tools.push(..._chunk62MFUHSIcjs.createPigmentTools.call(void 0, ));
10988
11022
  tools.push(..._chunkPFHJS4HEcjs.createStickerTools.call(void 0, { provider: () => c.stickersProvider }));
10989
11023
  tools.push(
10990
- ..._chunkDDL3ZBHKcjs.createLayerEffectTools.call(void 0,
11024
+ ..._chunkYJANF2BLcjs.createLayerEffectTools.call(void 0,
10991
11025
  {
10992
11026
  requireLayer: (id) => void c.getLayerEffects(id),
10993
11027
  getLayerEffects: (id) => c.getLayerEffects(id),
@@ -11012,16 +11046,16 @@ function createPaintEditorToolProvider(controller, options = {}) {
11012
11046
  }
11013
11047
  function hostTool({ coordinates, ...tool }, { origin, onChange }) {
11014
11048
  if (!origin && !onChange) return tool;
11015
- const write = !_optionalChain([tool, 'access', _575 => _575.annotations, 'optionalAccess', _576 => _576.readOnlyHint]);
11049
+ const write = !_optionalChain([tool, 'access', _596 => _596.annotations, 'optionalAccess', _597 => _597.readOnlyHint]);
11016
11050
  const done = (result) => {
11017
- if (write) _optionalChain([onChange, 'optionalCall', _577 => _577({ tool: tool.name })]);
11018
- return origin && _optionalChain([coordinates, 'optionalAccess', _578 => _578.out]) ? fromDocument(result, coordinates.out, origin) : result;
11051
+ if (write) _optionalChain([onChange, 'optionalCall', _598 => _598({ tool: tool.name })]);
11052
+ return origin && _optionalChain([coordinates, 'optionalAccess', _599 => _599.out]) ? fromDocument(result, coordinates.out, origin) : result;
11019
11053
  };
11020
11054
  return {
11021
11055
  ...tool,
11022
11056
  ...origin ? { description: hostedText(_nullishCoalesce(tool.description, () => ( ""))), inputSchema: hostedSchema(tool.inputSchema) } : {},
11023
11057
  handler: (args, context) => {
11024
- const r = tool.handler(origin && _optionalChain([coordinates, 'optionalAccess', _579 => _579.in]) ? toDocument(args, coordinates.in, origin) : args, context);
11058
+ const r = tool.handler(origin && _optionalChain([coordinates, 'optionalAccess', _600 => _600.in]) ? toDocument(args, coordinates.in, origin) : args, context);
11025
11059
  return r instanceof Promise ? r.then(done) : done(r);
11026
11060
  }
11027
11061
  };
@@ -11038,23 +11072,23 @@ function strokeSummary(s, withPoints, live) {
11038
11072
  color: s.color,
11039
11073
  points: withPoints ? s.points : s.points.length,
11040
11074
  seed: s.seed,
11041
- copies: _nullishCoalesce(_optionalChain([s, 'access', _580 => _580.copies, 'optionalAccess', _581 => _581.length]), () => ( 0)),
11075
+ copies: _nullishCoalesce(_optionalChain([s, 'access', _601 => _601.copies, 'optionalAccess', _602 => _602.length]), () => ( 0)),
11042
11076
  live,
11043
11077
  bounds: { x: Math.floor(Math.min(...xs) - pad), y: Math.floor(Math.min(...ys) - pad), width: Math.ceil(Math.max(...xs) - Math.min(...xs) + 2 * pad), height: Math.ceil(Math.max(...ys) - Math.min(...ys) + 2 * pad) }
11044
11078
  };
11045
11079
  }
11046
11080
 
11047
11081
  // src/paint-editor/brush-library-tools.ts
11048
- function paintBrushPreviewRenderer(paper = () => _chunkJJ2H25JGcjs.DEFAULT_PAPER, options = {}) {
11082
+ function paintBrushPreviewRenderer(paper = () => _chunkSNAFFCAXcjs.DEFAULT_PAPER, options = {}) {
11049
11083
  const sources = new BrushSourceArtCache();
11050
11084
  const draw = (brush, { width, height, color }) => {
11051
- const stickers = _optionalChain([options, 'access', _582 => _582.stampArt, 'optionalCall', _583 => _583()]);
11085
+ const stickers = _optionalChain([options, 'access', _603 => _603.stampArt, 'optionalCall', _604 => _604()]);
11052
11086
  const stampArt = sources.with(_nullishCoalesce(stickers, () => ( (() => void 0))));
11053
- const t = renderBrushThumbnail(_chunkEU2ZZA6Lcjs.resolveBrush.call(void 0, brush), { paper: paper(), width, height, color: color.toLowerCase(), stampArt });
11087
+ const t = renderBrushThumbnail(_chunkGHGBIAWQcjs.resolveBrush.call(void 0, brush), { paper: paper(), width, height, color: color.toLowerCase(), stampArt });
11054
11088
  return { data: _chunkW5M3J7PVcjs.bytesToBase64.call(void 0, _chunkW5M3J7PVcjs.encodePng.call(void 0, t.width, t.height, t.data)), mimeType: "image/png" };
11055
11089
  };
11056
11090
  const render = (brush, size) => {
11057
- const ids = _chunkEU2ZZA6Lcjs.brushSourceIds.call(void 0, brush);
11091
+ const ids = _chunkGHGBIAWQcjs.brushSourceIds.call(void 0, brush);
11058
11092
  if (!ids.length || !options.library) return draw(brush, size);
11059
11093
  const library = options.library;
11060
11094
  return Promise.all(ids.map((id) => library.getSource(id))).then((found) => {
@@ -11065,8 +11099,8 @@ function paintBrushPreviewRenderer(paper = () => _chunkJJ2H25JGcjs.DEFAULT_PAPER
11065
11099
  return Object.defineProperty(render, "paper", { get: () => paper().color, enumerable: true });
11066
11100
  }
11067
11101
  function createPaintBrushLibraryToolProvider(controller, options = {}) {
11068
- return _chunk3KNQ2W6Xcjs.createBrushLibraryToolProvider.call(void 0, controller.brushLibrary, {
11069
- profile: _chunkEU2ZZA6Lcjs.PAINT_PROFILE,
11102
+ return _chunk3JKCREEUcjs.createBrushLibraryToolProvider.call(void 0, controller.brushLibrary, {
11103
+ profile: _chunkGHGBIAWQcjs.PAINT_PROFILE,
11070
11104
  stickers: () => controller.stickers.provider,
11071
11105
  ...options,
11072
11106
  renderPreview: paintBrushPreviewRenderer(() => controller.getState().document.paper, { library: controller.brushLibrary, stampArt: () => controller.stampArt })
@@ -11152,13 +11186,13 @@ var PaintGesture = (_class15 = class {
11152
11186
  const p = this.doc(e);
11153
11187
  const s = this.controller.getState();
11154
11188
  const layerId = s.document.activeLayerId;
11155
- if (!layerId || !_optionalChain([s, 'access', _584 => _584.document, 'access', _585 => _585.liveStrokes, 'optionalAccess', _586 => _586[layerId]])) {
11189
+ if (!layerId || !_optionalChain([s, 'access', _605 => _605.document, 'access', _606 => _606.liveStrokes, 'optionalAccess', _607 => _607[layerId]])) {
11156
11190
  this.error = "Pick a stroke layer in the Layers panel (or add one) to select its strokes.";
11157
11191
  return false;
11158
11192
  }
11159
11193
  try {
11160
11194
  const hit = this.controller.liveStrokeAt(layerId, p.x, p.y);
11161
- this.controller.selectStroke(_nullishCoalesce(_optionalChain([hit, 'optionalAccess', _587 => _587.id]), () => ( null)));
11195
+ this.controller.selectStroke(_nullishCoalesce(_optionalChain([hit, 'optionalAccess', _608 => _608.id]), () => ( null)));
11162
11196
  if (!hit) return false;
11163
11197
  this.mode = { kind: "move-stroke", pointerId: e.pointerId, id: hit.id, from: p, to: p };
11164
11198
  return true;
@@ -11170,7 +11204,7 @@ var PaintGesture = (_class15 = class {
11170
11204
  /** While a stroke is dragged: how far it has moved (document pixels), to draw its outline there. */
11171
11205
  get strokeDrag() {
11172
11206
  const m = this.mode;
11173
- return _optionalChain([m, 'optionalAccess', _588 => _588.kind]) === "move-stroke" ? { id: m.id, dx: m.to.x - m.from.x, dy: m.to.y - m.from.y } : null;
11207
+ return _optionalChain([m, 'optionalAccess', _609 => _609.kind]) === "move-stroke" ? { id: m.id, dx: m.to.x - m.from.x, dy: m.to.y - m.from.y } : null;
11174
11208
  }
11175
11209
  /**
11176
11210
  * The Stickers tool: pressing a sticker picks it and dragging moves it (one undo step at the
@@ -11245,8 +11279,8 @@ var PaintGesture = (_class15 = class {
11245
11279
  this.mode = null;
11246
11280
  this.predicted = [];
11247
11281
  if (m.kind === "stroke") {
11248
- _optionalChain([this, 'access', _589 => _589.controller, 'access', _590 => _590.activeStroke, 'optionalAccess', _591 => _591.end, 'call', _592 => _592()]);
11249
- _optionalChain([this, 'access', _593 => _593.controller, 'access', _594 => _594.strokeRendering, 'optionalAccess', _595 => _595.catch, 'call', _596 => _596((err) => {
11282
+ _optionalChain([this, 'access', _610 => _610.controller, 'access', _611 => _611.activeStroke, 'optionalAccess', _612 => _612.end, 'call', _613 => _613()]);
11283
+ _optionalChain([this, 'access', _614 => _614.controller, 'access', _615 => _615.strokeRendering, 'optionalAccess', _616 => _616.catch, 'call', _617 => _617((err) => {
11250
11284
  this.error = err instanceof Error ? err.message : String(err);
11251
11285
  })]);
11252
11286
  }
@@ -11281,8 +11315,8 @@ var PaintGesture = (_class15 = class {
11281
11315
  cancel() {
11282
11316
  this.penDown = false;
11283
11317
  this.predicted = [];
11284
- if (_optionalChain([this, 'access', _597 => _597.mode, 'optionalAccess', _598 => _598.kind]) === "stroke") _optionalChain([this, 'access', _599 => _599.controller, 'access', _600 => _600.activeStroke, 'optionalAccess', _601 => _601.cancel, 'call', _602 => _602()]);
11285
- if (_optionalChain([this, 'access', _603 => _603.mode, 'optionalAccess', _604 => _604.kind]) === "sticker") this.controller.cancelStickerPreview();
11318
+ if (_optionalChain([this, 'access', _618 => _618.mode, 'optionalAccess', _619 => _619.kind]) === "stroke") _optionalChain([this, 'access', _620 => _620.controller, 'access', _621 => _621.activeStroke, 'optionalAccess', _622 => _622.cancel, 'call', _623 => _623()]);
11319
+ if (_optionalChain([this, 'access', _624 => _624.mode, 'optionalAccess', _625 => _625.kind]) === "sticker") this.controller.cancelStickerPreview();
11286
11320
  this.mode = null;
11287
11321
  }
11288
11322
  get active() {
@@ -11385,7 +11419,7 @@ function guideOverlay(controller, drag) {
11385
11419
  const size = s.document.canvas;
11386
11420
  const out = [];
11387
11421
  const layerId = s.document.activeLayerId;
11388
- const strokePicked = layerId && s.selectedStroke ? _optionalChain([s, 'access', _605 => _605.document, 'access', _606 => _606.liveStrokes, 'optionalAccess', _607 => _607[layerId], 'optionalAccess', _608 => _608.some, 'call', _609 => _609((x) => x.id === s.selectedStroke)]) : false;
11422
+ const strokePicked = layerId && s.selectedStroke ? _optionalChain([s, 'access', _626 => _626.document, 'access', _627 => _627.liveStrokes, 'optionalAccess', _628 => _628[layerId], 'optionalAccess', _629 => _629.some, 'call', _630 => _630((x) => x.id === s.selectedStroke)]) : false;
11389
11423
  const area = strokePicked ? controller.liveStrokeArea(s.selectedStroke) : null;
11390
11424
  if (area) {
11391
11425
  const dx = drag && drag.id === s.selectedStroke ? drag.dx : 0;
@@ -11398,7 +11432,7 @@ function guideOverlay(controller, drag) {
11398
11432
  ];
11399
11433
  for (let i = 0; i < 4; i++) out.push({ from: box[i], to: box[(i + 1) % 4], kind: "stroke" });
11400
11434
  }
11401
- const picked = layerId && s.selectedSticker ? _optionalChain([s, 'access', _610 => _610.document, 'access', _611 => _611.stickers, 'optionalAccess', _612 => _612[layerId], 'optionalAccess', _613 => _613.find, 'call', _614 => _614((x) => x.id === s.selectedSticker)]) : void 0;
11435
+ const picked = layerId && s.selectedSticker ? _optionalChain([s, 'access', _631 => _631.document, 'access', _632 => _632.stickers, 'optionalAccess', _633 => _633[layerId], 'optionalAccess', _634 => _634.find, 'call', _635 => _635((x) => x.id === s.selectedSticker)]) : void 0;
11402
11436
  if (picked) {
11403
11437
  const r = picked.size / 2 + 2;
11404
11438
  const a = picked.rotation * Math.PI / 180;
@@ -11428,7 +11462,7 @@ var PAPER_SLIDERS = [
11428
11462
  ];
11429
11463
  function readPath(obj, path) {
11430
11464
  let v = obj;
11431
- for (const k of path.split(".")) v = _optionalChain([v, 'optionalAccess', _615 => _615[k]]);
11465
+ for (const k of path.split(".")) v = _optionalChain([v, 'optionalAccess', _636 => _636[k]]);
11432
11466
  return typeof v === "number" ? v : 0;
11433
11467
  }
11434
11468
  function patchPath(obj, path, value) {
@@ -11544,7 +11578,7 @@ function startWetClock(controller, frame, cancel) {
11544
11578
  id = raf(loop);
11545
11579
  return () => {
11546
11580
  stopped = true;
11547
- _optionalChain([caf, 'optionalCall', _616 => _616(id)]);
11581
+ _optionalChain([caf, 'optionalCall', _637 => _637(id)]);
11548
11582
  };
11549
11583
  }
11550
11584
  function drawWaterOverlay(controller, ctx) {
@@ -11575,7 +11609,7 @@ var DOT_ROTATION_LABELS = { follow: "Follow motion", random: "Random", fixed: "T
11575
11609
  var STAMP_LABELS = { dot: "Dot", star: "Star", heart: "Heart", leaf: "Leaf", flower: "Flower", confetti: "Confetti", splat: "Splat", sparkle: "Sparkle", ring: "Ring" };
11576
11610
  function toggleStickerRef(refs, ref2) {
11577
11611
  if (refs.includes(ref2)) return refs.length > 1 ? refs.filter((r) => r !== ref2) : [...refs];
11578
- return refs.length < _chunkEU2ZZA6Lcjs.MAX_STICKER_STAMPS ? [...refs, ref2] : [...refs];
11612
+ return refs.length < _chunkGHGBIAWQcjs.MAX_STICKER_STAMPS ? [...refs, ref2] : [...refs];
11579
11613
  }
11580
11614
  function stickerRefLabel(ref2) {
11581
11615
  const stamp = ref2.startsWith("editor:") ? ref2.slice(7) : null;
@@ -11588,7 +11622,7 @@ function toggleStamp(stamps, stamp) {
11588
11622
  }
11589
11623
  function toggleDotTexture(textures, stamp) {
11590
11624
  if (textures.includes(stamp)) return textures.filter((s) => s !== stamp);
11591
- return textures.length < _chunkEU2ZZA6Lcjs.MAX_DOT_TEXTURES ? [...textures, stamp] : [...textures];
11625
+ return textures.length < _chunkGHGBIAWQcjs.MAX_DOT_TEXTURES ? [...textures, stamp] : [...textures];
11592
11626
  }
11593
11627
  var PATH_STROKE_TAPERS = [
11594
11628
  { id: "even", label: "Even" },
@@ -11902,7 +11936,7 @@ function createPaintChangeFeed(controller, options = {}) {
11902
11936
  const doc = state.document;
11903
11937
  const layers = /* @__PURE__ */ new Map();
11904
11938
  for (const l of controller.listLayers()) layers.set(l.id, { name: l.name, visible: l.visible, opacity: l.opacity, blend: l.blend });
11905
- return { doc, strokes: new Map(doc.strokes.map((s) => [s.id, s])), events: _nullishCoalesce(_optionalChain([doc, 'access', _617 => _617.paintEvents, 'optionalAccess', _618 => _618.length]), () => ( 0)), layers, stroking: state.stroking };
11939
+ return { doc, strokes: new Map(doc.strokes.map((s) => [s.id, s])), events: _nullishCoalesce(_optionalChain([doc, 'access', _638 => _638.paintEvents, 'optionalAccess', _639 => _639.length]), () => ( 0)), layers, stroking: state.stroking };
11906
11940
  };
11907
11941
  let last = take();
11908
11942
  const check = () => {
@@ -11933,7 +11967,7 @@ function createPaintChangeFeed(controller, options = {}) {
11933
11967
  if (edited) pending = void 0;
11934
11968
  const change = {
11935
11969
  seq: ++seq,
11936
- origin: _nullishCoalesce(_optionalChain([commit, 'optionalAccess', _619 => _619.origin]), () => ( "user")),
11970
+ origin: _nullishCoalesce(_optionalChain([commit, 'optionalAccess', _640 => _640.origin]), () => ( "user")),
11937
11971
  ...commit ? { commit } : {},
11938
11972
  addedStrokes,
11939
11973
  removedStrokes,
@@ -12000,7 +12034,7 @@ function createPaintProposals(options) {
12000
12034
  };
12001
12035
  const strokeIds = () => new Set(controller.getStrokes().map((s) => s.id));
12002
12036
  const validate = (input) => {
12003
- if (!_optionalChain([input, 'access', _620 => _620.title, 'optionalAccess', _621 => _621.trim, 'call', _622 => _622()])) throw new PaintEditorError("A proposal needs a title: what it adds, in a few words.");
12037
+ if (!_optionalChain([input, 'access', _641 => _641.title, 'optionalAccess', _642 => _642.trim, 'call', _643 => _643()])) throw new PaintEditorError("A proposal needs a title: what it adds, in a few words.");
12004
12038
  if (!Array.isArray(input.ops) || !input.ops.length) throw new PaintEditorError("A proposal needs at least one op (stroke, wash or echo).");
12005
12039
  const place = _nullishCoalesce(input.place, () => ( "top"));
12006
12040
  if (place === "above") {
@@ -12012,7 +12046,7 @@ function createPaintProposals(options) {
12012
12046
  input.ops.forEach((op, i) => {
12013
12047
  const at = `ops[${i}]`;
12014
12048
  if (op.kind === "stroke") {
12015
- if (!_optionalChain([op, 'access', _623 => _623.points, 'optionalAccess', _624 => _624.length])) throw new PaintEditorError(`${at}: a stroke needs points in document pixels.`);
12049
+ if (!_optionalChain([op, 'access', _644 => _644.points, 'optionalAccess', _645 => _645.length])) throw new PaintEditorError(`${at}: a stroke needs points in document pixels.`);
12016
12050
  points += op.points.length;
12017
12051
  if (op.color !== void 0 && !HEX3.test(op.color)) throw new PaintEditorError(`${at}: color "${op.color}" is not #rrggbb.`);
12018
12052
  const brush = op.brushId ? controller.getBrush(op.brushId) : controller.getState().brush;
@@ -12024,7 +12058,7 @@ function createPaintProposals(options) {
12024
12058
  if (!HEX3.test(_nullishCoalesce(op.color, () => ( "")))) throw new PaintEditorError(`${at}: a wash needs color as #rrggbb.`);
12025
12059
  if (op.opacity !== void 0 && !(op.opacity > 0 && op.opacity <= 1)) throw new PaintEditorError(`${at}: opacity must be in (0, 1].`);
12026
12060
  } else if (op.kind === "echo") {
12027
- if (!_optionalChain([op, 'access', _625 => _625.strokeIds, 'optionalAccess', _626 => _626.length])) throw new PaintEditorError(`${at}: an echo needs strokeIds (list_strokes).`);
12061
+ if (!_optionalChain([op, 'access', _646 => _646.strokeIds, 'optionalAccess', _647 => _647.length])) throw new PaintEditorError(`${at}: an echo needs strokeIds (list_strokes).`);
12028
12062
  const unknown = op.strokeIds.filter((id) => !known.has(id));
12029
12063
  if (unknown.length) throw new PaintEditorError(`${at}: unknown stroke ${unknown.map((u) => `"${u}"`).join(", ")}. Call list_strokes for the ids.`);
12030
12064
  if (op.color !== void 0 && !HEX3.test(op.color)) throw new PaintEditorError(`${at}: color "${op.color}" is not #rrggbb.`);
@@ -12073,7 +12107,7 @@ function createPaintProposals(options) {
12073
12107
  ...input.layerId ? { layerId: input.layerId } : {},
12074
12108
  ...input.layerName ? { layerName: input.layerName } : {}
12075
12109
  });
12076
- const topLayerId = () => _optionalChain([controller, 'access', _627 => _627.listLayers, 'call', _628 => _628(), 'access', _629 => _629.find, 'call', _630 => _630((l) => l.parentId === null), 'optionalAccess', _631 => _631.id]);
12110
+ const topLayerId = () => _optionalChain([controller, 'access', _648 => _648.listLayers, 'call', _649 => _649(), 'access', _650 => _650.find, 'call', _651 => _651((l) => l.parentId === null), 'optionalAccess', _652 => _652.id]);
12077
12111
  return {
12078
12112
  getState: () => state,
12079
12113
  subscribe(listener) {
@@ -12260,7 +12294,7 @@ function createPaintProposalToolProvider(proposals, options = {}) {
12260
12294
  },
12261
12295
  annotations: { title: "Propose paint", ...WRITE6 },
12262
12296
  handler: (args, context) => {
12263
- const origin = _optionalChain([context, 'access', _632 => _632.actor, 'optionalAccess', _633 => _633.id]) ? `agent:${context.actor.id}` : options.fallbackOrigin;
12297
+ const origin = _optionalChain([context, 'access', _653 => _653.actor, 'optionalAccess', _654 => _654.id]) ? `agent:${context.actor.id}` : options.fallbackOrigin;
12264
12298
  const proposal = proposals.propose({ ...args, ...origin ? { origin } : {} });
12265
12299
  const { id: _id, missing: _missing, createdAt: _createdAt, ...rest } = describe(proposal);
12266
12300
  return { proposalId: proposal.id, ...rest };
@@ -12382,10 +12416,10 @@ function toolList(provider) {
12382
12416
  function uiTables() {
12383
12417
  return {
12384
12418
  tools: PAINT_TOOLS,
12385
- brushOptions: _chunkDDL3ZBHKcjs.BRUSH_OPTION_CONTROLS,
12419
+ brushOptions: _chunkYJANF2BLcjs.BRUSH_OPTION_CONTROLS,
12386
12420
  blendMenu: BLEND_MENU_GROUPS,
12387
12421
  layerEffects: _chunkPVJMTLPJcjs.LAYER_EFFECT_MENU.map(({ kind, label }) => ({ kind, label, controls: _chunkPVJMTLPJcjs.layerEffectControls.call(void 0, _chunkPVJMTLPJcjs.defaultLayerEffect.call(void 0, kind, kind)) })),
12388
- sliders: { paper: PAPER_SLIDERS, wet: WET_PARAM_SLIDERS, wetTilt: WET_TILT_SLIDERS, wetSpeed: WET_SPEED_SLIDER, light: LIGHT_SLIDERS, stroke: STROKE_SLIDERS, sticker: STICKER_SLIDERS },
12422
+ sliders: { paper: PAPER_SLIDERS, wet: WET_PARAM_SLIDERS, wetTilt: WET_TILT_SLIDERS, wetSpeed: WET_SPEED_SLIDER, light: LIGHT_SLIDERS, ghost: _chunk3JKCREEUcjs.GHOST_SLIDERS, stroke: STROKE_SLIDERS, sticker: STICKER_SLIDERS },
12389
12423
  pathStrokeTapers: PATH_STROKE_TAPERS,
12390
12424
  padSampleSizes: PAD_SAMPLE_SIZES,
12391
12425
  wetGpu: WET_GPU_OPTIONS,
@@ -12819,4 +12853,7 @@ function createPaintConformanceHost(setup, options) {
12819
12853
 
12820
12854
 
12821
12855
 
12822
- exports.BACKLIGHT_SPILL = BACKLIGHT_SPILL; exports.BLEND_MENU_GROUPS = BLEND_MENU_GROUPS; exports.BLEND_MODES = _chunk2VX55NFMcjs.BLEND_MODES; exports.BRUSH_ID = _chunkEU2ZZA6Lcjs.BRUSH_ID; exports.BRUSH_ROTATIONS = _chunkEU2ZZA6Lcjs.BRUSH_ROTATIONS; exports.BRUSH_SLIDERS = _chunk3KNQ2W6Xcjs.BRUSH_SLIDERS; exports.BUILTIN_BRUSHES = _chunkEU2ZZA6Lcjs.BUILTIN_BRUSHES; exports.BristleStroke = BristleStroke; exports.BrushSourceArtCache = BrushSourceArtCache; exports.DAB_FLIPS = _chunkEU2ZZA6Lcjs.DAB_FLIPS; exports.DEFAULT_BACKLIGHT_COLOR = DEFAULT_BACKLIGHT_COLOR; exports.DEFAULT_BEHAVIOR = _chunkEU2ZZA6Lcjs.DEFAULT_BEHAVIOR; exports.DEFAULT_BRISTLE = _chunkEU2ZZA6Lcjs.DEFAULT_BRISTLE; exports.DEFAULT_BRUSH_ID = _chunkEU2ZZA6Lcjs.DEFAULT_BRUSH_ID; exports.DEFAULT_DPI = DEFAULT_DPI; exports.DEFAULT_DYNAMICS = _chunkEU2ZZA6Lcjs.DEFAULT_DYNAMICS; exports.DEFAULT_FLOW = _chunkJ5VQYK7Tcjs.DEFAULT_FLOW; exports.DEFAULT_IMPASTO = _chunkEU2ZZA6Lcjs.DEFAULT_IMPASTO; exports.DEFAULT_LIGHT = _chunkEU2ZZA6Lcjs.DEFAULT_LIGHT; exports.DEFAULT_LIGHTING = DEFAULT_LIGHTING; exports.DEFAULT_MULTI_COLOR = _chunkEU2ZZA6Lcjs.DEFAULT_MULTI_COLOR; exports.DEFAULT_PAINT_GRADIENT = _chunkNIBFKXMDcjs.DEFAULT_PAINT_GRADIENT; exports.DEFAULT_PAINT_GRADIENT_MAPPING = _chunkNIBFKXMDcjs.DEFAULT_PAINT_GRADIENT_MAPPING; exports.DEFAULT_PAPER = _chunkJJ2H25JGcjs.DEFAULT_PAPER; exports.DEFAULT_PARTICLE = _chunkEU2ZZA6Lcjs.DEFAULT_PARTICLE; exports.DEFAULT_SPRAY = _chunkEU2ZZA6Lcjs.DEFAULT_SPRAY; exports.DEFAULT_STICKER = _chunkEU2ZZA6Lcjs.DEFAULT_STICKER; exports.DEFAULT_SWATCHES = DEFAULT_SWATCHES; exports.DEFAULT_TIP_GRAIN = _chunkEU2ZZA6Lcjs.DEFAULT_TIP_GRAIN; exports.DEFAULT_VIEW = DEFAULT_VIEW; exports.DEFAULT_WET_BRUSH = _chunkEU2ZZA6Lcjs.DEFAULT_WET_BRUSH; exports.DEFAULT_WET_PARAMS = _chunkJ5VQYK7Tcjs.DEFAULT_WET_PARAMS; exports.DOT_ROTATIONS = _chunkEU2ZZA6Lcjs.DOT_ROTATIONS; exports.DOT_ROTATION_LABELS = DOT_ROTATION_LABELS; exports.DOT_TEXTURE_ORDERS = _chunkEU2ZZA6Lcjs.DOT_TEXTURE_ORDERS; exports.DOT_TEXTURE_ORDER_LABELS = DOT_TEXTURE_ORDER_LABELS; exports.DryStroke = _chunkJJ2H25JGcjs.DryStroke; exports.EFFECT_MAP_REPEATS = _chunkJJ2H25JGcjs.EFFECT_MAP_REPEATS; exports.EFFECT_STRIP_HEIGHT = _chunkJJ2H25JGcjs.EFFECT_STRIP_HEIGHT; exports.GPU_LEAD = _chunkJJ2H25JGcjs.GPU_LEAD; exports.GRAIN_PATTERNS = _chunkNIBFKXMDcjs.GRAIN_PATTERNS; exports.GRAIN_TILE = _chunkNIBFKXMDcjs.GRAIN_TILE; exports.HARMONY_KINDS = _chunkI3Y2Q3PMcjs.HARMONY_KINDS; exports.IDENTITY_AFFINE = IDENTITY_AFFINE; exports.IDENTITY_COPY = _chunkJJ2H25JGcjs.IDENTITY_COPY; exports.IMPASTO_TOOLS = _chunkEU2ZZA6Lcjs.IMPASTO_TOOLS; exports.IMPASTO_TOOL_LABELS = IMPASTO_TOOL_LABELS; exports.LIGHT_SLIDERS = LIGHT_SLIDERS; exports.LIVE_STROKE_ENGINES = LIVE_STROKE_ENGINES; exports.LitCache = LitCache; exports.MAX_BRUSH_SIZE = _chunkNIBFKXMDcjs.MAX_BRUSH_SIZE; exports.MAX_CANVAS_SIDE = MAX_CANVAS_SIDE; exports.MAX_COORDINATE = MAX_COORDINATE; exports.MAX_DOT_TEXTURES = _chunkEU2ZZA6Lcjs.MAX_DOT_TEXTURES; exports.MAX_EFFECT_PATH_POINTS = _chunkJJ2H25JGcjs.MAX_EFFECT_PATH_POINTS; exports.MAX_IMAGE_SIDE = MAX_IMAGE_SIDE; exports.MAX_LIVE_EFFECT_SOURCES = MAX_LIVE_EFFECT_SOURCES; exports.MAX_PATH_SAMPLES = MAX_PATH_SAMPLES; exports.MAX_STICKER_STAMPS = _chunkEU2ZZA6Lcjs.MAX_STICKER_STAMPS; exports.MAX_ZOOM = MAX_ZOOM; exports.MIN_CANVAS_SIDE = MIN_CANVAS_SIDE; exports.MIN_ZOOM = MIN_ZOOM; exports.MIXING_PAD_HEIGHT = MIXING_PAD_HEIGHT; exports.MIXING_PAD_WIDTH = MIXING_PAD_WIDTH; exports.MULTI_COLOR_MODES = _chunkEU2ZZA6Lcjs.MULTI_COLOR_MODES; exports.MixingPad = MixingPad; exports.PAD_SAMPLE_SIZES = PAD_SAMPLE_SIZES; exports.PAINTERLY_BLEND_MODES = _chunk2VX55NFMcjs.PAINTERLY_BLEND_MODES; exports.PAINT_BRUSH_CATEGORIES = _chunkEU2ZZA6Lcjs.PAINT_BRUSH_CATEGORIES; exports.PAINT_BRUSH_ENGINES = _chunkEU2ZZA6Lcjs.PAINT_BRUSH_ENGINES; exports.PAINT_COLOR_JSON_SCHEMA = _chunkNIBFKXMDcjs.PAINT_COLOR_JSON_SCHEMA; exports.PAINT_CONTRACT_FORMAT_VERSION = PAINT_CONTRACT_FORMAT_VERSION; exports.PAINT_DOCUMENT_JSON_SCHEMA = PAINT_DOCUMENT_JSON_SCHEMA; exports.PAINT_EFFECT_PLACES = PAINT_EFFECT_PLACES; exports.PAINT_FORMAT = PAINT_FORMAT; exports.PAINT_GRADIENT_FULL_SPEED = _chunkNIBFKXMDcjs.PAINT_GRADIENT_FULL_SPEED; exports.PAINT_GRADIENT_JSON_SCHEMA = _chunkNIBFKXMDcjs.PAINT_GRADIENT_JSON_SCHEMA; exports.PAINT_GRADIENT_KIT = _chunkNIBFKXMDcjs.PAINT_GRADIENT_KIT; exports.PAINT_GRADIENT_MAPPINGS = _chunkNIBFKXMDcjs.PAINT_GRADIENT_MAPPINGS; exports.PAINT_GRADIENT_MAPPING_LABELS = _chunkNIBFKXMDcjs.PAINT_GRADIENT_MAPPING_LABELS; exports.PAINT_GRADIENT_PRESETS = _chunkNIBFKXMDcjs.PAINT_GRADIENT_PRESETS; exports.PAINT_GRADIENT_REPEATS = _chunkNIBFKXMDcjs.PAINT_GRADIENT_REPEATS; exports.PAINT_GRADIENT_REPEAT_LABELS = _chunkNIBFKXMDcjs.PAINT_GRADIENT_REPEAT_LABELS; exports.PAINT_GRADIENT_SPACES = _chunkNIBFKXMDcjs.PAINT_GRADIENT_SPACES; exports.PAINT_GRADIENT_SPACE_LABELS = _chunkNIBFKXMDcjs.PAINT_GRADIENT_SPACE_LABELS; exports.PAINT_SCHEMA_VERSION = PAINT_SCHEMA_VERSION; exports.PAINT_SHORTCUTS = PAINT_SHORTCUTS; exports.PAINT_SOURCE_JSON_SCHEMA = _chunkNIBFKXMDcjs.PAINT_SOURCE_JSON_SCHEMA; exports.PAINT_TARGET = PAINT_TARGET; exports.PAINT_TOOLS = PAINT_TOOLS; exports.PAPER_EFFECT_BLENDS = PAPER_EFFECT_BLENDS; exports.PAPER_EFFECT_NODE_ID = PAPER_EFFECT_NODE_ID; exports.PAPER_FAMILIES = _chunkJJ2H25JGcjs.PAPER_FAMILIES; exports.PAPER_LIBRARY = _chunkJJ2H25JGcjs.PAPER_LIBRARY; exports.PAPER_NODE_ID = PAPER_NODE_ID; exports.PAPER_SLIDERS = PAPER_SLIDERS; exports.PAPER_TARGET = PAPER_TARGET; exports.PARTICLE_KINDS = _chunkEU2ZZA6Lcjs.PARTICLE_KINDS; exports.PARTICLE_KIND_LABELS = PARTICLE_KIND_LABELS; exports.PARTICLE_RENDERS = _chunkEU2ZZA6Lcjs.PARTICLE_RENDERS; exports.PARTICLE_RENDER_LABELS = PARTICLE_RENDER_LABELS; exports.PATH_STROKE_TAPERS = PATH_STROKE_TAPERS; exports.PaintCanvasPresenter = PaintCanvasPresenter; exports.PaintDabStroke = _chunkJJ2H25JGcjs.PaintDabStroke; exports.PaintDirector = PaintDirector; exports.PaintDocumentError = PaintDocumentError; exports.PaintEditorController = PaintEditorController; exports.PaintEditorError = PaintEditorError; exports.PaintEffectsRenderer = PaintEffectsRenderer; exports.PaintGesture = PaintGesture; exports.PaintGradientSampler = _chunkNIBFKXMDcjs.PaintGradientSampler; exports.PaintPresence = PaintPresence; exports.PaintSourceError = _chunkNIBFKXMDcjs.PaintSourceError; exports.PaintStrokeSession = PaintStrokeSession; exports.PaintWetLayers = _chunkJJ2H25JGcjs.PaintWetLayers; exports.PaperGrain = _chunkNIBFKXMDcjs.PaperGrain; exports.ParticleStroke = ParticleStroke; exports.PenDabWalker = _chunkJJ2H25JGcjs.PenDabWalker; exports.PenSmoother = _chunkJJ2H25JGcjs.PenSmoother; exports.PerspectiveSnapper = PerspectiveSnapper; exports.RIBBON_PAIRS = _chunkEU2ZZA6Lcjs.RIBBON_PAIRS; exports.RIBBON_PAIR_LABELS = RIBBON_PAIR_LABELS; exports.SNAP_DECIDE_DISTANCE = SNAP_DECIDE_DISTANCE; exports.STAMP_KINDS = _chunkRDFHWAHLcjs.STAMP_KINDS; exports.STAMP_LABELS = STAMP_LABELS; exports.STENCIL_KINDS = STENCIL_KINDS; exports.STENCIL_SHAPES = STENCIL_SHAPES; exports.STICKER_ART_SIZE = STICKER_ART_SIZE; exports.STICKER_SLIDERS = STICKER_SLIDERS; exports.STROKE_SLIDERS = STROKE_SLIDERS; exports.SYMMETRY_MODES = SYMMETRY_MODES; exports.StencilSnapper = StencilSnapper; exports.StickerArtCache = StickerArtCache; exports.StickerBrowser = _chunk3VHH6V67cjs.StickerBrowser; exports.StickerSpray = StickerSpray; exports.TIP_GRAIN_MODES = _chunkEU2ZZA6Lcjs.TIP_GRAIN_MODES; exports.TRACING_NODE_ID = TRACING_NODE_ID; exports.ThickStrokeDriver = ThickStrokeDriver; exports.TileableNoise = _chunk3K6HWEXZcjs.TileableNoise; exports.TipGrain = _chunkJJ2H25JGcjs.TipGrain; exports.WET_FLOW_KINDS = _chunkJ5VQYK7Tcjs.WET_FLOW_KINDS; exports.WET_GPU_MODES = _chunkJJ2H25JGcjs.WET_GPU_MODES; exports.WET_GPU_OPTIONS = WET_GPU_OPTIONS; exports.WET_MEDIA = _chunkEU2ZZA6Lcjs.WET_MEDIA; exports.WET_MEDIUM_LABELS = WET_MEDIUM_LABELS; exports.WET_MEDIUM_PARAMS = _chunkJJ2H25JGcjs.WET_MEDIUM_PARAMS; exports.WET_PARAM_KEYS = _chunkJ5VQYK7Tcjs.WET_PARAM_KEYS; exports.WET_PARAM_SCHEMA = WET_PARAM_SCHEMA; exports.WET_PARAM_SLIDERS = WET_PARAM_SLIDERS; exports.WET_SPEED_SLIDER = WET_SPEED_SLIDER; exports.WET_TILT_SLIDERS = WET_TILT_SLIDERS; exports.WET_TOOLS = _chunkEU2ZZA6Lcjs.WET_TOOLS; exports.WET_TOOL_LABELS = WET_TOOL_LABELS; exports.WetStrokeDriver = _chunkJJ2H25JGcjs.WetStrokeDriver; exports.addPaintGradientStop = _chunkNIBFKXMDcjs.addPaintGradientStop; exports.addPolygonArea = addPolygonArea; exports.affineCopy = affineCopy; exports.applyAffine = applyAffine; exports.backlightOf = backlightOf; exports.brushEngineControls = _chunk3KNQ2W6Xcjs.brushEngineControls; exports.brushLoadColor = brushLoadColor; exports.brushLoadForStroke = brushLoadForStroke; exports.brushTakesPaint = _chunkEU2ZZA6Lcjs.brushTakesPaint; exports.brushToJSON = _chunkEU2ZZA6Lcjs.brushToJSON; exports.buildTimeLapse = buildTimeLapse; exports.checkPaintEffectPlace = checkPaintEffectPlace; exports.clonePaper = _chunkJJ2H25JGcjs.clonePaper; exports.colorHarmony = colorHarmony2; exports.composeAffine = composeAffine; exports.contactSheet = contactSheet; exports.createPaintAgentStrokes = createPaintAgentStrokes; exports.createPaintBrushLibraryToolProvider = createPaintBrushLibraryToolProvider; exports.createPaintChangeFeed = createPaintChangeFeed; exports.createPaintCompositor = createPaintCompositor; exports.createPaintConformanceHost = createPaintConformanceHost; exports.createPaintDocument = createPaintDocument; exports.createPaintEditorDocument = createPaintEditorDocument; exports.createPaintEditorToolProvider = createPaintEditorToolProvider; exports.createPaintEffectsToolProvider = createPaintEffectsToolProvider; exports.createPaintLayer = createPaintLayer; exports.createPaintProposalToolProvider = createPaintProposalToolProvider; exports.createPaintProposals = createPaintProposals; exports.createPaintReplayTools = createPaintReplayTools; exports.createPaintStickerTools = createPaintStickerTools; exports.createPaintThickTools = createPaintThickTools; exports.createPaintWetTools = createPaintWetTools; exports.decodeImageBlob = decodeImageBlob; exports.defaultGuides = defaultGuides; exports.defaultImageEncoder = defaultImageEncoder; exports.defaultStickerRasterizer = defaultStickerRasterizer; exports.deserializePaintDocument = deserializePaintDocument; exports.deserializePaintDocumentAsync = deserializePaintDocumentAsync; exports.documentExtensions = documentExtensions; exports.documentToScreen = documentToScreen; exports.downloadBytes = downloadBytes; exports.downsampleRgba = downsampleRgba; exports.drawSticker = drawSticker; exports.drawWaterOverlay = drawWaterOverlay; exports.effectDabField = _chunkJJ2H25JGcjs.effectDabField; exports.effectLayersToJSON = effectLayersToJSON; exports.effectPaintKey = _chunkJJ2H25JGcjs.effectPaintKey; exports.effectPaintSize = _chunkJJ2H25JGcjs.effectPaintSize; exports.emptiedLayers = emptiedLayers; exports.emptyThickChannels = emptyThickChannels; exports.engineBrushSourceIds = engineBrushSourceIds; exports.fitZoom = fitZoom; exports.grainCatch = _chunkNIBFKXMDcjs.grainCatch; exports.grainHeights = _chunkNIBFKXMDcjs.grainHeights; exports.guideOverlay = guideOverlay; exports.handlePaintShortcut = handlePaintShortcut; exports.hash2 = _chunk3K6HWEXZcjs.hash2; exports.hexToPaintRgb = _chunkNIBFKXMDcjs.hexToPaintRgb; exports.hexToRgb8 = _chunkJJ2H25JGcjs.hexToRgb8; exports.hslToRgb = hslToRgb; exports.hsvToRgb = hsvToRgb; exports.hueToWheel = _chunkI3Y2Q3PMcjs.hueToWheel; exports.inferEffectPathControl = _chunkJJ2H25JGcjs.inferEffectPathControl; exports.invertAffine = invertAffine; exports.isBlendMode = _chunk2VX55NFMcjs.isBlendMode; exports.isGradientPaint = _chunkNIBFKXMDcjs.isGradientPaint; exports.isPaintEffectPaint = _chunkJJ2H25JGcjs.isPaintEffectPaint; exports.isPainterlyBlendMode = _chunk2VX55NFMcjs.isPainterlyBlendMode; exports.isPalmTouch = isPalmTouch; exports.isWetBrush = _chunkEU2ZZA6Lcjs.isWetBrush; exports.isWetCapable = _chunkEU2ZZA6Lcjs.isWetCapable; exports.lightTile = lightTile; exports.lightingKey = lightingKey; exports.liveStrokeBounds = liveStrokeBounds; exports.liveStrokeRefusal = liveStrokeRefusal; exports.mapPenPoint = mapPenPoint; exports.mix32 = _chunk3K6HWEXZcjs.mix32; exports.mixPixels = mixPixels; exports.mixerLoadForStroke = mixerLoadForStroke; exports.mixerTip = _chunkJJ2H25JGcjs.mixerTip; exports.multiColorForDab = _chunkJJ2H25JGcjs.multiColorForDab; exports.multiColorGradient = _chunkJJ2H25JGcjs.multiColorGradient; exports.multiColorPalette = _chunkJJ2H25JGcjs.multiColorPalette; exports.multiColorSliders = _chunk3KNQ2W6Xcjs.multiColorSliders; exports.multiColorToPaint = _chunkEU2ZZA6Lcjs.multiColorToPaint; exports.newPaintLayerId = newPaintLayerId; exports.nextPaperEffectVersion = nextPaperEffectVersion; exports.normalizeBehavior = _chunkEU2ZZA6Lcjs.normalizeBehavior; exports.normalizeBristle = _chunkEU2ZZA6Lcjs.normalizeBristle; exports.normalizeBrushStroke = normalizeBrushStroke; exports.normalizeCanvas = normalizeCanvas; exports.normalizeDynamics = _chunkEU2ZZA6Lcjs.normalizeDynamics; exports.normalizeFlow = _chunkJ5VQYK7Tcjs.normalizeFlow; exports.normalizeHexColor = _chunkNIBFKXMDcjs.normalizeHexColor; exports.normalizeImpasto = _chunkEU2ZZA6Lcjs.normalizeImpasto; exports.normalizeLight = _chunkEU2ZZA6Lcjs.normalizeLight; exports.normalizeLighting = normalizeLighting; exports.normalizeMultiColor = _chunkEU2ZZA6Lcjs.normalizeMultiColor; exports.normalizePaintBrush = _chunkEU2ZZA6Lcjs.normalizePaintBrush; exports.normalizePaper = _chunkJJ2H25JGcjs.normalizePaper; exports.normalizeParticle = _chunkEU2ZZA6Lcjs.normalizeParticle; exports.normalizePerspective = normalizePerspective; exports.normalizeRotation = normalizeRotation; exports.normalizeStencil = normalizeStencil; exports.normalizeStickerSettings = _chunkEU2ZZA6Lcjs.normalizeStickerSettings; exports.normalizeStickerUpdate = normalizeStickerUpdate; exports.normalizeSymmetry = normalizeSymmetry; exports.normalizeView = normalizeView; exports.normalizeWetBrush = _chunkEU2ZZA6Lcjs.normalizeWetBrush; exports.normalizeWetParams = _chunkJ5VQYK7Tcjs.normalizeWetParams; exports.overPixels = overPixels; exports.padSampleRadius = padSampleRadius; exports.paintAgentStrokePoints = paintAgentStrokePoints; exports.paintBrushPreviewRenderer = paintBrushPreviewRenderer; exports.paintContracts = paintContracts; exports.paintGradientMappingFor = _chunkNIBFKXMDcjs.paintGradientMappingFor; exports.paintPlaybackPanel = paintPlaybackPanel; exports.paintProposalGhost = paintProposalGhost; exports.paintShortcutFor = paintShortcutFor; exports.paintSourceColor = _chunkNIBFKXMDcjs.paintSourceColor; exports.paintSourceCss = _chunkNIBFKXMDcjs.paintSourceCss; exports.paintToMultiColor = _chunkEU2ZZA6Lcjs.paintToMultiColor; exports.paperEffectFromJSON = paperEffectFromJSON; exports.paperEffectToJSON = paperEffectToJSON; exports.paperGrain = paperGrain; exports.paperKey = paperKey; exports.paperNode = paperNode; exports.paperPreset = _chunkJJ2H25JGcjs.paperPreset; exports.parseBrushLibrary = _chunkEU2ZZA6Lcjs.parseBrushLibrary; exports.parseHexColor = parseHexColor; exports.parsePaintSource = _chunkNIBFKXMDcjs.parsePaintSource; exports.patchBrushValue = _chunk3KNQ2W6Xcjs.patchBrushValue; exports.patchPath = patchPath; exports.penOrientation = _chunkJJ2H25JGcjs.penOrientation; exports.perspectiveDirections = perspectiveDirections; exports.perspectiveGuideLines = perspectiveGuideLines; exports.planPaintToolPlayback = planPaintToolPlayback; exports.pointerToPenPoint = pointerToPenPoint; exports.quickStencil = quickStencil; exports.rand01 = _chunk3K6HWEXZcjs.rand01; exports.randSigned = _chunk3K6HWEXZcjs.randSigned; exports.readEffectStrokeMap = _chunkJJ2H25JGcjs.readEffectStrokeMap; exports.readPaintEffectPaint = _chunkJJ2H25JGcjs.readPaintEffectPaint; exports.readPaintEffectSource = readPaintEffectSource; exports.readPaintSource = _chunkNIBFKXMDcjs.readPaintSource; exports.readPath = readPath; exports.readSwatch = readSwatch; exports.reliefInfo = reliefInfo; exports.removePaintGradientStop = _chunkNIBFKXMDcjs.removePaintGradientStop; exports.renderBrushThumbnail = renderBrushThumbnail; exports.renderColorWheel = renderColorWheel; exports.renderPaper = _chunkJJ2H25JGcjs.renderPaper; exports.renderStickers = renderStickers; exports.replayFrame = replayFrame; exports.replayItems = replayItems; exports.replayPainting = replayPainting; exports.resolvePaintGradient = _chunkNIBFKXMDcjs.resolvePaintGradient; exports.reversePaintGradient = _chunkNIBFKXMDcjs.reversePaintGradient; exports.rgbToHexColor = rgbToHexColor; exports.rgbToHsl = rgbToHsl; exports.rgbToHsv = rgbToHsv; exports.sampleArt = sampleArt; exports.sampleEffectAt = _chunkJJ2H25JGcjs.sampleEffectAt; exports.sampleEffectField = _chunkJJ2H25JGcjs.sampleEffectField; exports.samplePath = samplePath; exports.samplePressure = samplePressure; exports.scalePaintGradient = _chunkNIBFKXMDcjs.scalePaintGradient; exports.scaleStencil = scaleStencil; exports.screenToDocument = screenToDocument; exports.seedFromString = _chunk3K6HWEXZcjs.seedFromString; exports.serializePaintDocument = serializePaintDocument; exports.serializePaintDocumentExternal = serializePaintDocumentExternal; exports.solidPaint = _chunkNIBFKXMDcjs.solidPaint; exports.stampCoverage = _chunkRDFHWAHLcjs.stampCoverage; exports.standardBlendMode = _chunk2VX55NFMcjs.standardBlendMode; exports.startWetClock = startWetClock; exports.stencilMask = stencilMask; exports.stencilOutline = stencilOutline; exports.stickerAt = stickerAt; exports.stickerRect = stickerRect; exports.stickerRefLabel = stickerRefLabel; exports.stickerStamp = stickerStamp; exports.stickerSurface = stickerSurface; exports.strokeBounds = strokeBounds; exports.strokeDuration = strokeDuration; exports.strokePathPoints = _chunkJJ2H25JGcjs.strokePathPoints; exports.strokeSchedule = strokeSchedule; exports.strokeToJSON = strokeToJSON; exports.sweepPath = sweepPath; exports.symmetryAxisAngles = symmetryAxisAngles; exports.symmetryAxisSegments = symmetryAxisSegments; exports.symmetryCopies = symmetryCopies; exports.thickFromJSON = thickFromJSON; exports.thickToJSON = thickToJSON; exports.thumbnailStroke = thumbnailStroke; exports.tiltToOrientation = _chunkJJ2H25JGcjs.tiltToOrientation; exports.timeLapseVideo = timeLapseVideo; exports.timeLapseZip = timeLapseZip; exports.toStrokePoint = _chunkJJ2H25JGcjs.toStrokePoint; exports.toggleDotTexture = toggleDotTexture; exports.toggleStamp = toggleStamp; exports.toggleStickerRef = toggleStickerRef; exports.translateStencil = translateStencil; exports.updatePaintGradientStop = _chunkNIBFKXMDcjs.updatePaintGradientStop; exports.usesPaintExchange = _chunkEU2ZZA6Lcjs.usesPaintExchange; exports.variationAffine = variationAffine; exports.varyStroke = varyStroke; exports.viewCssTransform = viewCssTransform; exports.viewMatrix = viewMatrix; exports.viewPenToDocument = viewPenToDocument; exports.wetEngineSummary = wetEngineSummary; exports.wetPaperInput = _chunkJJ2H25JGcjs.wetPaperInput; exports.wetPigmentOf = _chunkJJ2H25JGcjs.wetPigmentOf; exports.wetSupport = _chunkJ5VQYK7Tcjs.wetSupport; exports.wheelAngle = wheelAngle; exports.wheelPick = wheelPick; exports.wheelPoint = wheelPoint; exports.wheelToHue = _chunkI3Y2Q3PMcjs.wheelToHue; exports.withPaintPlayback = withPaintPlayback; exports.withStrokePath = _chunkJJ2H25JGcjs.withStrokePath;
12856
+
12857
+
12858
+
12859
+ exports.BACKLIGHT_SPILL = BACKLIGHT_SPILL; exports.BLEND_MENU_GROUPS = BLEND_MENU_GROUPS; exports.BLEND_MODES = _chunk2VX55NFMcjs.BLEND_MODES; exports.BRUSH_ID = _chunkGHGBIAWQcjs.BRUSH_ID; exports.BRUSH_ROTATIONS = _chunkGHGBIAWQcjs.BRUSH_ROTATIONS; exports.BRUSH_SLIDERS = _chunk3JKCREEUcjs.BRUSH_SLIDERS; exports.BUILTIN_BRUSHES = _chunkGHGBIAWQcjs.BUILTIN_BRUSHES; exports.BristleStroke = BristleStroke; exports.BrushSourceArtCache = BrushSourceArtCache; exports.DAB_FLIPS = _chunkGHGBIAWQcjs.DAB_FLIPS; exports.DEFAULT_BACKLIGHT_COLOR = DEFAULT_BACKLIGHT_COLOR; exports.DEFAULT_BEHAVIOR = _chunkGHGBIAWQcjs.DEFAULT_BEHAVIOR; exports.DEFAULT_BRISTLE = _chunkGHGBIAWQcjs.DEFAULT_BRISTLE; exports.DEFAULT_BRUSH_ID = _chunkGHGBIAWQcjs.DEFAULT_BRUSH_ID; exports.DEFAULT_DPI = DEFAULT_DPI; exports.DEFAULT_DYNAMICS = _chunkGHGBIAWQcjs.DEFAULT_DYNAMICS; exports.DEFAULT_FLOW = _chunkN5IMDAHMcjs.DEFAULT_FLOW; exports.DEFAULT_GHOST = _chunkGHGBIAWQcjs.DEFAULT_GHOST; exports.DEFAULT_IMPASTO = _chunkGHGBIAWQcjs.DEFAULT_IMPASTO; exports.DEFAULT_LIGHT = _chunkGHGBIAWQcjs.DEFAULT_LIGHT; exports.DEFAULT_LIGHTING = DEFAULT_LIGHTING; exports.DEFAULT_MULTI_COLOR = _chunkGHGBIAWQcjs.DEFAULT_MULTI_COLOR; exports.DEFAULT_PAINT_GRADIENT = _chunkNIBFKXMDcjs.DEFAULT_PAINT_GRADIENT; exports.DEFAULT_PAINT_GRADIENT_MAPPING = _chunkNIBFKXMDcjs.DEFAULT_PAINT_GRADIENT_MAPPING; exports.DEFAULT_PAPER = _chunkSNAFFCAXcjs.DEFAULT_PAPER; exports.DEFAULT_PARTICLE = _chunkGHGBIAWQcjs.DEFAULT_PARTICLE; exports.DEFAULT_SPRAY = _chunkGHGBIAWQcjs.DEFAULT_SPRAY; exports.DEFAULT_STICKER = _chunkGHGBIAWQcjs.DEFAULT_STICKER; exports.DEFAULT_SWATCHES = DEFAULT_SWATCHES; exports.DEFAULT_TIP_GRAIN = _chunkGHGBIAWQcjs.DEFAULT_TIP_GRAIN; exports.DEFAULT_VIEW = DEFAULT_VIEW; exports.DEFAULT_WET_BRUSH = _chunkGHGBIAWQcjs.DEFAULT_WET_BRUSH; exports.DEFAULT_WET_PARAMS = _chunkN5IMDAHMcjs.DEFAULT_WET_PARAMS; exports.DOT_ROTATIONS = _chunkGHGBIAWQcjs.DOT_ROTATIONS; exports.DOT_ROTATION_LABELS = DOT_ROTATION_LABELS; exports.DOT_TEXTURE_ORDERS = _chunkGHGBIAWQcjs.DOT_TEXTURE_ORDERS; exports.DOT_TEXTURE_ORDER_LABELS = DOT_TEXTURE_ORDER_LABELS; exports.DryStroke = _chunkSNAFFCAXcjs.DryStroke; exports.EFFECT_MAP_REPEATS = _chunkSNAFFCAXcjs.EFFECT_MAP_REPEATS; exports.EFFECT_STRIP_HEIGHT = _chunkSNAFFCAXcjs.EFFECT_STRIP_HEIGHT; exports.GHOST_SLIDERS = _chunk3JKCREEUcjs.GHOST_SLIDERS; exports.GPU_LEAD = _chunkSNAFFCAXcjs.GPU_LEAD; exports.GRAIN_PATTERNS = _chunkNIBFKXMDcjs.GRAIN_PATTERNS; exports.GRAIN_TILE = _chunkNIBFKXMDcjs.GRAIN_TILE; exports.HARMONY_KINDS = _chunkI3Y2Q3PMcjs.HARMONY_KINDS; exports.IDENTITY_AFFINE = IDENTITY_AFFINE; exports.IDENTITY_COPY = _chunkSNAFFCAXcjs.IDENTITY_COPY; exports.IMPASTO_TOOLS = _chunkGHGBIAWQcjs.IMPASTO_TOOLS; exports.IMPASTO_TOOL_LABELS = IMPASTO_TOOL_LABELS; exports.LIGHT_SLIDERS = LIGHT_SLIDERS; exports.LIVE_STROKE_ENGINES = LIVE_STROKE_ENGINES; exports.LitCache = LitCache; exports.MAX_BRUSH_SIZE = _chunkNIBFKXMDcjs.MAX_BRUSH_SIZE; exports.MAX_CANVAS_SIDE = MAX_CANVAS_SIDE; exports.MAX_COORDINATE = MAX_COORDINATE; exports.MAX_DOT_TEXTURES = _chunkGHGBIAWQcjs.MAX_DOT_TEXTURES; exports.MAX_EFFECT_PATH_POINTS = _chunkSNAFFCAXcjs.MAX_EFFECT_PATH_POINTS; exports.MAX_IMAGE_SIDE = MAX_IMAGE_SIDE; exports.MAX_LIVE_EFFECT_SOURCES = MAX_LIVE_EFFECT_SOURCES; exports.MAX_PATH_SAMPLES = MAX_PATH_SAMPLES; exports.MAX_STICKER_STAMPS = _chunkGHGBIAWQcjs.MAX_STICKER_STAMPS; exports.MAX_ZOOM = MAX_ZOOM; exports.MIN_CANVAS_SIDE = MIN_CANVAS_SIDE; exports.MIN_ZOOM = MIN_ZOOM; exports.MIXING_PAD_HEIGHT = MIXING_PAD_HEIGHT; exports.MIXING_PAD_WIDTH = MIXING_PAD_WIDTH; exports.MULTI_COLOR_MODES = _chunkGHGBIAWQcjs.MULTI_COLOR_MODES; exports.MixingPad = MixingPad; exports.PAD_SAMPLE_SIZES = PAD_SAMPLE_SIZES; exports.PAINTERLY_BLEND_MODES = _chunk2VX55NFMcjs.PAINTERLY_BLEND_MODES; exports.PAINT_BRUSH_CATEGORIES = _chunkGHGBIAWQcjs.PAINT_BRUSH_CATEGORIES; exports.PAINT_BRUSH_ENGINES = _chunkGHGBIAWQcjs.PAINT_BRUSH_ENGINES; exports.PAINT_COLOR_JSON_SCHEMA = _chunkNIBFKXMDcjs.PAINT_COLOR_JSON_SCHEMA; exports.PAINT_CONTRACT_FORMAT_VERSION = PAINT_CONTRACT_FORMAT_VERSION; exports.PAINT_DOCUMENT_JSON_SCHEMA = PAINT_DOCUMENT_JSON_SCHEMA; exports.PAINT_EFFECT_PLACES = PAINT_EFFECT_PLACES; exports.PAINT_FORMAT = PAINT_FORMAT; exports.PAINT_GRADIENT_FULL_SPEED = _chunkNIBFKXMDcjs.PAINT_GRADIENT_FULL_SPEED; exports.PAINT_GRADIENT_JSON_SCHEMA = _chunkNIBFKXMDcjs.PAINT_GRADIENT_JSON_SCHEMA; exports.PAINT_GRADIENT_KIT = _chunkNIBFKXMDcjs.PAINT_GRADIENT_KIT; exports.PAINT_GRADIENT_MAPPINGS = _chunkNIBFKXMDcjs.PAINT_GRADIENT_MAPPINGS; exports.PAINT_GRADIENT_MAPPING_LABELS = _chunkNIBFKXMDcjs.PAINT_GRADIENT_MAPPING_LABELS; exports.PAINT_GRADIENT_PRESETS = _chunkNIBFKXMDcjs.PAINT_GRADIENT_PRESETS; exports.PAINT_GRADIENT_REPEATS = _chunkNIBFKXMDcjs.PAINT_GRADIENT_REPEATS; exports.PAINT_GRADIENT_REPEAT_LABELS = _chunkNIBFKXMDcjs.PAINT_GRADIENT_REPEAT_LABELS; exports.PAINT_GRADIENT_SPACES = _chunkNIBFKXMDcjs.PAINT_GRADIENT_SPACES; exports.PAINT_GRADIENT_SPACE_LABELS = _chunkNIBFKXMDcjs.PAINT_GRADIENT_SPACE_LABELS; exports.PAINT_SCHEMA_VERSION = PAINT_SCHEMA_VERSION; exports.PAINT_SHORTCUTS = PAINT_SHORTCUTS; exports.PAINT_SOURCE_JSON_SCHEMA = _chunkNIBFKXMDcjs.PAINT_SOURCE_JSON_SCHEMA; exports.PAINT_TARGET = PAINT_TARGET; exports.PAINT_TOOLS = PAINT_TOOLS; exports.PAPER_EFFECT_BLENDS = PAPER_EFFECT_BLENDS; exports.PAPER_EFFECT_NODE_ID = PAPER_EFFECT_NODE_ID; exports.PAPER_FAMILIES = _chunkSNAFFCAXcjs.PAPER_FAMILIES; exports.PAPER_LIBRARY = _chunkSNAFFCAXcjs.PAPER_LIBRARY; exports.PAPER_NODE_ID = PAPER_NODE_ID; exports.PAPER_SLIDERS = PAPER_SLIDERS; exports.PAPER_TARGET = PAPER_TARGET; exports.PARTICLE_KINDS = _chunkGHGBIAWQcjs.PARTICLE_KINDS; exports.PARTICLE_KIND_LABELS = PARTICLE_KIND_LABELS; exports.PARTICLE_RENDERS = _chunkGHGBIAWQcjs.PARTICLE_RENDERS; exports.PARTICLE_RENDER_LABELS = PARTICLE_RENDER_LABELS; exports.PATH_STROKE_TAPERS = PATH_STROKE_TAPERS; exports.PaintCanvasPresenter = PaintCanvasPresenter; exports.PaintDabStroke = _chunkSNAFFCAXcjs.PaintDabStroke; exports.PaintDirector = PaintDirector; exports.PaintDocumentError = PaintDocumentError; exports.PaintEditorController = PaintEditorController; exports.PaintEditorError = PaintEditorError; exports.PaintEffectsRenderer = PaintEffectsRenderer; exports.PaintGesture = PaintGesture; exports.PaintGradientSampler = _chunkNIBFKXMDcjs.PaintGradientSampler; exports.PaintPresence = PaintPresence; exports.PaintSourceError = _chunkNIBFKXMDcjs.PaintSourceError; exports.PaintStrokeSession = PaintStrokeSession; exports.PaintWetLayers = _chunkSNAFFCAXcjs.PaintWetLayers; exports.PaperGrain = _chunkNIBFKXMDcjs.PaperGrain; exports.ParticleStroke = ParticleStroke; exports.PenDabWalker = _chunkSNAFFCAXcjs.PenDabWalker; exports.PenSmoother = _chunkSNAFFCAXcjs.PenSmoother; exports.PerspectiveSnapper = PerspectiveSnapper; exports.RIBBON_PAIRS = _chunkGHGBIAWQcjs.RIBBON_PAIRS; exports.RIBBON_PAIR_LABELS = RIBBON_PAIR_LABELS; exports.SNAP_DECIDE_DISTANCE = SNAP_DECIDE_DISTANCE; exports.STAMP_KINDS = _chunkRDFHWAHLcjs.STAMP_KINDS; exports.STAMP_LABELS = STAMP_LABELS; exports.STENCIL_KINDS = STENCIL_KINDS; exports.STENCIL_SHAPES = STENCIL_SHAPES; exports.STICKER_ART_SIZE = STICKER_ART_SIZE; exports.STICKER_SLIDERS = STICKER_SLIDERS; exports.STROKE_SLIDERS = STROKE_SLIDERS; exports.SYMMETRY_MODES = SYMMETRY_MODES; exports.StencilSnapper = StencilSnapper; exports.StickerArtCache = StickerArtCache; exports.StickerBrowser = _chunk3VHH6V67cjs.StickerBrowser; exports.StickerSpray = StickerSpray; exports.TIP_GRAIN_MODES = _chunkGHGBIAWQcjs.TIP_GRAIN_MODES; exports.TRACING_NODE_ID = TRACING_NODE_ID; exports.ThickStrokeDriver = ThickStrokeDriver; exports.TileableNoise = _chunk3K6HWEXZcjs.TileableNoise; exports.TipGrain = _chunkSNAFFCAXcjs.TipGrain; exports.WET_FLOW_KINDS = _chunkN5IMDAHMcjs.WET_FLOW_KINDS; exports.WET_GPU_MODES = _chunkSNAFFCAXcjs.WET_GPU_MODES; exports.WET_GPU_OPTIONS = WET_GPU_OPTIONS; exports.WET_MEDIA = _chunkGHGBIAWQcjs.WET_MEDIA; exports.WET_MEDIUM_LABELS = WET_MEDIUM_LABELS; exports.WET_MEDIUM_PARAMS = _chunkSNAFFCAXcjs.WET_MEDIUM_PARAMS; exports.WET_PARAM_KEYS = _chunkN5IMDAHMcjs.WET_PARAM_KEYS; exports.WET_PARAM_SCHEMA = WET_PARAM_SCHEMA; exports.WET_PARAM_SLIDERS = WET_PARAM_SLIDERS; exports.WET_SPEED_SLIDER = WET_SPEED_SLIDER; exports.WET_TILT_SLIDERS = WET_TILT_SLIDERS; exports.WET_TOOLS = _chunkGHGBIAWQcjs.WET_TOOLS; exports.WET_TOOL_LABELS = WET_TOOL_LABELS; exports.WetStrokeDriver = _chunkSNAFFCAXcjs.WetStrokeDriver; exports.addPaintGradientStop = _chunkNIBFKXMDcjs.addPaintGradientStop; exports.addPolygonArea = addPolygonArea; exports.affineCopy = affineCopy; exports.applyAffine = applyAffine; exports.backlightOf = backlightOf; exports.brushEngineControls = _chunk3JKCREEUcjs.brushEngineControls; exports.brushLoadColor = brushLoadColor; exports.brushLoadForStroke = brushLoadForStroke; exports.brushTakesPaint = _chunkGHGBIAWQcjs.brushTakesPaint; exports.brushToJSON = _chunkGHGBIAWQcjs.brushToJSON; exports.buildTimeLapse = buildTimeLapse; exports.checkPaintEffectPlace = checkPaintEffectPlace; exports.clonePaper = _chunkSNAFFCAXcjs.clonePaper; exports.colorHarmony = colorHarmony2; exports.composeAffine = composeAffine; exports.contactSheet = contactSheet; exports.createPaintAgentStrokes = createPaintAgentStrokes; exports.createPaintBrushLibraryToolProvider = createPaintBrushLibraryToolProvider; exports.createPaintChangeFeed = createPaintChangeFeed; exports.createPaintCompositor = createPaintCompositor; exports.createPaintConformanceHost = createPaintConformanceHost; exports.createPaintDocument = createPaintDocument; exports.createPaintEditorDocument = createPaintEditorDocument; exports.createPaintEditorToolProvider = createPaintEditorToolProvider; exports.createPaintEffectsToolProvider = createPaintEffectsToolProvider; exports.createPaintLayer = createPaintLayer; exports.createPaintProposalToolProvider = createPaintProposalToolProvider; exports.createPaintProposals = createPaintProposals; exports.createPaintReplayTools = createPaintReplayTools; exports.createPaintStickerTools = createPaintStickerTools; exports.createPaintThickTools = createPaintThickTools; exports.createPaintWetTools = createPaintWetTools; exports.decodeImageBlob = decodeImageBlob; exports.defaultGuides = defaultGuides; exports.defaultImageEncoder = defaultImageEncoder; exports.defaultStickerRasterizer = defaultStickerRasterizer; exports.deserializePaintDocument = deserializePaintDocument; exports.deserializePaintDocumentAsync = deserializePaintDocumentAsync; exports.documentExtensions = documentExtensions; exports.documentToScreen = documentToScreen; exports.downloadBytes = downloadBytes; exports.downsampleRgba = downsampleRgba; exports.drawSticker = drawSticker; exports.drawWaterOverlay = drawWaterOverlay; exports.effectDabField = _chunkSNAFFCAXcjs.effectDabField; exports.effectLayersToJSON = effectLayersToJSON; exports.effectPaintKey = _chunkSNAFFCAXcjs.effectPaintKey; exports.effectPaintSize = _chunkSNAFFCAXcjs.effectPaintSize; exports.emptiedLayers = emptiedLayers; exports.emptyThickChannels = emptyThickChannels; exports.engineBrushSourceIds = engineBrushSourceIds; exports.fitZoom = fitZoom; exports.grainCatch = _chunkNIBFKXMDcjs.grainCatch; exports.grainHeights = _chunkNIBFKXMDcjs.grainHeights; exports.guideOverlay = guideOverlay; exports.handlePaintShortcut = handlePaintShortcut; exports.hash2 = _chunk3K6HWEXZcjs.hash2; exports.hexToPaintRgb = _chunkNIBFKXMDcjs.hexToPaintRgb; exports.hexToRgb8 = _chunkSNAFFCAXcjs.hexToRgb8; exports.hslToRgb = hslToRgb; exports.hsvToRgb = hsvToRgb; exports.hueToWheel = _chunkI3Y2Q3PMcjs.hueToWheel; exports.inferEffectPathControl = _chunkSNAFFCAXcjs.inferEffectPathControl; exports.invertAffine = invertAffine; exports.isBlendMode = _chunk2VX55NFMcjs.isBlendMode; exports.isGradientPaint = _chunkNIBFKXMDcjs.isGradientPaint; exports.isPaintEffectPaint = _chunkSNAFFCAXcjs.isPaintEffectPaint; exports.isPainterlyBlendMode = _chunk2VX55NFMcjs.isPainterlyBlendMode; exports.isPalmTouch = isPalmTouch; exports.isWetBrush = _chunkGHGBIAWQcjs.isWetBrush; exports.isWetCapable = _chunkGHGBIAWQcjs.isWetCapable; exports.lightTile = lightTile; exports.lightingKey = lightingKey; exports.liveStrokeBounds = liveStrokeBounds; exports.liveStrokeRefusal = liveStrokeRefusal; exports.mapPenPoint = mapPenPoint; exports.mix32 = _chunk3K6HWEXZcjs.mix32; exports.mixPixels = mixPixels; exports.mixerLoadForStroke = mixerLoadForStroke; exports.mixerTip = _chunkSNAFFCAXcjs.mixerTip; exports.multiColorForDab = _chunkSNAFFCAXcjs.multiColorForDab; exports.multiColorGradient = _chunkSNAFFCAXcjs.multiColorGradient; exports.multiColorPalette = _chunkSNAFFCAXcjs.multiColorPalette; exports.multiColorSliders = _chunk3JKCREEUcjs.multiColorSliders; exports.multiColorToPaint = _chunkGHGBIAWQcjs.multiColorToPaint; exports.newPaintLayerId = newPaintLayerId; exports.nextPaperEffectVersion = nextPaperEffectVersion; exports.normalizeBehavior = _chunkGHGBIAWQcjs.normalizeBehavior; exports.normalizeBristle = _chunkGHGBIAWQcjs.normalizeBristle; exports.normalizeBrushStroke = normalizeBrushStroke; exports.normalizeCanvas = normalizeCanvas; exports.normalizeDynamics = _chunkGHGBIAWQcjs.normalizeDynamics; exports.normalizeFlow = _chunkN5IMDAHMcjs.normalizeFlow; exports.normalizeGhost = _chunkGHGBIAWQcjs.normalizeGhost; exports.normalizeHexColor = _chunkNIBFKXMDcjs.normalizeHexColor; exports.normalizeImpasto = _chunkGHGBIAWQcjs.normalizeImpasto; exports.normalizeLight = _chunkGHGBIAWQcjs.normalizeLight; exports.normalizeLighting = normalizeLighting; exports.normalizeMultiColor = _chunkGHGBIAWQcjs.normalizeMultiColor; exports.normalizePaintBrush = _chunkGHGBIAWQcjs.normalizePaintBrush; exports.normalizePaper = _chunkSNAFFCAXcjs.normalizePaper; exports.normalizeParticle = _chunkGHGBIAWQcjs.normalizeParticle; exports.normalizePerspective = normalizePerspective; exports.normalizeRotation = normalizeRotation; exports.normalizeStencil = normalizeStencil; exports.normalizeStickerSettings = _chunkGHGBIAWQcjs.normalizeStickerSettings; exports.normalizeStickerUpdate = normalizeStickerUpdate; exports.normalizeSymmetry = normalizeSymmetry; exports.normalizeView = normalizeView; exports.normalizeWetBrush = _chunkGHGBIAWQcjs.normalizeWetBrush; exports.normalizeWetParams = _chunkN5IMDAHMcjs.normalizeWetParams; exports.overPixels = overPixels; exports.padSampleRadius = padSampleRadius; exports.paintAgentStrokePoints = paintAgentStrokePoints; exports.paintBrushPreviewRenderer = paintBrushPreviewRenderer; exports.paintContracts = paintContracts; exports.paintGradientMappingFor = _chunkNIBFKXMDcjs.paintGradientMappingFor; exports.paintPlaybackPanel = paintPlaybackPanel; exports.paintProposalGhost = paintProposalGhost; exports.paintShortcutFor = paintShortcutFor; exports.paintSourceColor = _chunkNIBFKXMDcjs.paintSourceColor; exports.paintSourceCss = _chunkNIBFKXMDcjs.paintSourceCss; exports.paintToMultiColor = _chunkGHGBIAWQcjs.paintToMultiColor; exports.paperEffectFromJSON = paperEffectFromJSON; exports.paperEffectToJSON = paperEffectToJSON; exports.paperGrain = paperGrain; exports.paperKey = paperKey; exports.paperNode = paperNode; exports.paperPreset = _chunkSNAFFCAXcjs.paperPreset; exports.parseBrushLibrary = _chunkGHGBIAWQcjs.parseBrushLibrary; exports.parseHexColor = parseHexColor; exports.parsePaintSource = _chunkNIBFKXMDcjs.parsePaintSource; exports.patchBrushValue = _chunk3JKCREEUcjs.patchBrushValue; exports.patchPath = patchPath; exports.penOrientation = _chunkSNAFFCAXcjs.penOrientation; exports.perspectiveDirections = perspectiveDirections; exports.perspectiveGuideLines = perspectiveGuideLines; exports.planPaintToolPlayback = planPaintToolPlayback; exports.pointerToPenPoint = pointerToPenPoint; exports.quickStencil = quickStencil; exports.rand01 = _chunk3K6HWEXZcjs.rand01; exports.randSigned = _chunk3K6HWEXZcjs.randSigned; exports.readEffectStrokeMap = _chunkSNAFFCAXcjs.readEffectStrokeMap; exports.readPaintEffectPaint = _chunkSNAFFCAXcjs.readPaintEffectPaint; exports.readPaintEffectSource = readPaintEffectSource; exports.readPaintSource = _chunkNIBFKXMDcjs.readPaintSource; exports.readPath = readPath; exports.readSwatch = readSwatch; exports.reliefInfo = reliefInfo; exports.removePaintGradientStop = _chunkNIBFKXMDcjs.removePaintGradientStop; exports.renderBrushThumbnail = renderBrushThumbnail; exports.renderColorWheel = renderColorWheel; exports.renderPaper = _chunkSNAFFCAXcjs.renderPaper; exports.renderStickers = renderStickers; exports.replayFrame = replayFrame; exports.replayItems = replayItems; exports.replayPainting = replayPainting; exports.resolvePaintGradient = _chunkNIBFKXMDcjs.resolvePaintGradient; exports.reversePaintGradient = _chunkNIBFKXMDcjs.reversePaintGradient; exports.rgbToHexColor = rgbToHexColor; exports.rgbToHsl = rgbToHsl; exports.rgbToHsv = rgbToHsv; exports.sampleArt = sampleArt; exports.sampleEffectAt = _chunkSNAFFCAXcjs.sampleEffectAt; exports.sampleEffectField = _chunkSNAFFCAXcjs.sampleEffectField; exports.samplePath = samplePath; exports.samplePressure = samplePressure; exports.scalePaintGradient = _chunkNIBFKXMDcjs.scalePaintGradient; exports.scaleStencil = scaleStencil; exports.screenToDocument = screenToDocument; exports.seedFromString = _chunk3K6HWEXZcjs.seedFromString; exports.serializePaintDocument = serializePaintDocument; exports.serializePaintDocumentExternal = serializePaintDocumentExternal; exports.solidPaint = _chunkNIBFKXMDcjs.solidPaint; exports.stampCoverage = _chunkRDFHWAHLcjs.stampCoverage; exports.standardBlendMode = _chunk2VX55NFMcjs.standardBlendMode; exports.startWetClock = startWetClock; exports.stencilMask = stencilMask; exports.stencilOutline = stencilOutline; exports.stickerAt = stickerAt; exports.stickerRect = stickerRect; exports.stickerRefLabel = stickerRefLabel; exports.stickerStamp = stickerStamp; exports.stickerSurface = stickerSurface; exports.strokeBounds = strokeBounds; exports.strokeDuration = strokeDuration; exports.strokePathPoints = _chunkSNAFFCAXcjs.strokePathPoints; exports.strokeSchedule = strokeSchedule; exports.strokeToJSON = strokeToJSON; exports.sweepPath = sweepPath; exports.symmetryAxisAngles = symmetryAxisAngles; exports.symmetryAxisSegments = symmetryAxisSegments; exports.symmetryCopies = symmetryCopies; exports.thickFromJSON = thickFromJSON; exports.thickToJSON = thickToJSON; exports.thumbnailStroke = thumbnailStroke; exports.tiltToOrientation = _chunkSNAFFCAXcjs.tiltToOrientation; exports.timeLapseVideo = timeLapseVideo; exports.timeLapseZip = timeLapseZip; exports.toStrokePoint = _chunkSNAFFCAXcjs.toStrokePoint; exports.toggleDotTexture = toggleDotTexture; exports.toggleStamp = toggleStamp; exports.toggleStickerRef = toggleStickerRef; exports.translateStencil = translateStencil; exports.updatePaintGradientStop = _chunkNIBFKXMDcjs.updatePaintGradientStop; exports.usesPaintExchange = _chunkGHGBIAWQcjs.usesPaintExchange; exports.variationAffine = variationAffine; exports.varyStroke = varyStroke; exports.viewCssTransform = viewCssTransform; exports.viewMatrix = viewMatrix; exports.viewPenToDocument = viewPenToDocument; exports.wetEngineSummary = wetEngineSummary; exports.wetPaperInput = _chunkSNAFFCAXcjs.wetPaperInput; exports.wetPigmentOf = _chunkSNAFFCAXcjs.wetPigmentOf; exports.wetSupport = _chunkN5IMDAHMcjs.wetSupport; exports.wheelAngle = wheelAngle; exports.wheelPick = wheelPick; exports.wheelPoint = wheelPoint; exports.wheelToHue = _chunkI3Y2Q3PMcjs.wheelToHue; exports.withPaintPlayback = withPaintPlayback; exports.withStrokePath = _chunkSNAFFCAXcjs.withStrokePath;