@pixerate/editor 0.113.0 → 0.115.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 (125) hide show
  1. package/THIRD_PARTY_NOTICES.md +8 -0
  2. package/dist/animation-editor/index.cjs +60 -54
  3. package/dist/animation-editor/index.cjs.map +1 -1
  4. package/dist/animation-editor/index.d.cts +3 -3
  5. package/dist/animation-editor/index.d.ts +3 -3
  6. package/dist/animation-editor/index.js +14 -8
  7. package/dist/animation-editor/index.js.map +1 -1
  8. package/dist/builtin-CY97ppKM.d.cts +354 -0
  9. package/dist/builtin-CY97ppKM.d.ts +354 -0
  10. package/dist/canvas/index.cjs +3 -3
  11. package/dist/canvas/index.cjs.map +1 -1
  12. package/dist/canvas/index.js +9 -9
  13. package/dist/chunk-26PGXHY7.cjs +753 -0
  14. package/dist/chunk-26PGXHY7.cjs.map +1 -0
  15. package/dist/chunk-2OJACTPR.cjs +929 -0
  16. package/dist/chunk-2OJACTPR.cjs.map +1 -0
  17. package/dist/chunk-3UFGNHSP.js +929 -0
  18. package/dist/chunk-3UFGNHSP.js.map +1 -0
  19. package/dist/chunk-643B2HKC.cjs +534 -0
  20. package/dist/chunk-643B2HKC.cjs.map +1 -0
  21. package/dist/chunk-6FCKOS2B.js +534 -0
  22. package/dist/chunk-6FCKOS2B.js.map +1 -0
  23. package/dist/chunk-BRLYOPLT.js +2574 -0
  24. package/dist/chunk-BRLYOPLT.js.map +1 -0
  25. package/dist/{chunk-LQEEDHOP.js → chunk-C6C5PDKU.js} +759 -761
  26. package/dist/chunk-C6C5PDKU.js.map +1 -0
  27. package/dist/{chunk-4KLT7ZYS.cjs → chunk-DFQEX3AM.cjs} +29 -29
  28. package/dist/{chunk-4KLT7ZYS.cjs.map → chunk-DFQEX3AM.cjs.map} +1 -1
  29. package/dist/chunk-G5NMLUVF.cjs +2574 -0
  30. package/dist/chunk-G5NMLUVF.cjs.map +1 -0
  31. package/dist/{chunk-YGIMK4NX.cjs → chunk-I7FQBWMQ.cjs} +813 -842
  32. package/dist/chunk-I7FQBWMQ.cjs.map +1 -0
  33. package/dist/{chunk-LPYOIVLA.js → chunk-LKCYANMW.js} +3 -3
  34. package/dist/{chunk-W3GXSUSQ.cjs → chunk-LPLCWZTM.cjs} +5087 -1283
  35. package/dist/chunk-LPLCWZTM.cjs.map +1 -0
  36. package/dist/chunk-MMVHBKMM.js +753 -0
  37. package/dist/chunk-MMVHBKMM.js.map +1 -0
  38. package/dist/{chunk-POGBUYWE.cjs → chunk-ST7E3NEE.cjs} +857 -859
  39. package/dist/chunk-ST7E3NEE.cjs.map +1 -0
  40. package/dist/{chunk-7VOHOPLW.cjs → chunk-TCKIXI46.cjs} +59 -59
  41. package/dist/{chunk-7VOHOPLW.cjs.map → chunk-TCKIXI46.cjs.map} +1 -1
  42. package/dist/{chunk-XIOMMGPD.cjs → chunk-TFOPHZ3U.cjs} +1 -1
  43. package/dist/chunk-TFOPHZ3U.cjs.map +1 -0
  44. package/dist/{chunk-Z4BC6M74.js → chunk-UBIXVXPR.js} +2 -2
  45. package/dist/{chunk-BLWCAQCW.js → chunk-VXR7XWMF.js} +4574 -770
  46. package/dist/chunk-VXR7XWMF.js.map +1 -0
  47. package/dist/{chunk-CZOXTEMN.js → chunk-XICA4PVO.js} +392 -421
  48. package/dist/chunk-XICA4PVO.js.map +1 -0
  49. package/dist/{chunk-HNS7UHCM.js → chunk-XK5LZKBD.js} +1 -1
  50. package/dist/chunk-XK5LZKBD.js.map +1 -0
  51. package/dist/cms/index.cjs +146 -0
  52. package/dist/cms/index.cjs.map +1 -0
  53. package/dist/cms/index.d.cts +51 -0
  54. package/dist/cms/index.d.ts +51 -0
  55. package/dist/cms/index.js +146 -0
  56. package/dist/cms/index.js.map +1 -0
  57. package/dist/{export-CEXEzqBf.d.cts → export-BJE8T0YA.d.cts} +279 -191
  58. package/dist/{export-DIkoK8-r.d.ts → export-Con3UKkm.d.ts} +279 -191
  59. package/dist/image-editor/index.cjs +1848 -1218
  60. package/dist/image-editor/index.cjs.map +1 -1
  61. package/dist/image-editor/index.d.cts +85 -93
  62. package/dist/image-editor/index.d.ts +85 -93
  63. package/dist/image-editor/index.js +871 -241
  64. package/dist/image-editor/index.js.map +1 -1
  65. package/dist/opentype-BZEOSOX3.d.ts +188 -0
  66. package/dist/opentype-Dpe75vL5.d.cts +188 -0
  67. package/dist/paint/index.cjs +4 -4
  68. package/dist/paint/index.d.cts +2 -2
  69. package/dist/paint/index.d.ts +2 -2
  70. package/dist/paint/index.js +3 -3
  71. package/dist/paint-editor/index.cjs +147 -145
  72. package/dist/paint-editor/index.cjs.map +1 -1
  73. package/dist/paint-editor/index.d.cts +9 -8
  74. package/dist/paint-editor/index.d.ts +9 -8
  75. package/dist/paint-editor/index.js +7 -5
  76. package/dist/paint-editor/index.js.map +1 -1
  77. package/dist/raster/index.cjs +53 -3
  78. package/dist/raster/index.cjs.map +1 -1
  79. package/dist/raster/index.d.cts +62 -91
  80. package/dist/raster/index.d.ts +62 -91
  81. package/dist/raster/index.js +59 -9
  82. package/dist/{render-BEriFuqK.d.cts → render-B1K_OoLy.d.cts} +87 -2
  83. package/dist/{render-tjzKaik-.d.ts → render-CrmHOgpo.d.ts} +87 -2
  84. package/dist/{retouch-CEIKR22W.d.cts → retouch-Bxkuc0KH.d.cts} +1 -1
  85. package/dist/{retouch-BXmeSCaB.d.ts → retouch-Do6tBs2H.d.ts} +1 -1
  86. package/dist/{surface-C8RRg_Bh.d.cts → surface-Cn30xIV6.d.cts} +6 -1
  87. package/dist/{surface-C8RRg_Bh.d.ts → surface-Cn30xIV6.d.ts} +6 -1
  88. package/dist/{svg-D_cfkhlB.d.cts → svg-BnRj0q8i.d.cts} +16 -4
  89. package/dist/{svg-wIaKLrU0.d.ts → svg-CmmBFfGT.d.ts} +16 -4
  90. package/dist/{types-DtL_qLFz.d.ts → types-1SUQKDAw.d.ts} +273 -4
  91. package/dist/{types-DyQq-WPY.d.cts → types-yINF17Ta.d.cts} +273 -4
  92. package/dist/vector/index.cjs +12170 -7343
  93. package/dist/vector/index.cjs.map +1 -1
  94. package/dist/vector/index.d.cts +1579 -16
  95. package/dist/vector/index.d.ts +1579 -16
  96. package/dist/vector/index.js +6303 -1476
  97. package/dist/vector/index.js.map +1 -1
  98. package/dist/warp-B39VsOtd.d.cts +348 -0
  99. package/dist/warp-DMN30aY6.d.ts +348 -0
  100. package/dist/zlib-dxQdgHyN.d.cts +95 -0
  101. package/dist/zlib-dxQdgHyN.d.ts +95 -0
  102. package/package.json +9 -2
  103. package/skills/pixerate-image-editor/SKILL.md +13 -36
  104. package/skills/pixerate-image-editor/references/color-management.md +42 -0
  105. package/skills/pixerate-image-editor/references/photoshop-files.md +41 -0
  106. package/skills/pixerate-paint-editor/SKILL.md +136 -4
  107. package/skills/pixerate-vector/SKILL.md +72 -2
  108. package/dist/chunk-BLWCAQCW.js.map +0 -1
  109. package/dist/chunk-CZOXTEMN.js.map +0 -1
  110. package/dist/chunk-HNS7UHCM.js.map +0 -1
  111. package/dist/chunk-JLYX4V57.cjs +0 -2001
  112. package/dist/chunk-JLYX4V57.cjs.map +0 -1
  113. package/dist/chunk-KB2YBCVS.js +0 -2001
  114. package/dist/chunk-KB2YBCVS.js.map +0 -1
  115. package/dist/chunk-LQEEDHOP.js.map +0 -1
  116. package/dist/chunk-POGBUYWE.cjs.map +0 -1
  117. package/dist/chunk-W3GXSUSQ.cjs.map +0 -1
  118. package/dist/chunk-XIOMMGPD.cjs.map +0 -1
  119. package/dist/chunk-YGIMK4NX.cjs.map +0 -1
  120. package/dist/homography-CZ-tFjay.d.cts +0 -50
  121. package/dist/homography-Ctfjoc1b.d.ts +0 -50
  122. package/dist/warp-CWHZzE3x.d.ts +0 -118
  123. package/dist/warp-D5jz_tN7.d.cts +0 -118
  124. /package/dist/{chunk-LPYOIVLA.js.map → chunk-LKCYANMW.js.map} +0 -0
  125. /package/dist/{chunk-Z4BC6M74.js.map → chunk-UBIXVXPR.js.map} +0 -0
@@ -4,7 +4,7 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkYGIMK4NXcjs = require('../chunk-YGIMK4NX.cjs');
7
+ var _chunkI7FQBWMQcjs = require('../chunk-I7FQBWMQ.cjs');
8
8
 
9
9
 
10
10
 
@@ -19,7 +19,7 @@ var _chunkYGIMK4NXcjs = require('../chunk-YGIMK4NX.cjs');
19
19
 
20
20
 
21
21
 
22
- var _chunkPOGBUYWEcjs = require('../chunk-POGBUYWE.cjs');
22
+ var _chunkST7E3NEEcjs = require('../chunk-ST7E3NEE.cjs');
23
23
  require('../chunk-MUUXNRU4.cjs');
24
24
 
25
25
 
@@ -47,7 +47,7 @@ require('../chunk-MUUXNRU4.cjs');
47
47
 
48
48
 
49
49
 
50
- var _chunk7VOHOPLWcjs = require('../chunk-7VOHOPLW.cjs');
50
+ var _chunkTCKIXI46cjs = require('../chunk-TCKIXI46.cjs');
51
51
 
52
52
 
53
53
 
@@ -68,14 +68,16 @@ var _chunk7VOHOPLWcjs = require('../chunk-7VOHOPLW.cjs');
68
68
 
69
69
 
70
70
 
71
- var _chunkXIOMMGPDcjs = require('../chunk-XIOMMGPD.cjs');
71
+ var _chunkTFOPHZ3Ucjs = require('../chunk-TFOPHZ3U.cjs');
72
+ require('../chunk-G5NMLUVF.cjs');
73
+ require('../chunk-643B2HKC.cjs');
72
74
 
73
75
 
74
76
 
75
77
 
76
78
 
77
79
  var _chunkEGFUVXKKcjs = require('../chunk-EGFUVXKK.cjs');
78
- require('../chunk-W3GXSUSQ.cjs');
80
+ require('../chunk-LPLCWZTM.cjs');
79
81
  require('../chunk-XGD3FSNC.cjs');
80
82
  require('../chunk-MR3Z4OQI.cjs');
81
83
  require('../chunk-A6PHCAGX.cjs');
@@ -427,7 +429,7 @@ function newPaintLayerId() {
427
429
  return `pl${Date.now().toString(36)}${(nextId++).toString(36)}`;
428
430
  }
429
431
  function createPaintLayer(name, id = newPaintLayerId()) {
430
- return { type: "pixel", id, name, visible: true, opacity: 1, blend: "normal", surface: _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4), offset: { x: 0, y: 0 } };
432
+ return { type: "pixel", id, name, visible: true, opacity: 1, blend: "normal", surface: _chunkTFOPHZ3Ucjs.emptySurface.call(void 0, 4), offset: { x: 0, y: 0 } };
431
433
  }
432
434
  var PaintDocumentError = class extends Error {
433
435
  constructor(message) {
@@ -528,7 +530,7 @@ function normalizePaintBrush(raw = {}, base) {
528
530
  if (rb.dirty !== void 0) mixerIn.cleanEachStroke = !rb.dirty;
529
531
  if (rb.mixing !== void 0) mixerIn.mixing = rb.mixing;
530
532
  }
531
- const mixer = _chunk7VOHOPLWcjs.normalizeMixer.call(void 0, mixerIn);
533
+ const mixer = _chunkTCKIXI46cjs.normalizeMixer.call(void 0, mixerIn);
532
534
  let behavior = normalizeBehavior(rb, b.behavior);
533
535
  if (engine === "mixer") behavior = { ...behavior, pickup: mixer.wet, mix: mixer.mix, dirty: !mixer.cleanEachStroke, mixing: mixer.mixing };
534
536
  return {
@@ -536,7 +538,7 @@ function normalizePaintBrush(raw = {}, base) {
536
538
  name: typeof raw.name === "string" && raw.name.trim() ? raw.name.trim().slice(0, 80) : b.name,
537
539
  category: PAINT_BRUSH_CATEGORIES.includes(raw.category) ? raw.category : b.category,
538
540
  engine,
539
- tip: _chunk7VOHOPLWcjs.normalizeBrush.call(void 0, { ...b.tip, ..._nullishCoalesce(raw.tip, () => ( {})) }),
541
+ tip: _chunkTCKIXI46cjs.normalizeBrush.call(void 0, { ...b.tip, ..._nullishCoalesce(raw.tip, () => ( {})) }),
540
542
  grain: unit2(raw.grain, b.grain),
541
543
  pressureSmoothing: range(raw.pressureSmoothing, 0, 0.95, b.pressureSmoothing),
542
544
  rotation: BRUSH_ROTATIONS.includes(raw.rotation) ? raw.rotation : b.rotation,
@@ -544,8 +546,8 @@ function normalizePaintBrush(raw = {}, base) {
544
546
  mixer,
545
547
  loadsColor: typeof raw.loadsColor === "boolean" ? raw.loadsColor : b.loadsColor,
546
548
  behavior,
547
- blender: _chunk7VOHOPLWcjs.normalizeBlender.call(void 0, _nullishCoalesce(raw.blender, () => ( {})), b.blender),
548
- smudge: _chunk7VOHOPLWcjs.normalizeSmudge.call(void 0, _nullishCoalesce(raw.smudge, () => ( {})), b.smudge),
549
+ blender: _chunkTCKIXI46cjs.normalizeBlender.call(void 0, _nullishCoalesce(raw.blender, () => ( {})), b.blender),
550
+ smudge: _chunkTCKIXI46cjs.normalizeSmudge.call(void 0, _nullishCoalesce(raw.smudge, () => ( {})), b.smudge),
549
551
  ...raw.builtin ? { builtin: true } : {}
550
552
  };
551
553
  }
@@ -554,16 +556,16 @@ var BASE_BRUSH = {
554
556
  name: "Round",
555
557
  category: "custom",
556
558
  engine: "dab",
557
- tip: { ..._chunk7VOHOPLWcjs.DEFAULT_BRUSH },
559
+ tip: { ..._chunkTCKIXI46cjs.DEFAULT_BRUSH },
558
560
  grain: 0,
559
561
  pressureSmoothing: 0,
560
562
  rotation: "fixed",
561
563
  dynamics: { ...DEFAULT_DYNAMICS },
562
- mixer: { ..._chunk7VOHOPLWcjs.DEFAULT_MIXER },
564
+ mixer: { ..._chunkTCKIXI46cjs.DEFAULT_MIXER },
563
565
  loadsColor: true,
564
566
  behavior: { ...DEFAULT_BEHAVIOR, multicolor: { ...DEFAULT_MULTI_COLOR, colors: [] } },
565
- blender: { ..._chunk7VOHOPLWcjs.DEFAULT_BLENDER },
566
- smudge: { ..._chunk7VOHOPLWcjs.DEFAULT_SMUDGE }
567
+ blender: { ..._chunkTCKIXI46cjs.DEFAULT_BLENDER },
568
+ smudge: { ..._chunkTCKIXI46cjs.DEFAULT_SMUDGE }
567
569
  };
568
570
  var builtin = (init) => ({ ...normalizePaintBrush(init), builtin: true });
569
571
  var BUILTIN_BRUSHES = [
@@ -976,7 +978,7 @@ var DryStroke = (_class5 = class {
976
978
  }
977
979
 
978
980
 
979
- __init12() {this.coverage = new (0, _chunk7VOHOPLWcjs.CoverageMap)()}
981
+ __init12() {this.coverage = new (0, _chunkTCKIXI46cjs.CoverageMap)()}
980
982
  __init13() {this.dabCount = 0}
981
983
 
982
984
 
@@ -1010,11 +1012,11 @@ var DryStroke = (_class5 = class {
1010
1012
  const hardness = this.brush.tip.hardness;
1011
1013
  const grain = this.options.grain;
1012
1014
  for (const d of dabs) {
1013
- const rect = _chunk7VOHOPLWcjs.dabRect.call(void 0, d, hardness);
1015
+ const rect = _chunkTCKIXI46cjs.dabRect.call(void 0, d, hardness);
1014
1016
  const n = rect.width * rect.height;
1015
1017
  if (this.buf.length < n) this.buf = new Float32Array(n);
1016
1018
  const vals = this.buf.subarray(0, n);
1017
- _chunk7VOHOPLWcjs.rasterizeDab.call(void 0, d, hardness, rect, vals);
1019
+ _chunkTCKIXI46cjs.rasterizeDab.call(void 0, d, hardness, rect, vals);
1018
1020
  if (this.depth > 0 && grain) {
1019
1021
  for (let yy = 0, k = 0; yy < rect.height; yy++) {
1020
1022
  const y = rect.y + yy + 0.5;
@@ -1059,7 +1061,7 @@ function mixRgb(a, b, t, mixing) {
1059
1061
  if (mixing === "pigment") {
1060
1062
  const o = [0, 0, 0];
1061
1063
  const q = (v) => Math.round(Math.min(1, Math.max(0, v)) * 255);
1062
- _chunkXIOMMGPDcjs.mixPigment8.call(void 0, q(a[0]), q(a[1]), q(a[2]), q(b[0]), q(b[1]), q(b[2]), t, o);
1064
+ _chunkTFOPHZ3Ucjs.mixPigment8.call(void 0, q(a[0]), q(a[1]), q(a[2]), q(b[0]), q(b[1]), q(b[2]), t, o);
1063
1065
  return [o[0], o[1], o[2]];
1064
1066
  }
1065
1067
  return [a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t, a[2] + (b[2] - a[2]) * t];
@@ -1091,20 +1093,20 @@ var PaintDabStroke = (_class6 = class {
1091
1093
  this.smoother = new PenSmoother(brush.tip.smoothing, brush.pressureSmoothing);
1092
1094
  this.copies = _optionalChain([options, 'access', _4 => _4.copies, 'optionalAccess', _5 => _5.length]) ? options.copies : [IDENTITY_COPY];
1093
1095
  const exchanging = brush.engine === "mixer" || brush.engine === "dab";
1094
- const rates = brush.engine === "mixer" ? _chunk7VOHOPLWcjs.mixerRates.call(void 0, brush.mixer) : _chunk7VOHOPLWcjs.exchangeRates.call(void 0, brush.behavior.pickup, brush.behavior.mix, 1, brush.behavior.mixing);
1096
+ const rates = brush.engine === "mixer" ? _chunkTCKIXI46cjs.mixerRates.call(void 0, brush.mixer) : _chunkTCKIXI46cjs.exchangeRates.call(void 0, brush.behavior.pickup, brush.behavior.mix, 1, brush.behavior.mixing);
1095
1097
  this.mixing = brush.engine === "mixer" ? brush.mixer.mixing : brush.behavior.mixing;
1096
1098
  this.states = this.copies.map((c, i) => ({
1097
1099
  walker: new PenDabWalker(brush, (_nullishCoalesce(options.seed, () => ( 0))) + i * 7919 | 0, c.linear),
1098
- exchange: exchanging ? new (0, _chunk7VOHOPLWcjs.PaintExchange)(rates, options.load) : null,
1099
- smudge: brush.engine === "smudge" ? new (0, _chunk7VOHOPLWcjs.SmudgeTip)(brush.smudge, brush.tip.size * (1 + brush.dynamics.tiltSize * 1.5)) : null
1100
+ exchange: exchanging ? new (0, _chunkTCKIXI46cjs.PaintExchange)(rates, options.load) : null,
1101
+ smudge: brush.engine === "smudge" ? new (0, _chunkTCKIXI46cjs.SmudgeTip)(brush.smudge, brush.tip.size * (1 + brush.dynamics.tiltSize * 1.5)) : null
1100
1102
  }));
1101
- this.medium = new (0, _chunk7VOHOPLWcjs.TileMedium)(options.target, brush.engine === "dab" ? { blend: brush.tip.blend } : {});
1103
+ this.medium = new (0, _chunkTCKIXI46cjs.TileMedium)(options.target, brush.engine === "dab" ? { blend: brush.tip.blend } : {});
1102
1104
  this.depth = options.grain && !options.grain.flat ? Math.min(1, Math.max(0, options.paperDepth * brush.grain)) : 0;
1103
- this.coverage = brush.engine === "dab" ? new (0, _chunk7VOHOPLWcjs.CoverageMap)() : null;
1105
+ this.coverage = brush.engine === "dab" ? new (0, _chunkTCKIXI46cjs.CoverageMap)() : null;
1104
1106
  const mc = brush.behavior.multicolor;
1105
1107
  this.palette = exchanging && mc.mode !== "off" ? multiColorPalette(mc, options.color, options.secondary) : null;
1106
1108
  this.gradient = this.palette && mc.mode === "tip" ? multiColorGradient(this.palette, mc.softness, this.mixing) : null;
1107
- this.scratch = brush.engine === "blender" ? _chunk7VOHOPLWcjs.createBlenderScratch.call(void 0, ) : null;
1109
+ this.scratch = brush.engine === "blender" ? _chunkTCKIXI46cjs.createBlenderScratch.call(void 0, ) : null;
1108
1110
  }
1109
1111
 
1110
1112
 
@@ -1159,7 +1161,7 @@ var PaintDabStroke = (_class6 = class {
1159
1161
  }
1160
1162
  paintDabs(copy, dabs, rects) {
1161
1163
  for (const d of dabs) {
1162
- const rect = _chunk7VOHOPLWcjs.dabRect.call(void 0, d, this.brush.tip.hardness);
1164
+ const rect = _chunkTCKIXI46cjs.dabRect.call(void 0, d, this.brush.tip.hardness);
1163
1165
  if (rect.width <= 0 || rect.height <= 0) continue;
1164
1166
  this.dab(copy, d, rect);
1165
1167
  rects.push(rect);
@@ -1175,7 +1177,7 @@ var PaintDabStroke = (_class6 = class {
1175
1177
  }
1176
1178
  const tip = this.tip.subarray(0, n);
1177
1179
  tip.fill(0);
1178
- _chunk7VOHOPLWcjs.rasterizeDab.call(void 0, { ...d, alpha: 1 }, this.brush.tip.hardness, rect, tip);
1180
+ _chunkTCKIXI46cjs.rasterizeDab.call(void 0, { ...d, alpha: 1 }, this.brush.tip.hardness, rect, tip);
1179
1181
  if (!(this.depth > 0 && this.options.grain)) return { tip, cov: tip };
1180
1182
  const cov = this.cov.subarray(0, n);
1181
1183
  const grain = this.options.grain;
@@ -1190,7 +1192,7 @@ var PaintDabStroke = (_class6 = class {
1190
1192
  const { tip, cov } = this.rasterize(d, rect);
1191
1193
  const st = this.states[copy];
1192
1194
  if (brush.engine === "blender") {
1193
- _chunk7VOHOPLWcjs.blenderDab.call(void 0, this.medium, rect, cov, d.opacity * d.alpha * brush.tip.opacity, d.radius, brush.blender, this.scratch);
1195
+ _chunkTCKIXI46cjs.blenderDab.call(void 0, this.medium, rect, cov, d.opacity * d.alpha * brush.tip.opacity, d.radius, brush.blender, this.scratch);
1194
1196
  return;
1195
1197
  }
1196
1198
  if (brush.engine === "smudge") {
@@ -1281,7 +1283,7 @@ var PaintDabStroke = (_class6 = class {
1281
1283
 
1282
1284
  // src/paint-editor/stroke.ts
1283
1285
  function defaultTile(surface) {
1284
- const data = new Uint8ClampedArray(_chunkXIOMMGPDcjs.TILE * _chunkXIOMMGPDcjs.TILE * surface.channels);
1286
+ const data = new Uint8ClampedArray(_chunkTFOPHZ3Ucjs.TILE * _chunkTFOPHZ3Ucjs.TILE * surface.channels);
1285
1287
  if (surface.defaultValue) data.fill(surface.defaultValue);
1286
1288
  return data;
1287
1289
  }
@@ -1355,9 +1357,9 @@ var PaintStrokeSession = (_class7 = class {
1355
1357
  offset: this.init.offset,
1356
1358
  lockTransparency: this.init.lockTransparency,
1357
1359
  selection: null,
1358
- readTile: (tx, ty) => _nullishCoalesce(_optionalChain([this, 'access', _10 => _10.live, 'access', _11 => _11.get, 'call', _12 => _12(_chunkXIOMMGPDcjs.tileKey.call(void 0, tx, ty)), 'optionalAccess', _13 => _13.data]), () => ( null)),
1360
+ readTile: (tx, ty) => _nullishCoalesce(_optionalChain([this, 'access', _10 => _10.live, 'access', _11 => _11.get, 'call', _12 => _12(_chunkTFOPHZ3Ucjs.tileKey.call(void 0, tx, ty)), 'optionalAccess', _13 => _13.data]), () => ( null)),
1359
1361
  writeTile: (tx, ty) => {
1360
- const key = _chunkXIOMMGPDcjs.tileKey.call(void 0, tx, ty);
1362
+ const key = _chunkTFOPHZ3Ucjs.tileKey.call(void 0, tx, ty);
1361
1363
  if (!this.touched.has(key)) {
1362
1364
  const src = _nullishCoalesce(_optionalChain([this, 'access', _14 => _14.base, 'access', _15 => _15.tiles, 'access', _16 => _16.get, 'call', _17 => _17(key), 'optionalAccess', _18 => _18.data]), () => ( defaultTile(this.base)));
1363
1365
  this.live.set(key, { data: new Uint8ClampedArray(src), uniform: null });
@@ -1387,14 +1389,14 @@ var PaintStrokeSession = (_class7 = class {
1387
1389
  if (!this.dry) {
1388
1390
  for (const key of this.fresh) this.live.set(key, { data: this.live.get(key).data, uniform: null });
1389
1391
  this.fresh.clear();
1390
- this.host.update(this.layerId, new (0, _chunkXIOMMGPDcjs.TiledSurface)(ch, new Map(this.live), this.base.defaultValue), rects);
1392
+ this.host.update(this.layerId, new (0, _chunkTFOPHZ3Ucjs.TiledSurface)(ch, new Map(this.live), this.base.defaultValue), rects);
1391
1393
  return;
1392
1394
  }
1393
1395
  const off = this.init.offset;
1394
1396
  const regions = /* @__PURE__ */ new Map();
1395
1397
  for (const r of rects) {
1396
- for (const t of _chunkXIOMMGPDcjs.tilesInRect.call(void 0, { x: r.x - off.x, y: r.y - off.y, width: r.width, height: r.height })) {
1397
- const key = _chunkXIOMMGPDcjs.tileKey.call(void 0, t.tx, t.ty);
1398
+ for (const t of _chunkTFOPHZ3Ucjs.tilesInRect.call(void 0, { x: r.x - off.x, y: r.y - off.y, width: r.width, height: r.height })) {
1399
+ const key = _chunkTFOPHZ3Ucjs.tileKey.call(void 0, t.tx, t.ty);
1398
1400
  const cur = regions.get(key);
1399
1401
  regions.set(key, { tx: t.tx, ty: t.ty, r: cur ? union(cur.r, r) : r });
1400
1402
  }
@@ -1403,10 +1405,10 @@ var PaintStrokeSession = (_class7 = class {
1403
1405
  const src = _nullishCoalesce(_optionalChain([this, 'access', _19 => _19.base, 'access', _20 => _20.tiles, 'access', _21 => _21.get, 'call', _22 => _22(key), 'optionalAccess', _23 => _23.data]), () => ( defaultTile(this.base)));
1404
1406
  const prev = this.touched.has(key) ? _optionalChain([this, 'access', _24 => _24.live, 'access', _25 => _25.get, 'call', _26 => _26(key), 'optionalAccess', _27 => _27.data]) : void 0;
1405
1407
  this.touched.add(key);
1406
- const data = _chunk7VOHOPLWcjs.applyStrokeToTile.call(void 0, this.dry.coverage, src, ch, tx, ty, this.apply, prev ? { into: prev, region: r } : {});
1408
+ const data = _chunkTCKIXI46cjs.applyStrokeToTile.call(void 0, this.dry.coverage, src, ch, tx, ty, this.apply, prev ? { into: prev, region: r } : {});
1407
1409
  this.live.set(key, { data, uniform: null });
1408
1410
  }
1409
- this.host.update(this.layerId, new (0, _chunkXIOMMGPDcjs.TiledSurface)(ch, new Map(this.live), this.base.defaultValue), rects);
1411
+ this.host.update(this.layerId, new (0, _chunkTFOPHZ3Ucjs.TiledSurface)(ch, new Map(this.live), this.base.defaultValue), rects);
1410
1412
  }
1411
1413
  /** Ends the stroke (one undo step) and returns what changed. */
1412
1414
  end() {
@@ -1417,17 +1419,17 @@ var PaintStrokeSession = (_class7 = class {
1417
1419
  const tiles = new Map(this.base.tiles);
1418
1420
  let changed = false;
1419
1421
  for (const key of this.touched) {
1420
- const tile = _chunkXIOMMGPDcjs.finishTile.call(void 0, this.live.get(key).data, ch, this.base.defaultValue);
1422
+ const tile = _chunkTFOPHZ3Ucjs.finishTile.call(void 0, this.live.get(key).data, ch, this.base.defaultValue);
1421
1423
  const prev = this.base.tiles.get(key);
1422
1424
  if (tile) tiles.set(key, tile);
1423
1425
  else tiles.delete(key);
1424
1426
  if (!sameTile(prev, tile)) changed = true;
1425
1427
  }
1426
- const surface = changed ? new (0, _chunkXIOMMGPDcjs.TiledSurface)(ch, tiles, this.base.defaultValue) : null;
1428
+ const surface = changed ? new (0, _chunkTFOPHZ3Ucjs.TiledSurface)(ch, tiles, this.base.defaultValue) : null;
1427
1429
  const dabs = this.dry ? this.dry.dabCount : this.wet.dabCount;
1428
1430
  this.result = { layerId: this.layerId, bounds: changed ? this.bounds : null, dabs, strokeId: null };
1429
1431
  const carried = _optionalChain([this, 'access', _28 => _28.wet, 'optionalAccess', _29 => _29.load]);
1430
- if (carried) this.result.mixerLoad = this.init.brush.behavior.dirty ? carried : _chunk7VOHOPLWcjs.cleanMixer.call(void 0, carried);
1432
+ if (carried) this.result.mixerLoad = this.init.brush.behavior.dirty ? carried : _chunkTCKIXI46cjs.cleanMixer.call(void 0, carried);
1431
1433
  this.host.commit(this, surface, false);
1432
1434
  return this.result;
1433
1435
  }
@@ -1440,13 +1442,13 @@ var PaintStrokeSession = (_class7 = class {
1440
1442
  }, _class7);
1441
1443
  function mixerLoadForStroke(brush, current, color) {
1442
1444
  if (!brush.loadsColor) return { reservoir: null, amount: 0, pickup: brush.mixer.cleanEachStroke ? null : current.pickup };
1443
- if (brush.mixer.loadEachStroke || !current.reservoir) return _chunk7VOHOPLWcjs.loadMixer.call(void 0, current, color);
1445
+ if (brush.mixer.loadEachStroke || !current.reservoir) return _chunkTCKIXI46cjs.loadMixer.call(void 0, current, color);
1444
1446
  return current;
1445
1447
  }
1446
1448
  function brushLoadForStroke(brush, current, color) {
1447
1449
  if (brush.engine === "mixer") return mixerLoadForStroke(brush, current, color);
1448
1450
  if (usesPaintExchange(brush)) return { reservoir: [color[0], color[1], color[2]], amount: 1, pickup: brush.behavior.dirty ? current.pickup : null };
1449
- return _chunk7VOHOPLWcjs.EMPTY_MIXER_LOAD;
1451
+ return _chunkTCKIXI46cjs.EMPTY_MIXER_LOAD;
1450
1452
  }
1451
1453
 
1452
1454
  // src/paint-editor/strokes.ts
@@ -1625,7 +1627,7 @@ var PROFILE = {
1625
1627
  }
1626
1628
  };
1627
1629
  function createPaintCompositor() {
1628
- return new (0, _chunkPOGBUYWEcjs.RasterCompositor)(PROFILE);
1630
+ return new (0, _chunkST7E3NEEcjs.RasterCompositor)(PROFILE);
1629
1631
  }
1630
1632
  function downsampleRgba(data, width, height, tw, th) {
1631
1633
  tw = Math.max(1, Math.round(tw));
@@ -1697,11 +1699,11 @@ function header(state, options) {
1697
1699
  return out;
1698
1700
  }
1699
1701
  function serializePaintDocument(state, options = {}) {
1700
- const { layers, assets } = _chunkYGIMK4NXcjs.serializeLayers.call(void 0, state.layers);
1702
+ const { layers, assets } = _chunkI7FQBWMQcjs.serializeLayers.call(void 0, state.layers);
1701
1703
  return { ...header(state, options), layers, assets };
1702
1704
  }
1703
1705
  async function serializePaintDocumentExternal(state, store, options = {}) {
1704
- const { layers, assets } = await _chunkYGIMK4NXcjs.serializeLayersExternal.call(void 0, state.layers, store);
1706
+ const { layers, assets } = await _chunkI7FQBWMQcjs.serializeLayersExternal.call(void 0, state.layers, store);
1705
1707
  return { ...header(state, options), layers, assets };
1706
1708
  }
1707
1709
  function paintLayersOnly(layers, problems) {
@@ -1738,16 +1740,16 @@ function deserializePaintDocument(raw) {
1738
1740
  const canvas = normalizeCanvas({ width: r.width, height: r.height, dpi: _nullishCoalesce(r.dpi, () => ( void 0)) });
1739
1741
  const paper = normalizePaper(_nullishCoalesce(r.paper, () => ( {})));
1740
1742
  const assets = r.assets && typeof r.assets === "object" ? r.assets : {};
1741
- const layers = paintLayersOnly(_chunkYGIMK4NXcjs.deserializeLayers.call(void 0, r.layers, { assets, problems }), problems);
1743
+ const layers = paintLayersOnly(_chunkI7FQBWMQcjs.deserializeLayers.call(void 0, r.layers, { assets, problems }), problems);
1742
1744
  const wanted = typeof r.activeLayerId === "string" ? r.activeLayerId : null;
1743
- const activeLayerId = wanted && _chunkPOGBUYWEcjs.findLayer.call(void 0, layers, wanted) ? wanted : _nullishCoalesce(_optionalChain([_chunkPOGBUYWEcjs.flattenLayers.call(void 0, layers), 'access', _33 => _33.filter, 'call', _34 => _34((l) => l.type === "pixel"), 'access', _35 => _35.pop, 'call', _36 => _36(), 'optionalAccess', _37 => _37.id]), () => ( null));
1745
+ const activeLayerId = wanted && _chunkST7E3NEEcjs.findLayer.call(void 0, layers, wanted) ? wanted : _nullishCoalesce(_optionalChain([_chunkST7E3NEEcjs.flattenLayers.call(void 0, layers), 'access', _33 => _33.filter, 'call', _34 => _34((l) => l.type === "pixel"), 'access', _35 => _35.pop, 'call', _36 => _36(), 'optionalAccess', _37 => _37.id]), () => ( null));
1744
1746
  return { state: { canvas, paper, layers, activeLayerId, strokes: readStrokes(r.strokes, problems) }, extensions: documentExtensions(r), guides: r.guides, swatches: r.swatches, mixingPad: r.mixingPad, problems };
1745
1747
  }
1746
1748
  async function deserializePaintDocumentAsync(raw, store) {
1747
1749
  if (!raw || typeof raw !== "object") throw new Error("Not a paint document: expected a JSON object.");
1748
1750
  const r = raw;
1749
1751
  const problems = [];
1750
- const assets = await _chunkYGIMK4NXcjs.resolveExternalAssets.call(void 0, _nullishCoalesce(r.assets, () => ( {})), store, problems);
1752
+ const assets = await _chunkI7FQBWMQcjs.resolveExternalAssets.call(void 0, _nullishCoalesce(r.assets, () => ( {})), store, problems);
1751
1753
  const loaded = deserializePaintDocument({ ...r, assets });
1752
1754
  return { ...loaded, problems: [...problems, ...loaded.problems] };
1753
1755
  }
@@ -1926,7 +1928,7 @@ function paintTestStroke(surface, brush, paper, color, width, height) {
1926
1928
  colorHex: color,
1927
1929
  affineCopies: [],
1928
1930
  copies: [IDENTITY_COPY],
1929
- mixerLoad: brushLoadForStroke(brush, _chunk7VOHOPLWcjs.EMPTY_MIXER_LOAD, [r / 255, g / 255, b / 255])
1931
+ mixerLoad: brushLoadForStroke(brush, _chunkTCKIXI46cjs.EMPTY_MIXER_LOAD, [r / 255, g / 255, b / 255])
1930
1932
  }
1931
1933
  );
1932
1934
  session.push(thumbnailStroke(width, height));
@@ -1939,13 +1941,13 @@ function renderBrushThumbnail(brush, options) {
1939
1941
  const maxSize = height * 0.42;
1940
1942
  const b = brush.tip.size > maxSize ? normalizePaintBrush({ tip: { ...brush.tip, size: maxSize } }, brush) : brush;
1941
1943
  const rgba = [...hexToRgb8(options.color), 255];
1942
- let surface = _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4);
1944
+ let surface = _chunkTFOPHZ3Ucjs.emptySurface.call(void 0, 4);
1943
1945
  if (b.engine === "eraser") {
1944
- surface = _chunkXIOMMGPDcjs.fillRect.call(void 0, surface, { x: 0, y: 0, width, height }, rgba);
1946
+ surface = _chunkTFOPHZ3Ucjs.fillRect.call(void 0, surface, { x: 0, y: 0, width, height }, rgba);
1945
1947
  } else if (b.engine === "blender" || b.engine === "smudge" || b.engine === "mixer" && !b.loadsColor || b.behavior.pickup > 0) {
1946
1948
  const half = Math.ceil(height / 2);
1947
- surface = _chunkXIOMMGPDcjs.fillRect.call(void 0, surface, { x: 0, y: 0, width, height: half }, rgba);
1948
- surface = _chunkXIOMMGPDcjs.fillRect.call(void 0, surface, { x: 0, y: half, width, height: height - half }, [232, 196, 64, 255]);
1949
+ surface = _chunkTFOPHZ3Ucjs.fillRect.call(void 0, surface, { x: 0, y: 0, width, height: half }, rgba);
1950
+ surface = _chunkTFOPHZ3Ucjs.fillRect.call(void 0, surface, { x: 0, y: half, width, height: height - half }, [232, 196, 64, 255]);
1949
1951
  }
1950
1952
  surface = paintTestStroke(surface, b, options.paper, options.color, width, height);
1951
1953
  const layer = { type: "pixel", id: "thumbnail", name: "thumbnail", visible: true, opacity: 1, blend: "normal", surface, offset: { x: 0, y: 0 } };
@@ -2281,7 +2283,7 @@ var PAD_BLOB = normalizePaintBrush({
2281
2283
  var MixingPad = (_class9 = class {constructor() { _class9.prototype.__init36.call(this);_class9.prototype.__init37.call(this);_class9.prototype.__init38.call(this);_class9.prototype.__init39.call(this); }
2282
2284
  __init36() {this.width = MIXING_PAD_WIDTH}
2283
2285
  __init37() {this.height = MIXING_PAD_HEIGHT}
2284
- __init38() {this.surface = _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4)}
2286
+ __init38() {this.surface = _chunkTFOPHZ3Ucjs.emptySurface.call(void 0, 4)}
2285
2287
  /** Increments on every change (for redrawing). */
2286
2288
  __init39() {this.version = 0}
2287
2289
  /** Paints (`paint`, with `color`) or smears (`knife`) through `points` in pad pixels. */
@@ -2317,7 +2319,7 @@ var MixingPad = (_class9 = class {constructor() { _class9.prototype.__init36.cal
2317
2319
  colorHex: color,
2318
2320
  affineCopies: [],
2319
2321
  copies: [IDENTITY_COPY],
2320
- mixerLoad: brushLoadForStroke(brush, _chunk7VOHOPLWcjs.EMPTY_MIXER_LOAD, [r / 255, g / 255, b / 255])
2322
+ mixerLoad: brushLoadForStroke(brush, _chunkTCKIXI46cjs.EMPTY_MIXER_LOAD, [r / 255, g / 255, b / 255])
2321
2323
  }
2322
2324
  );
2323
2325
  session.push(points);
@@ -2336,7 +2338,7 @@ var MixingPad = (_class9 = class {constructor() { _class9.prototype.__init36.cal
2336
2338
  const y0 = Math.max(0, Math.floor(y) - r);
2337
2339
  const x1 = Math.min(this.width, Math.floor(x) + r + 1);
2338
2340
  const y1 = Math.min(this.height, Math.floor(y) + r + 1);
2339
- const px = _chunkXIOMMGPDcjs.readRegion.call(void 0, this.surface, { x: x0, y: y0, width: x1 - x0, height: y1 - y0 });
2341
+ const px = _chunkTFOPHZ3Ucjs.readRegion.call(void 0, this.surface, { x: x0, y: y0, width: x1 - x0, height: y1 - y0 });
2340
2342
  let R = 0;
2341
2343
  let G = 0;
2342
2344
  let B = 0;
@@ -2353,7 +2355,7 @@ var MixingPad = (_class9 = class {constructor() { _class9.prototype.__init36.cal
2353
2355
  return `#${hex(R)}${hex(G)}${hex(B)}`;
2354
2356
  }
2355
2357
  clear() {
2356
- this.surface = _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4);
2358
+ this.surface = _chunkTFOPHZ3Ucjs.emptySurface.call(void 0, 4);
2357
2359
  this.version++;
2358
2360
  }
2359
2361
  /**
@@ -2383,7 +2385,7 @@ var MixingPad = (_class9 = class {constructor() { _class9.prototype.__init36.cal
2383
2385
  throw new Error(`A pile of radius ${R} at (${cx}, ${cy}) does not fit on the ${this.width}\xD7${this.height} pad; move it at least ${R} px from every edge or use a smaller radius.`);
2384
2386
  }
2385
2387
  const bounds = { x: Math.floor(cx - R), y: Math.floor(cy - R), width: Math.ceil(2 * R), height: Math.ceil(2 * R) };
2386
- if (options.clear !== false) this.surface = _chunkXIOMMGPDcjs.writeRegion.call(void 0, this.surface, bounds, new Uint8ClampedArray(bounds.width * bounds.height * 4));
2388
+ if (options.clear !== false) this.surface = _chunkTFOPHZ3Ucjs.writeRegion.call(void 0, this.surface, bounds, new Uint8ClampedArray(bounds.width * bounds.height * 4));
2387
2389
  const used = paints.filter((p) => p.parts > 0);
2388
2390
  const area = Math.PI * (0.7 * R) ** 2;
2389
2391
  used.forEach((p, i) => {
@@ -2406,7 +2408,7 @@ var MixingPad = (_class9 = class {constructor() { _class9.prototype.__init36.cal
2406
2408
  }
2407
2409
  this.run(knife, stir, "#000000");
2408
2410
  }
2409
- const mixed = _chunkXIOMMGPDcjs.mixPigments.call(void 0,
2411
+ const mixed = _chunkTFOPHZ3Ucjs.mixPigments.call(void 0,
2410
2412
  paints.map((p) => hexToRgb8(p.color).map((v) => v / 255)),
2411
2413
  paints.map((p) => p.parts)
2412
2414
  );
@@ -2417,15 +2419,15 @@ var MixingPad = (_class9 = class {constructor() { _class9.prototype.__init36.cal
2417
2419
  }
2418
2420
  /** The pad's pixels as a PNG data URL (with alpha), for saving. */
2419
2421
  toPng() {
2420
- return _chunkPOGBUYWEcjs.pngDataUrl.call(void 0, this.width, this.height, _chunkXIOMMGPDcjs.readRegion.call(void 0, this.surface, { x: 0, y: 0, width: this.width, height: this.height }));
2422
+ return _chunkST7E3NEEcjs.pngDataUrl.call(void 0, this.width, this.height, _chunkTFOPHZ3Ucjs.readRegion.call(void 0, this.surface, { x: 0, y: 0, width: this.width, height: this.height }));
2421
2423
  }
2422
2424
  /** Replaces the pad with a PNG (data URL or base64) of the pad's size, as `toPng` writes. */
2423
2425
  fromPng(png) {
2424
- const bytes = png.startsWith("data:") ? _optionalChain([_chunkPOGBUYWEcjs.parseDataUrl.call(void 0, png), 'optionalAccess', _40 => _40.bytes]) : _chunkPOGBUYWEcjs.base64ToBytes.call(void 0, png);
2425
- if (!bytes || !_chunkPOGBUYWEcjs.isPng.call(void 0, bytes)) throw new Error("The pad image is not a PNG data URL or base64 PNG.");
2426
- const img = _chunkPOGBUYWEcjs.decodePng.call(void 0, bytes);
2426
+ const bytes = png.startsWith("data:") ? _optionalChain([_chunkST7E3NEEcjs.parseDataUrl.call(void 0, png), 'optionalAccess', _40 => _40.bytes]) : _chunkST7E3NEEcjs.base64ToBytes.call(void 0, png);
2427
+ if (!bytes || !_chunkST7E3NEEcjs.isPng.call(void 0, bytes)) throw new Error("The pad image is not a PNG data URL or base64 PNG.");
2428
+ const img = _chunkST7E3NEEcjs.decodePng.call(void 0, bytes);
2427
2429
  if (img.width !== this.width || img.height !== this.height) throw new Error(`The pad image is ${img.width}\xD7${img.height}; a mixing pad is ${this.width}\xD7${this.height}.`);
2428
- this.surface = _chunkXIOMMGPDcjs.surfaceFromPixels.call(void 0, { width: img.width, height: img.height, data: img.data }, 4);
2430
+ this.surface = _chunkTFOPHZ3Ucjs.surfaceFromPixels.call(void 0, { width: img.width, height: img.height, data: img.data }, 4);
2429
2431
  this.version++;
2430
2432
  }
2431
2433
  /** Whether nothing is on the pad. */
@@ -2434,7 +2436,7 @@ var MixingPad = (_class9 = class {constructor() { _class9.prototype.__init36.cal
2434
2436
  }
2435
2437
  /** The pad over white, `width × height` RGBA. */
2436
2438
  pixels() {
2437
- const px = _chunkXIOMMGPDcjs.readRegion.call(void 0, this.surface, { x: 0, y: 0, width: this.width, height: this.height });
2439
+ const px = _chunkTFOPHZ3Ucjs.readRegion.call(void 0, this.surface, { x: 0, y: 0, width: this.width, height: this.height });
2438
2440
  for (let i = 0; i < px.length; i += 4) {
2439
2441
  const a = px[i + 3] / 255;
2440
2442
  px[i] = Math.round(px[i] * a + 255 * (1 - a));
@@ -2485,7 +2487,7 @@ var PaintEditorController = (_class10 = class {
2485
2487
  __init43() {this.library = null}
2486
2488
 
2487
2489
  __init44() {this.secondaryColor = "#ffffff"}
2488
- __init45() {this.mixerLoad = _chunk7VOHOPLWcjs.EMPTY_MIXER_LOAD}
2490
+ __init45() {this.mixerLoad = _chunkTCKIXI46cjs.EMPTY_MIXER_LOAD}
2489
2491
  __init46() {this.view = { ...DEFAULT_VIEW, pan: { ...DEFAULT_VIEW.pan } }}
2490
2492
 
2491
2493
 
@@ -2658,7 +2660,7 @@ var PaintEditorController = (_class10 = class {
2658
2660
  }
2659
2661
  // --- Layers --------------------------------------------------------------------
2660
2662
  getLayer(id) {
2661
- return _optionalChain([_chunkPOGBUYWEcjs.findLayer.call(void 0, this.doc.layers, id), 'optionalAccess', _44 => _44.layer]);
2663
+ return _optionalChain([_chunkST7E3NEEcjs.findLayer.call(void 0, this.doc.layers, id), 'optionalAccess', _44 => _44.layer]);
2662
2664
  }
2663
2665
  /** The active pixel layer (or `undefined`). */
2664
2666
  getActiveLayer() {
@@ -2677,12 +2679,12 @@ var PaintEditorController = (_class10 = class {
2677
2679
  walk(this.doc.layers, null, 0);
2678
2680
  return out;
2679
2681
  }
2680
- describeLayer(l, parentId = _nullishCoalesce(_optionalChain([_chunkPOGBUYWEcjs.findLayer.call(void 0, this.doc.layers, l.id), 'optionalAccess', _45 => _45.parent, 'optionalAccess', _46 => _46.id]), () => ( null)), depth = _nullishCoalesce(_optionalChain([_chunkPOGBUYWEcjs.findLayer.call(void 0, this.doc.layers, l.id), 'optionalAccess', _47 => _47.path, 'access', _48 => _48.length]), () => ( 0))) {
2682
+ describeLayer(l, parentId = _nullishCoalesce(_optionalChain([_chunkST7E3NEEcjs.findLayer.call(void 0, this.doc.layers, l.id), 'optionalAccess', _45 => _45.parent, 'optionalAccess', _46 => _46.id]), () => ( null)), depth = _nullishCoalesce(_optionalChain([_chunkST7E3NEEcjs.findLayer.call(void 0, this.doc.layers, l.id), 'optionalAccess', _47 => _47.path, 'access', _48 => _48.length]), () => ( 0))) {
2681
2683
  let bounds = null;
2682
2684
  if (l.type === "pixel") {
2683
- const b = _chunkXIOMMGPDcjs.contentBounds.call(void 0, l.surface);
2685
+ const b = _chunkTFOPHZ3Ucjs.contentBounds.call(void 0, l.surface);
2684
2686
  bounds = b ? { ...b, x: b.x + l.offset.x, y: b.y + l.offset.y } : null;
2685
- } else for (const c of _chunkPOGBUYWEcjs.flattenLayers.call(void 0, l.children)) if (c.type === "pixel") bounds = unionRect(bounds, this.describeLayer(c, l.id, depth + 1).bounds);
2687
+ } else for (const c of _chunkST7E3NEEcjs.flattenLayers.call(void 0, l.children)) if (c.type === "pixel") bounds = unionRect(bounds, this.describeLayer(c, l.id, depth + 1).bounds);
2686
2688
  return {
2687
2689
  id: l.id,
2688
2690
  name: l.name,
@@ -2709,7 +2711,7 @@ var PaintEditorController = (_class10 = class {
2709
2711
  if (!id) throw new PaintEditorError(`There is no active layer to ${what}; add one with add_layer.`);
2710
2712
  const l = this.requireLayer(id);
2711
2713
  if (!isPixelLayer(l)) throw new PaintEditorError(`Layer "${l.name}" is a group; ${what} a pixel layer inside it.`);
2712
- if (_chunkPOGBUYWEcjs.isLayerLocked.call(void 0, l, "pixels")) throw new PaintEditorError(`Layer "${l.name}" has its pixels locked; unlock it (update_layer locks) before you ${what} it.`);
2714
+ if (_chunkST7E3NEEcjs.isLayerLocked.call(void 0, l, "pixels")) throw new PaintEditorError(`Layer "${l.name}" has its pixels locked; unlock it (update_layer locks) before you ${what} it.`);
2713
2715
  if (!l.visible) throw new PaintEditorError(`Layer "${l.name}" is hidden; show it (update_layer visible true) before you ${what} it.`);
2714
2716
  return l;
2715
2717
  }
@@ -2722,7 +2724,7 @@ var PaintEditorController = (_class10 = class {
2722
2724
  /** Adds an empty pixel layer or group above `aboveId` (default: the active layer) and makes it active. */
2723
2725
  addLayer(options = {}) {
2724
2726
  this.requireIdle("adding a layer");
2725
- const count = _chunkPOGBUYWEcjs.flattenLayers.call(void 0, this.doc.layers).length;
2727
+ const count = _chunkST7E3NEEcjs.flattenLayers.call(void 0, this.doc.layers).length;
2726
2728
  const type = _nullishCoalesce(options.type, () => ( "pixel"));
2727
2729
  const name = _optionalChain([options, 'access', _49 => _49.name, 'optionalAccess', _50 => _50.trim, 'call', _51 => _51()]) || (type === "group" ? `Group ${count + 1}` : `Layer ${count + 1}`);
2728
2730
  const layer = type === "group" ? { type: "group", id: newPaintLayerId(), name, visible: true, opacity: 1, blend: "pass-through", children: [] } : createPaintLayer(name);
@@ -2734,21 +2736,21 @@ var PaintEditorController = (_class10 = class {
2734
2736
  if (g.type !== "group") throw new PaintEditorError(`Layer "${g.name}" is not a group; pass a group id as parentId.`);
2735
2737
  parentId = g.id;
2736
2738
  } else if (above) {
2737
- const loc = _chunkPOGBUYWEcjs.findLayer.call(void 0, this.doc.layers, above);
2739
+ const loc = _chunkST7E3NEEcjs.findLayer.call(void 0, this.doc.layers, above);
2738
2740
  if (!loc) throw new PaintEditorError(`Unknown layer "${above}". Call list_layers for the ids.`);
2739
2741
  parentId = _nullishCoalesce(_optionalChain([loc, 'access', _52 => _52.parent, 'optionalAccess', _53 => _53.id]), () => ( null));
2740
2742
  index = loc.index + 1;
2741
2743
  }
2742
- const layers = _chunkPOGBUYWEcjs.insertLayer.call(void 0, this.doc.layers, layer, parentId, index);
2744
+ const layers = _chunkST7E3NEEcjs.insertLayer.call(void 0, this.doc.layers, layer, parentId, index);
2743
2745
  this.commit(type === "group" ? "Add group" : "Add layer", { ...this.doc, layers, activeLayerId: layer.id });
2744
2746
  return this.describeLayer(layer);
2745
2747
  }
2746
2748
  updateLayer(id, update) {
2747
2749
  this.requireIdle("changing a layer");
2748
2750
  const l = this.requireLayer(id);
2749
- if (_chunkPOGBUYWEcjs.isLayerLocked.call(void 0, l, "all") && Object.keys(update).some((k) => k !== "locks")) throw new PaintEditorError(`Layer "${l.name}" is fully locked; unlock it first (locks {all: false}).`);
2751
+ if (_chunkST7E3NEEcjs.isLayerLocked.call(void 0, l, "all") && Object.keys(update).some((k) => k !== "locks")) throw new PaintEditorError(`Layer "${l.name}" is fully locked; unlock it first (locks {all: false}).`);
2750
2752
  if (update.opacity !== void 0 && !(update.opacity >= 0 && update.opacity <= 1)) throw new PaintEditorError(`opacity ${update.opacity} is out of range; use 0..1.`);
2751
- if (update.blend !== void 0 && !_chunkXIOMMGPDcjs.isBlendMode.call(void 0, update.blend) && !(l.type === "group" && update.blend === "pass-through")) {
2753
+ if (update.blend !== void 0 && !_chunkTFOPHZ3Ucjs.isBlendMode.call(void 0, update.blend) && !(l.type === "group" && update.blend === "pass-through")) {
2752
2754
  throw new PaintEditorError(`Unknown blend mode "${update.blend}". Call get_canvas_info for the blend modes.`);
2753
2755
  }
2754
2756
  if (update.name !== void 0 && !update.name.trim()) throw new PaintEditorError("name is empty; give the layer a name.");
@@ -2762,66 +2764,66 @@ var PaintEditorController = (_class10 = class {
2762
2764
  const locks = { ..._nullishCoalesce(l.locks, () => ( {})), ...update.locks };
2763
2765
  next.locks = Object.values(locks).some(Boolean) ? locks : void 0;
2764
2766
  }
2765
- this.commit("Layer properties", { ...this.doc, layers: _chunkPOGBUYWEcjs.mapLayer.call(void 0, this.doc.layers, id, () => next) });
2767
+ this.commit("Layer properties", { ...this.doc, layers: _chunkST7E3NEEcjs.mapLayer.call(void 0, this.doc.layers, id, () => next) });
2766
2768
  return this.describeLayer(next);
2767
2769
  }
2768
2770
  removeLayer(id) {
2769
2771
  this.requireIdle("removing a layer");
2770
2772
  const l = this.requireLayer(id);
2771
- if (_chunkPOGBUYWEcjs.isLayerLocked.call(void 0, l, "all")) throw new PaintEditorError(`Layer "${l.name}" is fully locked; unlock it before removing it.`);
2772
- const layers = _chunkPOGBUYWEcjs.mapLayer.call(void 0, this.doc.layers, id, () => null);
2773
+ if (_chunkST7E3NEEcjs.isLayerLocked.call(void 0, l, "all")) throw new PaintEditorError(`Layer "${l.name}" is fully locked; unlock it before removing it.`);
2774
+ const layers = _chunkST7E3NEEcjs.mapLayer.call(void 0, this.doc.layers, id, () => null);
2773
2775
  let active = this.doc.activeLayerId;
2774
- if (active && !_chunkPOGBUYWEcjs.findLayer.call(void 0, layers, active)) active = _nullishCoalesce(_optionalChain([_chunkPOGBUYWEcjs.flattenLayers.call(void 0, layers), 'access', _54 => _54.filter, 'call', _55 => _55((x) => x.type === "pixel"), 'access', _56 => _56.pop, 'call', _57 => _57(), 'optionalAccess', _58 => _58.id]), () => ( null));
2776
+ if (active && !_chunkST7E3NEEcjs.findLayer.call(void 0, layers, active)) active = _nullishCoalesce(_optionalChain([_chunkST7E3NEEcjs.flattenLayers.call(void 0, layers), 'access', _54 => _54.filter, 'call', _55 => _55((x) => x.type === "pixel"), 'access', _56 => _56.pop, 'call', _57 => _57(), 'optionalAccess', _58 => _58.id]), () => ( null));
2775
2777
  this.commit("Remove layer", { ...this.doc, layers, activeLayerId: active });
2776
2778
  return { removed: id, activeLayerId: active };
2777
2779
  }
2778
2780
  duplicateLayer(id) {
2779
2781
  this.requireIdle("duplicating a layer");
2780
- const loc = _chunkPOGBUYWEcjs.findLayer.call(void 0, this.doc.layers, id);
2782
+ const loc = _chunkST7E3NEEcjs.findLayer.call(void 0, this.doc.layers, id);
2781
2783
  if (!loc) throw new PaintEditorError(`Unknown layer "${id}". Call list_layers for the ids.`);
2782
2784
  const copy = (l) => l.type === "group" ? { ...l, id: newPaintLayerId(), children: l.children.map(copy) } : { ...l, id: newPaintLayerId() };
2783
2785
  const dup = { ...copy(loc.layer), name: `${loc.layer.name} copy` };
2784
- const layers = _chunkPOGBUYWEcjs.insertLayer.call(void 0, this.doc.layers, dup, _nullishCoalesce(_optionalChain([loc, 'access', _59 => _59.parent, 'optionalAccess', _60 => _60.id]), () => ( null)), loc.index + 1);
2786
+ const layers = _chunkST7E3NEEcjs.insertLayer.call(void 0, this.doc.layers, dup, _nullishCoalesce(_optionalChain([loc, 'access', _59 => _59.parent, 'optionalAccess', _60 => _60.id]), () => ( null)), loc.index + 1);
2785
2787
  this.commit("Duplicate layer", { ...this.doc, layers, activeLayerId: dup.id });
2786
2788
  return this.describeLayer(dup);
2787
2789
  }
2788
2790
  /** Moves a layer to `index` (0 = bottom) within `parentId` (default its own parent; `null` = top level). */
2789
2791
  moveLayer(id, index, parentId) {
2790
2792
  this.requireIdle("moving a layer");
2791
- const loc = _chunkPOGBUYWEcjs.findLayer.call(void 0, this.doc.layers, id);
2793
+ const loc = _chunkST7E3NEEcjs.findLayer.call(void 0, this.doc.layers, id);
2792
2794
  if (!loc) throw new PaintEditorError(`Unknown layer "${id}". Call list_layers for the ids.`);
2793
2795
  const target = parentId === void 0 ? _nullishCoalesce(_optionalChain([loc, 'access', _61 => _61.parent, 'optionalAccess', _62 => _62.id]), () => ( null)) : parentId;
2794
2796
  if (target) {
2795
2797
  const g = this.requireLayer(target);
2796
2798
  if (g.type !== "group") throw new PaintEditorError(`Layer "${g.name}" is not a group; pass a group id as parentId.`);
2797
- if (target === id || loc.layer.type === "group" && _chunkPOGBUYWEcjs.findLayer.call(void 0, loc.layer.children, target)) throw new PaintEditorError("A group cannot move into itself.");
2799
+ if (target === id || loc.layer.type === "group" && _chunkST7E3NEEcjs.findLayer.call(void 0, loc.layer.children, target)) throw new PaintEditorError("A group cannot move into itself.");
2798
2800
  }
2799
- const without = _chunkPOGBUYWEcjs.mapLayer.call(void 0, this.doc.layers, id, () => null);
2800
- const siblings = target ? _chunkPOGBUYWEcjs.findLayer.call(void 0, without, target).layer.children : without;
2801
+ const without = _chunkST7E3NEEcjs.mapLayer.call(void 0, this.doc.layers, id, () => null);
2802
+ const siblings = target ? _chunkST7E3NEEcjs.findLayer.call(void 0, without, target).layer.children : without;
2801
2803
  if (!Number.isInteger(index) || index < 0 || index > siblings.length) throw new PaintEditorError(`index ${index} is out of range; use 0..${siblings.length} (0 is the bottom).`);
2802
- const layers = _chunkPOGBUYWEcjs.insertLayer.call(void 0, without, loc.layer, target, index);
2804
+ const layers = _chunkST7E3NEEcjs.insertLayer.call(void 0, without, loc.layer, target, index);
2803
2805
  this.commit("Move layer", { ...this.doc, layers });
2804
2806
  return this.describeLayer(loc.layer);
2805
2807
  }
2806
2808
  /** Merges a pixel layer into the pixel layer below it (keeping the lower one's settings). */
2807
2809
  mergeDown(id) {
2808
2810
  this.requireIdle("merging");
2809
- const loc = _chunkPOGBUYWEcjs.findLayer.call(void 0, this.doc.layers, id);
2811
+ const loc = _chunkST7E3NEEcjs.findLayer.call(void 0, this.doc.layers, id);
2810
2812
  if (!loc) throw new PaintEditorError(`Unknown layer "${id}". Call list_layers for the ids.`);
2811
2813
  const siblings = loc.parent ? loc.parent.children : this.doc.layers;
2812
2814
  const below = siblings[loc.index - 1];
2813
2815
  const upper = loc.layer;
2814
2816
  if (!isPixelLayer(upper) || !isPixelLayer(below)) throw new PaintEditorError("Merge down needs a pixel layer directly above another pixel layer in the same group.");
2815
- if (_chunkPOGBUYWEcjs.isLayerLocked.call(void 0, below, "pixels")) throw new PaintEditorError(`Layer "${below.name}" has its pixels locked; unlock it to merge into it.`);
2817
+ if (_chunkST7E3NEEcjs.isLayerLocked.call(void 0, below, "pixels")) throw new PaintEditorError(`Layer "${below.name}" has its pixels locked; unlock it to merge into it.`);
2816
2818
  const rect = unionRect(this.describeLayer(below).bounds, this.describeLayer(upper).bounds);
2817
- let surface = _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4);
2819
+ let surface = _chunkTFOPHZ3Ucjs.emptySurface.call(void 0, 4);
2818
2820
  if (rect) {
2819
2821
  const base = { ...below, opacity: 1, blend: "normal", visible: true, clipped: void 0, mask: void 0 };
2820
2822
  const px = createPaintCompositor().composite([base, upper.visible ? upper : { ...upper, opacity: 0 }], rect, this.sources());
2821
- surface = _chunkXIOMMGPDcjs.surfaceFromPixels.call(void 0, { width: rect.width, height: rect.height, data: px }, 4, rect.x, rect.y);
2823
+ surface = _chunkTFOPHZ3Ucjs.surfaceFromPixels.call(void 0, { width: rect.width, height: rect.height, data: px }, 4, rect.x, rect.y);
2822
2824
  }
2823
2825
  const merged = { ...below, surface, offset: { x: 0, y: 0 } };
2824
- const layers = _chunkPOGBUYWEcjs.mapLayer.call(void 0, _chunkPOGBUYWEcjs.mapLayer.call(void 0, this.doc.layers, upper.id, () => null), below.id, () => merged);
2826
+ const layers = _chunkST7E3NEEcjs.mapLayer.call(void 0, _chunkST7E3NEEcjs.mapLayer.call(void 0, this.doc.layers, upper.id, () => null), below.id, () => merged);
2825
2827
  this.commit("Merge down", { ...this.doc, layers, activeLayerId: below.id });
2826
2828
  return this.describeLayer(merged);
2827
2829
  }
@@ -2830,7 +2832,7 @@ var PaintEditorController = (_class10 = class {
2830
2832
  this.requireIdle("clearing");
2831
2833
  const l = this.paintTarget(layerId, "clear");
2832
2834
  const bounds = this.describeLayer(l).bounds;
2833
- this.commit("Clear layer", { ...this.doc, layers: _chunkPOGBUYWEcjs.mapLayer.call(void 0, this.doc.layers, l.id, () => ({ ...l, surface: _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4) })) });
2835
+ this.commit("Clear layer", { ...this.doc, layers: _chunkST7E3NEEcjs.mapLayer.call(void 0, this.doc.layers, l.id, () => ({ ...l, surface: _chunkTFOPHZ3Ucjs.emptySurface.call(void 0, 4) })) });
2834
2836
  return { layerId: l.id, bounds };
2835
2837
  }
2836
2838
  /**
@@ -2847,14 +2849,14 @@ var PaintEditorController = (_class10 = class {
2847
2849
  if (!(grainAmount >= 0 && grainAmount <= 1)) throw new PaintEditorError(`grain ${grainAmount} is out of range; use 0..1.`);
2848
2850
  const pressure = _nullishCoalesce(options.pressure, () => ( 0.5));
2849
2851
  const blend = _nullishCoalesce(options.blend, () => ( "normal"));
2850
- if (!_chunkXIOMMGPDcjs.isBlendMode.call(void 0, blend)) throw new PaintEditorError(`Unknown blend mode "${blend}".`);
2852
+ if (!_chunkTFOPHZ3Ucjs.isBlendMode.call(void 0, blend)) throw new PaintEditorError(`Unknown blend mode "${blend}".`);
2851
2853
  const { width, height } = this.doc.canvas;
2852
2854
  const rect = { x: 0, y: 0, width, height };
2853
- const coverage = new (0, _chunk7VOHOPLWcjs.CoverageMap)();
2855
+ const coverage = new (0, _chunkTCKIXI46cjs.CoverageMap)();
2854
2856
  const depth = grainAmount * this.doc.paper.depth;
2855
2857
  const grain = depth > 0 ? paperGrain(this.doc.paper) : null;
2856
- for (const { tx, ty } of _chunkXIOMMGPDcjs.tilesInRect.call(void 0, rect)) {
2857
- const r = { x: tx * _chunkXIOMMGPDcjs.TILE, y: ty * _chunkXIOMMGPDcjs.TILE, width: Math.min(_chunkXIOMMGPDcjs.TILE, width - tx * _chunkXIOMMGPDcjs.TILE), height: Math.min(_chunkXIOMMGPDcjs.TILE, height - ty * _chunkXIOMMGPDcjs.TILE) };
2858
+ for (const { tx, ty } of _chunkTFOPHZ3Ucjs.tilesInRect.call(void 0, rect)) {
2859
+ const r = { x: tx * _chunkTFOPHZ3Ucjs.TILE, y: ty * _chunkTFOPHZ3Ucjs.TILE, width: Math.min(_chunkTFOPHZ3Ucjs.TILE, width - tx * _chunkTFOPHZ3Ucjs.TILE), height: Math.min(_chunkTFOPHZ3Ucjs.TILE, height - ty * _chunkTFOPHZ3Ucjs.TILE) };
2858
2860
  const vals = new Float32Array(r.width * r.height);
2859
2861
  for (let y = 0, k = 0; y < r.height; y++) for (let x = 0; x < r.width; x++, k++) vals[k] = grain ? grainCatch(grain.at(r.x + x + 0.5, r.y + y + 0.5), depth, pressure) : 1;
2860
2862
  coverage.accumulate(r, vals, 1);
@@ -2865,25 +2867,25 @@ var PaintEditorController = (_class10 = class {
2865
2867
  background: rgbaOf(this.doc.paper.color),
2866
2868
  opacity,
2867
2869
  blend,
2868
- lockTransparency: _chunkPOGBUYWEcjs.isLayerLocked.call(void 0, l, "transparency"),
2870
+ lockTransparency: _chunkST7E3NEEcjs.isLayerLocked.call(void 0, l, "transparency"),
2869
2871
  selection: null,
2870
2872
  offset: l.offset
2871
2873
  };
2872
2874
  const surface = this.applyCoverage(l, coverage, rect, apply);
2873
- this.commit("Fill layer", { ...this.doc, layers: _chunkPOGBUYWEcjs.mapLayer.call(void 0, this.doc.layers, l.id, () => ({ ...l, surface })) });
2875
+ this.commit("Fill layer", { ...this.doc, layers: _chunkST7E3NEEcjs.mapLayer.call(void 0, this.doc.layers, l.id, () => ({ ...l, surface })) });
2874
2876
  return { layerId: l.id, bounds: rect };
2875
2877
  }
2876
2878
  applyCoverage(l, coverage, rect, apply) {
2877
2879
  const base = l.surface;
2878
2880
  const tiles = new Map(base.tiles);
2879
- for (const { tx, ty } of _chunkXIOMMGPDcjs.tilesInRect.call(void 0, { x: rect.x - l.offset.x, y: rect.y - l.offset.y, width: rect.width, height: rect.height })) {
2880
- const key = _chunkXIOMMGPDcjs.tileKey.call(void 0, tx, ty);
2881
- const src = _nullishCoalesce(_optionalChain([base, 'access', _63 => _63.tiles, 'access', _64 => _64.get, 'call', _65 => _65(key), 'optionalAccess', _66 => _66.data]), () => ( new Uint8ClampedArray(_chunkXIOMMGPDcjs.TILE * _chunkXIOMMGPDcjs.TILE * 4)));
2882
- const tile = _chunkXIOMMGPDcjs.finishTile.call(void 0, _chunk7VOHOPLWcjs.applyStrokeToTile.call(void 0, coverage, src, 4, tx, ty, apply), 4, 0);
2881
+ for (const { tx, ty } of _chunkTFOPHZ3Ucjs.tilesInRect.call(void 0, { x: rect.x - l.offset.x, y: rect.y - l.offset.y, width: rect.width, height: rect.height })) {
2882
+ const key = _chunkTFOPHZ3Ucjs.tileKey.call(void 0, tx, ty);
2883
+ const src = _nullishCoalesce(_optionalChain([base, 'access', _63 => _63.tiles, 'access', _64 => _64.get, 'call', _65 => _65(key), 'optionalAccess', _66 => _66.data]), () => ( new Uint8ClampedArray(_chunkTFOPHZ3Ucjs.TILE * _chunkTFOPHZ3Ucjs.TILE * 4)));
2884
+ const tile = _chunkTFOPHZ3Ucjs.finishTile.call(void 0, _chunkTCKIXI46cjs.applyStrokeToTile.call(void 0, coverage, src, 4, tx, ty, apply), 4, 0);
2883
2885
  if (tile) tiles.set(key, tile);
2884
2886
  else tiles.delete(key);
2885
2887
  }
2886
- return new (0, _chunkXIOMMGPDcjs.TiledSurface)(4, tiles, 0);
2888
+ return new (0, _chunkTFOPHZ3Ucjs.TiledSurface)(4, tiles, 0);
2887
2889
  }
2888
2890
  // --- Brushes -------------------------------------------------------------------
2889
2891
  findBrush(id) {
@@ -3008,7 +3010,7 @@ var PaintEditorController = (_class10 = class {
3008
3010
  if (options.layerId !== void 0) {
3009
3011
  const l = this.requireLayer(options.layerId);
3010
3012
  if (!isPixelLayer(l)) throw new PaintEditorError(`Layer "${l.name}" is a group; pick from a pixel layer or the composite.`);
3011
- const [r, g, b, a] = _chunkXIOMMGPDcjs.readPixel.call(void 0, l.surface, px - l.offset.x, py - l.offset.y);
3013
+ const [r, g, b, a] = _chunkTFOPHZ3Ucjs.readPixel.call(void 0, l.surface, px - l.offset.x, py - l.offset.y);
3012
3014
  return { color: rgbToHex(r, g, b), alpha: Math.round(a / 255 * 1e3) / 1e3 };
3013
3015
  }
3014
3016
  const d = this.exportCompositor.composite(this.renderLayers({}), { x: px, y: py, width: 1, height: 1 }, this.sources());
@@ -3018,13 +3020,13 @@ var PaintEditorController = (_class10 = class {
3018
3020
  /** Fills the Mixer Brush reservoir with a colour (default the editor colour). */
3019
3021
  loadMixerBrush(color) {
3020
3022
  const [r, g, b] = hexToRgb8(color === void 0 ? this.color : parseColor(color));
3021
- this.mixerLoad = _chunk7VOHOPLWcjs.loadMixer.call(void 0, this.mixerLoad, [r / 255, g / 255, b / 255]);
3023
+ this.mixerLoad = _chunkTCKIXI46cjs.loadMixer.call(void 0, this.mixerLoad, [r / 255, g / 255, b / 255]);
3022
3024
  this.emit([]);
3023
3025
  return this.mixerLoad;
3024
3026
  }
3025
3027
  /** Empties the pickup well (and with `emptyReservoir` the loaded paint too). */
3026
3028
  cleanMixerBrush(emptyReservoir = false) {
3027
- this.mixerLoad = emptyReservoir ? _chunk7VOHOPLWcjs.EMPTY_MIXER_LOAD : _chunk7VOHOPLWcjs.cleanMixer.call(void 0, this.mixerLoad);
3029
+ this.mixerLoad = emptyReservoir ? _chunkTCKIXI46cjs.EMPTY_MIXER_LOAD : _chunkTCKIXI46cjs.cleanMixer.call(void 0, this.mixerLoad);
3028
3030
  this.emit([]);
3029
3031
  return this.mixerLoad;
3030
3032
  }
@@ -3066,11 +3068,11 @@ var PaintEditorController = (_class10 = class {
3066
3068
  const layer = (() => {
3067
3069
  const id = _nullishCoalesce(init.layerId, () => ( doc.activeLayerId));
3068
3070
  if (!id) throw new PaintEditorError("There is no active layer to paint on; add one with add_layer.");
3069
- const loc = _chunkPOGBUYWEcjs.findLayer.call(void 0, doc.layers, id);
3071
+ const loc = _chunkST7E3NEEcjs.findLayer.call(void 0, doc.layers, id);
3070
3072
  if (!loc) throw new PaintEditorError(`Unknown layer "${id}". Call list_layers for the ids.`);
3071
3073
  const l = loc.layer;
3072
3074
  if (!isPixelLayer(l)) throw new PaintEditorError(`Layer "${l.name}" is a group; paint on a pixel layer inside it.`);
3073
- if (_chunkPOGBUYWEcjs.isLayerLocked.call(void 0, l, "pixels")) throw new PaintEditorError(`Layer "${l.name}" has its pixels locked; unlock it (update_layer locks) to paint on it.`);
3075
+ if (_chunkST7E3NEEcjs.isLayerLocked.call(void 0, l, "pixels")) throw new PaintEditorError(`Layer "${l.name}" has its pixels locked; unlock it (update_layer locks) to paint on it.`);
3074
3076
  if (!l.visible) throw new PaintEditorError(`Layer "${l.name}" is hidden; show it (update_layer visible true) to paint on it.`);
3075
3077
  return l;
3076
3078
  })();
@@ -3087,7 +3089,7 @@ var PaintEditorController = (_class10 = class {
3087
3089
  layerId: layer.id,
3088
3090
  surface: layer.surface,
3089
3091
  offset: layer.offset,
3090
- lockTransparency: _chunkPOGBUYWEcjs.isLayerLocked.call(void 0, layer, "transparency"),
3092
+ lockTransparency: _chunkST7E3NEEcjs.isLayerLocked.call(void 0, layer, "transparency"),
3091
3093
  brush,
3092
3094
  color: rgba,
3093
3095
  background: rgbaOf(doc.paper.color),
@@ -3141,7 +3143,7 @@ var PaintEditorController = (_class10 = class {
3141
3143
  const stroke = this.record(s);
3142
3144
  s.result.strokeId = stroke.id;
3143
3145
  const l = this.getLayer(s.layerId);
3144
- this.commit(`${brush.name} stroke`, { ...this.doc, layers: _chunkPOGBUYWEcjs.mapLayer.call(void 0, this.doc.layers, l.id, () => ({ ...l, surface })), strokes: [...this.doc.strokes, stroke] });
3146
+ this.commit(`${brush.name} stroke`, { ...this.doc, layers: _chunkST7E3NEEcjs.mapLayer.call(void 0, this.doc.layers, l.id, () => ({ ...l, surface })), strokes: [...this.doc.strokes, stroke] });
3145
3147
  }
3146
3148
  };
3147
3149
  const session = this.sessionFor(this.doc, { snapToPerspective: true, ...init }, host);
@@ -3163,8 +3165,8 @@ var PaintEditorController = (_class10 = class {
3163
3165
  if (cancelled || !surface) return;
3164
3166
  const stroke = this.record(s);
3165
3167
  s.result.strokeId = stroke.id;
3166
- const l = _chunkPOGBUYWEcjs.findLayer.call(void 0, out.layers, s.layerId).layer;
3167
- out = { ...out, layers: _chunkPOGBUYWEcjs.mapLayer.call(void 0, out.layers, l.id, () => ({ ...l, surface })), strokes: [...out.strokes, stroke] };
3168
+ const l = _chunkST7E3NEEcjs.findLayer.call(void 0, out.layers, s.layerId).layer;
3169
+ out = { ...out, layers: _chunkST7E3NEEcjs.mapLayer.call(void 0, out.layers, l.id, () => ({ ...l, surface })), strokes: [...out.strokes, stroke] };
3168
3170
  }
3169
3171
  };
3170
3172
  const session = this.sessionFor(doc, init, host);
@@ -3236,7 +3238,7 @@ var PaintEditorController = (_class10 = class {
3236
3238
  brush = normalizePaintBrush({ tip: { ...b.tip, size: b.tip.size * (v.brush.tip.size / s.brush.tip.size) } }, b);
3237
3239
  }
3238
3240
  const layerId = _nullishCoalesce(options.layerId, () => ( s.layerId));
3239
- if (!_chunkPOGBUYWEcjs.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.`);
3241
+ if (!_chunkST7E3NEEcjs.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.`);
3240
3242
  let load = s.load;
3241
3243
  if (load && options.color !== void 0 && load.reservoir) {
3242
3244
  const [r, g, b] = hexToRgb8(options.color);
@@ -3261,7 +3263,7 @@ var PaintEditorController = (_class10 = class {
3261
3263
  const live = this.live;
3262
3264
  if (!live) return this.doc.layers;
3263
3265
  if (_optionalChain([this, 'access', _72 => _72.liveLayers, 'optionalAccess', _73 => _73.key]) === live.surface) return this.liveLayers.layers;
3264
- const layers = _chunkPOGBUYWEcjs.mapLayer.call(void 0, this.doc.layers, live.layerId, (l) => ({ ...l, surface: live.surface }));
3266
+ const layers = _chunkST7E3NEEcjs.mapLayer.call(void 0, this.doc.layers, live.layerId, (l) => ({ ...l, surface: live.surface }));
3265
3267
  this.liveLayers = { key: live.surface, layers };
3266
3268
  return layers;
3267
3269
  }
@@ -3366,7 +3368,7 @@ var PaintEditorController = (_class10 = class {
3366
3368
  /** The canvas as PNG bytes (paper included by default; `scale` below 1 shrinks it). */
3367
3369
  exportPng(options = {}) {
3368
3370
  const img = this.scaled(options);
3369
- return _chunkPOGBUYWEcjs.encodePng.call(void 0, img.width, img.height, img.data);
3371
+ return _chunkST7E3NEEcjs.encodePng.call(void 0, img.width, img.height, img.data);
3370
3372
  }
3371
3373
  scaled(options) {
3372
3374
  const full = this.compositePixels(options);
@@ -3408,22 +3410,22 @@ var PaintEditorController = (_class10 = class {
3408
3410
  opacity: 1,
3409
3411
  blend: "normal",
3410
3412
  locks: { all: true },
3411
- surface: _chunkXIOMMGPDcjs.surfaceFromPixels.call(void 0, paperPixels, 4),
3413
+ surface: _chunkTFOPHZ3Ucjs.surfaceFromPixels.call(void 0, paperPixels, 4),
3412
3414
  offset: { x: 0, y: 0 }
3413
3415
  };
3414
3416
  const merged = this.compositePixels({ paper: true }).data;
3415
3417
  const changed = /* @__PURE__ */ new Map();
3416
3418
  const toStandard = (layers2) => layers2.map((l) => {
3417
- const blend = l.blend === "pass-through" ? l.blend : _chunkXIOMMGPDcjs.standardBlendMode.call(void 0, l.blend);
3419
+ const blend = l.blend === "pass-through" ? l.blend : _chunkTFOPHZ3Ucjs.standardBlendMode.call(void 0, l.blend);
3418
3420
  if (blend !== l.blend) changed.set(l.blend, [..._nullishCoalesce(changed.get(l.blend), () => ( [])), l.name]);
3419
3421
  const next = blend === l.blend ? l : { ...l, blend };
3420
3422
  return next.type === "group" ? { ...next, children: toStandard(next.children) } : next;
3421
3423
  });
3422
3424
  const layers = toStandard(this.doc.layers);
3423
- const result = _chunkYGIMK4NXcjs.exportPsd.call(void 0, { width, height, layers: [paperLayer, ...layers], merged, resolution: dpi });
3425
+ const result = _chunkI7FQBWMQcjs.exportPsd.call(void 0, { width, height, layers: [paperLayer, ...layers], merged, resolution: dpi });
3424
3426
  for (const [mode, names] of changed) {
3425
- const label = _nullishCoalesce(_optionalChain([_chunkXIOMMGPDcjs.BLEND_MODES, 'access', _81 => _81.find, 'call', _82 => _82((m) => m.id === mode), 'optionalAccess', _83 => _83.label]), () => ( mode));
3426
- const std = _nullishCoalesce(_optionalChain([_chunkXIOMMGPDcjs.BLEND_MODES, 'access', _84 => _84.find, 'call', _85 => _85((m) => m.id === _chunkXIOMMGPDcjs.standardBlendMode.call(void 0, mode)), 'optionalAccess', _86 => _86.label]), () => ( _chunkXIOMMGPDcjs.standardBlendMode.call(void 0, mode)));
3427
+ const label = _nullishCoalesce(_optionalChain([_chunkTFOPHZ3Ucjs.BLEND_MODES, 'access', _81 => _81.find, 'call', _82 => _82((m) => m.id === mode), 'optionalAccess', _83 => _83.label]), () => ( mode));
3428
+ const std = _nullishCoalesce(_optionalChain([_chunkTFOPHZ3Ucjs.BLEND_MODES, 'access', _84 => _84.find, 'call', _85 => _85((m) => m.id === _chunkTFOPHZ3Ucjs.standardBlendMode.call(void 0, mode)), 'optionalAccess', _86 => _86.label]), () => ( _chunkTFOPHZ3Ucjs.standardBlendMode.call(void 0, mode)));
3427
3429
  const list = names.map((n) => `"${n}"`).join(", ");
3428
3430
  const one = names.length === 1;
3429
3431
  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).`);
@@ -3433,7 +3435,7 @@ var PaintEditorController = (_class10 = class {
3433
3435
  /** `render_preview` as a base64 PNG. */
3434
3436
  previewPngBase64(options = {}) {
3435
3437
  const img = this.renderPreview(options);
3436
- return { data: _chunkPOGBUYWEcjs.bytesToBase64.call(void 0, _chunkPOGBUYWEcjs.encodePng.call(void 0, img.width, img.height, img.data)), width: img.width, height: img.height };
3438
+ return { data: _chunkST7E3NEEcjs.bytesToBase64.call(void 0, _chunkST7E3NEEcjs.encodePng.call(void 0, img.width, img.height, img.data)), width: img.width, height: img.height };
3437
3439
  }
3438
3440
  // --- Guides --------------------------------------------------------------------
3439
3441
  setGuides(next) {
@@ -3471,17 +3473,17 @@ var PaintEditorController = (_class10 = class {
3471
3473
  pixels = this.decodeImage(input.png.trim().startsWith("data:") ? input.png.trim() : `data:image/png;base64,${input.png.trim()}`, what);
3472
3474
  } else throw new PaintEditorError(`${what}: pass png (a PNG as base64 or a data URL) or pixels.`);
3473
3475
  if (pixels.width > MAX_IMAGE_SIDE || pixels.height > MAX_IMAGE_SIDE) throw new PaintEditorError(`${what} is ${pixels.width}\xD7${pixels.height}; the limit is ${MAX_IMAGE_SIDE} px per side.`);
3474
- const src = _chunkPOGBUYWEcjs.pngDataUrl.call(void 0, pixels.width, pixels.height, pixels.data);
3476
+ const src = _chunkST7E3NEEcjs.pngDataUrl.call(void 0, pixels.width, pixels.height, pixels.data);
3475
3477
  this.imagePixels.set(src, pixels);
3476
3478
  return { src, pixels };
3477
3479
  }
3478
3480
  decodeImage(src, what = "Image") {
3479
3481
  const cached = this.imagePixels.get(src);
3480
3482
  if (cached) return cached;
3481
- const parsed = _chunkPOGBUYWEcjs.parseDataUrl.call(void 0, src);
3483
+ const parsed = _chunkST7E3NEEcjs.parseDataUrl.call(void 0, src);
3482
3484
  if (!parsed) throw new PaintEditorError(`${what} is not a data URL or base64 PNG.`);
3483
3485
  try {
3484
- const png = _chunkPOGBUYWEcjs.decodePng.call(void 0, parsed.bytes);
3486
+ const png = _chunkST7E3NEEcjs.decodePng.call(void 0, parsed.bytes);
3485
3487
  const px = { width: png.width, height: png.height, data: png.data };
3486
3488
  this.imagePixels.set(src, px);
3487
3489
  return px;
@@ -3779,7 +3781,7 @@ var PaintEditorController = (_class10 = class {
3779
3781
  }
3780
3782
  /** A layer's tile surface (live while stroking), for thumbnails. */
3781
3783
  layerSurface(id) {
3782
- const l = _optionalChain([_chunkPOGBUYWEcjs.findLayer.call(void 0, this.currentLayers(), id), 'optionalAccess', _97 => _97.layer]);
3784
+ const l = _optionalChain([_chunkST7E3NEEcjs.findLayer.call(void 0, this.currentLayers(), id), 'optionalAccess', _97 => _97.layer]);
3783
3785
  return isPixelLayer(l) ? l.surface : null;
3784
3786
  }
3785
3787
  }, _class10);
@@ -4366,7 +4368,7 @@ function createPaintGuideTools(c) {
4366
4368
  const pad = c.mixingPad;
4367
4369
  return {
4368
4370
  content: [
4369
- { type: "image", data: _chunkPOGBUYWEcjs.bytesToBase64.call(void 0, _chunkPOGBUYWEcjs.encodePng.call(void 0, pad.width, pad.height, pad.pixels())), mimeType: "image/png" },
4371
+ { type: "image", data: _chunkST7E3NEEcjs.bytesToBase64.call(void 0, _chunkST7E3NEEcjs.encodePng.call(void 0, pad.width, pad.height, pad.pixels())), mimeType: "image/png" },
4370
4372
  { type: "text", text: `Mixing pad ${pad.width}\xD7${pad.height}` }
4371
4373
  ]
4372
4374
  };
@@ -4387,7 +4389,7 @@ var TIP = {
4387
4389
  type: "object",
4388
4390
  description: "The tip (the shared brush engine). Missing fields keep their current values.",
4389
4391
  properties: {
4390
- size: { type: "number", minimum: 1, maximum: _chunk7VOHOPLWcjs.MAX_BRUSH_SIZE, description: "Diameter in document pixels." },
4392
+ size: { type: "number", minimum: 1, maximum: _chunkTCKIXI46cjs.MAX_BRUSH_SIZE, description: "Diameter in document pixels." },
4391
4393
  hardness: { type: "number", minimum: 0, maximum: 1, description: "Edge hardness, 0 (soft) .. 1 (hard)." },
4392
4394
  spacing: { type: "number", minimum: 0.01, maximum: 10, description: "Dab spacing as a fraction of the diameter (0.05 is smooth, 1 is dotted)." },
4393
4395
  angle: { type: "number", minimum: -360, maximum: 360, description: "Tip angle in degrees, counter-clockwise; with rotation stroke or barrel it is added to the stroke direction or pen rotation." },
@@ -4399,7 +4401,7 @@ var TIP = {
4399
4401
  pressureOpacity: { type: "boolean", description: "Pressure scales the opacity." },
4400
4402
  blend: {
4401
4403
  type: "string",
4402
- enum: _chunkXIOMMGPDcjs.BLEND_MODES.map((m) => m.id),
4404
+ enum: _chunkTFOPHZ3Ucjs.BLEND_MODES.map((m) => m.id),
4403
4405
  description: "How paint combines with the layer. pigment mixes it in like real paint (blue into yellow gives green); multiply darkens like marker ink; watercolor glazes like a transparent wash; tint, highlight and shadow recolour, light and shade (see list_blend_modes)."
4404
4406
  }
4405
4407
  },
@@ -4432,11 +4434,11 @@ var MIXER = {
4432
4434
  mix: { type: "number", minimum: 0, maximum: 1, description: "Mix ratio: how far each dab's paint moves from the reservoir towards the picked-up colour." },
4433
4435
  loadEachStroke: { type: "boolean", description: "Refill the reservoir with the colour before each stroke." },
4434
4436
  cleanEachStroke: { type: "boolean", description: "Empty the pickup well after each stroke." },
4435
- mixing: { type: "string", enum: [..._chunk7VOHOPLWcjs.MIXING_MODELS], description: "rgb: RGB averages. pigment: mixes like paint (Kubelka-Munk)." }
4437
+ mixing: { type: "string", enum: [..._chunkTCKIXI46cjs.MIXING_MODELS], description: "rgb: RGB averages. pigment: mixes like paint (Kubelka-Munk)." }
4436
4438
  },
4437
4439
  additionalProperties: false
4438
4440
  };
4439
- var MIXING = { type: "string", enum: [..._chunk7VOHOPLWcjs.MIXING_MODELS], description: "pigment: mixes like paint (Kubelka-Munk, blue and yellow make green); rgb: straight RGB averages." };
4441
+ var MIXING = { type: "string", enum: [..._chunkTCKIXI46cjs.MIXING_MODELS], description: "pigment: mixes like paint (Kubelka-Munk, blue and yellow make green); rgb: straight RGB averages." };
4440
4442
  var BEHAVIOR = {
4441
4443
  type: "object",
4442
4444
  description: "How the brush handles paint on the canvas (dab and mixer engines; on a mixer brush pickup, mix, dirty and mixing are its mixer wet, mix, !cleanEachStroke and mixing). Missing fields keep their current values.",
@@ -4575,7 +4577,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
4575
4577
  strokes: d.strokes.length,
4576
4578
  undo: s.undoLabel,
4577
4579
  redo: s.redoLabel,
4578
- blendModes: _chunkXIOMMGPDcjs.BLEND_MODES.map((m) => m.id)
4580
+ blendModes: _chunkTFOPHZ3Ucjs.BLEND_MODES.map((m) => m.id)
4579
4581
  };
4580
4582
  }
4581
4583
  });
@@ -4708,7 +4710,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
4708
4710
  opacity: { type: "number", minimum: 0, maximum: 1, description: "Layer opacity 0..1." },
4709
4711
  blend: {
4710
4712
  type: "string",
4711
- enum: [..._chunkXIOMMGPDcjs.BLEND_MODES.map((m) => m.id), "pass-through"],
4713
+ enum: [..._chunkTFOPHZ3Ucjs.BLEND_MODES.map((m) => m.id), "pass-through"],
4712
4714
  description: "Blend mode (pass-through for groups only). Painterly modes: watercolor (the layer glazes like a transparent wash), tint (recolours keeping lightness), highlight (adds soft coloured light), shadow (shades with ambient fill); see list_blend_modes."
4713
4715
  },
4714
4716
  clipped: { type: "boolean", description: "Clip to the layer below (paint only shows where it has paint)." },
@@ -4737,12 +4739,12 @@ function createPaintEditorToolProvider(controller, options = {}) {
4737
4739
  inputSchema: EMPTY2,
4738
4740
  annotations: { title: "List blend modes", ...READ2 },
4739
4741
  handler: () => ({
4740
- modes: _chunkXIOMMGPDcjs.BLEND_MODES.map((m) => ({
4742
+ modes: _chunkTFOPHZ3Ucjs.BLEND_MODES.map((m) => ({
4741
4743
  id: m.id,
4742
4744
  label: m.label,
4743
4745
  group: m.painterly ? "painterly" : m.id === "pigment" ? "pigment" : "standard",
4744
4746
  ...m.description ? { description: m.description } : {},
4745
- psd: _chunkXIOMMGPDcjs.standardBlendMode.call(void 0, m.id)
4747
+ psd: _chunkTFOPHZ3Ucjs.standardBlendMode.call(void 0, m.id)
4746
4748
  }))
4747
4749
  })
4748
4750
  });
@@ -4810,7 +4812,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
4810
4812
  opacity: { type: "number", minimum: 0, maximum: 1, description: "Opacity 0..1 (default 1)." },
4811
4813
  grain: { type: "number", minimum: 0, maximum: 1, description: "Paper grain response 0..1 (default 0: flat)." },
4812
4814
  pressure: { type: "number", minimum: 0, maximum: 1, description: "With grain: how far into the valleys, 0..1 (default 0.5)." },
4813
- blend: { type: "string", enum: _chunkXIOMMGPDcjs.BLEND_MODES.map((m) => m.id), description: "Blend mode (default normal; pigment mixes like paint, watercolor glazes; see list_blend_modes)." }
4815
+ blend: { type: "string", enum: _chunkTFOPHZ3Ucjs.BLEND_MODES.map((m) => m.id), description: "Blend mode (default normal; pigment mixes like paint, watercolor glazes; see list_blend_modes)." }
4814
4816
  },
4815
4817
  additionalProperties: false
4816
4818
  },
@@ -4931,7 +4933,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
4931
4933
  const t = c.brushThumbnail(_nullishCoalesce(id, () => ( c.getState().brush.id)), { width, height, color });
4932
4934
  return {
4933
4935
  content: [
4934
- { type: "image", data: _chunkPOGBUYWEcjs.bytesToBase64.call(void 0, _chunkPOGBUYWEcjs.encodePng.call(void 0, t.width, t.height, t.data)), mimeType: "image/png" },
4936
+ { type: "image", data: _chunkST7E3NEEcjs.bytesToBase64.call(void 0, _chunkST7E3NEEcjs.encodePng.call(void 0, t.width, t.height, t.data)), mimeType: "image/png" },
4935
4937
  { type: "text", text: `Brush ${_nullishCoalesce(id, () => ( c.getState().brush.id))} ${t.width}\xD7${t.height}` }
4936
4938
  ]
4937
4939
  };
@@ -5186,7 +5188,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
5186
5188
  annotations: { title: "Export the painting", ...READ2 },
5187
5189
  handler: async ({ format, quality, scale, paper }) => {
5188
5190
  const bytes = await c.exportImage({ format, quality, scale, paper });
5189
- return { mimeType: _nullishCoalesce(format, () => ( "image/png")), bytes: bytes.length, data: _chunkPOGBUYWEcjs.bytesToBase64.call(void 0, bytes) };
5191
+ return { mimeType: _nullishCoalesce(format, () => ( "image/png")), bytes: bytes.length, data: _chunkST7E3NEEcjs.bytesToBase64.call(void 0, bytes) };
5190
5192
  }
5191
5193
  });
5192
5194
  add({
@@ -5197,7 +5199,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
5197
5199
  annotations: { title: "Export as PSD", ...READ2 },
5198
5200
  handler: () => {
5199
5201
  const r = c.exportPsd();
5200
- return { data: _chunkPOGBUYWEcjs.bytesToBase64.call(void 0, r.bytes), bytes: r.bytes.length, psb: r.psb, warnings: r.warnings };
5202
+ return { data: _chunkST7E3NEEcjs.bytesToBase64.call(void 0, r.bytes), bytes: r.bytes.length, psb: r.psb, warnings: r.warnings };
5201
5203
  }
5202
5204
  });
5203
5205
  add({
@@ -5221,7 +5223,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
5221
5223
  }
5222
5224
  });
5223
5225
  tools.push(...createPaintGuideTools(c));
5224
- tools.push(..._chunk7VOHOPLWcjs.createPigmentTools.call(void 0, ));
5226
+ tools.push(..._chunkTCKIXI46cjs.createPigmentTools.call(void 0, ));
5225
5227
  return { id: _nullishCoalesce(options.id, () => ( "paint-editor")), namespace: options.namespace, tools };
5226
5228
  }
5227
5229
 
@@ -5416,11 +5418,11 @@ var PaintCanvasPresenter = (_class12 = class {
5416
5418
  const key = `${tx},${ty}`;
5417
5419
  if (this.uploaded.get(key) === data) return;
5418
5420
  this.uploaded.set(key, data);
5419
- if (!this.scratch) this.scratch = ctx.createImageData(_chunkXIOMMGPDcjs.TILE, _chunkXIOMMGPDcjs.TILE);
5421
+ if (!this.scratch) this.scratch = ctx.createImageData(_chunkTFOPHZ3Ucjs.TILE, _chunkTFOPHZ3Ucjs.TILE);
5420
5422
  this.scratch.data.set(data);
5421
- const ox = tx * _chunkXIOMMGPDcjs.TILE;
5422
- const oy = ty * _chunkXIOMMGPDcjs.TILE;
5423
- ctx.putImageData(this.scratch, ox, oy, 0, 0, Math.min(_chunkXIOMMGPDcjs.TILE, width - ox), Math.min(_chunkXIOMMGPDcjs.TILE, height - oy));
5423
+ const ox = tx * _chunkTFOPHZ3Ucjs.TILE;
5424
+ const oy = ty * _chunkTFOPHZ3Ucjs.TILE;
5425
+ ctx.putImageData(this.scratch, ox, oy, 0, 0, Math.min(_chunkTFOPHZ3Ucjs.TILE, width - ox), Math.min(_chunkTFOPHZ3Ucjs.TILE, height - oy));
5424
5426
  drawn++;
5425
5427
  }, { dirty });
5426
5428
  return drawn;
@@ -5502,8 +5504,8 @@ function wheelPick(dx, dy, wheel, color) {
5502
5504
  return rgbToHexColor(nr, ng, nb);
5503
5505
  }
5504
5506
  var BLEND_MENU_GROUPS = [
5505
- { label: "Standard", modes: _chunkXIOMMGPDcjs.BLEND_MODES.filter((m) => !m.painterly && m.id !== "pigment") },
5506
- { label: "Paint", modes: _chunkXIOMMGPDcjs.BLEND_MODES.filter((m) => m.painterly || m.id === "pigment") }
5507
+ { label: "Standard", modes: _chunkTFOPHZ3Ucjs.BLEND_MODES.filter((m) => !m.painterly && m.id !== "pigment") },
5508
+ { label: "Paint", modes: _chunkTFOPHZ3Ucjs.BLEND_MODES.filter((m) => m.painterly || m.id === "pigment") }
5507
5509
  ];
5508
5510
  var PICKUP_SLIDERS = [
5509
5511
  { path: "behavior.pickup", label: "Pick-up", min: 0, max: 1, step: 0.01 },
@@ -5731,5 +5733,5 @@ function padSampleRadius(size) {
5731
5733
 
5732
5734
 
5733
5735
 
5734
- exports.BLEND_MENU_GROUPS = BLEND_MENU_GROUPS; exports.BLEND_MODES = _chunkXIOMMGPDcjs.BLEND_MODES; exports.BRUSH_ID = BRUSH_ID; exports.BRUSH_ROTATIONS = BRUSH_ROTATIONS; exports.BRUSH_SLIDERS = BRUSH_SLIDERS; exports.BUILTIN_BRUSHES = BUILTIN_BRUSHES; exports.DEFAULT_BEHAVIOR = DEFAULT_BEHAVIOR; exports.DEFAULT_BRUSH_ID = DEFAULT_BRUSH_ID; exports.DEFAULT_DPI = DEFAULT_DPI; exports.DEFAULT_DYNAMICS = DEFAULT_DYNAMICS; exports.DEFAULT_MULTI_COLOR = DEFAULT_MULTI_COLOR; exports.DEFAULT_PAPER = DEFAULT_PAPER; exports.DEFAULT_SWATCHES = DEFAULT_SWATCHES; exports.DEFAULT_VIEW = DEFAULT_VIEW; exports.DryStroke = DryStroke; exports.GRAIN_PATTERNS = GRAIN_PATTERNS; exports.GRAIN_TILE = GRAIN_TILE; exports.HARMONY_KINDS = HARMONY_KINDS; exports.IDENTITY_AFFINE = IDENTITY_AFFINE; exports.IDENTITY_COPY = IDENTITY_COPY; exports.MAX_BRUSH_SIZE = _chunk7VOHOPLWcjs.MAX_BRUSH_SIZE; exports.MAX_CANVAS_SIDE = MAX_CANVAS_SIDE; exports.MAX_COORDINATE = MAX_COORDINATE; exports.MAX_IMAGE_SIDE = MAX_IMAGE_SIDE; 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 = MULTI_COLOR_MODES; exports.MixingPad = MixingPad; exports.PAD_SAMPLE_SIZES = PAD_SAMPLE_SIZES; exports.PAINTERLY_BLEND_MODES = _chunkXIOMMGPDcjs.PAINTERLY_BLEND_MODES; exports.PAINT_BRUSH_CATEGORIES = PAINT_BRUSH_CATEGORIES; exports.PAINT_BRUSH_ENGINES = PAINT_BRUSH_ENGINES; exports.PAINT_FORMAT = PAINT_FORMAT; exports.PAINT_SCHEMA_VERSION = PAINT_SCHEMA_VERSION; exports.PAINT_TOOLS = PAINT_TOOLS; exports.PAPER_FAMILIES = PAPER_FAMILIES; exports.PAPER_LIBRARY = PAPER_LIBRARY; exports.PAPER_NODE_ID = PAPER_NODE_ID; exports.PAPER_SLIDERS = PAPER_SLIDERS; exports.PaintCanvasPresenter = PaintCanvasPresenter; exports.PaintDabStroke = PaintDabStroke; exports.PaintDirector = PaintDirector; exports.PaintDocumentError = PaintDocumentError; exports.PaintEditorController = PaintEditorController; exports.PaintEditorError = PaintEditorError; exports.PaintGesture = PaintGesture; exports.PaintPresence = PaintPresence; exports.PaintStrokeSession = PaintStrokeSession; exports.PaperGrain = PaperGrain; exports.PenDabWalker = PenDabWalker; exports.PenSmoother = PenSmoother; exports.PerspectiveSnapper = PerspectiveSnapper; exports.SNAP_DECIDE_DISTANCE = SNAP_DECIDE_DISTANCE; exports.SYMMETRY_MODES = SYMMETRY_MODES; exports.TRACING_NODE_ID = TRACING_NODE_ID; exports.TileableNoise = TileableNoise; exports.affineCopy = affineCopy; exports.applyAffine = applyAffine; exports.brushEngineControls = brushEngineControls; exports.brushLoadColor = brushLoadColor; exports.brushLoadForStroke = brushLoadForStroke; exports.brushToJSON = brushToJSON; exports.clonePaper = clonePaper; exports.colorHarmony = colorHarmony; exports.composeAffine = composeAffine; exports.createPaintCompositor = createPaintCompositor; exports.createPaintDocument = createPaintDocument; exports.createPaintEditorToolProvider = createPaintEditorToolProvider; exports.createPaintLayer = createPaintLayer; exports.decodeImageBlob = decodeImageBlob; exports.defaultGuides = defaultGuides; exports.defaultImageEncoder = defaultImageEncoder; exports.deserializePaintDocument = deserializePaintDocument; exports.deserializePaintDocumentAsync = deserializePaintDocumentAsync; exports.documentExtensions = documentExtensions; exports.documentToScreen = documentToScreen; exports.downloadBytes = downloadBytes; exports.downsampleRgba = downsampleRgba; exports.fitZoom = fitZoom; exports.grainCatch = grainCatch; exports.grainHeights = grainHeights; exports.guideOverlay = guideOverlay; exports.handlePaintShortcut = handlePaintShortcut; exports.hash2 = hash2; exports.hexToRgb8 = hexToRgb8; exports.hslToRgb = hslToRgb; exports.hsvToRgb = hsvToRgb; exports.hueToWheel = hueToWheel; exports.invertAffine = invertAffine; exports.isBlendMode = _chunkXIOMMGPDcjs.isBlendMode; exports.isPainterlyBlendMode = _chunkXIOMMGPDcjs.isPainterlyBlendMode; exports.isPalmTouch = isPalmTouch; exports.isWetCapable = isWetCapable; exports.mapPenPoint = mapPenPoint; exports.mix32 = mix32; exports.mixerLoadForStroke = mixerLoadForStroke; exports.mixerTip = mixerTip; exports.multiColorForDab = multiColorForDab; exports.multiColorGradient = multiColorGradient; exports.multiColorPalette = multiColorPalette; exports.multiColorSliders = multiColorSliders; exports.newPaintLayerId = newPaintLayerId; exports.normalizeBehavior = normalizeBehavior; exports.normalizeBrushStroke = normalizeBrushStroke; exports.normalizeCanvas = normalizeCanvas; exports.normalizeDynamics = normalizeDynamics; exports.normalizeMultiColor = normalizeMultiColor; exports.normalizePaintBrush = normalizePaintBrush; exports.normalizePaper = normalizePaper; exports.normalizePerspective = normalizePerspective; exports.normalizeRotation = normalizeRotation; exports.normalizeSymmetry = normalizeSymmetry; exports.normalizeView = normalizeView; exports.padSampleRadius = padSampleRadius; exports.paperGrain = paperGrain; exports.paperKey = paperKey; exports.paperNode = paperNode; exports.paperPreset = paperPreset; exports.parseBrushLibrary = parseBrushLibrary; exports.parseHexColor = parseHexColor; exports.patchBrushValue = patchBrushValue; exports.patchPath = patchPath; exports.penOrientation = penOrientation; exports.perspectiveDirections = perspectiveDirections; exports.perspectiveGuideLines = perspectiveGuideLines; exports.pointerToPenPoint = pointerToPenPoint; exports.rand01 = rand01; exports.randSigned = randSigned; exports.readPath = readPath; exports.renderBrushThumbnail = renderBrushThumbnail; exports.renderColorWheel = renderColorWheel; exports.renderPaper = renderPaper; exports.rgbToHexColor = rgbToHexColor; exports.rgbToHsl = rgbToHsl; exports.rgbToHsv = rgbToHsv; exports.samplePressure = samplePressure; exports.screenToDocument = screenToDocument; exports.seedFromString = seedFromString; exports.serializePaintDocument = serializePaintDocument; exports.serializePaintDocumentExternal = serializePaintDocumentExternal; exports.standardBlendMode = _chunkXIOMMGPDcjs.standardBlendMode; exports.strokeBounds = strokeBounds; exports.strokeDuration = strokeDuration; exports.strokeSchedule = strokeSchedule; exports.sweepPath = sweepPath; exports.symmetryAxisAngles = symmetryAxisAngles; exports.symmetryAxisSegments = symmetryAxisSegments; exports.symmetryCopies = symmetryCopies; exports.thumbnailStroke = thumbnailStroke; exports.tiltToOrientation = tiltToOrientation; exports.toStrokePoint = toStrokePoint; exports.usesPaintExchange = usesPaintExchange; exports.variationAffine = variationAffine; exports.varyStroke = varyStroke; exports.viewCssTransform = viewCssTransform; exports.viewMatrix = viewMatrix; exports.viewPenToDocument = viewPenToDocument; exports.wheelAngle = wheelAngle; exports.wheelPick = wheelPick; exports.wheelPoint = wheelPoint; exports.wheelToHue = wheelToHue;
5736
+ exports.BLEND_MENU_GROUPS = BLEND_MENU_GROUPS; exports.BLEND_MODES = _chunkTFOPHZ3Ucjs.BLEND_MODES; exports.BRUSH_ID = BRUSH_ID; exports.BRUSH_ROTATIONS = BRUSH_ROTATIONS; exports.BRUSH_SLIDERS = BRUSH_SLIDERS; exports.BUILTIN_BRUSHES = BUILTIN_BRUSHES; exports.DEFAULT_BEHAVIOR = DEFAULT_BEHAVIOR; exports.DEFAULT_BRUSH_ID = DEFAULT_BRUSH_ID; exports.DEFAULT_DPI = DEFAULT_DPI; exports.DEFAULT_DYNAMICS = DEFAULT_DYNAMICS; exports.DEFAULT_MULTI_COLOR = DEFAULT_MULTI_COLOR; exports.DEFAULT_PAPER = DEFAULT_PAPER; exports.DEFAULT_SWATCHES = DEFAULT_SWATCHES; exports.DEFAULT_VIEW = DEFAULT_VIEW; exports.DryStroke = DryStroke; exports.GRAIN_PATTERNS = GRAIN_PATTERNS; exports.GRAIN_TILE = GRAIN_TILE; exports.HARMONY_KINDS = HARMONY_KINDS; exports.IDENTITY_AFFINE = IDENTITY_AFFINE; exports.IDENTITY_COPY = IDENTITY_COPY; exports.MAX_BRUSH_SIZE = _chunkTCKIXI46cjs.MAX_BRUSH_SIZE; exports.MAX_CANVAS_SIDE = MAX_CANVAS_SIDE; exports.MAX_COORDINATE = MAX_COORDINATE; exports.MAX_IMAGE_SIDE = MAX_IMAGE_SIDE; 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 = MULTI_COLOR_MODES; exports.MixingPad = MixingPad; exports.PAD_SAMPLE_SIZES = PAD_SAMPLE_SIZES; exports.PAINTERLY_BLEND_MODES = _chunkTFOPHZ3Ucjs.PAINTERLY_BLEND_MODES; exports.PAINT_BRUSH_CATEGORIES = PAINT_BRUSH_CATEGORIES; exports.PAINT_BRUSH_ENGINES = PAINT_BRUSH_ENGINES; exports.PAINT_FORMAT = PAINT_FORMAT; exports.PAINT_SCHEMA_VERSION = PAINT_SCHEMA_VERSION; exports.PAINT_TOOLS = PAINT_TOOLS; exports.PAPER_FAMILIES = PAPER_FAMILIES; exports.PAPER_LIBRARY = PAPER_LIBRARY; exports.PAPER_NODE_ID = PAPER_NODE_ID; exports.PAPER_SLIDERS = PAPER_SLIDERS; exports.PaintCanvasPresenter = PaintCanvasPresenter; exports.PaintDabStroke = PaintDabStroke; exports.PaintDirector = PaintDirector; exports.PaintDocumentError = PaintDocumentError; exports.PaintEditorController = PaintEditorController; exports.PaintEditorError = PaintEditorError; exports.PaintGesture = PaintGesture; exports.PaintPresence = PaintPresence; exports.PaintStrokeSession = PaintStrokeSession; exports.PaperGrain = PaperGrain; exports.PenDabWalker = PenDabWalker; exports.PenSmoother = PenSmoother; exports.PerspectiveSnapper = PerspectiveSnapper; exports.SNAP_DECIDE_DISTANCE = SNAP_DECIDE_DISTANCE; exports.SYMMETRY_MODES = SYMMETRY_MODES; exports.TRACING_NODE_ID = TRACING_NODE_ID; exports.TileableNoise = TileableNoise; exports.affineCopy = affineCopy; exports.applyAffine = applyAffine; exports.brushEngineControls = brushEngineControls; exports.brushLoadColor = brushLoadColor; exports.brushLoadForStroke = brushLoadForStroke; exports.brushToJSON = brushToJSON; exports.clonePaper = clonePaper; exports.colorHarmony = colorHarmony; exports.composeAffine = composeAffine; exports.createPaintCompositor = createPaintCompositor; exports.createPaintDocument = createPaintDocument; exports.createPaintEditorToolProvider = createPaintEditorToolProvider; exports.createPaintLayer = createPaintLayer; exports.decodeImageBlob = decodeImageBlob; exports.defaultGuides = defaultGuides; exports.defaultImageEncoder = defaultImageEncoder; exports.deserializePaintDocument = deserializePaintDocument; exports.deserializePaintDocumentAsync = deserializePaintDocumentAsync; exports.documentExtensions = documentExtensions; exports.documentToScreen = documentToScreen; exports.downloadBytes = downloadBytes; exports.downsampleRgba = downsampleRgba; exports.fitZoom = fitZoom; exports.grainCatch = grainCatch; exports.grainHeights = grainHeights; exports.guideOverlay = guideOverlay; exports.handlePaintShortcut = handlePaintShortcut; exports.hash2 = hash2; exports.hexToRgb8 = hexToRgb8; exports.hslToRgb = hslToRgb; exports.hsvToRgb = hsvToRgb; exports.hueToWheel = hueToWheel; exports.invertAffine = invertAffine; exports.isBlendMode = _chunkTFOPHZ3Ucjs.isBlendMode; exports.isPainterlyBlendMode = _chunkTFOPHZ3Ucjs.isPainterlyBlendMode; exports.isPalmTouch = isPalmTouch; exports.isWetCapable = isWetCapable; exports.mapPenPoint = mapPenPoint; exports.mix32 = mix32; exports.mixerLoadForStroke = mixerLoadForStroke; exports.mixerTip = mixerTip; exports.multiColorForDab = multiColorForDab; exports.multiColorGradient = multiColorGradient; exports.multiColorPalette = multiColorPalette; exports.multiColorSliders = multiColorSliders; exports.newPaintLayerId = newPaintLayerId; exports.normalizeBehavior = normalizeBehavior; exports.normalizeBrushStroke = normalizeBrushStroke; exports.normalizeCanvas = normalizeCanvas; exports.normalizeDynamics = normalizeDynamics; exports.normalizeMultiColor = normalizeMultiColor; exports.normalizePaintBrush = normalizePaintBrush; exports.normalizePaper = normalizePaper; exports.normalizePerspective = normalizePerspective; exports.normalizeRotation = normalizeRotation; exports.normalizeSymmetry = normalizeSymmetry; exports.normalizeView = normalizeView; exports.padSampleRadius = padSampleRadius; exports.paperGrain = paperGrain; exports.paperKey = paperKey; exports.paperNode = paperNode; exports.paperPreset = paperPreset; exports.parseBrushLibrary = parseBrushLibrary; exports.parseHexColor = parseHexColor; exports.patchBrushValue = patchBrushValue; exports.patchPath = patchPath; exports.penOrientation = penOrientation; exports.perspectiveDirections = perspectiveDirections; exports.perspectiveGuideLines = perspectiveGuideLines; exports.pointerToPenPoint = pointerToPenPoint; exports.rand01 = rand01; exports.randSigned = randSigned; exports.readPath = readPath; exports.renderBrushThumbnail = renderBrushThumbnail; exports.renderColorWheel = renderColorWheel; exports.renderPaper = renderPaper; exports.rgbToHexColor = rgbToHexColor; exports.rgbToHsl = rgbToHsl; exports.rgbToHsv = rgbToHsv; exports.samplePressure = samplePressure; exports.screenToDocument = screenToDocument; exports.seedFromString = seedFromString; exports.serializePaintDocument = serializePaintDocument; exports.serializePaintDocumentExternal = serializePaintDocumentExternal; exports.standardBlendMode = _chunkTFOPHZ3Ucjs.standardBlendMode; exports.strokeBounds = strokeBounds; exports.strokeDuration = strokeDuration; exports.strokeSchedule = strokeSchedule; exports.sweepPath = sweepPath; exports.symmetryAxisAngles = symmetryAxisAngles; exports.symmetryAxisSegments = symmetryAxisSegments; exports.symmetryCopies = symmetryCopies; exports.thumbnailStroke = thumbnailStroke; exports.tiltToOrientation = tiltToOrientation; exports.toStrokePoint = toStrokePoint; exports.usesPaintExchange = usesPaintExchange; exports.variationAffine = variationAffine; exports.varyStroke = varyStroke; exports.viewCssTransform = viewCssTransform; exports.viewMatrix = viewMatrix; exports.viewPenToDocument = viewPenToDocument; exports.wheelAngle = wheelAngle; exports.wheelPick = wheelPick; exports.wheelPoint = wheelPoint; exports.wheelToHue = wheelToHue;
5735
5737
  //# sourceMappingURL=index.cjs.map