@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
@@ -41,7 +41,10 @@
41
41
 
42
42
 
43
43
 
44
- var _chunkPOGBUYWEcjs = require('./chunk-POGBUYWE.cjs');
44
+
45
+
46
+
47
+ var _chunkST7E3NEEcjs = require('./chunk-ST7E3NEE.cjs');
45
48
 
46
49
 
47
50
 
@@ -68,7 +71,20 @@ var _chunkMUUXNRU4cjs = require('./chunk-MUUXNRU4.cjs');
68
71
 
69
72
 
70
73
 
71
- var _chunkXIOMMGPDcjs = require('./chunk-XIOMMGPD.cjs');
74
+ var _chunkTFOPHZ3Ucjs = require('./chunk-TFOPHZ3U.cjs');
75
+
76
+
77
+
78
+
79
+
80
+ var _chunkG5NMLUVFcjs = require('./chunk-G5NMLUVF.cjs');
81
+
82
+
83
+
84
+
85
+ var _chunk643B2HKCcjs = require('./chunk-643B2HKC.cjs');
86
+
87
+
72
88
 
73
89
 
74
90
 
@@ -93,7 +109,16 @@ var _chunkXIOMMGPDcjs = require('./chunk-XIOMMGPD.cjs');
93
109
 
94
110
 
95
111
 
96
- var _chunkW3GXSUSQcjs = require('./chunk-W3GXSUSQ.cjs');
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+ var _chunkLPLCWZTMcjs = require('./chunk-LPLCWZTM.cjs');
97
122
 
98
123
 
99
124
 
@@ -1112,7 +1137,7 @@ function smoothCoverage(m, w, h, r) {
1112
1137
  return src;
1113
1138
  }
1114
1139
  function featherCoverage(m, w, h, radius) {
1115
- const out = _chunkPOGBUYWEcjs.gaussianBlur.call(void 0, m, w, h, Number.isFinite(radius) ? Math.max(0, radius) : 0, "zero");
1140
+ const out = _chunkST7E3NEEcjs.gaussianBlur.call(void 0, m, w, h, Number.isFinite(radius) ? Math.max(0, radius) : 0, "zero");
1116
1141
  for (let i = 0; i < out.length; i++) if (Math.abs(out[i]) < 1e-7) out[i] = 0;
1117
1142
  return out;
1118
1143
  }
@@ -1260,7 +1285,7 @@ function layerMaskCoverage(mask) {
1260
1285
  let v = new Float32Array(sel.data.length);
1261
1286
  for (let i = 0; i < v.length; i++) v[i] = sel.data[i] / 255;
1262
1287
  const feather = _nullishCoalesce(mask.feather, () => ( 0));
1263
- if (feather > 0) v = _chunkPOGBUYWEcjs.gaussianBlur.call(void 0, v, mask.width, mask.height, feather, "clamp");
1288
+ if (feather > 0) v = _chunkST7E3NEEcjs.gaussianBlur.call(void 0, v, mask.width, mask.height, feather, "clamp");
1264
1289
  const density = _nullishCoalesce(mask.density, () => ( 1));
1265
1290
  if (density !== 1) for (let i = 0; i < v.length; i++) v[i] = 1 - density * (1 - v[i]);
1266
1291
  return v;
@@ -1481,7 +1506,7 @@ function normalizeAdjustmentLayer(raw) {
1481
1506
  kind: r.kind,
1482
1507
  enabled: r.enabled !== false,
1483
1508
  opacity: clampTo(r.opacity, 0, 1, 1),
1484
- blend: _chunkXIOMMGPDcjs.normalizeBlendMode.call(void 0, r.blend),
1509
+ blend: _chunkTFOPHZ3Ucjs.normalizeBlendMode.call(void 0, r.blend),
1485
1510
  params: normParams(r.kind, r.params)
1486
1511
  };
1487
1512
  if (typeof r.name === "string" && r.name) layer.name = r.name;
@@ -1503,7 +1528,7 @@ function normalizeAdjustmentLayers(raw) {
1503
1528
  return out;
1504
1529
  }
1505
1530
  function curveLutFromLevels(points) {
1506
- return _chunkPOGBUYWEcjs.curveLut.call(void 0, points.map((p) => ({ input: p.input / 255, output: p.output / 255 })));
1531
+ return _chunkST7E3NEEcjs.curveLut.call(void 0, points.map((p) => ({ input: p.input / 255, output: p.output / 255 })));
1507
1532
  }
1508
1533
  var toUnitLevels = (c) => ({
1509
1534
  inBlack: c.inBlack / 255,
@@ -1742,7 +1767,7 @@ function lutOp(luts) {
1742
1767
  var isIdentityCurve = (pts) => pts.length === 2 && pts[0].input === 0 && pts[0].output === 0 && pts[1].input === 255 && pts[1].output === 255;
1743
1768
  var isIdentityLevels = (c) => c.inBlack === 0 && c.inWhite === 255 && c.gamma === 1 && c.outBlack === 0 && c.outWhite === 255;
1744
1769
  var LEVELS_QUANTUM = 255;
1745
- function toneLuts(layer) {
1770
+ function toneLuts(layer, quantum = LEVELS_QUANTUM) {
1746
1771
  const n = ADJUSTMENT_LUT_SIZE;
1747
1772
  if (layer.kind === "curves") {
1748
1773
  const m = curveLutFromLevels(layer.params.master);
@@ -1757,13 +1782,14 @@ function toneLuts(layer) {
1757
1782
  return [layer.params.red, layer.params.green, layer.params.blue].map((rec) => {
1758
1783
  const c = toUnitLevels(rec);
1759
1784
  const out = new Float32Array(n);
1760
- for (let k = 0; k < n; k++) out[k] = levelsValue(m, levelsValue(c, k / (n - 1), LEVELS_QUANTUM), LEVELS_QUANTUM);
1785
+ const q2 = _nullishCoalesce(quantum, () => ( void 0));
1786
+ for (let k = 0; k < n; k++) out[k] = levelsValue(m, levelsValue(c, k / (n - 1), q2), q2);
1761
1787
  return out;
1762
1788
  });
1763
1789
  }
1764
1790
  return null;
1765
1791
  }
1766
- function compileAdjustmentLayer(layer) {
1792
+ function compileAdjustmentLayer(layer, options = {}) {
1767
1793
  switch (layer.kind) {
1768
1794
  case "curves": {
1769
1795
  const p = layer.params;
@@ -1773,7 +1799,7 @@ function compileAdjustmentLayer(layer) {
1773
1799
  case "levels": {
1774
1800
  const p = layer.params;
1775
1801
  if ([p.master, p.red, p.green, p.blue].every(isIdentityLevels)) return null;
1776
- return lutOp(toneLuts(layer));
1802
+ return lutOp(toneLuts(layer, options.deep ? null : LEVELS_QUANTUM));
1777
1803
  }
1778
1804
  case "hueSaturation": {
1779
1805
  const p = layer.params;
@@ -1826,7 +1852,7 @@ function compileAdjustmentLayer(layer) {
1826
1852
  return (c) => {
1827
1853
  const g = blackWhiteGray(c, weights);
1828
1854
  if (tint) {
1829
- const t = _chunkXIOMMGPDcjs.setLum.call(void 0, tint, g);
1855
+ const t = _chunkTFOPHZ3Ucjs.setLum.call(void 0, tint, g);
1830
1856
  c[0] = clamp01(t[0]);
1831
1857
  c[1] = clamp01(t[1]);
1832
1858
  c[2] = clamp01(t[2]);
@@ -1845,7 +1871,7 @@ function compileAdjustmentLayer(layer) {
1845
1871
  let f = [0, 1, 2].map((r) => linearToSrgb(Math.max(0, m[r][0] * l[0] + m[r][1] * l[1] + m[r][2] * l[2])));
1846
1872
  if (preserve) {
1847
1873
  const target = 0.3 * c[0] + 0.59 * c[1] + 0.11 * c[2];
1848
- f = _chunkXIOMMGPDcjs.setLum.call(void 0, f, target);
1874
+ f = _chunkTFOPHZ3Ucjs.setLum.call(void 0, f, target);
1849
1875
  }
1850
1876
  c[0] = clamp01(f[0]);
1851
1877
  c[1] = clamp01(f[1]);
@@ -1878,15 +1904,15 @@ function compileAdjustmentLayer(layer) {
1878
1904
  }
1879
1905
  var COMPILE_CACHE_LIMIT = 64;
1880
1906
  var compileCache = /* @__PURE__ */ new Map();
1881
- function compiledFor(layer) {
1882
- const key = `${layer.kind}:${JSON.stringify(layer.params)}`;
1907
+ function compiledFor(layer, deep = false) {
1908
+ const key = `${deep ? "deep:" : ""}${layer.kind}:${JSON.stringify(layer.params)}`;
1883
1909
  if (compileCache.has(key)) {
1884
1910
  const op2 = compileCache.get(key);
1885
1911
  compileCache.delete(key);
1886
1912
  compileCache.set(key, op2);
1887
1913
  return op2;
1888
1914
  }
1889
- const op = compileAdjustmentLayer(layer);
1915
+ const op = compileAdjustmentLayer(layer, { deep });
1890
1916
  compileCache.set(key, op);
1891
1917
  if (compileCache.size > COMPILE_CACHE_LIMIT) compileCache.delete(compileCache.keys().next().value);
1892
1918
  return op;
@@ -1912,10 +1938,10 @@ function applyLayer(c, layer, op, coverage = 1) {
1912
1938
  const cb0 = c[0], cb1 = c[1], cb2 = c[2];
1913
1939
  op(c);
1914
1940
  if (blend === "pigment") {
1915
- _chunkXIOMMGPDcjs.mixPigmentRgb.call(void 0, [clamp01(cb0), clamp01(cb1), clamp01(cb2)], [clamp01(c[0]), clamp01(c[1]), clamp01(c[2])], alpha, c);
1941
+ _chunkTFOPHZ3Ucjs.mixPigmentRgb.call(void 0, [clamp01(cb0), clamp01(cb1), clamp01(cb2)], [clamp01(c[0]), clamp01(c[1]), clamp01(c[2])], alpha, c);
1916
1942
  return;
1917
1943
  }
1918
- const b = blend === "normal" ? c : _chunkXIOMMGPDcjs.blendRgb.call(void 0, blend, [cb0, cb1, cb2], c);
1944
+ const b = blend === "normal" ? c : _chunkTFOPHZ3Ucjs.blendRgb.call(void 0, blend, [cb0, cb1, cb2], c);
1919
1945
  c[0] = (1 - alpha) * cb0 + alpha * b[0];
1920
1946
  c[1] = (1 - alpha) * cb1 + alpha * b[1];
1921
1947
  c[2] = (1 - alpha) * cb2 + alpha * b[2];
@@ -1947,8 +1973,31 @@ function applyAdjustmentLayers(imageData, layers, masks) {
1947
1973
  data[i + 2] = Math.round(clamp01(c[2]) * 255);
1948
1974
  }
1949
1975
  }
1976
+ function applyAdjustmentLayersFloat(data, layers, masks) {
1977
+ const active = activeAdjustmentLayers(layers);
1978
+ if (!active.length) return;
1979
+ const ops = active.map((l) => compiledFor(l, true));
1980
+ const planes = active.map((l) => _optionalChain([masks, 'optionalAccess', _7 => _7.get, 'call', _8 => _8(l.id)]));
1981
+ const c = [0, 0, 0];
1982
+ for (let i = 0; i < data.length; i += 4) {
1983
+ if (!(data[i + 3] > 0)) continue;
1984
+ c[0] = data[i];
1985
+ c[1] = data[i + 1];
1986
+ c[2] = data[i + 2];
1987
+ for (let k = 0; k < active.length; k++) {
1988
+ const plane = planes[k];
1989
+ if (plane) {
1990
+ const cov = plane[i >> 2];
1991
+ if (cov > 0) applyLayer(c, active[k], ops[k], cov >= 1 ? 1 : cov);
1992
+ } else applyLayer(c, active[k], ops[k]);
1993
+ }
1994
+ data[i] = c[0];
1995
+ data[i + 1] = c[1];
1996
+ data[i + 2] = c[2];
1997
+ }
1998
+ }
1950
1999
  function adjustmentLayersKey(layers) {
1951
- if (!_optionalChain([layers, 'optionalAccess', _7 => _7.length])) return "";
2000
+ if (!_optionalChain([layers, 'optionalAccess', _9 => _9.length])) return "";
1952
2001
  return JSON.stringify(
1953
2002
  layers.map((l) => {
1954
2003
  const key = [l.kind, l.enabled !== false, _nullishCoalesce(l.opacity, () => ( 1)), _nullishCoalesce(l.blend, () => ( "normal")), l.params];
@@ -2222,22 +2271,24 @@ function removeAlpha(imageData) {
2222
2271
  }
2223
2272
  }
2224
2273
 
2274
+ // src/text/types.ts
2275
+ var TEXT_ALIGNS = ["left", "center", "right", "justify"];
2276
+
2225
2277
  // src/image-editor/layers/model.ts
2226
2278
  var SHAPE_OPERATIONS = ["combine", "subtract", "intersect", "exclude"];
2227
2279
  var LIVE_SHAPE_KINDS = ["rect", "ellipse", "polygon", "star", "line"];
2228
- var TEXT_ALIGNS = ["left", "center", "right", "justify"];
2229
2280
  var idCounter = 0;
2230
2281
  function newLayerId(prefix = "layer") {
2231
2282
  return `${prefix}_${Date.now().toString(36)}_${(++idCounter).toString(36)}`;
2232
2283
  }
2233
2284
  function pixelLayers(layers) {
2234
- return _chunkPOGBUYWEcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "pixel");
2285
+ return _chunkST7E3NEEcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "pixel");
2235
2286
  }
2236
2287
  function developFilter(layer) {
2237
- return _optionalChain([layer, 'access', _8 => _8.filters, 'optionalAccess', _9 => _9.find, 'call', _10 => _10((f) => f.kind === "develop")]);
2288
+ return _optionalChain([layer, 'access', _10 => _10.filters, 'optionalAccess', _11 => _11.find, 'call', _12 => _12((f) => f.kind === "develop")]);
2238
2289
  }
2239
2290
  function blurFilter(layer) {
2240
- return _optionalChain([layer, 'access', _11 => _11.filters, 'optionalAccess', _12 => _12.find, 'call', _13 => _13((f) => f.kind === "blur")]);
2291
+ return _optionalChain([layer, 'access', _13 => _13.filters, 'optionalAccess', _14 => _14.find, 'call', _15 => _15((f) => f.kind === "blur")]);
2241
2292
  }
2242
2293
  function isActiveFilter(f) {
2243
2294
  if (!f.enabled) return false;
@@ -2262,10 +2313,10 @@ function isRenderedLayer(layer) {
2262
2313
  return layer.type === "smart" || layer.type === "shape" || layer.type === "type";
2263
2314
  }
2264
2315
  function shapeLayers(layers) {
2265
- return _chunkPOGBUYWEcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "shape");
2316
+ return _chunkST7E3NEEcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "shape");
2266
2317
  }
2267
2318
  function smartObjectLayers(layers) {
2268
- return _chunkPOGBUYWEcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "smart");
2319
+ return _chunkST7E3NEEcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "smart");
2269
2320
  }
2270
2321
 
2271
2322
  // src/image-editor/layers/compositor.ts
@@ -2331,7 +2382,7 @@ function runLayerFilters(data, width, height, filters) {
2331
2382
  var filterSpecCache = /* @__PURE__ */ new WeakMap();
2332
2383
  function pixelFilterSpec(layer) {
2333
2384
  const list2 = layer.filters;
2334
- if (!_optionalChain([list2, 'optionalAccess', _14 => _14.length])) return null;
2385
+ if (!_optionalChain([list2, 'optionalAccess', _16 => _16.length])) return null;
2335
2386
  if (filterSpecCache.has(list2)) return filterSpecCache.get(list2);
2336
2387
  const filters = list2.filter(isActiveFilter);
2337
2388
  let spec = null;
@@ -2352,7 +2403,7 @@ var PHOTO_PROFILE = {
2352
2403
  const views = layers.map(adjustmentNodeAsLayer);
2353
2404
  applyAdjustmentLayers({ data: acc }, views, masks);
2354
2405
  },
2355
- contentTile: (l, r, sources) => l.type === "annotation" ? _nullishCoalesce(_optionalChain([sources, 'access', _15 => _15.rasterizeAnnotation, 'optionalCall', _16 => _16(l.annotation, r)]), () => ( null)) : null,
2406
+ contentTile: (l, r, sources) => l.type === "annotation" ? _nullishCoalesce(_optionalChain([sources, 'access', _17 => _17.rasterizeAnnotation, 'optionalCall', _18 => _18(l.annotation, r)]), () => ( null)) : null,
2356
2407
  /** Annotation layers draw with their annotation's blend mode unless the layer sets one. */
2357
2408
  contentBlend: (l) => l.type === "annotation" && l.blend === "normal" && l.annotation.blend ? l.annotation.blend : l.blend,
2358
2409
  layerKey: (l) => l.type === "pixel" ? [_nullishCoalesce(l.filters, () => ( null)), _nullishCoalesce(l.source, () => ( null))] : l.type === "adjustment" ? [l.kind, l.params] : l.type === "annotation" ? l.annotation : void 0,
@@ -2364,18 +2415,24 @@ var PHOTO_PROFILE = {
2364
2415
  isPixelLike: (l) => l.type === "smart" || l.type === "shape" || l.type === "type",
2365
2416
  maskSourcePlane: (source, W, H, sources) => {
2366
2417
  const opts = source;
2367
- const depth = _nullishCoalesce(_optionalChain([sources, 'access', _17 => _17.depthMap, 'optionalCall', _18 => _18(opts)]), () => ( null));
2418
+ const depth = _nullishCoalesce(_optionalChain([sources, 'access', _19 => _19.depthMap, 'optionalCall', _20 => _20(opts)]), () => ( null));
2368
2419
  if (!depth || depth.width !== W || depth.height !== H) return null;
2369
2420
  const v = new Float32Array(W * H);
2370
2421
  for (let i = 0; i < v.length; i++) v[i] = depthMaskAlpha(depth.data[i * 4], opts) / 255;
2371
2422
  return v;
2372
2423
  }
2373
2424
  };
2374
- var LayerCompositor = class extends _chunkPOGBUYWEcjs.RasterCompositor {
2425
+ var LayerCompositor = class extends _chunkST7E3NEEcjs.RasterCompositor {
2375
2426
  constructor(options = {}) {
2376
2427
  super(PHOTO_PROFILE, options);
2377
2428
  }
2378
2429
  };
2430
+ function compositeDeep(layers, rect, sources, depth) {
2431
+ const deep = new (0, _chunkST7E3NEEcjs.DeepCompositor)(new LayerCompositor(), PHOTO_PROFILE, {
2432
+ applyFilterRunDeep: (run, acc, _r, masks) => applyAdjustmentLayersFloat(acc, run.map(adjustmentNodeAsLayer), masks)
2433
+ }, depth);
2434
+ return deep.composite(layers, rect, sources);
2435
+ }
2379
2436
 
2380
2437
  // src/image-editor/layers/vector-raster.ts
2381
2438
  var FLATNESS = 0.01;
@@ -2917,47 +2974,47 @@ var fail = (message) => {
2917
2974
  throw new LayerOperationError(message);
2918
2975
  };
2919
2976
  function requireLayer(layers, id) {
2920
- const loc = _chunkPOGBUYWEcjs.findLayer.call(void 0, layers, id);
2977
+ const loc = _chunkST7E3NEEcjs.findLayer.call(void 0, layers, id);
2921
2978
  if (!loc) {
2922
- const ids = _chunkPOGBUYWEcjs.flattenLayers.call(void 0, layers).map((l) => l.id);
2979
+ const ids = _chunkST7E3NEEcjs.flattenLayers.call(void 0, layers).map((l) => l.id);
2923
2980
  fail(`Unknown layer "${id}". ${ids.length ? `Layers: ${ids.join(", ")}.` : "The document has no layers."} Call list_layers for ids.`);
2924
2981
  }
2925
2982
  return loc;
2926
2983
  }
2927
2984
  function requireUnlocked(layer, what, action) {
2928
- if (_chunkPOGBUYWEcjs.isLayerLocked.call(void 0, layer, "all")) fail(`Layer "${layer.name || layer.id}" is locked (all); unlock it before you ${action}.`);
2929
- if (what !== "all" && _chunkPOGBUYWEcjs.isLayerLocked.call(void 0, layer, what)) fail(`Layer "${layer.name || layer.id}" has its ${what} locked; unlock it before you ${action}.`);
2985
+ if (_chunkST7E3NEEcjs.isLayerLocked.call(void 0, layer, "all")) fail(`Layer "${layer.name || layer.id}" is locked (all); unlock it before you ${action}.`);
2986
+ if (what !== "all" && _chunkST7E3NEEcjs.isLayerLocked.call(void 0, layer, what)) fail(`Layer "${layer.name || layer.id}" has its ${what} locked; unlock it before you ${action}.`);
2930
2987
  }
2931
2988
  function placeLayer(layers, layer, placement = {}, defaultIndex) {
2932
2989
  const given = [placement.aboveId, placement.belowId, placement.parentId].filter((v) => v !== void 0).length;
2933
2990
  if (given > 1) fail("Give only one of aboveId, belowId and parentId.");
2934
2991
  if (placement.aboveId || placement.belowId) {
2935
2992
  const ref = requireLayer(layers, _nullishCoalesce(placement.aboveId, () => ( placement.belowId)));
2936
- return _chunkPOGBUYWEcjs.insertLayer.call(void 0, layers, layer, _nullishCoalesce(_optionalChain([ref, 'access', _19 => _19.parent, 'optionalAccess', _20 => _20.id]), () => ( null)), ref.index + (placement.aboveId ? 1 : 0));
2993
+ return _chunkST7E3NEEcjs.insertLayer.call(void 0, layers, layer, _nullishCoalesce(_optionalChain([ref, 'access', _21 => _21.parent, 'optionalAccess', _22 => _22.id]), () => ( null)), ref.index + (placement.aboveId ? 1 : 0));
2937
2994
  }
2938
2995
  if (placement.parentId) {
2939
2996
  const ref = requireLayer(layers, placement.parentId);
2940
2997
  if (ref.layer.type !== "group") fail(`Layer "${placement.parentId}" is not a group; parentId must be a group id.`);
2941
- return _chunkPOGBUYWEcjs.insertLayer.call(void 0, layers, layer, ref.layer.id, placement.index);
2998
+ return _chunkST7E3NEEcjs.insertLayer.call(void 0, layers, layer, ref.layer.id, placement.index);
2942
2999
  }
2943
- return _chunkPOGBUYWEcjs.insertLayer.call(void 0, layers, layer, null, _nullishCoalesce(placement.index, () => ( defaultIndex)));
3000
+ return _chunkST7E3NEEcjs.insertLayer.call(void 0, layers, layer, null, _nullishCoalesce(placement.index, () => ( defaultIndex)));
2944
3001
  }
2945
3002
  function removeLayer(layers, id) {
2946
3003
  const loc = requireLayer(layers, id);
2947
3004
  requireUnlocked(loc.layer, "all", "delete it");
2948
- return _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => null);
3005
+ return _chunkST7E3NEEcjs.mapLayer.call(void 0, layers, id, () => null);
2949
3006
  }
2950
3007
  function moveLayer(layers, id, placement) {
2951
3008
  const loc = requireLayer(layers, id);
2952
3009
  requireUnlocked(loc.layer, "all", "move it");
2953
3010
  const target = _nullishCoalesce(_nullishCoalesce(placement.aboveId, () => ( placement.belowId)), () => ( placement.parentId));
2954
3011
  if (target === id) fail("A layer cannot be placed relative to itself.");
2955
- if (target && loc.layer.type === "group" && _chunkPOGBUYWEcjs.flattenLayers.call(void 0, loc.layer.children).some((l) => l.id === target)) {
3012
+ if (target && loc.layer.type === "group" && _chunkST7E3NEEcjs.flattenLayers.call(void 0, loc.layer.children).some((l) => l.id === target)) {
2956
3013
  fail(`Group "${id}" cannot be moved into its own child "${target}".`);
2957
3014
  }
2958
3015
  if (target) requireLayer(layers, target);
2959
3016
  if (!target && placement.index === void 0) fail("Give aboveId, belowId, parentId or index.");
2960
- const without = _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => null);
3017
+ const without = _chunkST7E3NEEcjs.mapLayer.call(void 0, layers, id, () => null);
2961
3018
  return placeLayer(without, loc.layer, placement);
2962
3019
  }
2963
3020
  function withNewIds(layer) {
@@ -2965,7 +3022,7 @@ function withNewIds(layer) {
2965
3022
  if (next.type === "group") next.children = next.children.map(withNewIds);
2966
3023
  if (next.type === "annotation") next.annotation = { ...next.annotation, id: next.id };
2967
3024
  if (next.type === "shape" || next.type === "type") delete next.annotation;
2968
- if (next.type === "smart" && _optionalChain([next, 'access', _21 => _21.psd, 'optionalAccess', _22 => _22.placed])) {
3025
+ if (next.type === "smart" && _optionalChain([next, 'access', _23 => _23.psd, 'optionalAccess', _24 => _24.placed])) {
2969
3026
  next.psd = { ...next.psd };
2970
3027
  delete next.psd.placed;
2971
3028
  }
@@ -2976,7 +3033,7 @@ function duplicateLayer(layers, id, name) {
2976
3033
  const copy = withNewIds(loc.layer);
2977
3034
  copy.name = _nullishCoalesce(name, () => ( `${loc.layer.name || "Layer"} copy`));
2978
3035
  delete copy.locks;
2979
- return { layers: _chunkPOGBUYWEcjs.insertLayer.call(void 0, layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _23 => _23.parent, 'optionalAccess', _24 => _24.id]), () => ( null)), loc.index + 1), id: copy.id };
3036
+ return { layers: _chunkST7E3NEEcjs.insertLayer.call(void 0, layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _25 => _25.parent, 'optionalAccess', _26 => _26.id]), () => ( null)), loc.index + 1), id: copy.id };
2980
3037
  }
2981
3038
  function setLayerProperties(layers, id, props) {
2982
3039
  const loc = requireLayer(layers, id);
@@ -3003,7 +3060,7 @@ function setLayerProperties(layers, id, props) {
3003
3060
  if (props.blend !== void 0) {
3004
3061
  if (props.blend === "pass-through") {
3005
3062
  if (layer.type !== "group") fail("pass-through is only for groups.");
3006
- } else if (!_chunkXIOMMGPDcjs.isBlendMode.call(void 0, props.blend)) fail(`Unknown blend mode "${props.blend}".`);
3063
+ } else if (!_chunkTFOPHZ3Ucjs.isBlendMode.call(void 0, props.blend)) fail(`Unknown blend mode "${props.blend}".`);
3007
3064
  next.blend = props.blend;
3008
3065
  }
3009
3066
  if (props.clipped !== void 0) {
@@ -3023,13 +3080,13 @@ function setLayerProperties(layers, id, props) {
3023
3080
  if (props.collapsed) g.collapsed = true;
3024
3081
  else delete g.collapsed;
3025
3082
  }
3026
- return _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => next);
3083
+ return _chunkST7E3NEEcjs.mapLayer.call(void 0, layers, id, () => next);
3027
3084
  }
3028
3085
  function groupLayers(layers, ids, name = "Group") {
3029
3086
  if (!ids.length) fail("Give at least one layer id to group.");
3030
3087
  const locs = ids.map((id) => requireLayer(layers, id));
3031
- const parent = _nullishCoalesce(_optionalChain([locs, 'access', _25 => _25[0], 'access', _26 => _26.parent, 'optionalAccess', _27 => _27.id]), () => ( null));
3032
- if (locs.some((l) => (_nullishCoalesce(_optionalChain([l, 'access', _28 => _28.parent, 'optionalAccess', _29 => _29.id]), () => ( null))) !== parent)) fail("Layers to group must share one parent; move them next to each other first.");
3088
+ const parent = _nullishCoalesce(_optionalChain([locs, 'access', _27 => _27[0], 'access', _28 => _28.parent, 'optionalAccess', _29 => _29.id]), () => ( null));
3089
+ if (locs.some((l) => (_nullishCoalesce(_optionalChain([l, 'access', _30 => _30.parent, 'optionalAccess', _31 => _31.id]), () => ( null))) !== parent)) fail("Layers to group must share one parent; move them next to each other first.");
3033
3090
  for (const l of locs) requireUnlocked(l.layer, "all", "group it");
3034
3091
  const ordered = [...new Set(locs)].sort((a, b) => a.index - b.index);
3035
3092
  const top = ordered[ordered.length - 1].index;
@@ -3046,23 +3103,23 @@ function groupLayers(layers, ids, name = "Group") {
3046
3103
  return c;
3047
3104
  })
3048
3105
  };
3049
- if (_optionalChain([group, 'access', _30 => _30.children, 'access', _31 => _31[0], 'optionalAccess', _32 => _32.clipped])) {
3106
+ if (_optionalChain([group, 'access', _32 => _32.children, 'access', _33 => _33[0], 'optionalAccess', _34 => _34.clipped])) {
3050
3107
  const c = { ...group.children[0] };
3051
3108
  delete c.clipped;
3052
3109
  group.children[0] = c;
3053
3110
  }
3054
3111
  let out = layers;
3055
- for (const l of ordered) out = _chunkPOGBUYWEcjs.mapLayer.call(void 0, out, l.layer.id, () => null);
3056
- return { layers: _chunkPOGBUYWEcjs.insertLayer.call(void 0, out, group, parent, top - below), id: group.id };
3112
+ for (const l of ordered) out = _chunkST7E3NEEcjs.mapLayer.call(void 0, out, l.layer.id, () => null);
3113
+ return { layers: _chunkST7E3NEEcjs.insertLayer.call(void 0, out, group, parent, top - below), id: group.id };
3057
3114
  }
3058
3115
  function ungroupLayer(layers, id) {
3059
3116
  const loc = requireLayer(layers, id);
3060
3117
  if (loc.layer.type !== "group") fail(`Layer "${id}" is not a group.`);
3061
3118
  requireUnlocked(loc.layer, "all", "ungroup it");
3062
3119
  const group = loc.layer;
3063
- let out = _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => null);
3120
+ let out = _chunkST7E3NEEcjs.mapLayer.call(void 0, layers, id, () => null);
3064
3121
  group.children.forEach((c, i) => {
3065
- out = _chunkPOGBUYWEcjs.insertLayer.call(void 0, out, c, _nullishCoalesce(_optionalChain([loc, 'access', _33 => _33.parent, 'optionalAccess', _34 => _34.id]), () => ( null)), loc.index + i);
3122
+ out = _chunkST7E3NEEcjs.insertLayer.call(void 0, out, c, _nullishCoalesce(_optionalChain([loc, 'access', _35 => _35.parent, 'optionalAccess', _36 => _36.id]), () => ( null)), loc.index + i);
3066
3123
  });
3067
3124
  return { layers: out, ids: group.children.map((c) => c.id) };
3068
3125
  }
@@ -3075,14 +3132,14 @@ function offsetLayer(layers, id, offset) {
3075
3132
  const next = { ...layer, offset: { x: Math.round(offset.x), y: Math.round(offset.y) } };
3076
3133
  const mask = layer.mask;
3077
3134
  if (mask && mask.linked === false && !mask.source) {
3078
- next.mask = { ...mask, surface: _chunkXIOMMGPDcjs.translateSurface.call(void 0, mask.surface, layer.offset.x - next.offset.x, layer.offset.y - next.offset.y) };
3135
+ next.mask = { ...mask, surface: _chunkTFOPHZ3Ucjs.translateSurface.call(void 0, mask.surface, layer.offset.x - next.offset.x, layer.offset.y - next.offset.y) };
3079
3136
  }
3080
- return _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => next);
3137
+ return _chunkST7E3NEEcjs.mapLayer.call(void 0, layers, id, () => next);
3081
3138
  }
3082
3139
  function setLayerMask(layers, id, mask) {
3083
3140
  const loc = requireLayer(layers, id);
3084
3141
  requireUnlocked(loc.layer, "all", "change its mask");
3085
- return _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, (l) => {
3142
+ return _chunkST7E3NEEcjs.mapLayer.call(void 0, layers, id, (l) => {
3086
3143
  const next = { ...l };
3087
3144
  if (mask) next.mask = mask;
3088
3145
  else delete next.mask;
@@ -3120,8 +3177,8 @@ function requirePixelLayer(layers, id) {
3120
3177
  }
3121
3178
  function addLayerFilter(layers, id, filter) {
3122
3179
  const layer = requirePixelLayer(layers, id);
3123
- if (_optionalChain([layer, 'access', _35 => _35.filters, 'optionalAccess', _36 => _36.some, 'call', _37 => _37((f) => f.kind === filter.kind)])) fail(`Layer "${id}" already has a ${filter.kind} filter; change it with update_layer_filter.`);
3124
- return _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => ({ ...layer, filters: [..._nullishCoalesce(layer.filters, () => ( [])), filter] }));
3180
+ if (_optionalChain([layer, 'access', _37 => _37.filters, 'optionalAccess', _38 => _38.some, 'call', _39 => _39((f) => f.kind === filter.kind)])) fail(`Layer "${id}" already has a ${filter.kind} filter; change it with update_layer_filter.`);
3181
+ return _chunkST7E3NEEcjs.mapLayer.call(void 0, layers, id, () => ({ ...layer, filters: [..._nullishCoalesce(layer.filters, () => ( [])), filter] }));
3125
3182
  }
3126
3183
  function updateLayerFilter(layers, id, filterId, changes) {
3127
3184
  const layer = requirePixelLayer(layers, id);
@@ -3132,7 +3189,7 @@ function updateLayerFilter(layers, id, filterId, changes) {
3132
3189
  const merged2 = normalizeFilter({ ...current, ...changes, kind: current.kind }, current.id);
3133
3190
  const filters = [...layer.filters];
3134
3191
  filters[i] = merged2;
3135
- return _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => ({ ...layer, filters }));
3192
+ return _chunkST7E3NEEcjs.mapLayer.call(void 0, layers, id, () => ({ ...layer, filters }));
3136
3193
  }
3137
3194
  function removeLayerFilter(layers, id, filterId) {
3138
3195
  const layer = requirePixelLayer(layers, id);
@@ -3141,7 +3198,7 @@ function removeLayerFilter(layers, id, filterId) {
3141
3198
  const next = { ...layer };
3142
3199
  if (filters.length) next.filters = filters;
3143
3200
  else delete next.filters;
3144
- return _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => next);
3201
+ return _chunkST7E3NEEcjs.mapLayer.call(void 0, layers, id, () => next);
3145
3202
  }
3146
3203
  function requireEffectLayer(layers, id, action) {
3147
3204
  const layer = requireLayer(layers, id).layer;
@@ -3156,7 +3213,7 @@ function guard(fn) {
3156
3213
  try {
3157
3214
  return fn();
3158
3215
  } catch (e) {
3159
- if (e instanceof _chunkPOGBUYWEcjs.LayerEffectError) fail(e.message);
3216
+ if (e instanceof _chunkST7E3NEEcjs.LayerEffectError) fail(e.message);
3160
3217
  throw e;
3161
3218
  }
3162
3219
  }
@@ -3164,27 +3221,27 @@ function setLayerEffects(layers, id, effects) {
3164
3221
  const layer = requireEffectLayer(layers, id, "change its effects");
3165
3222
  const next = { ...layer };
3166
3223
  if (effects && (effects.items.length || effects.psd || effects.scale !== void 0 || !effects.enabled)) {
3167
- guard(() => _chunkPOGBUYWEcjs.validateLayerEffects.call(void 0, effects));
3224
+ guard(() => _chunkST7E3NEEcjs.validateLayerEffects.call(void 0, effects));
3168
3225
  next.effects = effects;
3169
3226
  } else delete next.effects;
3170
- return _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => next);
3227
+ return _chunkST7E3NEEcjs.mapLayer.call(void 0, layers, id, () => next);
3171
3228
  }
3172
3229
  function addLayerEffect(layers, id, kind, params = {}, index) {
3173
- if (!_chunkPOGBUYWEcjs.isLayerEffectKind.call(void 0, kind)) fail(`Unknown effect kind "${String(kind)}". Kinds: ${_chunkPOGBUYWEcjs.LAYER_EFFECT_KINDS.join(", ")}.`);
3230
+ if (!_chunkST7E3NEEcjs.isLayerEffectKind.call(void 0, kind)) fail(`Unknown effect kind "${String(kind)}". Kinds: ${_chunkST7E3NEEcjs.LAYER_EFFECT_KINDS.join(", ")}.`);
3174
3231
  const layer = requireEffectLayer(layers, id, "add effects");
3175
3232
  const current = layerEffectsOf(layer);
3176
3233
  const ids = new Set(current.items.map((e) => e.id));
3177
- let effectId = _chunkPOGBUYWEcjs.newEffectId.call(void 0, );
3178
- while (ids.has(effectId)) effectId = _chunkPOGBUYWEcjs.newEffectId.call(void 0, );
3234
+ let effectId = _chunkST7E3NEEcjs.newEffectId.call(void 0, );
3235
+ while (ids.has(effectId)) effectId = _chunkST7E3NEEcjs.newEffectId.call(void 0, );
3179
3236
  const { id: _ignored, kind: _kind, ...rest } = params;
3180
- const effect = guard(() => _chunkPOGBUYWEcjs.mergeLayerEffect.call(void 0, _chunkPOGBUYWEcjs.defaultLayerEffect.call(void 0, kind, effectId), rest));
3237
+ const effect = guard(() => _chunkST7E3NEEcjs.mergeLayerEffect.call(void 0, _chunkST7E3NEEcjs.defaultLayerEffect.call(void 0, kind, effectId), rest));
3181
3238
  const items = [...current.items];
3182
3239
  const at = index === void 0 ? items.length : Math.max(0, Math.min(items.length, Math.floor(index)));
3183
3240
  items.splice(at, 0, effect);
3184
3241
  return { layers: setLayerEffects(layers, id, { ...current, items }), effect };
3185
3242
  }
3186
3243
  function requireEffect(layer, effectId) {
3187
- const items = _nullishCoalesce(_optionalChain([layer, 'access', _38 => _38.effects, 'optionalAccess', _39 => _39.items]), () => ( []));
3244
+ const items = _nullishCoalesce(_optionalChain([layer, 'access', _40 => _40.effects, 'optionalAccess', _41 => _41.items]), () => ( []));
3188
3245
  const i = items.findIndex((e) => e.id === effectId);
3189
3246
  if (i === -1) fail(`Layer "${layer.name || layer.id}" has no effect "${effectId}". Effects: ${items.map((e) => `${e.id} (${e.kind})`).join(", ") || "none"}; call list_layer_effects.`);
3190
3247
  return i;
@@ -3194,7 +3251,7 @@ function updateLayerEffect(layers, id, effectId, changes) {
3194
3251
  const i = requireEffect(layer, effectId);
3195
3252
  const current = layer.effects;
3196
3253
  const items = [...current.items];
3197
- items[i] = guard(() => _chunkPOGBUYWEcjs.mergeLayerEffect.call(void 0, items[i], changes));
3254
+ items[i] = guard(() => _chunkST7E3NEEcjs.mergeLayerEffect.call(void 0, items[i], changes));
3198
3255
  return setLayerEffects(layers, id, { ...current, items });
3199
3256
  }
3200
3257
  function removeLayerEffect(layers, id, effectId) {
@@ -3217,7 +3274,7 @@ function setLayerEffectsEnabled(layers, id, enabled, scale) {
3217
3274
  function parseBlend(value, allowPassThrough = false) {
3218
3275
  if (value === void 0) return void 0;
3219
3276
  if (value === "pass-through" && allowPassThrough) return value;
3220
- if (!_chunkXIOMMGPDcjs.isBlendMode.call(void 0, value)) fail(`Unknown blend mode "${String(value)}".`);
3277
+ if (!_chunkTFOPHZ3Ucjs.isBlendMode.call(void 0, value)) fail(`Unknown blend mode "${String(value)}".`);
3221
3278
  return value;
3222
3279
  }
3223
3280
  function unionRect(a, b) {
@@ -3229,7 +3286,7 @@ function unionRect(a, b) {
3229
3286
  }
3230
3287
 
3231
3288
  // src/image-editor/layers/shape.ts
3232
- var SHAPE_RENDER_MARGIN = _chunkPOGBUYWEcjs.MAX_EFFECT_REACH;
3289
+ var SHAPE_RENDER_MARGIN = _chunkST7E3NEEcjs.MAX_EFFECT_REACH;
3233
3290
  var DEFAULT_MITER_LIMIT = 100;
3234
3291
  var fail2 = (message) => {
3235
3292
  throw new LayerOperationError(message);
@@ -3269,7 +3326,7 @@ function mapAnchor(a, f) {
3269
3326
  return out;
3270
3327
  }
3271
3328
  function mapSubpaths(subpaths, f) {
3272
- return _chunkW3GXSUSQcjs.expandVectorCorners.call(void 0, subpaths).map((sp) => ({ closed: sp.closed, anchors: sp.anchors.map((a) => mapAnchor(a, f)) }));
3329
+ return _chunkLPLCWZTMcjs.expandVectorCorners.call(void 0, subpaths).map((sp) => ({ closed: sp.closed, anchors: sp.anchors.map((a) => mapAnchor(a, f)) }));
3273
3330
  }
3274
3331
  function liveShapeSubpaths(live) {
3275
3332
  let out;
@@ -3277,19 +3334,19 @@ function liveShapeSubpaths(live) {
3277
3334
  case "rect": {
3278
3335
  const x = Math.min(live.x, live.x + live.width);
3279
3336
  const y = Math.min(live.y, live.y + live.height);
3280
- const sp = _chunkW3GXSUSQcjs.rectSubpath.call(void 0, { x, y, width: Math.abs(live.width), height: Math.abs(live.height) });
3337
+ const sp = _chunkLPLCWZTMcjs.rectSubpath.call(void 0, { x, y, width: Math.abs(live.width), height: Math.abs(live.height) });
3281
3338
  const r = _nullishCoalesce(live.radii, () => ( [0, 0, 0, 0]));
3282
- out = [{ closed: true, anchors: sp.anchors.map((a, i) => r[i] > 0 ? _chunkW3GXSUSQcjs.setAnchorCorner.call(void 0, a, r[i]) : a) }];
3339
+ out = [{ closed: true, anchors: sp.anchors.map((a, i) => r[i] > 0 ? _chunkLPLCWZTMcjs.setAnchorCorner.call(void 0, a, r[i]) : a) }];
3283
3340
  break;
3284
3341
  }
3285
3342
  case "ellipse":
3286
- out = [_chunkW3GXSUSQcjs.ellipseSubpath.call(void 0, normBox(live))];
3343
+ out = [_chunkLPLCWZTMcjs.ellipseSubpath.call(void 0, normBox(live))];
3287
3344
  break;
3288
3345
  case "polygon":
3289
- out = [_chunkW3GXSUSQcjs.polygonSubpath.call(void 0, normBox(live), live.sides)];
3346
+ out = [_chunkLPLCWZTMcjs.polygonSubpath.call(void 0, normBox(live), live.sides)];
3290
3347
  break;
3291
3348
  case "star":
3292
- out = [_chunkW3GXSUSQcjs.starSubpath.call(void 0, normBox(live), live.points, Math.max(0, Math.min(1, live.innerRatio)))];
3349
+ out = [_chunkLPLCWZTMcjs.starSubpath.call(void 0, normBox(live), live.points, Math.max(0, Math.min(1, live.innerRatio)))];
3293
3350
  break;
3294
3351
  case "line": {
3295
3352
  const a = { x: live.x1, y: live.y1 };
@@ -3312,7 +3369,7 @@ function liveShapeSubpaths(live) {
3312
3369
  }
3313
3370
  }
3314
3371
  const m = live.transform;
3315
- return m && !_chunkW3GXSUSQcjs.isIdentityMatrix.call(void 0, m) ? mapSubpaths(out, (p) => _chunkW3GXSUSQcjs.applyMatrix.call(void 0, m, p)) : out;
3372
+ return m && !_chunkLPLCWZTMcjs.isIdentityMatrix.call(void 0, m) ? mapSubpaths(out, (p) => _chunkLPLCWZTMcjs.applyMatrix.call(void 0, m, p)) : out;
3316
3373
  }
3317
3374
  function normBox(b) {
3318
3375
  return { x: Math.min(b.x, b.x + b.width), y: Math.min(b.y, b.y + b.height), width: Math.abs(b.width), height: Math.abs(b.height) };
@@ -3324,7 +3381,7 @@ var pathCache = /* @__PURE__ */ new WeakMap();
3324
3381
  function componentPath(c) {
3325
3382
  let p = pathCache.get(c.subpaths);
3326
3383
  if (!p) {
3327
- p = _chunkW3GXSUSQcjs.subpathsToBezier.call(void 0, c.subpaths);
3384
+ p = _chunkLPLCWZTMcjs.subpathsToBezier.call(void 0, c.subpaths);
3328
3385
  pathCache.set(c.subpaths, p);
3329
3386
  }
3330
3387
  return p;
@@ -3372,7 +3429,7 @@ function closedOutline(path) {
3372
3429
  function strokeArea(path, stroke, double) {
3373
3430
  const w = stroke.width * (double ? 2 : 1);
3374
3431
  if (!(w > 0) || !path.length) return [];
3375
- const dashes = _optionalChain([stroke, 'access', _40 => _40.dashes, 'optionalAccess', _41 => _41.length]) && stroke.dashes.some((d) => d > 0) ? stroke.dashes.map((d) => d * stroke.width) : void 0;
3432
+ const dashes = _optionalChain([stroke, 'access', _42 => _42.dashes, 'optionalAccess', _43 => _43.length]) && stroke.dashes.some((d) => d > 0) ? stroke.dashes.map((d) => d * stroke.width) : void 0;
3376
3433
  const options = {
3377
3434
  width: w,
3378
3435
  cap: _nullishCoalesce(stroke.cap, () => ( "butt")),
@@ -3445,11 +3502,11 @@ function fillCoverage(geo, rect, rule, inverted = false) {
3445
3502
  function paintContext(env) {
3446
3503
  const tiles = /* @__PURE__ */ new Map();
3447
3504
  return {
3448
- light: _chunkPOGBUYWEcjs.DEFAULT_GLOBAL_LIGHT,
3505
+ light: _chunkST7E3NEEcjs.DEFAULT_GLOBAL_LIGHT,
3449
3506
  pattern: (id) => {
3450
3507
  if (tiles.has(id)) return tiles.get(id);
3451
- const p = _nullishCoalesce(_optionalChain([env, 'access', _42 => _42.pattern, 'optionalCall', _43 => _43(id)]), () => ( _chunkPOGBUYWEcjs.builtinPattern.call(void 0, id)));
3452
- const t = p && p.width > 0 && p.height > 0 && p.data.length >= p.width * p.height * 4 ? new (0, _chunkPOGBUYWEcjs.PatternTile)(p) : null;
3508
+ const p = _nullishCoalesce(_optionalChain([env, 'access', _44 => _44.pattern, 'optionalCall', _45 => _45(id)]), () => ( _chunkST7E3NEEcjs.builtinPattern.call(void 0, id)));
3509
+ const t = p && p.width > 0 && p.height > 0 && p.data.length >= p.width * p.height * 4 ? new (0, _chunkST7E3NEEcjs.PatternTile)(p) : null;
3453
3510
  tiles.set(id, t);
3454
3511
  return t;
3455
3512
  }
@@ -3480,10 +3537,10 @@ function renderShapeRect(layer, rect, env, ctx = paintContext(env)) {
3480
3537
  if (!fCov && !sCov) return null;
3481
3538
  const canvas = { x: 0, y: 0, width: env.width, height: env.height };
3482
3539
  const anchor = { x: geo.frame.x, y: geo.frame.y };
3483
- const fc = fCov ? _chunkPOGBUYWEcjs.effectFillColors.call(void 0, layer.fill, rect, geo.frame, canvas, anchor, ctx) : null;
3484
- const fo = _nullishCoalesce(_optionalChain([layer, 'access', _44 => _44.fill, 'optionalAccess', _45 => _45.opacity]), () => ( 1));
3485
- const sc = sCov ? _chunkPOGBUYWEcjs.effectFillColors.call(void 0, layer.stroke.paint, rect, geo.frame, canvas, anchor, ctx) : null;
3486
- const so = _nullishCoalesce(_optionalChain([layer, 'access', _46 => _46.stroke, 'optionalAccess', _47 => _47.paint, 'access', _48 => _48.opacity]), () => ( 1));
3540
+ const fc = fCov ? _chunkST7E3NEEcjs.effectFillColors.call(void 0, layer.fill, rect, geo.frame, canvas, anchor, ctx) : null;
3541
+ const fo = _nullishCoalesce(_optionalChain([layer, 'access', _46 => _46.fill, 'optionalAccess', _47 => _47.opacity]), () => ( 1));
3542
+ const sc = sCov ? _chunkST7E3NEEcjs.effectFillColors.call(void 0, layer.stroke.paint, rect, geo.frame, canvas, anchor, ctx) : null;
3543
+ const so = _nullishCoalesce(_optionalChain([layer, 'access', _48 => _48.stroke, 'optionalAccess', _49 => _49.paint, 'access', _50 => _50.opacity]), () => ( 1));
3487
3544
  const out = new Uint8ClampedArray(n * 4);
3488
3545
  let any = false;
3489
3546
  for (let i = 0; i < n; i++) {
@@ -3521,20 +3578,20 @@ function renderShapeRect(layer, rect, env, ctx = paintContext(env)) {
3521
3578
  }
3522
3579
  function renderShape(layer, env, options = {}) {
3523
3580
  const geo = shapeGeometry(layer);
3524
- if (!geo.bounds) return _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4);
3581
+ if (!geo.bounds) return _chunkTFOPHZ3Ucjs.emptySurface.call(void 0, 4);
3525
3582
  let region = intersect(geo.bounds, shapeRenderClip(env));
3526
3583
  if (region && options.clip) region = intersect(region, options.clip);
3527
- if (!region) return _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4);
3584
+ if (!region) return _chunkTFOPHZ3Ucjs.emptySurface.call(void 0, 4);
3528
3585
  const ctx = paintContext(env);
3529
3586
  const tiles = /* @__PURE__ */ new Map();
3530
- for (const { tx, ty } of _chunkXIOMMGPDcjs.tilesInRect.call(void 0, region)) {
3531
- const rect = { x: tx * _chunkXIOMMGPDcjs.TILE, y: ty * _chunkXIOMMGPDcjs.TILE, width: _chunkXIOMMGPDcjs.TILE, height: _chunkXIOMMGPDcjs.TILE };
3587
+ for (const { tx, ty } of _chunkTFOPHZ3Ucjs.tilesInRect.call(void 0, region)) {
3588
+ const rect = { x: tx * _chunkTFOPHZ3Ucjs.TILE, y: ty * _chunkTFOPHZ3Ucjs.TILE, width: _chunkTFOPHZ3Ucjs.TILE, height: _chunkTFOPHZ3Ucjs.TILE };
3532
3589
  const px2 = renderShapeRect(layer, rect, env, ctx);
3533
3590
  if (!px2) continue;
3534
- const tile = _chunkXIOMMGPDcjs.finishTile.call(void 0, px2, 4, 0);
3535
- if (tile) tiles.set(_chunkXIOMMGPDcjs.tileKey.call(void 0, tx, ty), tile);
3591
+ const tile = _chunkTFOPHZ3Ucjs.finishTile.call(void 0, px2, 4, 0);
3592
+ if (tile) tiles.set(_chunkTFOPHZ3Ucjs.tileKey.call(void 0, tx, ty), tile);
3536
3593
  }
3537
- return new (0, _chunkXIOMMGPDcjs.TiledSurface)(4, tiles, 0);
3594
+ return new (0, _chunkTFOPHZ3Ucjs.TiledSurface)(4, tiles, 0);
3538
3595
  }
3539
3596
  function rerenderShape(layer, env) {
3540
3597
  return { ...layer, surface: renderShape(layer, env) };
@@ -3565,7 +3622,7 @@ function normalizeShapePaint(v, path = "paint") {
3565
3622
  const g = o.gradient;
3566
3623
  if (!g || typeof g !== "object") return fail2(`${path}.gradient is required: { stops: [{ position, color }], style, angle, \u2026 }.`);
3567
3624
  const gradient = {
3568
- stops: Array.isArray(g.stops) ? g.stops.map((s) => ({ position: s.position, color: _nullishCoalesce(_optionalChain([parseCssColor, 'call', _49 => _49(s.color), 'optionalAccess', _50 => _50.hex]), () => ( s.color)) })) : [],
3625
+ stops: Array.isArray(g.stops) ? g.stops.map((s) => ({ position: s.position, color: _nullishCoalesce(_optionalChain([parseCssColor, 'call', _51 => _51(s.color), 'optionalAccess', _52 => _52.hex]), () => ( s.color)) })) : [],
3569
3626
  ...g.opacityStops ? { opacityStops: g.opacityStops } : {},
3570
3627
  style: _nullishCoalesce(g.style, () => ( "linear")),
3571
3628
  angle: _nullishCoalesce(g.angle, () => ( 90)),
@@ -3575,9 +3632,9 @@ function normalizeShapePaint(v, path = "paint") {
3575
3632
  offset: _nullishCoalesce(g.offset, () => ( { x: 0, y: 0 }))
3576
3633
  };
3577
3634
  try {
3578
- _chunkPOGBUYWEcjs.validateEffectGradient.call(void 0, gradient, `${path}.gradient`);
3635
+ _chunkST7E3NEEcjs.validateEffectGradient.call(void 0, gradient, `${path}.gradient`);
3579
3636
  } catch (e) {
3580
- if (e instanceof _chunkPOGBUYWEcjs.LayerEffectError) fail2(e.message);
3637
+ if (e instanceof _chunkST7E3NEEcjs.LayerEffectError) fail2(e.message);
3581
3638
  throw e;
3582
3639
  }
3583
3640
  if (gradient.stops.length < 1) fail2(`${path}.gradient.stops needs at least one { position, color }.`);
@@ -3591,7 +3648,7 @@ function normalizeShapePaint(v, path = "paint") {
3591
3648
  if (o.link !== void 0) p.link = Boolean(o.link);
3592
3649
  if (o.phase !== void 0) {
3593
3650
  const ph = o.phase;
3594
- p.phase = { x: requireNum(_optionalChain([ph, 'optionalAccess', _51 => _51.x]), `${path}.phase.x`), y: requireNum(_optionalChain([ph, 'optionalAccess', _52 => _52.y]), `${path}.phase.y`) };
3651
+ p.phase = { x: requireNum(_optionalChain([ph, 'optionalAccess', _53 => _53.x]), `${path}.phase.x`), y: requireNum(_optionalChain([ph, 'optionalAccess', _54 => _54.y]), `${path}.phase.y`) };
3595
3652
  }
3596
3653
  return withOpacity(p);
3597
3654
  }
@@ -3604,7 +3661,7 @@ function normalizeShapeStroke(v, path = "stroke", base) {
3604
3661
  const paint = o.paint === void 0 && base ? base.paint : o.paint === void 0 && o.color !== void 0 ? normalizeShapePaint(o.color, `${path}.color`) : normalizeShapePaint(o.paint, `${path}.paint`);
3605
3662
  const out = { width, paint };
3606
3663
  const pick = (k, allowed) => {
3607
- const value = o[k] === void 0 ? _optionalChain([base, 'optionalAccess', _53 => _53[k]]) : o[k];
3664
+ const value = o[k] === void 0 ? _optionalChain([base, 'optionalAccess', _55 => _55[k]]) : o[k];
3608
3665
  if (value === void 0) return;
3609
3666
  if (!allowed.includes(value)) fail2(`${path}.${k} must be one of ${allowed.join(", ")}, got ${JSON.stringify(value)}.`);
3610
3667
  if (value !== (k === "align" ? "center" : k === "cap" ? "butt" : "miter")) out[k] = value;
@@ -3612,9 +3669,9 @@ function normalizeShapeStroke(v, path = "stroke", base) {
3612
3669
  pick("align", ["inside", "center", "outside"]);
3613
3670
  pick("cap", ["butt", "round", "square"]);
3614
3671
  pick("join", ["miter", "round", "bevel"]);
3615
- const miter = o.miterLimit === void 0 ? _optionalChain([base, 'optionalAccess', _54 => _54.miterLimit]) : requireNum(o.miterLimit, `${path}.miterLimit`, 1, 500);
3672
+ const miter = o.miterLimit === void 0 ? _optionalChain([base, 'optionalAccess', _56 => _56.miterLimit]) : requireNum(o.miterLimit, `${path}.miterLimit`, 1, 500);
3616
3673
  if (miter !== void 0 && miter !== DEFAULT_MITER_LIMIT) out.miterLimit = miter;
3617
- const dashes = o.dashes === void 0 ? _optionalChain([base, 'optionalAccess', _55 => _55.dashes]) : o.dashes;
3674
+ const dashes = o.dashes === void 0 ? _optionalChain([base, 'optionalAccess', _57 => _57.dashes]) : o.dashes;
3618
3675
  if (dashes !== void 0 && dashes !== null) {
3619
3676
  if (!Array.isArray(dashes) || dashes.length > 32 || !dashes.every((d) => isNum(d) && d >= 0 && d <= 1e4)) fail2(`${path}.dashes must be at most 32 lengths 0..10000 (multiples of the width).`);
3620
3677
  if (dashes.length) {
@@ -3622,7 +3679,7 @@ function normalizeShapeStroke(v, path = "stroke", base) {
3622
3679
  out.dashes = [...dashes];
3623
3680
  }
3624
3681
  }
3625
- const offset = o.dashOffset === void 0 ? _optionalChain([base, 'optionalAccess', _56 => _56.dashOffset]) : requireNum(o.dashOffset, `${path}.dashOffset`, -1e6, 1e6);
3682
+ const offset = o.dashOffset === void 0 ? _optionalChain([base, 'optionalAccess', _58 => _58.dashOffset]) : requireNum(o.dashOffset, `${path}.dashOffset`, -1e6, 1e6);
3626
3683
  if (offset) out.dashOffset = offset;
3627
3684
  return out;
3628
3685
  }
@@ -3647,7 +3704,7 @@ function matrixArg(v, path) {
3647
3704
  if (!Array.isArray(v) || v.length !== 6 || !v.every(isNum)) fail2(`${path} must be six numbers [a, b, c, d, e, f].`);
3648
3705
  const m = v;
3649
3706
  if (Math.abs(m[0] * m[3] - m[1] * m[2]) < 1e-12) fail2(`${path} is singular.`);
3650
- return _chunkW3GXSUSQcjs.isIdentityMatrix.call(void 0, m) ? void 0 : [...m];
3707
+ return _chunkLPLCWZTMcjs.isIdentityMatrix.call(void 0, m) ? void 0 : [...m];
3651
3708
  }
3652
3709
  function normalizeLiveShape(v, path = "shape") {
3653
3710
  if (!v || typeof v !== "object") return fail2(`${path} must be an object with kind ${LIVE_SHAPE_KINDS.join(", ")}.`);
@@ -3708,7 +3765,7 @@ function normalizeSubpaths(v, path = "subpaths") {
3708
3765
  if (typeof v === "string") {
3709
3766
  let subs;
3710
3767
  try {
3711
- subs = _chunkW3GXSUSQcjs.bezierToSubpaths.call(void 0, v);
3768
+ subs = _chunkLPLCWZTMcjs.bezierToSubpaths.call(void 0, v);
3712
3769
  } catch (e5) {
3713
3770
  return fail2(`${path}: could not read the SVG path data.`);
3714
3771
  }
@@ -3758,7 +3815,7 @@ function createShapeLayer(init, env, id = newLayerId()) {
3758
3815
  components: init.components,
3759
3816
  fill: init.fill === void 0 ? null : init.fill,
3760
3817
  stroke: _nullishCoalesce(init.stroke, () => ( null)),
3761
- surface: _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4),
3818
+ surface: _chunkTFOPHZ3Ucjs.emptySurface.call(void 0, 4),
3762
3819
  offset: { x: 0, y: 0 }
3763
3820
  };
3764
3821
  if (init.fillRule && init.fillRule !== "nonzero") layer.fillRule = init.fillRule;
@@ -3766,7 +3823,7 @@ function createShapeLayer(init, env, id = newLayerId()) {
3766
3823
  return rerenderShape(layer, env);
3767
3824
  }
3768
3825
  function defaultShapeName(c) {
3769
- switch (_optionalChain([c, 'optionalAccess', _57 => _57.live, 'optionalAccess', _58 => _58.kind])) {
3826
+ switch (_optionalChain([c, 'optionalAccess', _59 => _59.live, 'optionalAccess', _60 => _60.kind])) {
3770
3827
  case "rect":
3771
3828
  return "Rectangle";
3772
3829
  case "ellipse":
@@ -3789,20 +3846,20 @@ function updateShapeLayer(layers, id, change, env, action = "edit it") {
3789
3846
  if (!("annotation" in patch)) delete next.annotation;
3790
3847
  if (!next.components.length) fail2("A shape needs at least one component; delete the layer instead.");
3791
3848
  const rendered = rerenderShape(next, env);
3792
- return { layers: _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => rendered), layer: rendered };
3849
+ return { layers: _chunkST7E3NEEcjs.mapLayer.call(void 0, layers, id, () => rendered), layer: rendered };
3793
3850
  }
3794
3851
  function transformShapeComponents(components, f, affine) {
3795
3852
  return components.map((c) => {
3796
3853
  if (affine && c.live) {
3797
- const live = { ...c.live, transform: _chunkW3GXSUSQcjs.multiplyMatrices.call(void 0, _nullishCoalesce(c.live.transform, () => ( _chunkW3GXSUSQcjs.IDENTITY_MATRIX)), affine) };
3798
- if (_chunkW3GXSUSQcjs.isIdentityMatrix.call(void 0, live.transform)) delete live.transform;
3854
+ const live = { ...c.live, transform: _chunkLPLCWZTMcjs.multiplyMatrices.call(void 0, _nullishCoalesce(c.live.transform, () => ( _chunkLPLCWZTMcjs.IDENTITY_MATRIX)), affine) };
3855
+ if (_chunkLPLCWZTMcjs.isIdentityMatrix.call(void 0, live.transform)) delete live.transform;
3799
3856
  return { op: c.op, subpaths: liveShapeSubpaths(live), live };
3800
3857
  }
3801
3858
  return { op: c.op, subpaths: mapSubpaths(c.subpaths, f) };
3802
3859
  });
3803
3860
  }
3804
3861
  function offsetShape(layer, dx, dy, env) {
3805
- const m = _chunkW3GXSUSQcjs.translateMatrix.call(void 0, dx, dy);
3862
+ const m = _chunkLPLCWZTMcjs.translateMatrix.call(void 0, dx, dy);
3806
3863
  const next = { ...layer, components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }), m) };
3807
3864
  delete next.annotation;
3808
3865
  return rerenderShape(next, env);
@@ -3810,7 +3867,7 @@ function offsetShape(layer, dx, dy, env) {
3810
3867
  function mergeShapeComponents(components, fillRule = "nonzero") {
3811
3868
  if (components.length < 2) return [...components];
3812
3869
  const path = shapeOutline(components, fillRule);
3813
- const subpaths = _chunkW3GXSUSQcjs.bezierToSubpaths.call(void 0, path);
3870
+ const subpaths = _chunkLPLCWZTMcjs.bezierToSubpaths.call(void 0, path);
3814
3871
  if (!subpaths.length) fail2("The components combine to nothing (the operations remove every area), so there is nothing to merge into.");
3815
3872
  return [{ op: "combine", subpaths }];
3816
3873
  }
@@ -3820,14 +3877,14 @@ function shapeAsPixelLayer(layer) {
3820
3877
  }
3821
3878
  function annotationPaint(color, opacity) {
3822
3879
  const c = parseCssColor(color);
3823
- if (!c || !_chunkPOGBUYWEcjs.parseEffectColor.call(void 0, c.hex)) return void 0;
3880
+ if (!c || !_chunkST7E3NEEcjs.parseEffectColor.call(void 0, c.hex)) return void 0;
3824
3881
  const a = c.alpha * opacity;
3825
3882
  return a !== 1 ? { type: "color", color: c.hex, opacity: a } : { type: "color", color: c.hex };
3826
3883
  }
3827
3884
  function shapeFromAnnotation(a) {
3828
3885
  const opacity = _nullishCoalesce(a.opacity, () => ( 1));
3829
3886
  const lineWidth = "strokeWidth" in a && a.strokeWidth > 0 ? a.strokeWidth : 1;
3830
- const rotation = a.rotation ? _chunkW3GXSUSQcjs.rotateMatrix.call(void 0, a.rotation, { x: a.x, y: a.y }) : void 0;
3887
+ const rotation = a.rotation ? _chunkLPLCWZTMcjs.rotateMatrix.call(void 0, a.rotation, { x: a.x, y: a.y }) : void 0;
3831
3888
  const t = rotation ? { transform: rotation } : {};
3832
3889
  const live = (l) => liveComponent(l);
3833
3890
  switch (a.type) {
@@ -3870,7 +3927,7 @@ function shapeFromAnnotation(a) {
3870
3927
  case "pen": {
3871
3928
  const paint = annotationPaint(a.strokeColor, opacity);
3872
3929
  if (!paint) return null;
3873
- const pts = rotation ? a.points.map((p) => _chunkW3GXSUSQcjs.applyMatrix.call(void 0, rotation, p)) : a.points;
3930
+ const pts = rotation ? a.points.map((p) => _chunkLPLCWZTMcjs.applyMatrix.call(void 0, rotation, p)) : a.points;
3874
3931
  const subpaths = pts.length > 1 ? [{ closed: false, anchors: pts.map((p) => ({ x: p.x, y: p.y })) }] : [];
3875
3932
  return {
3876
3933
  components: [{ op: "combine", subpaths }],
@@ -3884,7 +3941,7 @@ function shapeFromAnnotation(a) {
3884
3941
  }
3885
3942
  function annotationBlend(a, layerBlend) {
3886
3943
  if (layerBlend !== "normal") return layerBlend;
3887
- return a.blend && _chunkXIOMMGPDcjs.isBlendMode.call(void 0, a.blend) ? a.blend : "normal";
3944
+ return a.blend && _chunkTFOPHZ3Ucjs.isBlendMode.call(void 0, a.blend) ? a.blend : "normal";
3888
3945
  }
3889
3946
  function annotationOfShape(layer) {
3890
3947
  const a = layer.annotation;
@@ -3901,303 +3958,9 @@ function annotationOfShape(layer) {
3901
3958
  var fail3 = (message) => {
3902
3959
  throw new LayerOperationError(message);
3903
3960
  };
3904
- var DEFAULT_TEXT_STYLE = { fontFamily: "sans-serif", fontWeight: 400, fontSize: 24, color: "#000000" };
3905
- var DEFAULT_AUTO_LEADING = 1.2;
3906
- var sameStyle = (a, b) => JSON.stringify(a) === JSON.stringify(b);
3907
- function compact(runs) {
3908
- const out = [];
3909
- for (const r of runs) {
3910
- if (r.length <= 0) continue;
3911
- const last = out[out.length - 1];
3912
- if (last && sameStyle(last.style, r.style)) out[out.length - 1] = { ...last, length: last.length + r.length };
3913
- else out.push({ ...r });
3914
- }
3915
- return out;
3916
- }
3917
- function fitRuns(runs, length, fallback) {
3918
- const out = [];
3919
- let left = length;
3920
- for (const r of runs) {
3921
- if (left <= 0) break;
3922
- const n = Math.min(Math.max(0, Math.floor(r.length)), left);
3923
- if (n > 0) out.push({ ...r, length: n });
3924
- left -= n;
3925
- }
3926
- if (left > 0) {
3927
- if (out.length) out[out.length - 1] = { ...out[out.length - 1], length: out[out.length - 1].length + left };
3928
- else out.push({ length: left, style: _nullishCoalesce(_optionalChain([runs, 'access', _59 => _59[runs.length - 1], 'optionalAccess', _60 => _60.style]), () => ( fallback)) });
3929
- }
3930
- return compact(out);
3931
- }
3932
- function styleAt(runs, index, fallback) {
3933
- let at = 0;
3934
- for (const r of runs) {
3935
- if (index < at + r.length) return r.style;
3936
- at += r.length;
3937
- }
3938
- return _nullishCoalesce(_optionalChain([runs, 'access', _61 => _61[runs.length - 1], 'optionalAccess', _62 => _62.style]), () => ( fallback));
3939
- }
3940
- function restyleRange(runs, start, end, patch) {
3941
- const out = [];
3942
- let at = 0;
3943
- for (const r of runs) {
3944
- const a = at;
3945
- const b = at + r.length;
3946
- at = b;
3947
- const lo = Math.max(a, start);
3948
- const hi = Math.min(b, end);
3949
- if (hi <= lo) {
3950
- out.push({ ...r });
3951
- continue;
3952
- }
3953
- if (lo > a) out.push({ length: lo - a, style: r.style });
3954
- out.push({ length: hi - lo, style: patch(r.style) });
3955
- if (b > hi) out.push({ length: b - hi, style: r.style });
3956
- }
3957
- return compact(out);
3958
- }
3959
- function spliceRuns(runs, start, end, inserted, style) {
3960
- const out = [];
3961
- let at = 0;
3962
- let placed = false;
3963
- for (const r of runs) {
3964
- const a = at;
3965
- const b = at + r.length;
3966
- at = b;
3967
- if (b <= start) {
3968
- out.push({ ...r });
3969
- continue;
3970
- }
3971
- if (a < start) out.push({ length: start - a, style: r.style });
3972
- if (!placed) {
3973
- out.push({ length: inserted, style });
3974
- placed = true;
3975
- }
3976
- if (b > end) out.push({ length: b - Math.max(end, a), style: r.style });
3977
- }
3978
- if (!placed) out.push({ length: inserted, style });
3979
- return compact(out);
3980
- }
3981
- function paragraphRanges(text3) {
3982
- const out = [];
3983
- let start = 0;
3984
- for (let i = 0; i < text3.length; i++) {
3985
- if (text3[i] === "\n") {
3986
- out.push({ start, end: i + 1, content: i });
3987
- start = i + 1;
3988
- }
3989
- }
3990
- out.push({ start, end: text3.length, content: text3.length });
3991
- return out;
3992
- }
3993
- function fitParagraphRuns(runs, text3) {
3994
- const fallback = _nullishCoalesce(_optionalChain([runs, 'access', _63 => _63[0], 'optionalAccess', _64 => _64.style]), () => ( {}));
3995
- const out = compact(paragraphRanges(text3).map((p) => ({ length: p.end - p.start, style: styleAt(runs, p.start, fallback) })));
3996
- return out.length ? out : [{ length: 0, style: fallback }];
3997
- }
3998
- function fontOf(style) {
3999
- const f = { family: style.fontFamily, weight: style.fontWeight, italic: Boolean(style.italic), size: style.fontSize };
4000
- if (style.postScriptName) f.postScriptName = style.postScriptName;
4001
- return f;
4002
- }
4003
- var isBreakAfter = (c) => c === " " || c === " " || c === "-" || c === "\u2010" || c === "\u200B";
4004
- var isSpace = (c) => c === " " || c === " ";
4005
- var isWide = (code) => code >= 11904 && code <= 40959 || code >= 44032 && code <= 55215 || code >= 63744 && code <= 64255 || code >= 65280 && code <= 65519;
4006
- var layoutCache = /* @__PURE__ */ new WeakMap();
4007
- function layoutText(layer, shaper) {
4008
- let byShaper = layoutCache.get(layer);
4009
- const hit = _optionalChain([byShaper, 'optionalAccess', _65 => _65.get, 'call', _66 => _66(shaper.id)]);
4010
- if (hit) return hit;
4011
- const out = computeLayout(layer, shaper);
4012
- if (!byShaper) {
4013
- byShaper = /* @__PURE__ */ new Map();
4014
- layoutCache.set(layer, byShaper);
4015
- }
4016
- byShaper.set(shaper.id, out);
4017
- return out;
4018
- }
4019
- function computeLayout(layer, shaper) {
4020
- const { text: text3, frame } = layer;
4021
- const runs = fitRuns(layer.runs, text3.length, DEFAULT_TEXT_STYLE);
4022
- const missing = /* @__PURE__ */ new Set();
4023
- const resolved = /* @__PURE__ */ new Map();
4024
- const familyOf = (font) => {
4025
- const key = `${font.family}|${font.weight}|${font.italic}|${_nullishCoalesce(font.postScriptName, () => ( ""))}`;
4026
- let fam = resolved.get(key);
4027
- if (fam === void 0) {
4028
- const r = shaper.resolve(font);
4029
- fam = r.family;
4030
- if (!r.available) missing.add(font.family);
4031
- resolved.set(key, fam);
4032
- }
4033
- return fam;
4034
- };
4035
- const resolvedFont = (style) => ({ ...fontOf(style), family: familyOf(fontOf(style)) });
4036
- const box2 = frame.kind === "box" ? frame : null;
4037
- const lines = [];
4038
- let y = 0;
4039
- let first = true;
4040
- const paragraphs = paragraphRanges(text3);
4041
- paragraphs.forEach((para, pi) => {
4042
- const pstyle = styleAt(layer.paragraphs, para.start, {});
4043
- const autoLeading = _nullishCoalesce(pstyle.autoLeading, () => ( DEFAULT_AUTO_LEADING));
4044
- if (pi > 0) y += _nullishCoalesce(pstyle.spaceBefore, () => ( 0));
4045
- const chars = [];
4046
- let i = para.start;
4047
- while (i < para.content) {
4048
- const style = styleAt(runs, i, DEFAULT_TEXT_STYLE);
4049
- let j = i + 1;
4050
- while (j < para.content && styleAt(runs, j, DEFAULT_TEXT_STYLE) === style) j++;
4051
- const seg = text3.slice(i, j);
4052
- const carets = shaper.measure(seg, resolvedFont(style));
4053
- const track = (_nullishCoalesce(style.tracking, () => ( 0))) / 1e3 * style.fontSize;
4054
- for (let k = 0; k < seg.length; k++) chars.push({ index: i + k, ch: seg[k], advance: (_nullishCoalesce(carets[k + 1], () => ( 0))) - (_nullishCoalesce(carets[k], () => ( 0))) + track, style });
4055
- i = j;
4056
- }
4057
- const startIndent = _nullishCoalesce(pstyle.startIndent, () => ( 0));
4058
- const endIndent = _nullishCoalesce(pstyle.endIndent, () => ( 0));
4059
- const firstIndent = _nullishCoalesce(pstyle.firstLineIndent, () => ( 0));
4060
- const breaks = [];
4061
- if (!box2 || !chars.length) breaks.push([0, chars.length]);
4062
- else {
4063
- let s = 0;
4064
- while (s < chars.length) {
4065
- const avail = box2.width - startIndent - endIndent - (breaks.length === 0 ? firstIndent : 0);
4066
- let w = 0;
4067
- let e = s;
4068
- let lastBreak = -1;
4069
- while (e < chars.length) {
4070
- const c = chars[e];
4071
- if (!isSpace(c.ch) && w + c.advance > avail && e > s) break;
4072
- w += c.advance;
4073
- if (isBreakAfter(c.ch) || isWide(c.ch.charCodeAt(0)) || e + 1 < chars.length && isWide(chars[e + 1].ch.charCodeAt(0))) lastBreak = e + 1;
4074
- e++;
4075
- }
4076
- if (e < chars.length && lastBreak > s) e = lastBreak;
4077
- while (e < chars.length && isSpace(chars[e].ch)) e++;
4078
- breaks.push([s, e]);
4079
- s = e;
4080
- }
4081
- }
4082
- const align = _nullishCoalesce(pstyle.align, () => ( "left"));
4083
- breaks.forEach(([s, e], li) => {
4084
- const lineChars = chars.slice(s, e);
4085
- let visibleEnd = lineChars.length;
4086
- while (visibleEnd > 0 && isSpace(lineChars[visibleEnd - 1].ch)) visibleEnd--;
4087
- const styles = lineChars.length ? [...new Set(lineChars.map((c) => c.style))] : [styleAt(runs, Math.min(para.start, Math.max(0, text3.length - 1)), DEFAULT_TEXT_STYLE)];
4088
- let ascent = 0;
4089
- let descent = 0;
4090
- let leading = 0;
4091
- for (const st of styles) {
4092
- const m = shaper.metrics(resolvedFont(st));
4093
- ascent = Math.max(ascent, m.ascent);
4094
- descent = Math.max(descent, m.descent);
4095
- leading = Math.max(leading, _nullishCoalesce(st.leading, () => ( autoLeading * st.fontSize)));
4096
- }
4097
- if (first) {
4098
- y = frame.kind === "box" || frame.kind === "point" && frame.origin === "top" ? ascent : 0;
4099
- first = false;
4100
- } else y += leading;
4101
- const indent = startIndent + (li === 0 ? firstIndent : 0);
4102
- let width = 0;
4103
- for (let k2 = 0; k2 < visibleEnd; k2++) width += lineChars[k2].advance;
4104
- const lastLine = li === breaks.length - 1;
4105
- let extraPerSpace = 0;
4106
- if (box2 && align === "justify" && !lastLine) {
4107
- const spaces = lineChars.slice(0, visibleEnd).filter((c) => isSpace(c.ch)).length;
4108
- const avail = box2.width - startIndent - endIndent - (li === 0 ? firstIndent : 0);
4109
- if (spaces > 0 && avail > width) extraPerSpace = (avail - width) / spaces;
4110
- }
4111
- let x0;
4112
- const fullWidth = width + extraPerSpace * lineChars.slice(0, visibleEnd).filter((c) => isSpace(c.ch)).length;
4113
- if (box2) {
4114
- const avail = box2.width - startIndent - endIndent - (li === 0 ? firstIndent : 0);
4115
- x0 = indent + (align === "center" ? (avail - fullWidth) / 2 : align === "right" ? avail - fullWidth : 0);
4116
- } else x0 = indent + (align === "center" ? -fullWidth / 2 : align === "right" ? -fullWidth : 0);
4117
- const laid = [];
4118
- let x = x0;
4119
- for (const c of lineChars) {
4120
- const adv = c.advance + (isSpace(c.ch) ? extraPerSpace : 0);
4121
- laid.push({ index: c.index, x, advance: adv });
4122
- x += adv;
4123
- }
4124
- const fragments = [];
4125
- let k = 0;
4126
- while (k < lineChars.length) {
4127
- const st = lineChars[k].style;
4128
- let m = k + 1;
4129
- while (m < lineChars.length && lineChars[m].style === st) m++;
4130
- const font = resolvedFont(st);
4131
- const fx = laid[k].x;
4132
- const carets = [0];
4133
- for (let q2 = k; q2 < m; q2++) carets.push(laid[q2].x + laid[q2].advance - fx);
4134
- fragments.push({
4135
- start: lineChars[k].index,
4136
- end: lineChars[m - 1].index + 1,
4137
- style: st,
4138
- font,
4139
- family: font.family,
4140
- x: fx,
4141
- y: y - (_nullishCoalesce(st.baselineShift, () => ( 0))),
4142
- carets,
4143
- spaced: Boolean(st.tracking) || extraPerSpace > 0
4144
- });
4145
- k = m;
4146
- }
4147
- const lineStart = lineChars.length ? lineChars[0].index : para.start;
4148
- lines.push({ start: lineStart, end: lineChars.length ? lineChars[lineChars.length - 1].index + 1 : para.start, baseline: y, ascent, descent, x: x0, width, chars: laid, fragments });
4149
- });
4150
- y += _nullishCoalesce(pstyle.spaceAfter, () => ( 0));
4151
- });
4152
- let bounds;
4153
- if (box2) bounds = { x: 0, y: 0, width: box2.width, height: box2.height };
4154
- else {
4155
- let x0 = Infinity;
4156
- let x1 = -Infinity;
4157
- for (const l of lines) {
4158
- x0 = Math.min(x0, l.x);
4159
- x1 = Math.max(x1, l.x + l.width);
4160
- }
4161
- if (!Number.isFinite(x0)) x0 = x1 = 0;
4162
- const top = lines.length ? lines[0].baseline - lines[0].ascent : 0;
4163
- const last = lines[lines.length - 1];
4164
- const bottom = last ? last.baseline + last.descent : 0;
4165
- bounds = { x: x0, y: top, width: Math.max(0, x1 - x0), height: Math.max(0, bottom - top) };
4166
- }
4167
- return { lines, bounds, missingFonts: [...missing] };
4168
- }
4169
- function textIndexAt(layout, p) {
4170
- if (!layout.lines.length) return 0;
4171
- let line = layout.lines[layout.lines.length - 1];
4172
- for (const l of layout.lines) {
4173
- if (p.y <= l.baseline + l.descent) {
4174
- line = l;
4175
- break;
4176
- }
4177
- }
4178
- if (!line.chars.length) return line.start;
4179
- for (const c of line.chars) if (p.x < c.x + c.advance / 2) return c.index;
4180
- const lastChar = line.chars[line.chars.length - 1];
4181
- return lastChar.index + 1;
4182
- }
4183
- function caretAt(layout, index) {
4184
- const lines = layout.lines;
4185
- if (!lines.length) return { x: 0, top: 0, bottom: 0, line: 0 };
4186
- for (let li = 0; li < lines.length; li++) {
4187
- const l2 = lines[li];
4188
- const next = lines[li + 1];
4189
- if (next && index >= next.start && (next.chars.length || index > l2.end || next.start > l2.end)) continue;
4190
- const c = l2.chars.find((ch) => ch.index === index);
4191
- const prev = l2.chars.find((ch) => ch.index === index - 1);
4192
- const x = c ? c.x : prev ? prev.x + prev.advance : l2.x;
4193
- return { x, top: l2.baseline - l2.ascent, bottom: l2.baseline + l2.descent, line: li };
4194
- }
4195
- const l = lines[lines.length - 1];
4196
- return { x: l.x + l.width, top: l.baseline - l.ascent, bottom: l.baseline + l.descent, line: lines.length - 1 };
4197
- }
4198
- var TEXT_RENDER_MARGIN = _chunkPOGBUYWEcjs.MAX_EFFECT_REACH;
3961
+ var TEXT_RENDER_MARGIN = _chunkST7E3NEEcjs.MAX_EFFECT_REACH;
4199
3962
  function textMatrix(layer) {
4200
- return _nullishCoalesce(layer.transform, () => ( _chunkW3GXSUSQcjs.IDENTITY_MATRIX));
3963
+ return _nullishCoalesce(layer.transform, () => ( _chunkLPLCWZTMcjs.IDENTITY_MATRIX));
4201
3964
  }
4202
3965
  function rectCorners(r) {
4203
3966
  return [
@@ -4208,7 +3971,7 @@ function rectCorners(r) {
4208
3971
  ];
4209
3972
  }
4210
3973
  function docRect(r, m) {
4211
- const pts = rectCorners(r).map((p) => _chunkW3GXSUSQcjs.applyMatrix.call(void 0, m, p));
3974
+ const pts = rectCorners(r).map((p) => _chunkLPLCWZTMcjs.applyMatrix.call(void 0, m, p));
4212
3975
  const x0 = Math.floor(Math.min(...pts.map((p) => p.x)));
4213
3976
  const y0 = Math.floor(Math.min(...pts.map((p) => p.y)));
4214
3977
  const x1 = Math.ceil(Math.max(...pts.map((p) => p.x)));
@@ -4239,56 +4002,31 @@ function inkBounds(layout) {
4239
4002
  }
4240
4003
  return b;
4241
4004
  }
4242
- function decorations(f, l) {
4243
- const out = [];
4244
- const t = Math.max(1, f.style.fontSize / 15);
4245
- const w = f.carets[f.carets.length - 1];
4246
- if (f.style.underline) out.push({ x: f.x, y: f.y + Math.max(t, l.descent * 0.35), width: w, height: t });
4247
- if (f.style.strikethrough) out.push({ x: f.x, y: f.y - l.ascent * 0.3 - t / 2, width: w, height: t });
4248
- return out;
4249
- }
4250
- var rectPath = (r) => [
4251
- { type: "M", x: r.x, y: r.y },
4252
- { type: "L", x: r.x + r.width, y: r.y },
4253
- { type: "L", x: r.x + r.width, y: r.y + r.height },
4254
- { type: "L", x: r.x, y: r.y + r.height },
4255
- { type: "Z" }
4256
- ];
4257
- function fragmentOutline(shaper, text3, f) {
4258
- const s = text3.slice(f.start, f.end);
4259
- if (!f.spaced) return shaper.outline(s, f.font, f.x, f.y);
4260
- const out = [];
4261
- for (let k = 0; k < s.length; k++) {
4262
- if (isSpace(s[k])) continue;
4263
- out.push(...shaper.outline(s[k], f.font, f.x + f.carets[k], f.y));
4264
- }
4265
- return out;
4266
- }
4267
4005
  function textOutlines(layer, shaper) {
4268
4006
  if (!shaper.outline) fail3(`The text shaper "${shaper.id}" cannot give glyph outlines; plug in an outline shaper (createOutlineTextShaper) to convert text to shapes.`);
4269
- const layout = layoutText(layer, shaper);
4007
+ const layout = _chunkLPLCWZTMcjs.layoutText.call(void 0, layer, shaper);
4270
4008
  const m = textMatrix(layer);
4271
4009
  const out = [];
4272
4010
  for (const l of layout.lines) {
4273
4011
  for (const f of l.fragments) {
4274
- let path = fragmentOutline(shaper, layer.text, f);
4275
- for (const r of decorations(f, l)) path = [...path, ...rectPath(r)];
4276
- out.push({ fragment: f, path: _chunkW3GXSUSQcjs.isIdentityMatrix.call(void 0, m) ? path : _chunkXGD3FSNCcjs.transformBezierPath.call(void 0, path, m) });
4012
+ let path = _chunkLPLCWZTMcjs.textFragmentOutline.call(void 0, shaper, layer.text, f);
4013
+ for (const r of _chunkLPLCWZTMcjs.textDecorations.call(void 0, f, l)) path = [...path, ..._chunkLPLCWZTMcjs.textRectPath.call(void 0, r)];
4014
+ out.push({ fragment: f, path: _chunkLPLCWZTMcjs.isIdentityMatrix.call(void 0, m) ? path : _chunkXGD3FSNCcjs.transformBezierPath.call(void 0, path, m) });
4277
4015
  }
4278
4016
  }
4279
4017
  return out;
4280
4018
  }
4281
4019
  var rgbOf = (hex) => {
4282
4020
  const c = parseCssColor(hex);
4283
- const h = (_nullishCoalesce(_optionalChain([c, 'optionalAccess', _67 => _67.hex]), () => ( "#000000"))).slice(1);
4021
+ const h = (_nullishCoalesce(_optionalChain([c, 'optionalAccess', _61 => _61.hex]), () => ( "#000000"))).slice(1);
4284
4022
  return [parseInt(h.slice(0, 2), 16), parseInt(h.slice(2, 4), 16), parseInt(h.slice(4, 6), 16)];
4285
4023
  };
4286
4024
  function renderOutlines(layer, shaper, region) {
4287
4025
  const parts = textOutlines(layer, shaper).map(({ fragment, path }) => ({ style: fragment.style, flat: flattenPath(path) }));
4288
4026
  const tiles = /* @__PURE__ */ new Map();
4289
- for (const { tx, ty } of _chunkXIOMMGPDcjs.tilesInRect.call(void 0, region)) {
4290
- const rect = { x: tx * _chunkXIOMMGPDcjs.TILE, y: ty * _chunkXIOMMGPDcjs.TILE, width: _chunkXIOMMGPDcjs.TILE, height: _chunkXIOMMGPDcjs.TILE };
4291
- const n = _chunkXIOMMGPDcjs.TILE * _chunkXIOMMGPDcjs.TILE;
4027
+ for (const { tx, ty } of _chunkTFOPHZ3Ucjs.tilesInRect.call(void 0, region)) {
4028
+ const rect = { x: tx * _chunkTFOPHZ3Ucjs.TILE, y: ty * _chunkTFOPHZ3Ucjs.TILE, width: _chunkTFOPHZ3Ucjs.TILE, height: _chunkTFOPHZ3Ucjs.TILE };
4029
+ const n = _chunkTFOPHZ3Ucjs.TILE * _chunkTFOPHZ3Ucjs.TILE;
4292
4030
  const acc = new Float32Array(n * 4);
4293
4031
  let any = false;
4294
4032
  for (const p of parts) {
@@ -4319,17 +4057,17 @@ function renderOutlines(layer, shaper, region) {
4319
4057
  px2[i + 2] = Math.round(acc[i + 2]);
4320
4058
  px2[i + 3] = a;
4321
4059
  }
4322
- const tile = _chunkXIOMMGPDcjs.finishTile.call(void 0, px2, 4, 0);
4323
- if (tile) tiles.set(_chunkXIOMMGPDcjs.tileKey.call(void 0, tx, ty), tile);
4060
+ const tile = _chunkTFOPHZ3Ucjs.finishTile.call(void 0, px2, 4, 0);
4061
+ if (tile) tiles.set(_chunkTFOPHZ3Ucjs.tileKey.call(void 0, tx, ty), tile);
4324
4062
  }
4325
- return new (0, _chunkXIOMMGPDcjs.TiledSurface)(4, tiles, 0);
4063
+ return new (0, _chunkTFOPHZ3Ucjs.TiledSurface)(4, tiles, 0);
4326
4064
  }
4327
4065
  function renderOnCanvas(layer, shaper, region, env) {
4328
4066
  if (!env.createCanvas) return null;
4329
4067
  const canvas = env.createCanvas(region.width, region.height);
4330
4068
  const ctx = canvas.getContext("2d");
4331
4069
  if (!ctx || typeof ctx.getImageData !== "function") return null;
4332
- const layout = layoutText(layer, shaper);
4070
+ const layout = _chunkLPLCWZTMcjs.layoutText.call(void 0, layer, shaper);
4333
4071
  const m = textMatrix(layer);
4334
4072
  ctx.setTransform(1, 0, 0, 1, 0, 0);
4335
4073
  ctx.clearRect(0, 0, region.width, region.height);
@@ -4341,23 +4079,23 @@ function renderOnCanvas(layer, shaper, region, env) {
4341
4079
  ctx.globalAlpha = _nullishCoalesce(f.style.opacity, () => ( 1));
4342
4080
  const s = layer.text.slice(f.start, f.end);
4343
4081
  if (!f.spaced) shaper.draw(ctx, s, f.font, f.x, f.y);
4344
- else for (let k = 0; k < s.length; k++) if (!isSpace(s[k])) shaper.draw(ctx, s[k], f.font, f.x + f.carets[k], f.y);
4345
- for (const d of decorations(f, l)) ctx.fillRect(d.x, d.y, d.width, d.height);
4082
+ else for (let k = 0; k < s.length; k++) if (!_chunkLPLCWZTMcjs.isTextSpace.call(void 0, s[k])) shaper.draw(ctx, s[k], f.font, f.x + f.carets[k], f.y);
4083
+ for (const d of _chunkLPLCWZTMcjs.textDecorations.call(void 0, f, l)) ctx.fillRect(d.x, d.y, d.width, d.height);
4346
4084
  }
4347
4085
  }
4348
4086
  ctx.globalAlpha = 1;
4349
4087
  ctx.setTransform(1, 0, 0, 1, 0, 0);
4350
4088
  const data = ctx.getImageData(0, 0, region.width, region.height).data;
4351
- return _chunkXIOMMGPDcjs.surfaceFromPixels.call(void 0, { width: region.width, height: region.height, data: new Uint8ClampedArray(data) }, 4, region.x, region.y);
4089
+ return _chunkTFOPHZ3Ucjs.surfaceFromPixels.call(void 0, { width: region.width, height: region.height, data: new Uint8ClampedArray(data) }, 4, region.x, region.y);
4352
4090
  }
4353
4091
  function renderText(layer, env) {
4354
4092
  const shaper = env.shaper;
4355
4093
  if (!shaper || !shaper.outline && !shaper.draw) return null;
4356
- const layout = layoutText(layer, shaper);
4094
+ const layout = _chunkLPLCWZTMcjs.layoutText.call(void 0, layer, shaper);
4357
4095
  const ink = inkBounds(layout);
4358
4096
  const clip = { x: -TEXT_RENDER_MARGIN, y: -TEXT_RENDER_MARGIN, width: env.width + 2 * TEXT_RENDER_MARGIN, height: env.height + 2 * TEXT_RENDER_MARGIN };
4359
4097
  const region = ink ? intersect2(docRect(ink, textMatrix(layer)), clip) : null;
4360
- if (!region) return { surface: _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4), missingFonts: layout.missingFonts };
4098
+ if (!region) return { surface: _chunkTFOPHZ3Ucjs.emptySurface.call(void 0, 4), missingFonts: layout.missingFonts };
4361
4099
  if (shaper.outline) return { surface: renderOutlines(layer, shaper, region), missingFonts: layout.missingFonts };
4362
4100
  const surface = renderOnCanvas(layer, shaper, region, env);
4363
4101
  return surface ? { surface, missingFonts: layout.missingFonts } : null;
@@ -4448,7 +4186,7 @@ function patchParagraphStyle(base, patch, path = "paragraph") {
4448
4186
  continue;
4449
4187
  }
4450
4188
  const value = k === "autoLeading" ? num(v, `${path}.${k}`, 0.1, 10) : num(v, `${path}.${k}`, -1e4, 1e4);
4451
- if (k === "autoLeading" && value === DEFAULT_AUTO_LEADING || k !== "autoLeading" && value === 0) delete o[k];
4189
+ if (k === "autoLeading" && value === _chunkLPLCWZTMcjs.DEFAULT_AUTO_LEADING || k !== "autoLeading" && value === 0) delete o[k];
4452
4190
  else o[k] = value;
4453
4191
  } else fail3(`${path}.${k} is not a paragraph style field; use ${PARAGRAPH_STYLE_FIELDS.join(", ")}.`);
4454
4192
  }
@@ -4485,14 +4223,14 @@ function createTypeLayer(init, env, id = newLayerId(), lenient = false) {
4485
4223
  opacity: 1,
4486
4224
  blend: "normal",
4487
4225
  text: text3,
4488
- runs: fitRuns(init.runs, text3.length, DEFAULT_TEXT_STYLE),
4489
- paragraphs: fitParagraphRuns(_nullishCoalesce(init.paragraphs, () => ( [{ length: text3.length, style: {} }])), text3),
4226
+ runs: _chunkLPLCWZTMcjs.fitRuns.call(void 0, init.runs, text3.length, _chunkLPLCWZTMcjs.DEFAULT_TEXT_STYLE),
4227
+ paragraphs: _chunkLPLCWZTMcjs.fitParagraphRuns.call(void 0, _nullishCoalesce(init.paragraphs, () => ( [{ length: text3.length, style: {} }])), text3),
4490
4228
  frame: init.frame,
4491
- surface: _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4),
4229
+ surface: _chunkTFOPHZ3Ucjs.emptySurface.call(void 0, 4),
4492
4230
  offset: { x: 0, y: 0 }
4493
4231
  };
4494
- if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([init, 'access', _68 => _68.runs, 'access', _69 => _69[0], 'optionalAccess', _70 => _70.style]), () => ( DEFAULT_TEXT_STYLE)) }];
4495
- if (init.transform && !_chunkW3GXSUSQcjs.isIdentityMatrix.call(void 0, init.transform)) layer.transform = init.transform;
4232
+ if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([init, 'access', _62 => _62.runs, 'access', _63 => _63[0], 'optionalAccess', _64 => _64.style]), () => ( _chunkLPLCWZTMcjs.DEFAULT_TEXT_STYLE)) }];
4233
+ if (init.transform && !_chunkLPLCWZTMcjs.isIdentityMatrix.call(void 0, init.transform)) layer.transform = init.transform;
4496
4234
  if (lenient && !renderText(layer, env)) return { ...layer, rendering: "stored" };
4497
4235
  return rerenderText(layer, env);
4498
4236
  }
@@ -4502,24 +4240,24 @@ function updateTypeLayer(layers, id, change, env, action = "edit it") {
4502
4240
  const patch = change(current);
4503
4241
  const next = { ...current, ...patch };
4504
4242
  if (!("annotation" in patch)) delete next.annotation;
4505
- if ("text" in patch || "runs" in patch) next.runs = fitRuns(next.runs, next.text.length, _nullishCoalesce(_optionalChain([current, 'access', _71 => _71.runs, 'access', _72 => _72[0], 'optionalAccess', _73 => _73.style]), () => ( DEFAULT_TEXT_STYLE)));
4506
- if (!next.runs.length) next.runs = [{ length: 0, style: styleAt(current.runs, 0, DEFAULT_TEXT_STYLE) }];
4507
- if ("text" in patch || "paragraphs" in patch) next.paragraphs = fitParagraphRuns(next.paragraphs, next.text);
4243
+ if ("text" in patch || "runs" in patch) next.runs = _chunkLPLCWZTMcjs.fitRuns.call(void 0, next.runs, next.text.length, _nullishCoalesce(_optionalChain([current, 'access', _65 => _65.runs, 'access', _66 => _66[0], 'optionalAccess', _67 => _67.style]), () => ( _chunkLPLCWZTMcjs.DEFAULT_TEXT_STYLE)));
4244
+ if (!next.runs.length) next.runs = [{ length: 0, style: _chunkLPLCWZTMcjs.styleAt.call(void 0, current.runs, 0, _chunkLPLCWZTMcjs.DEFAULT_TEXT_STYLE) }];
4245
+ if ("text" in patch || "paragraphs" in patch) next.paragraphs = _chunkLPLCWZTMcjs.fitParagraphRuns.call(void 0, next.paragraphs, next.text);
4508
4246
  const rendered = rerenderText(next, env);
4509
- return { layers: _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => rendered), layer: rendered };
4247
+ return { layers: _chunkST7E3NEEcjs.mapLayer.call(void 0, layers, id, () => rendered), layer: rendered };
4510
4248
  }
4511
4249
  function replaceTextRange(layer, start, end, insert) {
4512
4250
  const text3 = layer.text.slice(0, start) + insert + layer.text.slice(end);
4513
- const style = styleAt(layer.runs, start > 0 && start === layer.text.length ? start - 1 : start, DEFAULT_TEXT_STYLE);
4514
- const runs = spliceRuns(layer.runs, start, end, insert.length, style);
4515
- const pstyle = styleAt(layer.paragraphs, start, {});
4516
- const paragraphs = spliceRuns(layer.paragraphs, start, end, insert.length, pstyle);
4517
- return { text: text3, runs, paragraphs: fitParagraphRuns(paragraphs, text3) };
4251
+ const style = _chunkLPLCWZTMcjs.styleAt.call(void 0, layer.runs, start > 0 && start === layer.text.length ? start - 1 : start, _chunkLPLCWZTMcjs.DEFAULT_TEXT_STYLE);
4252
+ const runs = _chunkLPLCWZTMcjs.spliceRuns.call(void 0, layer.runs, start, end, insert.length, style);
4253
+ const pstyle = _chunkLPLCWZTMcjs.styleAt.call(void 0, layer.paragraphs, start, {});
4254
+ const paragraphs = _chunkLPLCWZTMcjs.spliceRuns.call(void 0, layer.paragraphs, start, end, insert.length, pstyle);
4255
+ return { text: text3, runs, paragraphs: _chunkLPLCWZTMcjs.fitParagraphRuns.call(void 0, paragraphs, text3) };
4518
4256
  }
4519
4257
  function transformTypeLayer(layer, m) {
4520
- const t = _chunkW3GXSUSQcjs.multiplyMatrices.call(void 0, textMatrix(layer), m);
4258
+ const t = _chunkLPLCWZTMcjs.multiplyMatrices.call(void 0, textMatrix(layer), m);
4521
4259
  const next = { ...layer };
4522
- if (_chunkW3GXSUSQcjs.isIdentityMatrix.call(void 0, t)) delete next.transform;
4260
+ if (_chunkLPLCWZTMcjs.isIdentityMatrix.call(void 0, t)) delete next.transform;
4523
4261
  else next.transform = t;
4524
4262
  delete next.annotation;
4525
4263
  return next;
@@ -4527,7 +4265,7 @@ function transformTypeLayer(layer, m) {
4527
4265
  function typeFrame(layer, shaper) {
4528
4266
  if (layer.frame.kind === "box") return { x: 0, y: 0, width: layer.frame.width, height: layer.frame.height };
4529
4267
  if (!shaper) return fail3("Type layers need a text shaper to be measured; none is set here.");
4530
- const b = layoutText(layer, shaper).bounds;
4268
+ const b = _chunkLPLCWZTMcjs.layoutText.call(void 0, layer, shaper).bounds;
4531
4269
  return { x: b.x, y: b.y, width: Math.max(b.width, 1), height: Math.max(b.height, 1) };
4532
4270
  }
4533
4271
  function typeAsPixelLayer(layer) {
@@ -4535,7 +4273,7 @@ function typeAsPixelLayer(layer) {
4535
4273
  return { ...rest, type: "pixel", surface: layer.surface, offset: { x: 0, y: 0 } };
4536
4274
  }
4537
4275
  function toTextSpace(layer, p) {
4538
- return _chunkW3GXSUSQcjs.applyMatrix.call(void 0, _chunkW3GXSUSQcjs.invertMatrix.call(void 0, textMatrix(layer)), p);
4276
+ return _chunkLPLCWZTMcjs.applyMatrix.call(void 0, _chunkLPLCWZTMcjs.invertMatrix.call(void 0, textMatrix(layer)), p);
4539
4277
  }
4540
4278
  function typeFromAnnotation(a) {
4541
4279
  if (a.type !== "text") return null;
@@ -4549,7 +4287,7 @@ function typeFromAnnotation(a) {
4549
4287
  if (op !== 1) style.opacity = op;
4550
4288
  const text3 = t.text.replace(/\r?\n|\r/g, " ");
4551
4289
  const translate = [1, 0, 0, 1, t.x, t.y];
4552
- const transform = t.rotation ? _chunkW3GXSUSQcjs.multiplyMatrices.call(void 0, translate, _chunkW3GXSUSQcjs.rotateMatrix.call(void 0, t.rotation, { x: t.x, y: t.y })) : translate;
4290
+ const transform = t.rotation ? _chunkLPLCWZTMcjs.multiplyMatrices.call(void 0, translate, _chunkLPLCWZTMcjs.rotateMatrix.call(void 0, t.rotation, { x: t.x, y: t.y })) : translate;
4553
4291
  return { text: text3, runs: [{ length: text3.length, style }], frame: { kind: "point", origin: "top" }, transform };
4554
4292
  }
4555
4293
  function annotationOfType(layer) {
@@ -4598,7 +4336,7 @@ function rasterMaskFromLegacy(mask, width, height) {
4598
4336
  const sel = decodeLayerMask(mask);
4599
4337
  if (!sel) return null;
4600
4338
  const sized = sel.width === width && sel.height === height ? sel : resizeSelection(sel, width, height);
4601
- const surface = _chunkXIOMMGPDcjs.surfaceFromPixels.call(void 0, { width, height, data: sized.data }, 1, 0, 0, 0);
4339
+ const surface = _chunkTFOPHZ3Ucjs.surfaceFromPixels.call(void 0, { width, height, data: sized.data }, 1, 0, 0, 0);
4602
4340
  legacyMaskMemo.set(surface, { width: mask.width, height: mask.height, rle: mask.rle });
4603
4341
  const out = { surface, defaultValue: 0 };
4604
4342
  if (mask.density !== void 0 && mask.density !== 1) out.density = mask.density;
@@ -4617,7 +4355,7 @@ function hasResampledLegacyMask(layers, width, height) {
4617
4355
  function legacyMaskOf(mask, width, height) {
4618
4356
  let memo = legacyMaskMemo.get(mask.surface);
4619
4357
  if (!memo) {
4620
- const data = _chunkXIOMMGPDcjs.readRegion.call(void 0, mask.surface, { x: 0, y: 0, width, height });
4358
+ const data = _chunkTFOPHZ3Ucjs.readRegion.call(void 0, mask.surface, { x: 0, y: 0, width, height });
4621
4359
  memo = { width, height, rle: encodeSelectionRle(new Uint8Array(data.buffer, data.byteOffset, data.length)) };
4622
4360
  legacyMaskMemo.set(mask.surface, memo);
4623
4361
  }
@@ -4719,7 +4457,7 @@ function backgroundLayer(filters = [], mask) {
4719
4457
  visible: true,
4720
4458
  opacity: 1,
4721
4459
  blend: "normal",
4722
- surface: _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4),
4460
+ surface: _chunkTFOPHZ3Ucjs.emptySurface.call(void 0, 4),
4723
4461
  offset: { x: 0, y: 0 },
4724
4462
  source: "document",
4725
4463
  filters
@@ -4729,7 +4467,7 @@ function backgroundLayer(filters = [], mask) {
4729
4467
  }
4730
4468
  function depthRasterMask(source) {
4731
4469
  const out = {
4732
- surface: _chunkXIOMMGPDcjs.emptySurface.call(void 0, 1, 255),
4470
+ surface: _chunkTFOPHZ3Ucjs.emptySurface.call(void 0, 1, 255),
4733
4471
  defaultValue: 255,
4734
4472
  source: { ...source, depthRange: [...source.depthRange] }
4735
4473
  };
@@ -4789,7 +4527,7 @@ function legacyView(stack, width, height, activeLayerId = null) {
4789
4527
  const { layers } = stack;
4790
4528
  const target = developTarget(layers, activeLayerId);
4791
4529
  const develop = target ? developFilter(target) : void 0;
4792
- const blur = _nullishCoalesce(_nullishCoalesce(stack.legacyOutputBlur, () => ( (target ? _optionalChain([blurFilter, 'call', _74 => _74(target), 'optionalAccess', _75 => _75.radius]) : void 0))), () => ( 0));
4530
+ const blur = _nullishCoalesce(_nullishCoalesce(stack.legacyOutputBlur, () => ( (target ? _optionalChain([blurFilter, 'call', _68 => _68(target), 'optionalAccess', _69 => _69.radius]) : void 0))), () => ( 0));
4793
4531
  const adjustments = {
4794
4532
  ...DEFAULT_ADJUSTMENTS_VALUES,
4795
4533
  ...develop ? {
@@ -4818,7 +4556,7 @@ function legacyView(stack, width, height, activeLayerId = null) {
4818
4556
  };
4819
4557
  walk(layers);
4820
4558
  if (adjNodes.length) adjustments.layers = adjNodes.map((n) => legacyAdjustmentLayer(n, width, height));
4821
- const depthSource = _optionalChain([target, 'optionalAccess', _76 => _76.mask, 'optionalAccess', _77 => _77.source]);
4559
+ const depthSource = _optionalChain([target, 'optionalAccess', _70 => _70.mask, 'optionalAccess', _71 => _71.source]);
4822
4560
  const depthMask = depthSource ? { ...depthSource, depthRange: [...depthSource.depthRange] } : { ...DEFAULT_DEPTH_MASK_VALUES, depthRange: [...DEFAULT_DEPTH_MASK_VALUES.depthRange] };
4823
4561
  return { adjustments, depthMask, annotations, exact: isLegacyShape(stack) };
4824
4562
  }
@@ -4843,7 +4581,7 @@ function isLegacyShape(stack) {
4843
4581
  let adjustments = 0;
4844
4582
  for (; i < layers.length && layers[i].type === "adjustment"; i++) {
4845
4583
  const l = layers[i];
4846
- if (l.clipped || l.locks || _optionalChain([l, 'access', _78 => _78.mask, 'optionalAccess', _79 => _79.source]) || l.effects) return false;
4584
+ if (l.clipped || l.locks || _optionalChain([l, 'access', _72 => _72.mask, 'optionalAccess', _73 => _73.source]) || l.effects) return false;
4847
4585
  adjustments++;
4848
4586
  }
4849
4587
  for (; i < layers.length; i++) {
@@ -4883,7 +4621,7 @@ function identityTransform(box2) {
4883
4621
  }
4884
4622
  function cornersFromMatrix(box2, m) {
4885
4623
  const q2 = _chunkMUUXNRU4cjs.boxQuad.call(void 0, box2);
4886
- return [_chunkW3GXSUSQcjs.applyMatrix.call(void 0, m, q2[0]), _chunkW3GXSUSQcjs.applyMatrix.call(void 0, m, q2[1]), _chunkW3GXSUSQcjs.applyMatrix.call(void 0, m, q2[2]), _chunkW3GXSUSQcjs.applyMatrix.call(void 0, m, q2[3])];
4624
+ return [_chunkLPLCWZTMcjs.applyMatrix.call(void 0, m, q2[0]), _chunkLPLCWZTMcjs.applyMatrix.call(void 0, m, q2[1]), _chunkLPLCWZTMcjs.applyMatrix.call(void 0, m, q2[2]), _chunkLPLCWZTMcjs.applyMatrix.call(void 0, m, q2[3])];
4887
4625
  }
4888
4626
  function matrixFromCorners(box2, corners, eps = 1e-6) {
4889
4627
  const [tl, tr, br, bl] = corners;
@@ -4900,7 +4638,7 @@ function transformHomography(geometry) {
4900
4638
  function hasWarp(geometry) {
4901
4639
  const w = geometry.warp;
4902
4640
  if (!w) return false;
4903
- const id = _chunkW3GXSUSQcjs.identityWarpMesh.call(void 0, geometry.box, w.us.length - 1, w.vs.length - 1);
4641
+ const id = _chunkLPLCWZTMcjs.identityWarpMesh.call(void 0, geometry.box, w.us.length - 1, w.vs.length - 1);
4904
4642
  if (id.points.length !== w.points.length || id.us.some((u, i) => Math.abs(u - w.us[i]) > 1e-12) || id.vs.some((v, i) => Math.abs(v - w.vs[i]) > 1e-12)) return true;
4905
4643
  return w.points.some((p, i) => Math.abs(p.x - id.points[i].x) > 1e-6 || Math.abs(p.y - id.points[i].y) > 1e-6);
4906
4644
  }
@@ -4915,7 +4653,7 @@ function transformMap(geometry) {
4915
4653
  const { box: box2 } = geometry;
4916
4654
  const warp = hasWarp(geometry) ? geometry.warp : null;
4917
4655
  if (!warp) return (p) => _chunkMUUXNRU4cjs.applyHomography.call(void 0, h, p);
4918
- return (p) => _chunkMUUXNRU4cjs.applyHomography.call(void 0, h, _chunkW3GXSUSQcjs.evalWarpMesh.call(void 0, warp, (p.x - box2.x) / box2.width, (p.y - box2.y) / box2.height));
4656
+ return (p) => _chunkMUUXNRU4cjs.applyHomography.call(void 0, h, _chunkLPLCWZTMcjs.evalWarpMesh.call(void 0, warp, (p.x - box2.x) / box2.width, (p.y - box2.y) / box2.height));
4919
4657
  }
4920
4658
  function transformedPoint(geometry, fx, fy) {
4921
4659
  const f = transformMap(geometry);
@@ -4959,8 +4697,8 @@ function matrixFromParams(box2, params) {
4959
4697
  const tx = Math.tan((_nullishCoalesce(params.skewX, () => ( 0))) * Math.PI / 180);
4960
4698
  const ty = Math.tan((_nullishCoalesce(params.skewY, () => ( 0))) * Math.PI / 180);
4961
4699
  const ref = referencePoint(box2, params.reference);
4962
- const linear = _chunkW3GXSUSQcjs.multiplyMatrices.call(void 0, _chunkW3GXSUSQcjs.multiplyMatrices.call(void 0, [1, ty, tx, 1, 0, 0], [sx, 0, 0, sy, 0, 0]), _chunkW3GXSUSQcjs.rotateMatrix.call(void 0, _nullishCoalesce(params.rotate, () => ( 0))));
4963
- return _chunkW3GXSUSQcjs.multiplyMatrices.call(void 0, _chunkW3GXSUSQcjs.matrixAbout.call(void 0, linear, ref), _chunkW3GXSUSQcjs.translateMatrix.call(void 0, _nullishCoalesce(params.dx, () => ( 0)), _nullishCoalesce(params.dy, () => ( 0))));
4700
+ const linear = _chunkLPLCWZTMcjs.multiplyMatrices.call(void 0, _chunkLPLCWZTMcjs.multiplyMatrices.call(void 0, [1, ty, tx, 1, 0, 0], [sx, 0, 0, sy, 0, 0]), _chunkLPLCWZTMcjs.rotateMatrix.call(void 0, _nullishCoalesce(params.rotate, () => ( 0))));
4701
+ return _chunkLPLCWZTMcjs.multiplyMatrices.call(void 0, _chunkLPLCWZTMcjs.matrixAbout.call(void 0, linear, ref), _chunkLPLCWZTMcjs.translateMatrix.call(void 0, _nullishCoalesce(params.dx, () => ( 0)), _nullishCoalesce(params.dy, () => ( 0))));
4964
4702
  }
4965
4703
  function describeTransform(geometry, reference = "center") {
4966
4704
  const m = hasWarp(geometry) ? null : matrixFromCorners(geometry.box, geometry.corners);
@@ -4977,7 +4715,7 @@ function describeTransform(geometry, reference = "center") {
4977
4715
  const shear = sxAbs ? (a * c + b * d) / sxAbs : 0;
4978
4716
  const sy = sxAbs ? (a * d - b * c) / sxAbs : 0;
4979
4717
  const skew = sxAbs ? Math.atan(shear / sxAbs) * 180 / Math.PI : 0;
4980
- const at = _chunkW3GXSUSQcjs.applyMatrix.call(void 0, m, ref);
4718
+ const at = _chunkLPLCWZTMcjs.applyMatrix.call(void 0, m, ref);
4981
4719
  const clean = (v) => Math.abs(v) < 1e-9 ? 0 : v;
4982
4720
  return {
4983
4721
  affine: true,
@@ -4995,24 +4733,24 @@ function applyParams(geometry, params) {
4995
4733
  const ref = params.reference && typeof params.reference === "object" ? params.reference : anchorPoint(geometry, _nullishCoalesce(params.reference, () => ( "center")));
4996
4734
  const m = matrixFromParams({ x: ref.x, y: ref.y, width: 0, height: 0 }, { ...params, reference: ref });
4997
4735
  const c = geometry.corners;
4998
- return [_chunkW3GXSUSQcjs.applyMatrix.call(void 0, m, c[0]), _chunkW3GXSUSQcjs.applyMatrix.call(void 0, m, c[1]), _chunkW3GXSUSQcjs.applyMatrix.call(void 0, m, c[2]), _chunkW3GXSUSQcjs.applyMatrix.call(void 0, m, c[3])];
4736
+ return [_chunkLPLCWZTMcjs.applyMatrix.call(void 0, m, c[0]), _chunkLPLCWZTMcjs.applyMatrix.call(void 0, m, c[1]), _chunkLPLCWZTMcjs.applyMatrix.call(void 0, m, c[2]), _chunkLPLCWZTMcjs.applyMatrix.call(void 0, m, c[3])];
4999
4737
  }
5000
4738
  function flipCorners(geometry, axis) {
5001
4739
  const c = anchorPoint(geometry, "center");
5002
4740
  const m = axis === "horizontal" ? [-1, 0, 0, 1, 2 * c.x, 0] : [1, 0, 0, -1, 0, 2 * c.y];
5003
4741
  const q2 = geometry.corners;
5004
- return [_chunkW3GXSUSQcjs.applyMatrix.call(void 0, m, q2[0]), _chunkW3GXSUSQcjs.applyMatrix.call(void 0, m, q2[1]), _chunkW3GXSUSQcjs.applyMatrix.call(void 0, m, q2[2]), _chunkW3GXSUSQcjs.applyMatrix.call(void 0, m, q2[3])];
4742
+ return [_chunkLPLCWZTMcjs.applyMatrix.call(void 0, m, q2[0]), _chunkLPLCWZTMcjs.applyMatrix.call(void 0, m, q2[1]), _chunkLPLCWZTMcjs.applyMatrix.call(void 0, m, q2[2]), _chunkLPLCWZTMcjs.applyMatrix.call(void 0, m, q2[3])];
5005
4743
  }
5006
4744
  function boxPointOf(geometry, p) {
5007
4745
  const m = matrixFromCorners(geometry.box, geometry.corners);
5008
- if (m) return _chunkW3GXSUSQcjs.applyMatrix.call(void 0, _chunkW3GXSUSQcjs.invertMatrix.call(void 0, m), p);
4746
+ if (m) return _chunkLPLCWZTMcjs.applyMatrix.call(void 0, _chunkLPLCWZTMcjs.invertMatrix.call(void 0, m), p);
5009
4747
  return null;
5010
4748
  }
5011
4749
  function presetWarp(box2, preset) {
5012
- return _chunkW3GXSUSQcjs.warpPresetMesh.call(void 0, preset, box2);
4750
+ return _chunkLPLCWZTMcjs.warpPresetMesh.call(void 0, preset, box2);
5013
4751
  }
5014
4752
  function isValidWarp(mesh) {
5015
- return _chunkW3GXSUSQcjs.isValidWarpMesh.call(void 0, mesh);
4753
+ return _chunkLPLCWZTMcjs.isValidWarpMesh.call(void 0, mesh);
5016
4754
  }
5017
4755
  function geometryHomography(geometry) {
5018
4756
  const m = matrixFromCorners(geometry.box, geometry.corners);
@@ -5023,7 +4761,7 @@ function geometryHomography(geometry) {
5023
4761
  var fail4 = (message) => {
5024
4762
  throw new LayerOperationError(message);
5025
4763
  };
5026
- var SMART_RENDER_MARGIN = _chunkPOGBUYWEcjs.MAX_EFFECT_REACH;
4764
+ var SMART_RENDER_MARGIN = _chunkST7E3NEEcjs.MAX_EFFECT_REACH;
5027
4765
  function newContentsId() {
5028
4766
  return newLayerId("so");
5029
4767
  }
@@ -5041,7 +4779,7 @@ function isContentsDecoded(contents) {
5041
4779
  }
5042
4780
  function requireDecoded(layer, action) {
5043
4781
  if (isContentsDecoded(layer.contents)) return;
5044
- const what = _optionalChain([layer, 'access', _80 => _80.contents, 'access', _81 => _81.file, 'optionalAccess', _82 => _82.type]) ? `a ${layer.contents.file.type.toUpperCase()} file` : "a file";
4782
+ const what = _optionalChain([layer, 'access', _74 => _74.contents, 'access', _75 => _75.file, 'optionalAccess', _76 => _76.type]) ? `a ${layer.contents.file.type.toUpperCase()} file` : "a file";
5045
4783
  fail4(
5046
4784
  `The contents of smart object "${layer.name || layer.id}" are ${what} that could not be decoded here, so it cannot ${action}. Run prepareSmartObjects() in a browser first, or rasterize it.`
5047
4785
  );
@@ -5056,26 +4794,26 @@ function contentsSurface(contents) {
5056
4794
  let s = contentsPixels.get(contents);
5057
4795
  if (s) return s;
5058
4796
  if (contents.kind === "raster") {
5059
- s = _nullishCoalesce(contents.raster, () => ( _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4)));
4797
+ s = _nullishCoalesce(contents.raster, () => ( _chunkTFOPHZ3Ucjs.emptySurface.call(void 0, 4)));
5060
4798
  } else {
5061
4799
  const doc = contents.document;
5062
- if (!doc) return _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4);
4800
+ if (!doc) return _chunkTFOPHZ3Ucjs.emptySurface.call(void 0, 4);
5063
4801
  const W = contents.width;
5064
4802
  const H = contents.height;
5065
4803
  const data = new LayerCompositor().composite(doc.layers, { x: 0, y: 0, width: W, height: H }, {
5066
4804
  width: W,
5067
4805
  height: H,
5068
4806
  globalLight: doc.globalLight,
5069
- pattern: (id) => _nullishCoalesce(_optionalChain([doc, 'access', _83 => _83.patterns, 'optionalAccess', _84 => _84.find, 'call', _85 => _85((p) => p.id === id)]), () => ( null))
4807
+ pattern: (id) => _nullishCoalesce(_optionalChain([doc, 'access', _77 => _77.patterns, 'optionalAccess', _78 => _78.find, 'call', _79 => _79((p) => p.id === id)]), () => ( null))
5070
4808
  });
5071
- s = _chunkXIOMMGPDcjs.surfaceFromPixels.call(void 0, { width: W, height: H, data }, 4, 0, 0);
4809
+ s = _chunkTFOPHZ3Ucjs.surfaceFromPixels.call(void 0, { width: W, height: H, data }, 4, 0, 0);
5072
4810
  }
5073
4811
  contentsPixels.set(contents, s);
5074
4812
  return s;
5075
4813
  }
5076
4814
  function rasterContents(pixels, name, id = newContentsId()) {
5077
4815
  if (!(pixels.width > 0 && pixels.height > 0) || pixels.data.length < pixels.width * pixels.height * 4) fail4("Contents pixels must be RGBA with width \xD7 height \xD7 4 bytes.");
5078
- return { id, name, width: pixels.width, height: pixels.height, kind: "raster", raster: _chunkXIOMMGPDcjs.surfaceFromPixels.call(void 0, pixels, 4, 0, 0) };
4816
+ return { id, name, width: pixels.width, height: pixels.height, kind: "raster", raster: _chunkTFOPHZ3Ucjs.surfaceFromPixels.call(void 0, pixels, 4, 0, 0) };
5079
4817
  }
5080
4818
  function documentContents(document, width, height, name, id = newContentsId()) {
5081
4819
  if (!(Number.isInteger(width) && Number.isInteger(height) && width > 0 && height > 0)) fail4("Contents width and height must be positive whole numbers.");
@@ -5101,7 +4839,7 @@ function placeContents(layer, canvas, options = {}) {
5101
4839
  const preview = Boolean(options.step && options.step > 1) || Boolean(options.clip);
5102
4840
  const key = placementKey(placement, canvas);
5103
4841
  if (!preview) {
5104
- const hit = _optionalChain([placedCache, 'access', _86 => _86.get, 'call', _87 => _87(contents), 'optionalAccess', _88 => _88.get, 'call', _89 => _89(key)]);
4842
+ const hit = _optionalChain([placedCache, 'access', _80 => _80.get, 'call', _81 => _81(contents), 'optionalAccess', _82 => _82.get, 'call', _83 => _83(key)]);
5105
4843
  if (hit) return hit;
5106
4844
  }
5107
4845
  const src = contentsSurface(contents);
@@ -5119,7 +4857,7 @@ function placeContents(layer, canvas, options = {}) {
5119
4857
  let out;
5120
4858
  const move = integerMove(layer);
5121
4859
  if (move && !options.clip) {
5122
- out = _chunkXIOMMGPDcjs.translateSurface.call(void 0, src, move.x, move.y);
4860
+ out = _chunkTFOPHZ3Ucjs.translateSurface.call(void 0, src, move.x, move.y);
5123
4861
  } else {
5124
4862
  const g = placementGeometry(layer);
5125
4863
  const interpolation = preview ? placement.interpolation === "nearest" ? "nearest" : "bilinear" : _nullishCoalesce(placement.interpolation, () => ( "bicubic"));
@@ -5128,10 +4866,10 @@ function placeContents(layer, canvas, options = {}) {
5128
4866
  let k = 1;
5129
4867
  if (step > 1) {
5130
4868
  k = step;
5131
- let r = _optionalChain([options, 'access', _90 => _90.reduced, 'optionalAccess', _91 => _91.get, 'call', _92 => _92(k)]);
4869
+ let r = _optionalChain([options, 'access', _84 => _84.reduced, 'optionalAccess', _85 => _85.get, 'call', _86 => _86(k)]);
5132
4870
  if (!r) {
5133
- r = _chunkPOGBUYWEcjs.reduceSurface.call(void 0, src, k);
5134
- _optionalChain([options, 'access', _93 => _93.reduced, 'optionalAccess', _94 => _94.set, 'call', _95 => _95(k, r)]);
4871
+ r = _chunkST7E3NEEcjs.reduceSurface.call(void 0, src, k);
4872
+ _optionalChain([options, 'access', _87 => _87.reduced, 'optionalAccess', _88 => _88.set, 'call', _89 => _89(k, r)]);
5135
4873
  }
5136
4874
  source = r;
5137
4875
  }
@@ -5140,15 +4878,15 @@ function placeContents(layer, canvas, options = {}) {
5140
4878
  if (hasWarp(g)) {
5141
4879
  const f = transformMap(g);
5142
4880
  if (!f) fail4("The placement folds the contents over itself or through the horizon; keep the corners a convex quad.");
5143
- out = _chunkPOGBUYWEcjs.warpSurface.call(void 0, source, (p) => f({ x: p.x * k, y: p.y * k }), { interpolation, source: box2, clip, step: step > 1 ? step : void 0 });
4881
+ out = _chunkST7E3NEEcjs.warpSurface.call(void 0, source, (p) => f({ x: p.x * k, y: p.y * k }), { interpolation, source: box2, clip, step: step > 1 ? step : void 0 });
5144
4882
  } else {
5145
4883
  const h = transformHomography(g);
5146
4884
  if (!h) fail4("The placement folds the contents over itself or through the horizon; keep the corners a convex quad.");
5147
4885
  const hk = _chunkMUUXNRU4cjs.multiplyHomographies.call(void 0, [k, 0, 0, 0, k, 0, 0, 0, 1], h);
5148
- out = _chunkPOGBUYWEcjs.transformSurface.call(void 0, source, hk, { interpolation, source: box2, clip, step: step > 1 ? step : void 0 });
4886
+ out = _chunkST7E3NEEcjs.transformSurface.call(void 0, source, hk, { interpolation, source: box2, clip, step: step > 1 ? step : void 0 });
5149
4887
  }
5150
4888
  } catch (e) {
5151
- if (e instanceof _chunkPOGBUYWEcjs.TransformTooLargeError) fail4(e.message);
4889
+ if (e instanceof _chunkST7E3NEEcjs.TransformTooLargeError) fail4(e.message);
5152
4890
  throw e;
5153
4891
  }
5154
4892
  }
@@ -5164,14 +4902,14 @@ function placeContents(layer, canvas, options = {}) {
5164
4902
  return out;
5165
4903
  }
5166
4904
  function activeSmartFilters(stack) {
5167
- if (!_optionalChain([stack, 'optionalAccess', _96 => _96.enabled])) return [];
4905
+ if (!_optionalChain([stack, 'optionalAccess', _90 => _90.enabled])) return [];
5168
4906
  return stack.filters.filter((f) => f.kind !== "psd" && isActiveFilter(f) && f.opacity > 0);
5169
4907
  }
5170
4908
  function filterMaskCoverage(mask, canvas) {
5171
4909
  if (!mask || mask.enabled === false || mask.source) return null;
5172
4910
  const W = canvas.width;
5173
4911
  const H = canvas.height;
5174
- const bytes = _chunkXIOMMGPDcjs.readRegion.call(void 0, mask.surface, { x: 0, y: 0, width: W, height: H });
4912
+ const bytes = _chunkTFOPHZ3Ucjs.readRegion.call(void 0, mask.surface, { x: 0, y: 0, width: W, height: H });
5175
4913
  let v = new Float32Array(W * H);
5176
4914
  let all = true;
5177
4915
  for (let i = 0; i < v.length; i++) {
@@ -5180,7 +4918,7 @@ function filterMaskCoverage(mask, canvas) {
5180
4918
  }
5181
4919
  const feather = _nullishCoalesce(mask.feather, () => ( 0));
5182
4920
  if (all && !(feather > 0)) return null;
5183
- if (feather > 0) v = _chunkPOGBUYWEcjs.gaussianBlur.call(void 0, v, W, H, feather, "clamp");
4921
+ if (feather > 0) v = _chunkST7E3NEEcjs.gaussianBlur.call(void 0, v, W, H, feather, "clamp");
5184
4922
  const density = _nullishCoalesce(mask.density, () => ( 1));
5185
4923
  if (density !== 1) for (let i = 0; i < v.length; i++) v[i] = 1 - density * (1 - v[i]);
5186
4924
  return v;
@@ -5193,7 +4931,7 @@ function applySmartFilters(placed, stack, canvas) {
5193
4931
  const key = JSON.stringify([W, H, active.map((f) => ({ ...f, id: void 0 }))]);
5194
4932
  let entry = filteredCache.get(placed);
5195
4933
  if (!entry || entry.key !== key) {
5196
- const base = _chunkXIOMMGPDcjs.readRegion.call(void 0, placed, { x: 0, y: 0, width: W, height: H });
4934
+ const base = _chunkTFOPHZ3Ucjs.readRegion.call(void 0, placed, { x: 0, y: 0, width: W, height: H });
5197
4935
  let acc = new Uint8ClampedArray(base);
5198
4936
  for (const f of active) {
5199
4937
  const out = new Uint8ClampedArray(acc);
@@ -5202,7 +4940,7 @@ function applySmartFilters(placed, stack, canvas) {
5202
4940
  if (f.opacity >= 1) acc = out;
5203
4941
  else lerpInto(acc, out, f.opacity, null);
5204
4942
  } else {
5205
- _chunkPOGBUYWEcjs.blendTile.call(void 0, acc, out, f.blend, f.opacity, null);
4943
+ _chunkST7E3NEEcjs.blendTile.call(void 0, acc, out, f.blend, f.opacity, null);
5206
4944
  }
5207
4945
  }
5208
4946
  entry = { key, base, filtered: acc };
@@ -5214,7 +4952,7 @@ function applySmartFilters(placed, stack, canvas) {
5214
4952
  result = new Uint8ClampedArray(entry.base);
5215
4953
  lerpInto(result, entry.filtered, 1, cov);
5216
4954
  }
5217
- return _chunkXIOMMGPDcjs.surfaceFromPixels.call(void 0, { width: W, height: H, data: result }, 4, 0, 0);
4955
+ return _chunkTFOPHZ3Ucjs.surfaceFromPixels.call(void 0, { width: W, height: H, data: result }, 4, 0, 0);
5218
4956
  }
5219
4957
  function lerpInto(dst, src, k, coverage) {
5220
4958
  for (let i = 0, p = 0; i < dst.length; i += 4, p++) {
@@ -5239,17 +4977,17 @@ function rerender(layer, canvas, action = "change") {
5239
4977
  return { ...layer, surface: renderSmartObject(layer, canvas) };
5240
4978
  }
5241
4979
  function normalizePlacement(raw, contents) {
5242
- const c = _optionalChain([raw, 'optionalAccess', _97 => _97.corners]);
4980
+ const c = _optionalChain([raw, 'optionalAccess', _91 => _91.corners]);
5243
4981
  if (!Array.isArray(c) || c.length !== 4 || !c.every((p) => p && Number.isFinite(p.x) && Number.isFinite(p.y))) {
5244
4982
  fail4("corners must be four finite points [top-left, top-right, bottom-right, bottom-left] in document pixels.");
5245
4983
  }
5246
4984
  const out = { corners: c.map((p) => ({ x: p.x, y: p.y })) };
5247
4985
  if (raw.warp) {
5248
- if (!_chunkW3GXSUSQcjs.isValidWarpMesh.call(void 0, raw.warp)) fail4("warp must be a mesh with us and vs (knots from 0 to 1, increasing) and (3\xB7columns + 1) \xD7 (3\xB7rows + 1) finite points in contents pixels.");
4986
+ if (!_chunkLPLCWZTMcjs.isValidWarpMesh.call(void 0, raw.warp)) fail4("warp must be a mesh with us and vs (knots from 0 to 1, increasing) and (3\xB7columns + 1) \xD7 (3\xB7rows + 1) finite points in contents pixels.");
5249
4987
  out.warp = { us: [...raw.warp.us], vs: [...raw.warp.vs], points: raw.warp.points.map((p) => ({ x: p.x, y: p.y })) };
5250
4988
  }
5251
4989
  if (raw.interpolation !== void 0) {
5252
- if (!_chunkPOGBUYWEcjs.isInterpolation.call(void 0, raw.interpolation)) fail4(`Unknown interpolation "${String(raw.interpolation)}"; use nearest, bilinear or bicubic.`);
4990
+ if (!_chunkST7E3NEEcjs.isInterpolation.call(void 0, raw.interpolation)) fail4(`Unknown interpolation "${String(raw.interpolation)}"; use nearest, bilinear or bicubic.`);
5253
4991
  if (raw.interpolation !== "bicubic") out.interpolation = raw.interpolation;
5254
4992
  }
5255
4993
  const g = { box: { x: 0, y: 0, width: contents.width, height: contents.height }, corners: out.corners, warp: _nullishCoalesce(out.warp, () => ( null)) };
@@ -5269,7 +5007,7 @@ function followMask(mask, before, after) {
5269
5007
  const inv = _chunkMUUXNRU4cjs.invertHomography.call(void 0, h0);
5270
5008
  if (!inv) return mask;
5271
5009
  const delta = _chunkMUUXNRU4cjs.multiplyHomographies.call(void 0, inv, h1);
5272
- const surface = _chunkPOGBUYWEcjs.transformSurface.call(void 0, mask.surface, delta, { interpolation: "bilinear" });
5010
+ const surface = _chunkST7E3NEEcjs.transformSurface.call(void 0, mask.surface, delta, { interpolation: "bilinear" });
5273
5011
  return { ...mask, surface };
5274
5012
  }
5275
5013
  function setSmartPlacement(layers, id, placement, canvas) {
@@ -5284,13 +5022,13 @@ function setSmartPlacement(layers, id, placement, canvas) {
5284
5022
  masksMoved ||= m !== layer.mask;
5285
5023
  next.mask = m;
5286
5024
  }
5287
- if (_optionalChain([next, 'access', _98 => _98.smartFilters, 'optionalAccess', _99 => _99.mask])) {
5025
+ if (_optionalChain([next, 'access', _92 => _92.smartFilters, 'optionalAccess', _93 => _93.mask])) {
5288
5026
  const m = followMask(next.smartFilters.mask, layer, next);
5289
5027
  masksMoved ||= m !== next.smartFilters.mask;
5290
5028
  next.smartFilters = { ...next.smartFilters, mask: m };
5291
5029
  }
5292
5030
  next = rerender(next, canvas, "be transformed");
5293
- return { layers: _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => next), layer: next, masksMoved };
5031
+ return { layers: _chunkST7E3NEEcjs.mapLayer.call(void 0, layers, id, () => next), layer: next, masksMoved };
5294
5032
  }
5295
5033
  function offsetSmartObject(layers, id, dx, dy, canvas) {
5296
5034
  const layer = requireSmartObject(layers, id);
@@ -5300,26 +5038,26 @@ function offsetSmartObject(layers, id, dx, dy, canvas) {
5300
5038
  if (!mx && !my) return layers;
5301
5039
  const corners = layer.placement.corners.map((p) => ({ x: p.x + mx, y: p.y + my }));
5302
5040
  let next = { ...layer, placement: { ...layer.placement, corners } };
5303
- const moveMask = (m2) => m2 && m2.linked !== false && !m2.source ? { ...m2, surface: _chunkXIOMMGPDcjs.translateSurface.call(void 0, m2.surface, mx, my) } : m2;
5041
+ const moveMask = (m2) => m2 && m2.linked !== false && !m2.source ? { ...m2, surface: _chunkTFOPHZ3Ucjs.translateSurface.call(void 0, m2.surface, mx, my) } : m2;
5304
5042
  if (layer.mask) next.mask = moveMask(layer.mask);
5305
- if (_optionalChain([layer, 'access', _100 => _100.smartFilters, 'optionalAccess', _101 => _101.mask])) next.smartFilters = { ...layer.smartFilters, mask: moveMask(layer.smartFilters.mask) };
5043
+ if (_optionalChain([layer, 'access', _94 => _94.smartFilters, 'optionalAccess', _95 => _95.mask])) next.smartFilters = { ...layer.smartFilters, mask: moveMask(layer.smartFilters.mask) };
5306
5044
  const spatial = activeSmartFilters(layer.smartFilters).some((f) => f.kind === "blur");
5307
- const b = _chunkXIOMMGPDcjs.contentBounds.call(void 0, layer.surface);
5045
+ const b = _chunkTFOPHZ3Ucjs.contentBounds.call(void 0, layer.surface);
5308
5046
  const m = SMART_RENDER_MARGIN;
5309
5047
  const cut = b && (b.x <= -m || b.y <= -m || b.x + b.width >= canvas.width + m || b.y + b.height >= canvas.height + m);
5310
- if (!spatial && !cut && !(_optionalChain([next, 'access', _102 => _102.smartFilters, 'optionalAccess', _103 => _103.mask]) && activeSmartFilters(next.smartFilters).length && next.smartFilters.mask.linked === false)) {
5311
- next = { ...next, surface: _chunkXIOMMGPDcjs.translateSurface.call(void 0, layer.surface, mx, my) };
5048
+ if (!spatial && !cut && !(_optionalChain([next, 'access', _96 => _96.smartFilters, 'optionalAccess', _97 => _97.mask]) && activeSmartFilters(next.smartFilters).length && next.smartFilters.mask.linked === false)) {
5049
+ next = { ...next, surface: _chunkTFOPHZ3Ucjs.translateSurface.call(void 0, layer.surface, mx, my) };
5312
5050
  } else {
5313
5051
  next = rerender(next, canvas, "move");
5314
5052
  }
5315
- return _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => next);
5053
+ return _chunkST7E3NEEcjs.mapLayer.call(void 0, layers, id, () => next);
5316
5054
  }
5317
5055
  function translateLayer(layer, dx, dy) {
5318
5056
  if (!dx && !dy) return layer;
5319
5057
  const moveMask = (m) => {
5320
5058
  if (!m) return m;
5321
5059
  if (m.source) fail4(`Layer "${layer.name || layer.id}" has a depth mask, which cannot move into a smart object; bake or remove it first.`);
5322
- return { ...m, surface: _chunkXIOMMGPDcjs.translateSurface.call(void 0, m.surface, dx, dy) };
5060
+ return { ...m, surface: _chunkTFOPHZ3Ucjs.translateSurface.call(void 0, m.surface, dx, dy) };
5323
5061
  };
5324
5062
  switch (layer.type) {
5325
5063
  case "pixel":
@@ -5328,11 +5066,11 @@ function translateLayer(layer, dx, dy) {
5328
5066
  const next = {
5329
5067
  ...layer,
5330
5068
  placement: { ...layer.placement, corners: layer.placement.corners.map((p) => ({ x: p.x + dx, y: p.y + dy })) },
5331
- surface: _chunkXIOMMGPDcjs.translateSurface.call(void 0, layer.surface, dx, dy),
5069
+ surface: _chunkTFOPHZ3Ucjs.translateSurface.call(void 0, layer.surface, dx, dy),
5332
5070
  mask: moveMask(layer.mask)
5333
5071
  };
5334
5072
  if (!next.mask) delete next.mask;
5335
- if (_optionalChain([layer, 'access', _104 => _104.smartFilters, 'optionalAccess', _105 => _105.mask])) next.smartFilters = { ...layer.smartFilters, mask: moveMask(layer.smartFilters.mask) };
5073
+ if (_optionalChain([layer, 'access', _98 => _98.smartFilters, 'optionalAccess', _99 => _99.mask])) next.smartFilters = { ...layer.smartFilters, mask: moveMask(layer.smartFilters.mask) };
5336
5074
  return next;
5337
5075
  }
5338
5076
  case "group": {
@@ -5348,8 +5086,8 @@ function translateLayer(layer, dx, dy) {
5348
5086
  case "shape": {
5349
5087
  const next = {
5350
5088
  ...layer,
5351
- components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }), _chunkW3GXSUSQcjs.translateMatrix.call(void 0, dx, dy)),
5352
- surface: _chunkXIOMMGPDcjs.translateSurface.call(void 0, layer.surface, dx, dy),
5089
+ components: transformShapeComponents(layer.components, (p) => ({ x: p.x + dx, y: p.y + dy }), _chunkLPLCWZTMcjs.translateMatrix.call(void 0, dx, dy)),
5090
+ surface: _chunkTFOPHZ3Ucjs.translateSurface.call(void 0, layer.surface, dx, dy),
5353
5091
  mask: moveMask(layer.mask)
5354
5092
  };
5355
5093
  if (!next.mask) delete next.mask;
@@ -5357,7 +5095,7 @@ function translateLayer(layer, dx, dy) {
5357
5095
  return next;
5358
5096
  }
5359
5097
  case "type": {
5360
- const next = { ...transformTypeLayer(layer, _chunkW3GXSUSQcjs.translateMatrix.call(void 0, dx, dy)), surface: _chunkXIOMMGPDcjs.translateSurface.call(void 0, layer.surface, dx, dy), mask: moveMask(layer.mask) };
5098
+ const next = { ...transformTypeLayer(layer, _chunkLPLCWZTMcjs.translateMatrix.call(void 0, dx, dy)), surface: _chunkTFOPHZ3Ucjs.translateSurface.call(void 0, layer.surface, dx, dy), mask: moveMask(layer.mask) };
5361
5099
  if (!next.mask) delete next.mask;
5362
5100
  return next;
5363
5101
  }
@@ -5372,7 +5110,7 @@ function layerExtent(layer, surfaceOf, canvas) {
5372
5110
  const s = layer.type === "pixel" ? surfaceOf(layer) : layer.surface;
5373
5111
  if (s.defaultValue !== 0) b = full;
5374
5112
  else {
5375
- const c = _chunkXIOMMGPDcjs.contentBounds.call(void 0, s);
5113
+ const c = _chunkTFOPHZ3Ucjs.contentBounds.call(void 0, s);
5376
5114
  b = c ? { x: c.x + layer.offset.x, y: c.y + layer.offset.y, width: c.width, height: c.height } : null;
5377
5115
  }
5378
5116
  } else if (layer.type === "group") {
@@ -5380,7 +5118,7 @@ function layerExtent(layer, surfaceOf, canvas) {
5380
5118
  } else {
5381
5119
  b = full;
5382
5120
  }
5383
- const m = _chunkPOGBUYWEcjs.effectsMargin.call(void 0, layer.effects);
5121
+ const m = _chunkST7E3NEEcjs.effectsMargin.call(void 0, layer.effects);
5384
5122
  if (b && m > 0) b = { x: b.x - Math.ceil(m), y: b.y - Math.ceil(m), width: b.width + 2 * Math.ceil(m), height: b.height + 2 * Math.ceil(m) };
5385
5123
  return b;
5386
5124
  }
@@ -5392,14 +5130,14 @@ function union(a, b) {
5392
5130
  return { x, y, width: Math.max(a.x + a.width, b.x + b.width) - x, height: Math.max(a.y + a.height, b.y + b.height) - y };
5393
5131
  }
5394
5132
  function asSmartFilters(filters) {
5395
- if (!_optionalChain([filters, 'optionalAccess', _106 => _106.length])) return void 0;
5133
+ if (!_optionalChain([filters, 'optionalAccess', _100 => _100.length])) return void 0;
5396
5134
  return { enabled: true, filters: filters.map((f) => ({ ...f, blend: "normal", opacity: 1 })) };
5397
5135
  }
5398
5136
  function convertToSmartObject(layers, ids, canvas, options) {
5399
5137
  if (!ids.length) fail4("Give at least one layer id to convert.");
5400
5138
  const locs = [...new Set(ids)].map((id) => requireLayer(layers, id));
5401
- const parent = _nullishCoalesce(_optionalChain([locs, 'access', _107 => _107[0], 'access', _108 => _108.parent, 'optionalAccess', _109 => _109.id]), () => ( null));
5402
- if (locs.some((l) => (_nullishCoalesce(_optionalChain([l, 'access', _110 => _110.parent, 'optionalAccess', _111 => _111.id]), () => ( null))) !== parent)) fail4("Layers to convert must share one parent; move them next to each other first.");
5139
+ const parent = _nullishCoalesce(_optionalChain([locs, 'access', _101 => _101[0], 'access', _102 => _102.parent, 'optionalAccess', _103 => _103.id]), () => ( null));
5140
+ if (locs.some((l) => (_nullishCoalesce(_optionalChain([l, 'access', _104 => _104.parent, 'optionalAccess', _105 => _105.id]), () => ( null))) !== parent)) fail4("Layers to convert must share one parent; move them next to each other first.");
5403
5141
  for (const l of locs) requireUnlocked(l.layer, "all", "convert it");
5404
5142
  const ordered = locs.sort((a, b) => a.index - b.index);
5405
5143
  const top = ordered[ordered.length - 1];
@@ -5408,7 +5146,7 @@ function convertToSmartObject(layers, ids, canvas, options) {
5408
5146
  if (single && single.type === "pixel") {
5409
5147
  const surface = options.surfaceOf(single);
5410
5148
  if (surface.defaultValue !== 0) fail4(`Layer "${single.name || single.id}" has no transparent area to crop to; it cannot be converted.`);
5411
- const b = _chunkXIOMMGPDcjs.contentBounds.call(void 0, surface);
5149
+ const b = _chunkTFOPHZ3Ucjs.contentBounds.call(void 0, surface);
5412
5150
  if (!b) fail4(`Layer "${single.name || single.id}" has no pixels to convert; paint something first.`);
5413
5151
  const contents = {
5414
5152
  id: newContentsId(),
@@ -5416,7 +5154,7 @@ function convertToSmartObject(layers, ids, canvas, options) {
5416
5154
  width: b.width,
5417
5155
  height: b.height,
5418
5156
  kind: "raster",
5419
- raster: _chunkXIOMMGPDcjs.translateSurface.call(void 0, surface, -b.x, -b.y)
5157
+ raster: _chunkTFOPHZ3Ucjs.translateSurface.call(void 0, surface, -b.x, -b.y)
5420
5158
  };
5421
5159
  smart = {
5422
5160
  type: "smart",
@@ -5427,14 +5165,14 @@ function convertToSmartObject(layers, ids, canvas, options) {
5427
5165
  blend: single.blend,
5428
5166
  contents,
5429
5167
  placement: placementAt(contents, b.x + single.offset.x, b.y + single.offset.y),
5430
- surface: _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4),
5168
+ surface: _chunkTFOPHZ3Ucjs.emptySurface.call(void 0, 4),
5431
5169
  offset: { x: 0, y: 0 }
5432
5170
  };
5433
5171
  if (single.clipped) smart.clipped = true;
5434
5172
  if (single.fillOpacity !== void 0) smart.fillOpacity = single.fillOpacity;
5435
5173
  if (single.effects) smart.effects = single.effects;
5436
5174
  if (single.mask) {
5437
- smart.mask = single.mask.source ? single.mask : { ...single.mask, surface: _chunkXIOMMGPDcjs.translateSurface.call(void 0, single.mask.surface, single.offset.x, single.offset.y) };
5175
+ smart.mask = single.mask.source ? single.mask : { ...single.mask, surface: _chunkTFOPHZ3Ucjs.translateSurface.call(void 0, single.mask.surface, single.offset.x, single.offset.y) };
5438
5176
  }
5439
5177
  const filters = asSmartFilters(single.filters);
5440
5178
  if (filters) smart.smartFilters = filters;
@@ -5449,7 +5187,7 @@ function convertToSmartObject(layers, ids, canvas, options) {
5449
5187
  delete resolved.source;
5450
5188
  layer = resolved;
5451
5189
  }
5452
- if (_chunkPOGBUYWEcjs.flattenLayers.call(void 0, [layer]).some((x) => x.type === "pixel" && x.source === "document")) fail4(`Layer "${layer.name || layer.id}" holds the document image inside a group; convert the Background on its own.`);
5190
+ if (_chunkST7E3NEEcjs.flattenLayers.call(void 0, [layer]).some((x) => x.type === "pixel" && x.source === "document")) fail4(`Layer "${layer.name || layer.id}" holds the document image inside a group; convert the Background on its own.`);
5453
5191
  return translateLayer(layer, -b.x, -b.y);
5454
5192
  });
5455
5193
  if (nested[0].clipped) {
@@ -5457,7 +5195,7 @@ function convertToSmartObject(layers, ids, canvas, options) {
5457
5195
  delete first.clipped;
5458
5196
  nested[0] = first;
5459
5197
  }
5460
- const name = _optionalChain([options, 'access', _112 => _112.name, 'optionalAccess', _113 => _113.trim, 'call', _114 => _114()]) || top.layer.name || "Smart Object";
5198
+ const name = _optionalChain([options, 'access', _106 => _106.name, 'optionalAccess', _107 => _107.trim, 'call', _108 => _108()]) || top.layer.name || "Smart Object";
5461
5199
  const contents = documentContents({ layers: nested }, b.width, b.height, `${name}.psb`);
5462
5200
  smart = {
5463
5201
  type: "smart",
@@ -5468,16 +5206,16 @@ function convertToSmartObject(layers, ids, canvas, options) {
5468
5206
  blend: "normal",
5469
5207
  contents,
5470
5208
  placement: placementAt(contents, b.x, b.y),
5471
- surface: _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4),
5209
+ surface: _chunkTFOPHZ3Ucjs.emptySurface.call(void 0, 4),
5472
5210
  offset: { x: 0, y: 0 }
5473
5211
  };
5474
5212
  }
5475
- if (_optionalChain([options, 'access', _115 => _115.name, 'optionalAccess', _116 => _116.trim, 'call', _117 => _117()])) smart.name = options.name.trim();
5213
+ if (_optionalChain([options, 'access', _109 => _109.name, 'optionalAccess', _110 => _110.trim, 'call', _111 => _111()])) smart.name = options.name.trim();
5476
5214
  smart = { ...smart, surface: renderSmartObject(smart, canvas) };
5477
5215
  const below = ordered.filter((l) => l.index < top.index).length;
5478
5216
  let out = layers;
5479
- for (const l of ordered) out = _chunkPOGBUYWEcjs.mapLayer.call(void 0, out, l.layer.id, () => null);
5480
- return { layers: _chunkPOGBUYWEcjs.insertLayer.call(void 0, out, smart, parent, top.index - below), layer: smart };
5217
+ for (const l of ordered) out = _chunkST7E3NEEcjs.mapLayer.call(void 0, out, l.layer.id, () => null);
5218
+ return { layers: _chunkST7E3NEEcjs.insertLayer.call(void 0, out, smart, parent, top.index - below), layer: smart };
5481
5219
  }
5482
5220
  function rasterizeSmartObject(layers, id) {
5483
5221
  const layer = requireSmartObject(layers, id);
@@ -5497,29 +5235,29 @@ function rasterizeSmartObject(layers, id) {
5497
5235
  if (layer.locks) out.locks = layer.locks;
5498
5236
  if (layer.effects) out.effects = layer.effects;
5499
5237
  if (layer.fillOpacity !== void 0) out.fillOpacity = layer.fillOpacity;
5500
- return { layers: _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => out), layer: out };
5238
+ return { layers: _chunkST7E3NEEcjs.mapLayer.call(void 0, layers, id, () => out), layer: out };
5501
5239
  }
5502
5240
  function copySmartObject(layers, id, linked, name) {
5503
5241
  const loc = requireLayer(layers, id);
5504
5242
  const layer = requireSmartObject(layers, id);
5505
- const copy = { ...layer, id: newLayerId("smart"), name: _optionalChain([name, 'optionalAccess', _118 => _118.trim, 'call', _119 => _119()]) || `${layer.name || "Smart Object"} copy` };
5243
+ const copy = { ...layer, id: newLayerId("smart"), name: _optionalChain([name, 'optionalAccess', _112 => _112.trim, 'call', _113 => _113()]) || `${layer.name || "Smart Object"} copy` };
5506
5244
  delete copy.locks;
5507
5245
  delete copy.psd;
5508
5246
  if (!linked) copy.contents = { ...layer.contents, id: newContentsId() };
5509
5247
  if (copy.smartFilters) copy.smartFilters = { ...copy.smartFilters, filters: copy.smartFilters.filters.map((f) => ({ ...f, id: newLayerId("flt") })) };
5510
- return { layers: _chunkPOGBUYWEcjs.insertLayer.call(void 0, layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _120 => _120.parent, 'optionalAccess', _121 => _121.id]), () => ( null)), loc.index + 1), layer: copy };
5248
+ return { layers: _chunkST7E3NEEcjs.insertLayer.call(void 0, layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _114 => _114.parent, 'optionalAccess', _115 => _115.id]), () => ( null)), loc.index + 1), layer: copy };
5511
5249
  }
5512
5250
  function instancesOf(layers, contentsId) {
5513
- return _chunkPOGBUYWEcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "smart" && l.contents.id === contentsId).map((l) => l.id);
5251
+ return _chunkST7E3NEEcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "smart" && l.contents.id === contentsId).map((l) => l.id);
5514
5252
  }
5515
5253
  function replaceContents(layers, contentsId, contents, canvas) {
5516
5254
  const ids = instancesOf(layers, contentsId);
5517
5255
  if (!ids.length) fail4(`No smart object uses contents "${contentsId}".`);
5518
- for (const id of ids) requireUnlocked(_chunkPOGBUYWEcjs.findLayer.call(void 0, layers, id).layer, "all", "replace its contents");
5256
+ for (const id of ids) requireUnlocked(_chunkST7E3NEEcjs.findLayer.call(void 0, layers, id).layer, "all", "replace its contents");
5519
5257
  const next = { ...contents, id: contentsId };
5520
5258
  let out = layers;
5521
5259
  for (const id of ids) {
5522
- out = _chunkPOGBUYWEcjs.mapLayer.call(void 0, out, id, (l) => {
5260
+ out = _chunkST7E3NEEcjs.mapLayer.call(void 0, out, id, (l) => {
5523
5261
  const layer = l;
5524
5262
  return rerender({ ...layer, contents: next, placement: refitPlacement(layer, next) }, canvas, "take the new contents");
5525
5263
  });
@@ -5543,14 +5281,14 @@ function refitPlacement(layer, contents) {
5543
5281
  });
5544
5282
  const out = { corners: pts };
5545
5283
  if (layer.placement.interpolation) out.interpolation = layer.placement.interpolation;
5546
- if (layer.placement.warp) out.warp = _chunkW3GXSUSQcjs.mapWarpMeshPoints.call(void 0, layer.placement.warp, (p) => ({ x: p.x * W1 / W0, y: p.y * H1 / H0 }));
5284
+ if (layer.placement.warp) out.warp = _chunkLPLCWZTMcjs.mapWarpMeshPoints.call(void 0, layer.placement.warp, (p) => ({ x: p.x * W1 / W0, y: p.y * H1 / H0 }));
5547
5285
  return out;
5548
5286
  }
5549
5287
  function normalizeSmartFilter(raw, id = newLayerId("flt")) {
5550
5288
  if (raw.kind === "psd") fail4("Photoshop filters can only come from a PSD; add develop or blur.");
5551
5289
  const base = normalizeFilter(raw, id);
5552
5290
  const blend = _nullishCoalesce(raw.blend, () => ( "normal"));
5553
- if (!_chunkXIOMMGPDcjs.isBlendMode.call(void 0, blend) || blend === "pigment") fail4(`Unknown blend mode "${String(blend)}" for a smart filter.`);
5291
+ if (!_chunkTFOPHZ3Ucjs.isBlendMode.call(void 0, blend) || blend === "pigment") fail4(`Unknown blend mode "${String(blend)}" for a smart filter.`);
5554
5292
  const opacity = _nullishCoalesce(raw.opacity, () => ( 1));
5555
5293
  if (!(typeof opacity === "number" && opacity >= 0 && opacity <= 1)) fail4("opacity must be a number from 0 to 1.");
5556
5294
  return { ...base, blend, opacity };
@@ -5565,7 +5303,7 @@ function stackOf(layer) {
5565
5303
  return _nullishCoalesce(layer.smartFilters, () => ( { enabled: true, filters: [] }));
5566
5304
  }
5567
5305
  function requireFilter(layer, filterId) {
5568
- const list2 = _nullishCoalesce(_optionalChain([layer, 'access', _122 => _122.smartFilters, 'optionalAccess', _123 => _123.filters]), () => ( []));
5306
+ const list2 = _nullishCoalesce(_optionalChain([layer, 'access', _116 => _116.smartFilters, 'optionalAccess', _117 => _117.filters]), () => ( []));
5569
5307
  const i = list2.findIndex((f) => f.id === filterId);
5570
5308
  if (i === -1) fail4(`Smart object "${layer.name || layer.id}" has no smart filter "${filterId}". Filters: ${list2.map((f) => `${f.id} (${f.kind})`).join(", ") || "none"}; call get_smart_object.`);
5571
5309
  return i;
@@ -5582,7 +5320,7 @@ function addSmartFilter(layers, id, filter, canvas, index) {
5582
5320
  const at = index === void 0 ? filters.length : Math.max(0, Math.min(filters.length, Math.floor(index)));
5583
5321
  filters.splice(at, 0, filter);
5584
5322
  const next = withStack(layer, { ...stack, filters }, canvas);
5585
- return { layers: _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => next), layer: next, filter };
5323
+ return { layers: _chunkST7E3NEEcjs.mapLayer.call(void 0, layers, id, () => next), layer: next, filter };
5586
5324
  }
5587
5325
  function updateSmartFilter(layers, id, filterId, changes, canvas) {
5588
5326
  const layer = editableSmart(layers, id);
@@ -5594,7 +5332,7 @@ function updateSmartFilter(layers, id, filterId, changes, canvas) {
5594
5332
  const extra = Object.keys(changes).filter((k) => !["enabled", "blend", "opacity", "kind"].includes(k));
5595
5333
  if (extra.length) fail4(`"${current.name}" is a Photoshop filter we keep but do not model; only enabled, blend and opacity change. Unknown: ${extra.join(", ")}.`);
5596
5334
  const blend = _nullishCoalesce(changes.blend, () => ( current.blend));
5597
- if (!_chunkXIOMMGPDcjs.isBlendMode.call(void 0, blend) || blend === "pigment") fail4(`Unknown blend mode "${String(blend)}" for a smart filter.`);
5335
+ if (!_chunkTFOPHZ3Ucjs.isBlendMode.call(void 0, blend) || blend === "pigment") fail4(`Unknown blend mode "${String(blend)}" for a smart filter.`);
5598
5336
  const opacity = _nullishCoalesce(changes.opacity, () => ( current.opacity));
5599
5337
  if (!(typeof opacity === "number" && opacity >= 0 && opacity <= 1)) fail4("opacity must be a number from 0 to 1.");
5600
5338
  merged2 = { ...current, enabled: changes.enabled === void 0 ? current.enabled : Boolean(changes.enabled), blend, opacity };
@@ -5604,7 +5342,7 @@ function updateSmartFilter(layers, id, filterId, changes, canvas) {
5604
5342
  const filters = [...layer.smartFilters.filters];
5605
5343
  filters[i] = merged2;
5606
5344
  const next = withStack(layer, { ...layer.smartFilters, filters }, canvas);
5607
- return { layers: _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => next), layer: next, filter: merged2 };
5345
+ return { layers: _chunkST7E3NEEcjs.mapLayer.call(void 0, layers, id, () => next), layer: next, filter: merged2 };
5608
5346
  }
5609
5347
  function removeSmartFilter(layers, id, filterId, canvas) {
5610
5348
  const layer = editableSmart(layers, id);
@@ -5612,7 +5350,7 @@ function removeSmartFilter(layers, id, filterId, canvas) {
5612
5350
  const stack = layer.smartFilters;
5613
5351
  const filters = stack.filters.filter((f) => f.id !== filterId);
5614
5352
  const next = withStack(layer, filters.length ? { ...stack, filters } : stack.enabled ? void 0 : { enabled: false, filters }, canvas);
5615
- return { layers: _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
5353
+ return { layers: _chunkST7E3NEEcjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
5616
5354
  }
5617
5355
  function moveSmartFilter(layers, id, filterId, index, canvas) {
5618
5356
  const layer = editableSmart(layers, id);
@@ -5623,21 +5361,21 @@ function moveSmartFilter(layers, id, filterId, index, canvas) {
5623
5361
  const [f] = filters.splice(i, 1);
5624
5362
  filters.splice(index, 0, f);
5625
5363
  const next = withStack(layer, { ...layer.smartFilters, filters }, canvas);
5626
- return { layers: _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
5364
+ return { layers: _chunkST7E3NEEcjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
5627
5365
  }
5628
5366
  function setSmartFiltersEnabled(layers, id, enabled, canvas) {
5629
5367
  const layer = editableSmart(layers, id);
5630
5368
  const next = withStack(layer, { ...stackOf(layer), enabled: Boolean(enabled) }, canvas);
5631
- return { layers: _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
5369
+ return { layers: _chunkST7E3NEEcjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
5632
5370
  }
5633
5371
  function setSmartFilterMask(layers, id, mask, canvas) {
5634
5372
  const layer = editableSmart(layers, id);
5635
- if (_optionalChain([mask, 'optionalAccess', _124 => _124.source])) fail4("A smart filter mask is painted, not generated; use a raster mask.");
5373
+ if (_optionalChain([mask, 'optionalAccess', _118 => _118.source])) fail4("A smart filter mask is painted, not generated; use a raster mask.");
5636
5374
  const stack = { ...stackOf(layer) };
5637
5375
  if (mask) stack.mask = mask;
5638
5376
  else delete stack.mask;
5639
5377
  const next = withStack(layer, stack, canvas);
5640
- return { layers: _chunkPOGBUYWEcjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
5378
+ return { layers: _chunkST7E3NEEcjs.mapLayer.call(void 0, layers, id, () => next), layer: next };
5641
5379
  }
5642
5380
  function withFilterMaskSurface(layer, surface, canvas) {
5643
5381
  const stack = stackOf(layer);
@@ -5651,7 +5389,7 @@ function placementBounds(layer) {
5651
5389
  // src/image-editor/layers/serialize.ts
5652
5390
  var LAYERED_SCHEMA_VERSION = 3;
5653
5391
  function serializePatterns(patterns) {
5654
- return patterns.map((p) => ({ id: p.id, name: p.name, png: _chunkPOGBUYWEcjs.pngDataUrl.call(void 0, p.width, p.height, p.data) }));
5392
+ return patterns.map((p) => ({ id: p.id, name: p.name, png: _chunkST7E3NEEcjs.pngDataUrl.call(void 0, p.width, p.height, p.data) }));
5655
5393
  }
5656
5394
  function deserializePatterns(raw, problems = []) {
5657
5395
  if (!Array.isArray(raw)) return [];
@@ -5670,15 +5408,51 @@ function deserializePatterns(raw, problems = []) {
5670
5408
  var encodedCache = /* @__PURE__ */ new WeakMap();
5671
5409
  function encodeSurface(surface) {
5672
5410
  if (encodedCache.has(surface)) return encodedCache.get(surface);
5673
- const b = _chunkXIOMMGPDcjs.contentBounds.call(void 0, surface);
5411
+ const b = _chunkTFOPHZ3Ucjs.contentBounds.call(void 0, surface);
5674
5412
  let out = null;
5675
5413
  if (b) {
5676
- const data = _chunkXIOMMGPDcjs.readRegion.call(void 0, surface, b);
5677
- out = { url: _chunkPOGBUYWEcjs.pngDataUrl.call(void 0, b.width, b.height, data, surface.channels), x: b.x, y: b.y };
5414
+ const data = _chunkTFOPHZ3Ucjs.readRegion.call(void 0, surface, b);
5415
+ out = { url: _chunkST7E3NEEcjs.pngDataUrl.call(void 0, b.width, b.height, data, surface.channels), x: b.x, y: b.y };
5678
5416
  }
5679
5417
  encodedCache.set(surface, out);
5680
5418
  return out;
5681
5419
  }
5420
+ var deepCache = /* @__PURE__ */ new WeakMap();
5421
+ function encodeDeepSurface(surface) {
5422
+ if (deepCache.has(surface)) return deepCache.get(surface);
5423
+ let out = null;
5424
+ const depth = _chunkST7E3NEEcjs.surfaceDepth.call(void 0, surface);
5425
+ const b = depth === 8 ? null : _chunkTFOPHZ3Ucjs.contentBounds.call(void 0, surface);
5426
+ if (depth !== 8 && b) {
5427
+ const samples = _chunkST7E3NEEcjs.readDeepRegion.call(void 0, surface, b, depth);
5428
+ const bytes = new Uint8Array(samples.byteLength);
5429
+ const view = new DataView(bytes.buffer);
5430
+ if (samples instanceof Uint16Array) for (let i = 0; i < samples.length; i++) view.setUint16(2 * i, samples[i], true);
5431
+ else for (let i = 0; i < samples.length; i++) view.setFloat32(4 * i, samples[i], true);
5432
+ out = { depth, x: b.x, y: b.y, width: b.width, height: b.height, data: _chunkST7E3NEEcjs.bytesToBase64.call(void 0, _chunk643B2HKCcjs.deflate.call(void 0, bytes)) };
5433
+ }
5434
+ deepCache.set(surface, out);
5435
+ return out;
5436
+ }
5437
+ function decodeDeepSurface(surface, raw, problems, label) {
5438
+ const d = raw;
5439
+ if (!d || typeof d !== "object") return surface;
5440
+ try {
5441
+ if (d.depth !== 16 && d.depth !== 32 || !(d.width > 0 && d.height > 0) || !Number.isInteger(d.x) || !Number.isInteger(d.y) || typeof d.data !== "string") throw new Error("malformed");
5442
+ const n = d.width * d.height * 4;
5443
+ const size = d.depth === 16 ? 2 : 4;
5444
+ const bytes = _chunk643B2HKCcjs.inflate.call(void 0, _chunkST7E3NEEcjs.base64ToBytes.call(void 0, d.data), { maxOutput: n * size });
5445
+ if (bytes.length !== n * size) throw new Error("wrong length");
5446
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
5447
+ const samples = d.depth === 16 ? new Uint16Array(n) : new Float32Array(n);
5448
+ if (samples instanceof Uint16Array) for (let i = 0; i < n; i++) samples[i] = view.getUint16(2 * i, true);
5449
+ else for (let i = 0; i < n; i++) samples[i] = view.getFloat32(4 * i, true);
5450
+ return _chunkST7E3NEEcjs.writeDeepRegion.call(void 0, surface, { x: d.x, y: d.y, width: d.width, height: d.height }, samples);
5451
+ } catch (e6) {
5452
+ problems.push(`${label}: its ${d.depth}-bit samples could not be read, so it was opened at 8 bits`);
5453
+ return surface;
5454
+ }
5455
+ }
5682
5456
  function baseFields(layer, ctx) {
5683
5457
  const out = {
5684
5458
  id: layer.id,
@@ -5696,7 +5470,7 @@ function baseFields(layer, ctx) {
5696
5470
  function serializeEffects(effects) {
5697
5471
  const out = { enabled: effects.enabled, items: JSON.parse(JSON.stringify(effects.items)) };
5698
5472
  if (effects.scale !== void 0 && effects.scale !== 1) out.scale = effects.scale;
5699
- if (effects.psd) out.psd = { key: effects.psd.key, data: _chunkPOGBUYWEcjs.bytesToBase64.call(void 0, effects.psd.data) };
5473
+ if (effects.psd) out.psd = { key: effects.psd.key, data: _chunkST7E3NEEcjs.bytesToBase64.call(void 0, effects.psd.data) };
5700
5474
  return out;
5701
5475
  }
5702
5476
  function deserializeEffects(raw) {
@@ -5706,12 +5480,12 @@ function deserializeEffects(raw) {
5706
5480
  const p = r.psd;
5707
5481
  if (p && typeof p.key === "string" && typeof p.data === "string") {
5708
5482
  try {
5709
- psd = { key: p.key, data: _chunkPOGBUYWEcjs.base64ToBytes.call(void 0, p.data) };
5710
- } catch (e6) {
5483
+ psd = { key: p.key, data: _chunkST7E3NEEcjs.base64ToBytes.call(void 0, p.data) };
5484
+ } catch (e7) {
5711
5485
  psd = void 0;
5712
5486
  }
5713
5487
  }
5714
- return _chunkPOGBUYWEcjs.normalizeLayerEffects.call(void 0, { ...r, psd });
5488
+ return _chunkST7E3NEEcjs.normalizeLayerEffects.call(void 0, { ...r, psd });
5715
5489
  }
5716
5490
  function serializeMask(mask, hint, ctx) {
5717
5491
  const out = { defaultValue: mask.defaultValue };
@@ -5746,7 +5520,11 @@ function serializeLayer(layer, ctx) {
5746
5520
  }
5747
5521
  }
5748
5522
  if (layer.fillOpacity !== void 0 && layer.fillOpacity !== 1) out.fillOpacity = layer.fillOpacity;
5749
- if (_optionalChain([layer, 'access', _125 => _125.filters, 'optionalAccess', _126 => _126.length])) out.filters = JSON.parse(JSON.stringify(layer.filters));
5523
+ if (_optionalChain([layer, 'access', _119 => _119.filters, 'optionalAccess', _120 => _120.length])) out.filters = JSON.parse(JSON.stringify(layer.filters));
5524
+ if (layer.source !== "document") {
5525
+ const deep = encodeDeepSurface(layer.surface);
5526
+ if (deep) out.deep = deep;
5527
+ }
5750
5528
  return out;
5751
5529
  }
5752
5530
  case "adjustment":
@@ -5784,12 +5562,12 @@ function serializeType(layer, base, ctx) {
5784
5562
  out.x = enc.x;
5785
5563
  out.y = enc.y;
5786
5564
  }
5787
- if (_optionalChain([layer, 'access', _127 => _127.missingFonts, 'optionalAccess', _128 => _128.length])) out.missingFonts = [...layer.missingFonts];
5565
+ if (_optionalChain([layer, 'access', _121 => _121.missingFonts, 'optionalAccess', _122 => _122.length])) out.missingFonts = [...layer.missingFonts];
5788
5566
  if (layer.annotation) out.annotation = JSON.parse(JSON.stringify(layer.annotation));
5789
- if (_optionalChain([layer, 'access', _129 => _129.psd, 'optionalAccess', _130 => _130.tySh]) || _optionalChain([layer, 'access', _131 => _131.psd, 'optionalAccess', _132 => _132.blocks, 'optionalAccess', _133 => _133.length])) {
5567
+ if (_optionalChain([layer, 'access', _123 => _123.psd, 'optionalAccess', _124 => _124.tySh]) || _optionalChain([layer, 'access', _125 => _125.psd, 'optionalAccess', _126 => _126.blocks, 'optionalAccess', _127 => _127.length])) {
5790
5568
  out.psd = {};
5791
- if (layer.psd.tySh) out.psd.tySh = _chunkPOGBUYWEcjs.bytesToBase64.call(void 0, layer.psd.tySh);
5792
- if (_optionalChain([layer, 'access', _134 => _134.psd, 'access', _135 => _135.blocks, 'optionalAccess', _136 => _136.length])) out.psd.blocks = layer.psd.blocks.map((b) => ({ key: b.key, data: _chunkPOGBUYWEcjs.bytesToBase64.call(void 0, b.data) }));
5569
+ if (layer.psd.tySh) out.psd.tySh = _chunkST7E3NEEcjs.bytesToBase64.call(void 0, layer.psd.tySh);
5570
+ if (_optionalChain([layer, 'access', _128 => _128.psd, 'access', _129 => _129.blocks, 'optionalAccess', _130 => _130.length])) out.psd.blocks = layer.psd.blocks.map((b) => ({ key: b.key, data: _chunkST7E3NEEcjs.bytesToBase64.call(void 0, b.data) }));
5793
5571
  if (layer.psd.signature) out.psd.signature = layer.psd.signature;
5794
5572
  }
5795
5573
  return out;
@@ -5799,27 +5577,27 @@ function readType(r, base, ctx) {
5799
5577
  try {
5800
5578
  const text3 = normalizeText(_nullishCoalesce(r.text, () => ( "")));
5801
5579
  const runs = (Array.isArray(r.runs) ? r.runs : []).map((run, i) => ({
5802
- length: Math.max(0, Math.floor(num2(_optionalChain([run, 'optionalAccess', _137 => _137.length]), 0, 1e9, 0))),
5803
- style: patchTextStyle(DEFAULT_TEXT_STYLE, _optionalChain([run, 'optionalAccess', _138 => _138.style]) && typeof run.style === "object" ? run.style : {}, `runs[${i}].style`)
5580
+ length: Math.max(0, Math.floor(num2(_optionalChain([run, 'optionalAccess', _131 => _131.length]), 0, 1e9, 0))),
5581
+ style: patchTextStyle(_chunkLPLCWZTMcjs.DEFAULT_TEXT_STYLE, _optionalChain([run, 'optionalAccess', _132 => _132.style]) && typeof run.style === "object" ? run.style : {}, `runs[${i}].style`)
5804
5582
  }));
5805
5583
  const paragraphs = (Array.isArray(r.paragraphs) ? r.paragraphs : []).map((p, i) => ({
5806
- length: Math.max(0, Math.floor(num2(_optionalChain([p, 'optionalAccess', _139 => _139.length]), 0, 1e9, 0))),
5807
- style: patchParagraphStyle({}, _optionalChain([p, 'optionalAccess', _140 => _140.style]) && typeof p.style === "object" ? p.style : {}, `paragraphs[${i}].style`)
5584
+ length: Math.max(0, Math.floor(num2(_optionalChain([p, 'optionalAccess', _133 => _133.length]), 0, 1e9, 0))),
5585
+ style: patchParagraphStyle({}, _optionalChain([p, 'optionalAccess', _134 => _134.style]) && typeof p.style === "object" ? p.style : {}, `paragraphs[${i}].style`)
5808
5586
  }));
5809
5587
  const f = r.frame;
5810
- const frame = _optionalChain([f, 'optionalAccess', _141 => _141.kind]) === "box" ? { kind: "box", width: num2(f.width, 1, 1e6, 100), height: num2(f.height, 1, 1e6, 100) } : _optionalChain([f, 'optionalAccess', _142 => _142.origin]) === "top" ? { kind: "point", origin: "top" } : { kind: "point" };
5588
+ const frame = _optionalChain([f, 'optionalAccess', _135 => _135.kind]) === "box" ? { kind: "box", width: num2(f.width, 1, 1e6, 100), height: num2(f.height, 1, 1e6, 100) } : _optionalChain([f, 'optionalAccess', _136 => _136.origin]) === "top" ? { kind: "point", origin: "top" } : { kind: "point" };
5811
5589
  const m = Array.isArray(r.transform) && r.transform.length === 6 && r.transform.every((v) => typeof v === "number" && Number.isFinite(v)) ? r.transform : void 0;
5812
5590
  const layer = {
5813
5591
  ...base,
5814
5592
  type: "type",
5815
5593
  text: text3,
5816
- runs: fitRuns(runs, text3.length, DEFAULT_TEXT_STYLE),
5817
- paragraphs: fitParagraphRuns(paragraphs.length ? paragraphs : [{ length: text3.length, style: {} }], text3),
5594
+ runs: _chunkLPLCWZTMcjs.fitRuns.call(void 0, runs, text3.length, _chunkLPLCWZTMcjs.DEFAULT_TEXT_STYLE),
5595
+ paragraphs: _chunkLPLCWZTMcjs.fitParagraphRuns.call(void 0, paragraphs.length ? paragraphs : [{ length: text3.length, style: {} }], text3),
5818
5596
  frame,
5819
- surface: _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4),
5597
+ surface: _chunkTFOPHZ3Ucjs.emptySurface.call(void 0, 4),
5820
5598
  offset: { x: 0, y: 0 }
5821
5599
  };
5822
- if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([runs, 'access', _143 => _143[0], 'optionalAccess', _144 => _144.style]), () => ( DEFAULT_TEXT_STYLE)) }];
5600
+ if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([runs, 'access', _137 => _137[0], 'optionalAccess', _138 => _138.style]), () => ( _chunkLPLCWZTMcjs.DEFAULT_TEXT_STYLE)) }];
5823
5601
  if (m) layer.transform = m;
5824
5602
  if (r.antiAlias === false) layer.antiAlias = false;
5825
5603
  if (typeof r.fillOpacity === "number" && r.fillOpacity !== 1) layer.fillOpacity = num2(r.fillOpacity, 0, 1, 1);
@@ -5827,16 +5605,16 @@ function readType(r, base, ctx) {
5827
5605
  if (r.annotation && typeof r.annotation === "object" && r.annotation.type === "text") layer.annotation = JSON.parse(JSON.stringify({ ...r.annotation, id: _nullishCoalesce(r.annotation.id, () => ( base.id)) }));
5828
5606
  if (r.psd && typeof r.psd === "object") {
5829
5607
  const psd = {};
5830
- if (typeof r.psd.tySh === "string") psd.tySh = _chunkPOGBUYWEcjs.base64ToBytes.call(void 0, r.psd.tySh);
5831
- if (Array.isArray(r.psd.blocks)) psd.blocks = r.psd.blocks.filter((b) => b && typeof b.key === "string" && typeof b.data === "string").map((b) => ({ key: b.key, data: _chunkPOGBUYWEcjs.base64ToBytes.call(void 0, b.data) }));
5608
+ if (typeof r.psd.tySh === "string") psd.tySh = _chunkST7E3NEEcjs.base64ToBytes.call(void 0, r.psd.tySh);
5609
+ if (Array.isArray(r.psd.blocks)) psd.blocks = r.psd.blocks.filter((b) => b && typeof b.key === "string" && typeof b.data === "string").map((b) => ({ key: b.key, data: _chunkST7E3NEEcjs.base64ToBytes.call(void 0, b.data) }));
5832
5610
  if (typeof r.psd.signature === "string") psd.signature = r.psd.signature;
5833
- if (psd.tySh || _optionalChain([psd, 'access', _145 => _145.blocks, 'optionalAccess', _146 => _146.length])) layer.psd = psd;
5611
+ if (psd.tySh || _optionalChain([psd, 'access', _139 => _139.blocks, 'optionalAccess', _140 => _140.length])) layer.psd = psd;
5834
5612
  }
5835
5613
  if (typeof r.asset === "string") return { ...layer, surface: readSurface(r.asset, r.x, r.y, 4, 0, ctx, label), rendering: "stored" };
5836
- const env = { ..._nullishCoalesce(ctx.canvas, () => ( { width: 1, height: 1 })), shaper: _nullishCoalesce(_optionalChain([ctx, 'access', _147 => _147.text, 'optionalAccess', _148 => _148.shaper]), () => ( null)), createCanvas: _optionalChain([ctx, 'access', _149 => _149.text, 'optionalAccess', _150 => _150.createCanvas]) };
5614
+ const env = { ..._nullishCoalesce(ctx.canvas, () => ( { width: 1, height: 1 })), shaper: _nullishCoalesce(_optionalChain([ctx, 'access', _141 => _141.text, 'optionalAccess', _142 => _142.shaper]), () => ( null)), createCanvas: _optionalChain([ctx, 'access', _143 => _143.text, 'optionalAccess', _144 => _144.createCanvas]) };
5837
5615
  try {
5838
5616
  return rerenderText(layer, env);
5839
- } catch (e7) {
5617
+ } catch (e8) {
5840
5618
  return { ...layer, rendering: "stored" };
5841
5619
  }
5842
5620
  } catch (e) {
@@ -5856,7 +5634,7 @@ function serializeShape(layer, base) {
5856
5634
  if (layer.inverted) out.inverted = true;
5857
5635
  if (layer.fillOpacity !== void 0 && layer.fillOpacity !== 1) out.fillOpacity = layer.fillOpacity;
5858
5636
  if (layer.annotation) out.annotation = JSON.parse(JSON.stringify(layer.annotation));
5859
- if (_optionalChain([layer, 'access', _151 => _151.psd, 'optionalAccess', _152 => _152.blocks, 'optionalAccess', _153 => _153.length])) out.psd = { blocks: layer.psd.blocks.map((b) => ({ key: b.key, data: _chunkPOGBUYWEcjs.bytesToBase64.call(void 0, b.data) })), ...layer.psd.signature ? { signature: layer.psd.signature } : {} };
5637
+ if (_optionalChain([layer, 'access', _145 => _145.psd, 'optionalAccess', _146 => _146.blocks, 'optionalAccess', _147 => _147.length])) out.psd = { blocks: layer.psd.blocks.map((b) => ({ key: b.key, data: _chunkST7E3NEEcjs.bytesToBase64.call(void 0, b.data) })), ...layer.psd.signature ? { signature: layer.psd.signature } : {} };
5860
5638
  return out;
5861
5639
  }
5862
5640
  function readShape(r, base, ctx) {
@@ -5870,12 +5648,12 @@ function readShape(r, base, ctx) {
5870
5648
  if (!data) {
5871
5649
  if (!Array.isArray(r.components) || !r.components.length) throw new Error("it has no components");
5872
5650
  const components = r.components.map((c, i) => {
5873
- const op = requireOperation(_optionalChain([c, 'optionalAccess', _154 => _154.op]), `components[${i}].op`);
5874
- if (_optionalChain([c, 'optionalAccess', _155 => _155.live])) {
5651
+ const op = requireOperation(_optionalChain([c, 'optionalAccess', _148 => _148.op]), `components[${i}].op`);
5652
+ if (_optionalChain([c, 'optionalAccess', _149 => _149.live])) {
5875
5653
  const live = normalizeLiveShape(c.live, `components[${i}].live`);
5876
5654
  return { op, subpaths: liveShapeSubpaths(live), live };
5877
5655
  }
5878
- return { op, subpaths: Array.isArray(_optionalChain([c, 'optionalAccess', _156 => _156.subpaths])) && !c.subpaths.length ? [] : normalizeSubpaths(_optionalChain([c, 'optionalAccess', _157 => _157.subpaths]), `components[${i}].subpaths`) };
5656
+ return { op, subpaths: Array.isArray(_optionalChain([c, 'optionalAccess', _150 => _150.subpaths])) && !c.subpaths.length ? [] : normalizeSubpaths(_optionalChain([c, 'optionalAccess', _151 => _151.subpaths]), `components[${i}].subpaths`) };
5879
5657
  });
5880
5658
  data = {
5881
5659
  components,
@@ -5888,7 +5666,7 @@ function readShape(r, base, ctx) {
5888
5666
  if (typeof r.fillOpacity === "number" && r.fillOpacity !== 1) out.fillOpacity = num2(r.fillOpacity, 0, 1, 1);
5889
5667
  if (a && shapeFromAnnotation(a)) out.annotation = a;
5890
5668
  if (r.psd && Array.isArray(r.psd.blocks)) {
5891
- const blocks = r.psd.blocks.filter((b) => b && typeof b.key === "string" && typeof b.data === "string").map((b) => ({ key: b.key, data: _chunkPOGBUYWEcjs.base64ToBytes.call(void 0, b.data) }));
5669
+ const blocks = r.psd.blocks.filter((b) => b && typeof b.key === "string" && typeof b.data === "string").map((b) => ({ key: b.key, data: _chunkST7E3NEEcjs.base64ToBytes.call(void 0, b.data) }));
5892
5670
  if (blocks.length) out.psd = { blocks };
5893
5671
  if (out.psd && typeof r.psd.signature === "string") out.psd.signature = r.psd.signature;
5894
5672
  }
@@ -5901,7 +5679,7 @@ function readShape(r, base, ctx) {
5901
5679
  function serializeSmartFilters(stack, layerId, ctx) {
5902
5680
  const out = {
5903
5681
  enabled: stack.enabled,
5904
- filters: stack.filters.map((f) => f.kind === "psd" ? { ...f, data: _chunkPOGBUYWEcjs.bytesToBase64.call(void 0, f.data) } : JSON.parse(JSON.stringify(f)))
5682
+ filters: stack.filters.map((f) => f.kind === "psd" ? { ...f, data: _chunkST7E3NEEcjs.bytesToBase64.call(void 0, f.data) } : JSON.parse(JSON.stringify(f)))
5905
5683
  };
5906
5684
  if (stack.mask) out.mask = serializeMask(stack.mask, `${layerId}-filter-mask`, ctx);
5907
5685
  return out;
@@ -5927,7 +5705,7 @@ function serializeSmartObject(layer, base, ctx) {
5927
5705
  }
5928
5706
  if (layer.fillOpacity !== void 0 && layer.fillOpacity !== 1) out.fillOpacity = layer.fillOpacity;
5929
5707
  if (layer.psd) {
5930
- out.psd = { key: layer.psd.key, data: _chunkPOGBUYWEcjs.bytesToBase64.call(void 0, layer.psd.data) };
5708
+ out.psd = { key: layer.psd.key, data: _chunkST7E3NEEcjs.bytesToBase64.call(void 0, layer.psd.data) };
5931
5709
  if (layer.psd.placed) out.psd.placed = layer.psd.placed;
5932
5710
  }
5933
5711
  return out;
@@ -5938,17 +5716,17 @@ function serializeContents(c, ctx) {
5938
5716
  const enc = encodeSurface(c.raster);
5939
5717
  if (enc) {
5940
5718
  if (enc.x !== 0 || enc.y !== 0) {
5941
- const data = _chunkXIOMMGPDcjs.readRegion.call(void 0, c.raster, { x: 0, y: 0, width: c.width, height: c.height });
5942
- out.asset = ctx.addAsset(_chunkPOGBUYWEcjs.pngDataUrl.call(void 0, c.width, c.height, data, 4), `contents-${c.id}`);
5719
+ const data = _chunkTFOPHZ3Ucjs.readRegion.call(void 0, c.raster, { x: 0, y: 0, width: c.width, height: c.height });
5720
+ out.asset = ctx.addAsset(_chunkST7E3NEEcjs.pngDataUrl.call(void 0, c.width, c.height, data, 4), `contents-${c.id}`);
5943
5721
  } else out.asset = ctx.addAsset(enc.url, `contents-${c.id}`);
5944
5722
  }
5945
5723
  }
5946
5724
  if (c.kind === "document" && c.document) {
5947
5725
  out.layers = c.document.layers.map((l) => serializeLayer(l, ctx));
5948
5726
  if (c.document.globalLight) out.globalLight = { ...c.document.globalLight };
5949
- if (_optionalChain([c, 'access', _158 => _158.document, 'access', _159 => _159.patterns, 'optionalAccess', _160 => _160.length])) out.patterns = serializePatterns(c.document.patterns);
5727
+ if (_optionalChain([c, 'access', _152 => _152.document, 'access', _153 => _153.patterns, 'optionalAccess', _154 => _154.length])) out.patterns = serializePatterns(c.document.patterns);
5950
5728
  }
5951
- if (c.file) out.file = { type: c.file.type, data: _chunkPOGBUYWEcjs.bytesToBase64.call(void 0, c.file.bytes) };
5729
+ if (c.file) out.file = { type: c.file.type, data: _chunkST7E3NEEcjs.bytesToBase64.call(void 0, c.file.bytes) };
5952
5730
  if (c.linked) out.linked = { path: c.linked.path };
5953
5731
  return out;
5954
5732
  }
@@ -5984,7 +5762,7 @@ async function serializeLayersExternal(layers, store) {
5984
5762
  for (const [id, url] of Object.entries(inline.assets)) {
5985
5763
  let ref = refs.get(url);
5986
5764
  if (!ref) {
5987
- const parsed = _chunkPOGBUYWEcjs.parseDataUrl.call(void 0, url);
5765
+ const parsed = _chunkST7E3NEEcjs.parseDataUrl.call(void 0, url);
5988
5766
  const png = decodePngHeader(parsed.bytes);
5989
5767
  ref = await store.put(new Blob([parsed.bytes], { type: "image/png" }), { id, width: png.width, height: png.height });
5990
5768
  if (typeof ref !== "string" || !ref) throw new Error(`The asset store returned no reference for "${id}".`);
@@ -6012,7 +5790,7 @@ async function resolveExternalAssets(assets, store, problems) {
6012
5790
  try {
6013
5791
  const blob = await store.get(ref);
6014
5792
  const bytes = new Uint8Array(await blob.arrayBuffer());
6015
- out[id] = `data:image/png;base64,${_chunkPOGBUYWEcjs.bytesToBase64.call(void 0, bytes)}`;
5793
+ out[id] = `data:image/png;base64,${_chunkST7E3NEEcjs.bytesToBase64.call(void 0, bytes)}`;
6016
5794
  } catch (err) {
6017
5795
  problems.push(`Asset "${id}" (${ref}) could not be fetched: ${err.message}`);
6018
5796
  }
@@ -6020,9 +5798,9 @@ async function resolveExternalAssets(assets, store, problems) {
6020
5798
  return out;
6021
5799
  }
6022
5800
  function decodePngDataUrl(url, channels) {
6023
- const parsed = _chunkPOGBUYWEcjs.parseDataUrl.call(void 0, url);
5801
+ const parsed = _chunkST7E3NEEcjs.parseDataUrl.call(void 0, url);
6024
5802
  if (!parsed) throw new Error("Asset is not a data URL.");
6025
- const png = _chunkPOGBUYWEcjs.decodePng.call(void 0, parsed.bytes, { keepGray: channels === 1 });
5803
+ const png = _chunkST7E3NEEcjs.decodePng.call(void 0, parsed.bytes, { keepGray: channels === 1 });
6026
5804
  if (png.channels === channels) return png;
6027
5805
  if (channels === 1) {
6028
5806
  const out2 = new Uint8ClampedArray(png.width * png.height);
@@ -6040,18 +5818,18 @@ function decodePngDataUrl(url, channels) {
6040
5818
  }
6041
5819
  var num2 = (v, lo, hi, fallback) => typeof v === "number" && Number.isFinite(v) ? Math.min(hi, Math.max(lo, v)) : fallback;
6042
5820
  function readSurface(ref, x, y, channels, defaultValue, ctx, what) {
6043
- if (typeof ref !== "string" || !ref) return _chunkXIOMMGPDcjs.emptySurface.call(void 0, channels, defaultValue);
5821
+ if (typeof ref !== "string" || !ref) return _chunkTFOPHZ3Ucjs.emptySurface.call(void 0, channels, defaultValue);
6044
5822
  const url = ctx.assets[ref];
6045
5823
  if (typeof url !== "string") {
6046
5824
  ctx.problems.push(`${what}: asset "${ref}" is missing`);
6047
- return _chunkXIOMMGPDcjs.emptySurface.call(void 0, channels, defaultValue);
5825
+ return _chunkTFOPHZ3Ucjs.emptySurface.call(void 0, channels, defaultValue);
6048
5826
  }
6049
5827
  try {
6050
5828
  const px2 = (_nullishCoalesce(ctx.decodeAsset, () => ( decodePngDataUrl)))(url, channels);
6051
- return _chunkXIOMMGPDcjs.surfaceFromPixels.call(void 0, px2, channels, Math.round(num2(x, -1e7, 1e7, 0)), Math.round(num2(y, -1e7, 1e7, 0)), defaultValue);
5829
+ return _chunkTFOPHZ3Ucjs.surfaceFromPixels.call(void 0, px2, channels, Math.round(num2(x, -1e7, 1e7, 0)), Math.round(num2(y, -1e7, 1e7, 0)), defaultValue);
6052
5830
  } catch (err) {
6053
5831
  ctx.problems.push(`${what}: asset "${ref}" could not be decoded (${err.message})`);
6054
- return _chunkXIOMMGPDcjs.emptySurface.call(void 0, channels, defaultValue);
5832
+ return _chunkTFOPHZ3Ucjs.emptySurface.call(void 0, channels, defaultValue);
6055
5833
  }
6056
5834
  }
6057
5835
  function readMask(raw, ctx, what) {
@@ -6059,7 +5837,7 @@ function readMask(raw, ctx, what) {
6059
5837
  const r = raw;
6060
5838
  const defaultValue = r.defaultValue === 255 ? 255 : 0;
6061
5839
  const mask = {
6062
- surface: r.source ? _chunkXIOMMGPDcjs.emptySurface.call(void 0, 1, 255) : readSurface(r.asset, r.x, r.y, 1, defaultValue, ctx, `${what} mask`),
5840
+ surface: r.source ? _chunkTFOPHZ3Ucjs.emptySurface.call(void 0, 1, 255) : readSurface(r.asset, r.x, r.y, 1, defaultValue, ctx, `${what} mask`),
6063
5841
  defaultValue: r.source ? 255 : defaultValue
6064
5842
  };
6065
5843
  if (typeof r.density === "number" && r.density !== 1) mask.density = num2(r.density, 0, 1, 1);
@@ -6107,7 +5885,7 @@ function deserializeLayer(raw, ctx) {
6107
5885
  name: typeof r.name === "string" ? r.name : "",
6108
5886
  visible: r.visible !== false,
6109
5887
  opacity: num2(r.opacity, 0, 1, 1),
6110
- blend: _chunkXIOMMGPDcjs.normalizeBlendMode.call(void 0, r.blend)
5888
+ blend: _chunkTFOPHZ3Ucjs.normalizeBlendMode.call(void 0, r.blend)
6111
5889
  };
6112
5890
  if (r.clipped === true) base.clipped = true;
6113
5891
  const mask = readMask(r.mask, ctx, `Layer "${base.name || id}"`);
@@ -6124,10 +5902,11 @@ function deserializeLayer(raw, ctx) {
6124
5902
  const layer = {
6125
5903
  ...base,
6126
5904
  type: "pixel",
6127
- surface: r.source === "document" ? _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4) : readSurface(r.asset, r.x, r.y, 4, 0, ctx, `Layer "${base.name || id}"`),
6128
- offset: { x: Math.round(num2(_optionalChain([r, 'access', _161 => _161.offset, 'optionalAccess', _162 => _162.x]), -1e7, 1e7, 0)), y: Math.round(num2(_optionalChain([r, 'access', _163 => _163.offset, 'optionalAccess', _164 => _164.y]), -1e7, 1e7, 0)) }
5905
+ surface: r.source === "document" ? _chunkTFOPHZ3Ucjs.emptySurface.call(void 0, 4) : readSurface(r.asset, r.x, r.y, 4, 0, ctx, `Layer "${base.name || id}"`),
5906
+ offset: { x: Math.round(num2(_optionalChain([r, 'access', _155 => _155.offset, 'optionalAccess', _156 => _156.x]), -1e7, 1e7, 0)), y: Math.round(num2(_optionalChain([r, 'access', _157 => _157.offset, 'optionalAccess', _158 => _158.y]), -1e7, 1e7, 0)) }
6129
5907
  };
6130
5908
  if (r.source === "document") layer.source = "document";
5909
+ else if (r.deep) layer.surface = decodeDeepSurface(layer.surface, r.deep, ctx.problems, `Layer "${base.name || id}"`);
6131
5910
  if (typeof r.fillOpacity === "number" && r.fillOpacity !== 1) layer.fillOpacity = num2(r.fillOpacity, 0, 1, 1);
6132
5911
  const filters = readFilters(r.filters);
6133
5912
  if (filters) layer.filters = filters;
@@ -6143,7 +5922,7 @@ function deserializeLayer(raw, ctx) {
6143
5922
  }
6144
5923
  case "group": {
6145
5924
  const children = Array.isArray(r.children) ? r.children.map((c) => deserializeLayer(c, ctx)).filter(Boolean) : [];
6146
- const blend = r.blend === "pass-through" ? "pass-through" : _chunkXIOMMGPDcjs.isBlendMode.call(void 0, r.blend) ? r.blend : "pass-through";
5925
+ const blend = r.blend === "pass-through" ? "pass-through" : _chunkTFOPHZ3Ucjs.isBlendMode.call(void 0, r.blend) ? r.blend : "pass-through";
6147
5926
  const group = { ...base, type: "group", blend, children };
6148
5927
  if (r.collapsed === true) group.collapsed = true;
6149
5928
  return group;
@@ -6155,7 +5934,7 @@ function deserializeLayer(raw, ctx) {
6155
5934
  return null;
6156
5935
  }
6157
5936
  const annotation = JSON.parse(JSON.stringify({ ...a, id: typeof a.id === "string" ? a.id : id }));
6158
- const migrated = annotationLayerFor(annotation, { ..._nullishCoalesce(ctx.canvas, () => ( { width: 1, height: 1 })), shaper: _nullishCoalesce(_optionalChain([ctx, 'access', _165 => _165.text, 'optionalAccess', _166 => _166.shaper]), () => ( null)), createCanvas: _optionalChain([ctx, 'access', _167 => _167.text, 'optionalAccess', _168 => _168.createCanvas]) });
5937
+ const migrated = annotationLayerFor(annotation, { ..._nullishCoalesce(ctx.canvas, () => ( { width: 1, height: 1 })), shaper: _nullishCoalesce(_optionalChain([ctx, 'access', _159 => _159.text, 'optionalAccess', _160 => _160.shaper]), () => ( null)), createCanvas: _optionalChain([ctx, 'access', _161 => _161.text, 'optionalAccess', _162 => _162.createCanvas]) });
6159
5938
  if (migrated.type === "shape" || migrated.type === "type") {
6160
5939
  const blend = base.blend === "normal" ? migrated.blend : base.blend;
6161
5940
  return { ...migrated, ...base, blend, id, name: base.name };
@@ -6195,15 +5974,15 @@ function readContents(id, ctx) {
6195
5974
  const c = { id, name: typeof raw.name === "string" ? raw.name : "Contents", width, height, kind: raw.kind === "document" ? "document" : "raster" };
6196
5975
  if (raw.file && typeof raw.file.type === "string" && typeof raw.file.data === "string") {
6197
5976
  try {
6198
- c.file = { type: raw.file.type, bytes: _chunkPOGBUYWEcjs.base64ToBytes.call(void 0, raw.file.data) };
6199
- } catch (e8) {
5977
+ c.file = { type: raw.file.type, bytes: _chunkST7E3NEEcjs.base64ToBytes.call(void 0, raw.file.data) };
5978
+ } catch (e9) {
6200
5979
  ctx.problems.push(`Smart object contents "${c.name}": the embedded file could not be read`);
6201
5980
  }
6202
5981
  }
6203
5982
  if (raw.linked && typeof raw.linked.path === "string") c.linked = { path: raw.linked.path };
6204
5983
  if (c.kind === "raster") {
6205
5984
  if (typeof raw.asset === "string") c.raster = readSurface(raw.asset, 0, 0, 4, 0, ctx, `Smart object contents "${c.name}"`);
6206
- else if (!c.file) c.raster = _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4);
5985
+ else if (!c.file) c.raster = _chunkTFOPHZ3Ucjs.emptySurface.call(void 0, 4);
6207
5986
  } else {
6208
5987
  const outer = ctx.canvas;
6209
5988
  ctx.canvas = { width, height };
@@ -6226,12 +6005,12 @@ function readSmartFilters(raw, ctx, what) {
6226
6005
  let k = 0;
6227
6006
  for (const f of list2) {
6228
6007
  if (!f || typeof f !== "object") continue;
6229
- const blend = _chunkXIOMMGPDcjs.isBlendMode.call(void 0, f.blend) && f.blend !== "pigment" ? f.blend : "normal";
6008
+ const blend = _chunkTFOPHZ3Ucjs.isBlendMode.call(void 0, f.blend) && f.blend !== "pigment" ? f.blend : "normal";
6230
6009
  const opacity = num2(f.opacity, 0, 1, 1);
6231
6010
  if (f.kind === "psd") {
6232
6011
  try {
6233
- filters.push({ id: typeof f.id === "string" ? f.id : newLayerId("flt"), kind: "psd", enabled: f.enabled !== false, name: typeof f.name === "string" ? f.name : "Filter", data: _chunkPOGBUYWEcjs.base64ToBytes.call(void 0, String(_nullishCoalesce(f.data, () => ( "")))), blend, opacity });
6234
- } catch (e9) {
6012
+ filters.push({ id: typeof f.id === "string" ? f.id : newLayerId("flt"), kind: "psd", enabled: f.enabled !== false, name: typeof f.name === "string" ? f.name : "Filter", data: _chunkST7E3NEEcjs.base64ToBytes.call(void 0, String(_nullishCoalesce(f.data, () => ( "")))), blend, opacity });
6013
+ } catch (e10) {
6235
6014
  ctx.problems.push(`${what}: a Photoshop smart filter could not be read`);
6236
6015
  }
6237
6016
  } else if (f.kind === "develop" || f.kind === "blur") {
@@ -6255,22 +6034,22 @@ function readSmartObject(r, base, ctx) {
6255
6034
  let placement;
6256
6035
  try {
6257
6036
  const raw = { corners: p.corners };
6258
- if (p.warp && _chunkW3GXSUSQcjs.isValidWarpMesh.call(void 0, p.warp)) raw.warp = p.warp;
6259
- if (_chunkPOGBUYWEcjs.isInterpolation.call(void 0, p.interpolation)) raw.interpolation = p.interpolation;
6037
+ if (p.warp && _chunkLPLCWZTMcjs.isValidWarpMesh.call(void 0, p.warp)) raw.warp = p.warp;
6038
+ if (_chunkST7E3NEEcjs.isInterpolation.call(void 0, p.interpolation)) raw.interpolation = p.interpolation;
6260
6039
  placement = normalizePlacement(raw, contents);
6261
6040
  } catch (e) {
6262
6041
  ctx.problems.push(`${what}: its placement is invalid (${e instanceof Error ? e.message : String(e)}); it was placed at the top left`);
6263
6042
  placement = { corners: [{ x: 0, y: 0 }, { x: contents.width, y: 0 }, { x: contents.width, y: contents.height }, { x: 0, y: contents.height }] };
6264
6043
  }
6265
- const layer = { ...base, type: "smart", contents, placement, surface: _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4), offset: { x: 0, y: 0 } };
6044
+ const layer = { ...base, type: "smart", contents, placement, surface: _chunkTFOPHZ3Ucjs.emptySurface.call(void 0, 4), offset: { x: 0, y: 0 } };
6266
6045
  const filters = readSmartFilters(r.smartFilters, ctx, what);
6267
6046
  if (filters) layer.smartFilters = filters;
6268
6047
  if (typeof r.fillOpacity === "number" && r.fillOpacity !== 1) layer.fillOpacity = num2(r.fillOpacity, 0, 1, 1);
6269
6048
  if (r.psd && typeof r.psd.key === "string" && typeof r.psd.data === "string") {
6270
6049
  try {
6271
- layer.psd = { key: r.psd.key, data: _chunkPOGBUYWEcjs.base64ToBytes.call(void 0, r.psd.data) };
6050
+ layer.psd = { key: r.psd.key, data: _chunkST7E3NEEcjs.base64ToBytes.call(void 0, r.psd.data) };
6272
6051
  if (typeof r.psd.placed === "string") layer.psd.placed = r.psd.placed;
6273
- } catch (e10) {
6052
+ } catch (e11) {
6274
6053
  }
6275
6054
  }
6276
6055
  if (typeof r.asset === "string") layer.surface = readSurface(r.asset, r.x, r.y, 4, 0, ctx, what);
@@ -6513,7 +6292,7 @@ var PsdWriter = (_class = class {constructor() { _class.prototype.__init.call(th
6513
6292
  function decodeLegacyName(b) {
6514
6293
  try {
6515
6294
  return new TextDecoder("utf-8", { fatal: true }).decode(b);
6516
- } catch (e11) {
6295
+ } catch (e12) {
6517
6296
  return String.fromCharCode(...b);
6518
6297
  }
6519
6298
  }
@@ -6534,7 +6313,7 @@ function descriptor(classId, items = []) {
6534
6313
  return { name: "", classId, items };
6535
6314
  }
6536
6315
  function descGet(d, key) {
6537
- return _optionalChain([d, 'access', _169 => _169.items, 'access', _170 => _170.find, 'call', _171 => _171(([k]) => k === key), 'optionalAccess', _172 => _172[1]]);
6316
+ return _optionalChain([d, 'access', _163 => _163.items, 'access', _164 => _164.find, 'call', _165 => _165(([k]) => k === key), 'optionalAccess', _166 => _166[1]]);
6538
6317
  }
6539
6318
  function descNumber(d, key) {
6540
6319
  const v = descGet(d, key);
@@ -6544,7 +6323,7 @@ function descNumber(d, key) {
6544
6323
  }
6545
6324
  function descBool(d, key) {
6546
6325
  const v = descGet(d, key);
6547
- return _optionalChain([v, 'optionalAccess', _173 => _173.type]) === "bool" ? v.value : void 0;
6326
+ return _optionalChain([v, 'optionalAccess', _167 => _167.type]) === "bool" ? v.value : void 0;
6548
6327
  }
6549
6328
  function descObject(d, key) {
6550
6329
  const v = descGet(d, key);
@@ -7015,7 +6794,7 @@ function parseAdjustmentBlock(key, data) {
7015
6794
  default:
7016
6795
  return null;
7017
6796
  }
7018
- } catch (e12) {
6797
+ } catch (e13) {
7019
6798
  return null;
7020
6799
  }
7021
6800
  }
@@ -7238,7 +7017,7 @@ function vectorBlockForComponents(components, inverted, width, height, flags = 0
7238
7017
  const fr = (p) => ({ x: p.x / w, y: p.y / h });
7239
7018
  const subpaths = [];
7240
7019
  components.forEach((c, ci) => {
7241
- _chunkW3GXSUSQcjs.expandVectorCorners.call(void 0, c.subpaths).forEach((sp, si) => {
7020
+ _chunkLPLCWZTMcjs.expandVectorCorners.call(void 0, c.subpaths).forEach((sp, si) => {
7242
7021
  if (!sp.anchors.length) return;
7243
7022
  subpaths.push({
7244
7023
  closed: sp.closed,
@@ -7265,12 +7044,12 @@ var enumV = (typeId, value) => ({ type: "enum", typeId, value });
7265
7044
  var obj = (d) => ({ type: "Objc", value: d });
7266
7045
  var enumOf = (d, key) => {
7267
7046
  const v = descGet(d, key);
7268
- return _optionalChain([v, 'optionalAccess', _174 => _174.type]) === "enum" ? v.value : void 0;
7047
+ return _optionalChain([v, 'optionalAccess', _168 => _168.type]) === "enum" ? v.value : void 0;
7269
7048
  };
7270
7049
  function read(data) {
7271
7050
  try {
7272
7051
  return parseVersionedDescriptor(data);
7273
- } catch (e13) {
7052
+ } catch (e14) {
7274
7053
  return null;
7275
7054
  }
7276
7055
  }
@@ -7347,7 +7126,7 @@ function strokeFromVstk(data, dpi, notes) {
7347
7126
  const miter = descNumber(d, "strokeStyleMiterLimit");
7348
7127
  if (miter !== void 0 && miter !== 100) stroke.miterLimit = Math.max(1, Math.min(500, miter));
7349
7128
  const dashes = descGet(d, "strokeStyleLineDashSet");
7350
- if (_optionalChain([dashes, 'optionalAccess', _175 => _175.type]) === "VlLs") {
7129
+ if (_optionalChain([dashes, 'optionalAccess', _169 => _169.type]) === "VlLs") {
7351
7130
  const list2 = dashes.items.map((v) => v.type === "UntF" || v.type === "doub" || v.type === "long" ? v.value : NaN).filter((v) => Number.isFinite(v) && v >= 0);
7352
7131
  if (list2.length && list2.some((v) => v > 0)) stroke.dashes = list2;
7353
7132
  }
@@ -7499,7 +7278,7 @@ function vogkBytes(components, dpi) {
7499
7278
  ["keyOriginLineArrowEnd", boolV(Boolean(live.endArrow))],
7500
7279
  ["keyOriginLineArrWdth", dbl(head ? head.width / w * 100 : 0)],
7501
7280
  ["keyOriginLineArrLngth", dbl(head ? head.length / w * 100 : 0)],
7502
- ["keyOriginLineArrConc", long2(_optionalChain([head, 'optionalAccess', _176 => _176.concavity]) ? head.concavity * 100 : 0)]
7281
+ ["keyOriginLineArrConc", long2(_optionalChain([head, 'optionalAccess', _170 => _170.concavity]) ? head.concavity * 100 : 0)]
7503
7282
  ];
7504
7283
  }
7505
7284
  const m = live.transform;
@@ -7532,7 +7311,7 @@ function shapeSignature(layer) {
7532
7311
  return JSON.stringify([layer.components, layer.fill, layer.stroke, _nullishCoalesce(layer.fillRule, () => ( "nonzero")), Boolean(layer.inverted)]);
7533
7312
  }
7534
7313
  function shapeFromBlocks(blocks, width, height, dpi, notes) {
7535
- const block = (k) => _optionalChain([blocks, 'access', _177 => _177.find, 'call', _178 => _178((b) => b.key === k), 'optionalAccess', _179 => _179.data]);
7314
+ const block = (k) => _optionalChain([blocks, 'access', _171 => _171.find, 'call', _172 => _172((b) => b.key === k), 'optionalAccess', _173 => _173.data]);
7536
7315
  const vector = _nullishCoalesce(block("vsms"), () => ( block("vmsk")));
7537
7316
  const path = vector ? componentsFromVectorBlock(vector, width, height) : null;
7538
7317
  if (!path) return null;
@@ -7545,7 +7324,7 @@ function shapeFromBlocks(blocks, width, height, dpi, notes) {
7545
7324
  const d = data && (() => {
7546
7325
  try {
7547
7326
  return parseVersionedDescriptor(data);
7548
- } catch (e14) {
7327
+ } catch (e15) {
7549
7328
  return null;
7550
7329
  }
7551
7330
  })();
@@ -7587,18 +7366,18 @@ function sameExtent(sub, c) {
7587
7366
  return a.every((v, i) => Math.abs(v - b[i]) < 1);
7588
7367
  }
7589
7368
  function shapeBlocks(layer, width, height, dpi, notes) {
7590
- const kept = _optionalChain([layer, 'access', _180 => _180.psd, 'optionalAccess', _181 => _181.blocks]);
7591
- if (_optionalChain([kept, 'optionalAccess', _182 => _182.length]) && _optionalChain([layer, 'access', _183 => _183.psd, 'optionalAccess', _184 => _184.signature]) === shapeSignature(layer)) return kept.map((b) => ({ key: b.key, data: b.data }));
7369
+ const kept = _optionalChain([layer, 'access', _174 => _174.psd, 'optionalAccess', _175 => _175.blocks]);
7370
+ if (_optionalChain([kept, 'optionalAccess', _176 => _176.length]) && _optionalChain([layer, 'access', _177 => _177.psd, 'optionalAccess', _178 => _178.signature]) === shapeSignature(layer)) return kept.map((b) => ({ key: b.key, data: b.data }));
7592
7371
  const out = [];
7593
7372
  out.push({ key: "vsms", data: vectorBlockForComponents(layer.components, Boolean(layer.inverted), width, height) });
7594
7373
  if (layer.fillRule === "evenodd" && layer.components.some((c) => c.subpaths.length > 1)) notes.add("Even-odd fill rules were written as nonzero (Photoshop fills shapes nonzero)");
7595
7374
  const fill = _nullishCoalesce(layer.fill, () => ( { type: "color", color: "#000000" }));
7596
- if (_optionalChain([layer, 'access', _185 => _185.fill, 'optionalAccess', _186 => _186.opacity]) !== void 0 && layer.fill.opacity < 1) notes.add("Shape fill opacity has no PSD equivalent and was written as 100 % (use the layer fill opacity)");
7375
+ if (_optionalChain([layer, 'access', _179 => _179.fill, 'optionalAccess', _180 => _180.opacity]) !== void 0 && layer.fill.opacity < 1) notes.add("Shape fill opacity has no PSD equivalent and was written as 100 % (use the layer fill opacity)");
7597
7376
  out.push({ key: "vscg", data: vscgBytes(fill) });
7598
7377
  if (layer.stroke || !layer.fill) out.push({ key: "vstk", data: vstkBytes(layer.stroke, Boolean(layer.fill), dpi) });
7599
7378
  const vogk = vogkBytes(layer.components, dpi);
7600
7379
  if (vogk) out.push({ key: "vogk", data: vogk });
7601
- if (layer.components.some((c) => _optionalChain([c, 'access', _187 => _187.live, 'optionalAccess', _188 => _188.kind]) === "line" && (c.live.startArrow && c.live.endArrow && JSON.stringify(c.live.startArrow) !== JSON.stringify(c.live.endArrow) || false))) {
7380
+ if (layer.components.some((c) => _optionalChain([c, 'access', _181 => _181.live, 'optionalAccess', _182 => _182.kind]) === "line" && (c.live.startArrow && c.live.endArrow && JSON.stringify(c.live.startArrow) !== JSON.stringify(c.live.endArrow) || false))) {
7602
7381
  notes.add("Lines with different start and end arrowheads were written with one arrowhead size (Photoshop has one)");
7603
7382
  }
7604
7383
  return out;
@@ -7807,7 +7586,7 @@ var E = {
7807
7586
  bool: (value) => ({ t: "bool", value })
7808
7587
  };
7809
7588
  function eGet(v, key) {
7810
- return _optionalChain([v, 'optionalAccess', _189 => _189.t]) === "dict" ? _optionalChain([v, 'access', _190 => _190.items, 'access', _191 => _191.find, 'call', _192 => _192(([k]) => k === key), 'optionalAccess', _193 => _193[1]]) : void 0;
7589
+ return _optionalChain([v, 'optionalAccess', _183 => _183.t]) === "dict" ? _optionalChain([v, 'access', _184 => _184.items, 'access', _185 => _185.find, 'call', _186 => _186(([k]) => k === key), 'optionalAccess', _187 => _187[1]]) : void 0;
7811
7590
  }
7812
7591
  function ePath(v, keys) {
7813
7592
  return keys.reduce((at, k) => eGet(at, k), v);
@@ -7825,7 +7604,7 @@ function eStr(v) {
7825
7604
  return v && (v.t === "string" || v.t === "name") ? v.value : void 0;
7826
7605
  }
7827
7606
  function eArray(v) {
7828
- return _optionalChain([v, 'optionalAccess', _194 => _194.t]) === "array" ? v.items : [];
7607
+ return _optionalChain([v, 'optionalAccess', _188 => _188.t]) === "array" ? v.items : [];
7829
7608
  }
7830
7609
  function eSet(d, key, value) {
7831
7610
  if (d.t !== "dict") return;
@@ -7852,12 +7631,12 @@ function parseTySh(data) {
7852
7631
  try {
7853
7632
  r.u16();
7854
7633
  warp = readVersionedDescriptor(r);
7855
- } catch (e15) {
7634
+ } catch (e16) {
7856
7635
  r.pos = at;
7857
7636
  }
7858
7637
  }
7859
7638
  return { transform: m, text: text3, warp, tail: r.rest() };
7860
- } catch (e16) {
7639
+ } catch (e17) {
7861
7640
  return null;
7862
7641
  }
7863
7642
  }
@@ -7927,7 +7706,7 @@ function fontFromPostScript(ps) {
7927
7706
  }
7928
7707
  family += suffix;
7929
7708
  const s = style.toLowerCase();
7930
- const weight = _nullishCoalesce(_optionalChain([WEIGHTS, 'access', _195 => _195.find, 'call', _196 => _196(([re]) => re.test(s)), 'optionalAccess', _197 => _197[1]]), () => ( 400));
7709
+ const weight = _nullishCoalesce(_optionalChain([WEIGHTS, 'access', _189 => _189.find, 'call', _190 => _190(([re]) => re.test(s)), 'optionalAccess', _191 => _191[1]]), () => ( 400));
7931
7710
  return { family: family || ps, weight, italic: /italic|oblique|it$/.test(s) };
7932
7711
  }
7933
7712
  var STYLE_NAMES = [
@@ -7952,7 +7731,7 @@ var hex22 = (v) => Math.round(Math.max(0, Math.min(1, v)) * 255).toString(16).pa
7952
7731
  function merged(levels) {
7953
7732
  const items = [];
7954
7733
  for (const l of levels) {
7955
- if (_optionalChain([l, 'optionalAccess', _198 => _198.t]) !== "dict") continue;
7734
+ if (_optionalChain([l, 'optionalAccess', _192 => _192.t]) !== "dict") continue;
7956
7735
  for (const [k, v] of l.items) if (!items.some(([o]) => o === k)) items.push([k, v]);
7957
7736
  }
7958
7737
  return E.dict(items);
@@ -7960,7 +7739,7 @@ function merged(levels) {
7960
7739
  function charStyle(d, fonts, notes) {
7961
7740
  const n = (k) => eNum(eGet(d, k));
7962
7741
  const flag = (k) => eBool(eGet(d, k));
7963
- const s = { ...DEFAULT_TEXT_STYLE };
7742
+ const s = { ..._chunkLPLCWZTMcjs.DEFAULT_TEXT_STYLE };
7964
7743
  const fi = n("Font");
7965
7744
  const ps = fi !== void 0 ? fonts[fi] : void 0;
7966
7745
  if (ps) {
@@ -8023,27 +7802,27 @@ function typeFromTySh(data, notes) {
8023
7802
  const t = parseTySh(data);
8024
7803
  if (!t) return null;
8025
7804
  const txtV = descGet(t.text, "Txt ");
8026
- const txt = _optionalChain([txtV, 'optionalAccess', _199 => _199.type]) === "TEXT" ? txtV.value.replace(/\0+$/, "") : void 0;
7805
+ const txt = _optionalChain([txtV, 'optionalAccess', _193 => _193.type]) === "TEXT" ? txtV.value.replace(/\0+$/, "") : void 0;
8027
7806
  const ed = descGet(t.text, "EngineData");
8028
7807
  let engine = null;
8029
- if (_optionalChain([ed, 'optionalAccess', _200 => _200.type]) === "tdta") {
7808
+ if (_optionalChain([ed, 'optionalAccess', _194 => _194.type]) === "tdta") {
8030
7809
  try {
8031
7810
  engine = parseEngineData(ed.data);
8032
- } catch (e17) {
7811
+ } catch (e18) {
8033
7812
  notes.add("the text engine data could not be read; the text came in in one style");
8034
7813
  }
8035
7814
  }
8036
7815
  const anti = descGet(t.text, "AntA");
8037
- const antiAlias = !(_optionalChain([anti, 'optionalAccess', _201 => _201.type]) === "enum" && (anti.value === "Anno" || anti.value === "antiAliasNone"));
7816
+ const antiAlias = !(_optionalChain([anti, 'optionalAccess', _195 => _195.type]) === "enum" && (anti.value === "Anno" || anti.value === "antiAliasNone"));
8038
7817
  const ornt = descGet(t.text, "Ornt");
8039
- if (_optionalChain([ornt, 'optionalAccess', _202 => _202.type]) === "enum" && ornt.value === "Vrtc") notes.add("vertical type is laid out horizontally");
7818
+ if (_optionalChain([ornt, 'optionalAccess', _196 => _196.type]) === "enum" && ornt.value === "Vrtc") notes.add("vertical type is laid out horizontally");
8040
7819
  if (t.warp) {
8041
7820
  const style = descGet(t.warp, "warpStyle");
8042
- if (_optionalChain([style, 'optionalAccess', _203 => _203.type]) === "enum" && style.value !== "warpNone") notes.add("warped text is drawn without its warp when edited");
7821
+ if (_optionalChain([style, 'optionalAccess', _197 => _197.type]) === "enum" && style.value !== "warpNone") notes.add("warped text is drawn without its warp when edited");
8043
7822
  }
8044
7823
  const edText = _nullishCoalesce(eStr(ePath(_nullishCoalesce(engine, () => ( void 0)), ["EngineDict", "Editor", "Text"])), () => ( ""));
8045
7824
  const text3 = (_nullishCoalesce(txt, () => ( edText.replace(/\r$/, "")))).replace(/\r\n?/g, "\n");
8046
- let runs = [{ length: text3.length, style: { ...DEFAULT_TEXT_STYLE } }];
7825
+ let runs = [{ length: text3.length, style: { ..._chunkLPLCWZTMcjs.DEFAULT_TEXT_STYLE } }];
8047
7826
  let paragraphs = [{ length: text3.length, style: {} }];
8048
7827
  let frame = { kind: "point" };
8049
7828
  let transform = t.transform;
@@ -8088,7 +7867,7 @@ function typeFromTySh(data, notes) {
8088
7867
  let at = 0;
8089
7868
  runs = ssheets.map((sheet, i) => {
8090
7869
  const own = named(styleSet, sheet);
8091
- const paraDefault = _optionalChain([paraBases, 'access', _204 => _204[paraAt(at)], 'optionalAccess', _205 => _205.charDefault]);
7870
+ const paraDefault = _optionalChain([paraBases, 'access', _198 => _198[paraAt(at)], 'optionalAccess', _199 => _199.charDefault]);
8092
7871
  at += _nullishCoalesce(slens[i], () => ( 0));
8093
7872
  const d = merged([eGet(sheet, "StyleSheetData"), eGet(own, "StyleSheetData"), eGet(paraDefault, "StyleSheetData"), eGet(normalStyle, "StyleSheetData")]);
8094
7873
  return { length: _nullishCoalesce(slens[i], () => ( 0)), style: charStyle(d, fonts, notes) };
@@ -8099,14 +7878,14 @@ function typeFromTySh(data, notes) {
8099
7878
  const b = eArray(ePath(shape, ["Cookie", "Photoshop", "BoxBounds"])).map((v) => _nullishCoalesce(eNum(v), () => ( 0)));
8100
7879
  if (b.length === 4 && b[2] > b[0] && b[3] > b[1]) {
8101
7880
  frame = { kind: "box", width: b[2] - b[0], height: b[3] - b[1] };
8102
- transform = _chunkW3GXSUSQcjs.multiplyMatrices.call(void 0, [1, 0, 0, 1, b[0], b[1]], t.transform);
7881
+ transform = _chunkLPLCWZTMcjs.multiplyMatrices.call(void 0, [1, 0, 0, 1, b[0], b[1]], t.transform);
8103
7882
  }
8104
7883
  }
8105
7884
  }
8106
7885
  return {
8107
7886
  text: text3,
8108
- runs: fitRuns(runs, text3.length, DEFAULT_TEXT_STYLE),
8109
- paragraphs: fitParagraphRuns(paragraphs, text3),
7887
+ runs: _chunkLPLCWZTMcjs.fitRuns.call(void 0, runs, text3.length, _chunkLPLCWZTMcjs.DEFAULT_TEXT_STYLE),
7888
+ paragraphs: _chunkLPLCWZTMcjs.fitParagraphRuns.call(void 0, paragraphs, text3),
8110
7889
  frame,
8111
7890
  transform,
8112
7891
  antiAlias,
@@ -8167,8 +7946,8 @@ var fontEntry = (name) => E.dict([
8167
7946
  ["Synthetic", E.int(0)]
8168
7947
  ]);
8169
7948
  function buildEngineData(layer, template) {
8170
- const e = _optionalChain([template, 'optionalAccess', _206 => _206.t]) === "dict" ? eClone(template) : E.dict([["EngineDict", E.dict()], ["ResourceDict", E.dict()]]);
8171
- if (_optionalChain([eGet, 'call', _207 => _207(e, "EngineDict"), 'optionalAccess', _208 => _208.t]) !== "dict") eSet(e, "EngineDict", E.dict());
7949
+ const e = _optionalChain([template, 'optionalAccess', _200 => _200.t]) === "dict" ? eClone(template) : E.dict([["EngineDict", E.dict()], ["ResourceDict", E.dict()]]);
7950
+ if (_optionalChain([eGet, 'call', _201 => _201(e, "EngineDict"), 'optionalAccess', _202 => _202.t]) !== "dict") eSet(e, "EngineDict", E.dict());
8172
7951
  const dict = eGet(e, "EngineDict");
8173
7952
  const text3 = layer.text.replace(/\n/g, "\r");
8174
7953
  const edText = `${text3}\r`;
@@ -8180,7 +7959,7 @@ function buildEngineData(layer, template) {
8180
7959
  fonts.push(ps);
8181
7960
  return fonts.length - 1;
8182
7961
  };
8183
- const runs = fitRuns(layer.runs, layer.text.length, DEFAULT_TEXT_STYLE);
7962
+ const runs = _chunkLPLCWZTMcjs.fitRuns.call(void 0, layer.runs, layer.text.length, _chunkLPLCWZTMcjs.DEFAULT_TEXT_STYLE);
8184
7963
  const sruns = [];
8185
7964
  const slens = [];
8186
7965
  runs.forEach((r, i) => {
@@ -8188,10 +7967,10 @@ function buildEngineData(layer, template) {
8188
7967
  slens.push(E.int(r.length + (i === runs.length - 1 ? 1 : 0)));
8189
7968
  });
8190
7969
  if (!runs.length) {
8191
- sruns.push(E.dict([["StyleSheet", E.dict([["StyleSheetData", styleSheetData(DEFAULT_TEXT_STYLE, fontIndex(postScriptFor(DEFAULT_TEXT_STYLE)))]])]]));
7970
+ sruns.push(E.dict([["StyleSheet", E.dict([["StyleSheetData", styleSheetData(_chunkLPLCWZTMcjs.DEFAULT_TEXT_STYLE, fontIndex(postScriptFor(_chunkLPLCWZTMcjs.DEFAULT_TEXT_STYLE)))]])]]));
8192
7971
  slens.push(E.int(1));
8193
7972
  }
8194
- const paras = fitParagraphRuns(layer.paragraphs, layer.text);
7973
+ const paras = _chunkLPLCWZTMcjs.fitParagraphRuns.call(void 0, layer.paragraphs, layer.text);
8195
7974
  const pruns = [];
8196
7975
  const plens = [];
8197
7976
  paras.forEach((p, i) => {
@@ -8247,7 +8026,7 @@ function buildEngineData(layer, template) {
8247
8026
  eSet(e, key, rd);
8248
8027
  }
8249
8028
  eSet(rd, "FontSet", fontSet);
8250
- if (!eGet(rd, "StyleSheetSet")) eSet(rd, "StyleSheetSet", E.array([E.dict([["Name", E.str("Normal RGB")], ["StyleSheetData", styleSheetData(_nullishCoalesce(_optionalChain([runs, 'access', _209 => _209[0], 'optionalAccess', _210 => _210.style]), () => ( DEFAULT_TEXT_STYLE)), 0)]])]));
8029
+ if (!eGet(rd, "StyleSheetSet")) eSet(rd, "StyleSheetSet", E.array([E.dict([["Name", E.str("Normal RGB")], ["StyleSheetData", styleSheetData(_nullishCoalesce(_optionalChain([runs, 'access', _203 => _203[0], 'optionalAccess', _204 => _204.style]), () => ( _chunkLPLCWZTMcjs.DEFAULT_TEXT_STYLE)), 0)]])]));
8251
8030
  if (!eGet(rd, "ParagraphSheetSet")) eSet(rd, "ParagraphSheetSet", E.array([E.dict([["Name", E.str("Normal RGB")], ["DefaultStyleSheet", E.int(0)], ["Properties", paragraphProperties({})]])]));
8252
8031
  if (!eGet(rd, "TheNormalStyleSheet")) eSet(rd, "TheNormalStyleSheet", E.int(0));
8253
8032
  if (!eGet(rd, "TheNormalParagraphSheet")) eSet(rd, "TheNormalParagraphSheet", E.int(0));
@@ -8256,27 +8035,27 @@ function buildEngineData(layer, template) {
8256
8035
  }
8257
8036
  function inkBounds2(layer) {
8258
8037
  if (layer.frame.kind === "box") return [0, 0, layer.frame.width, layer.frame.height];
8259
- const b = _chunkXIOMMGPDcjs.contentBounds.call(void 0, layer.surface);
8038
+ const b = _chunkTFOPHZ3Ucjs.contentBounds.call(void 0, layer.surface);
8260
8039
  if (!b) return [0, 0, 0, 0];
8261
- const inv = _chunkW3GXSUSQcjs.invertMatrix.call(void 0, textMatrix(layer));
8040
+ const inv = _chunkLPLCWZTMcjs.invertMatrix.call(void 0, textMatrix(layer));
8262
8041
  const pts = [
8263
8042
  { x: b.x, y: b.y },
8264
8043
  { x: b.x + b.width, y: b.y },
8265
8044
  { x: b.x + b.width, y: b.y + b.height },
8266
8045
  { x: b.x, y: b.y + b.height }
8267
- ].map((p) => _chunkW3GXSUSQcjs.applyMatrix.call(void 0, inv, p));
8046
+ ].map((p) => _chunkLPLCWZTMcjs.applyMatrix.call(void 0, inv, p));
8268
8047
  return [Math.min(...pts.map((p) => p.x)), Math.min(...pts.map((p) => p.y)), Math.max(...pts.map((p) => p.x)), Math.max(...pts.map((p) => p.y))];
8269
8048
  }
8270
8049
  function tyShForLayer(layer) {
8271
- const raw = _optionalChain([layer, 'access', _211 => _211.psd, 'optionalAccess', _212 => _212.tySh]);
8272
- if (raw && _optionalChain([layer, 'access', _213 => _213.psd, 'optionalAccess', _214 => _214.signature]) === typeSignature(layer)) return raw;
8050
+ const raw = _optionalChain([layer, 'access', _205 => _205.psd, 'optionalAccess', _206 => _206.tySh]);
8051
+ if (raw && _optionalChain([layer, 'access', _207 => _207.psd, 'optionalAccess', _208 => _208.signature]) === typeSignature(layer)) return raw;
8273
8052
  const old = raw ? parseTySh(raw) : null;
8274
8053
  const oldEd = old ? descGet(old.text, "EngineData") : void 0;
8275
8054
  let template = null;
8276
- if (_optionalChain([oldEd, 'optionalAccess', _215 => _215.type]) === "tdta") {
8055
+ if (_optionalChain([oldEd, 'optionalAccess', _209 => _209.type]) === "tdta") {
8277
8056
  try {
8278
8057
  template = parseEngineData(oldEd.data);
8279
- } catch (e18) {
8058
+ } catch (e19) {
8280
8059
  template = null;
8281
8060
  }
8282
8061
  }
@@ -8305,8 +8084,8 @@ function tyShForLayer(layer) {
8305
8084
  set("boundingBox", rect("boundingBox"));
8306
8085
  if (!descGet(text3, "TextIndex")) set("TextIndex", { type: "long", value: 0 });
8307
8086
  set("EngineData", { type: "tdta", data: writeEngineData(engine) });
8308
- const warpStyle = _optionalChain([old, 'optionalAccess', _216 => _216.warp]) ? descGet(old.warp, "warpStyle") : void 0;
8309
- const warp = _optionalChain([old, 'optionalAccess', _217 => _217.warp]) && _optionalChain([warpStyle, 'optionalAccess', _218 => _218.type]) === "enum" && warpStyle.value === "warpNone" ? old.warp : null;
8087
+ const warpStyle = _optionalChain([old, 'optionalAccess', _210 => _210.warp]) ? descGet(old.warp, "warpStyle") : void 0;
8088
+ const warp = _optionalChain([old, 'optionalAccess', _211 => _211.warp]) && _optionalChain([warpStyle, 'optionalAccess', _212 => _212.type]) === "enum" && warpStyle.value === "warpNone" ? old.warp : null;
8310
8089
  return writeTySh({ transform: textMatrix(layer), text: text3, warp, tail: new Uint8Array(16) });
8311
8090
  }
8312
8091
 
@@ -8375,9 +8154,9 @@ function packbitsDecodeInto(src, expected, out, at) {
8375
8154
  function inflateChecked(data, expected) {
8376
8155
  let out;
8377
8156
  try {
8378
- out = _chunkPOGBUYWEcjs.inflate.call(void 0, data, { maxOutput: expected + (1 << 20), sizeHint: expected, verify: false });
8157
+ out = _chunk643B2HKCcjs.inflate.call(void 0, data, { maxOutput: expected + (1 << 20), sizeHint: expected, verify: false });
8379
8158
  } catch (e) {
8380
- throw new PsdError(`ZIP channel data: ${e instanceof _chunkPOGBUYWEcjs.ZlibError || e instanceof Error ? e.message : String(e)}`);
8159
+ throw new PsdError(`ZIP channel data: ${e instanceof _chunk643B2HKCcjs.ZlibError || e instanceof Error ? e.message : String(e)}`);
8381
8160
  }
8382
8161
  if (out.length < expected) throw new PsdError(`ZIP stream produced ${out.length} of ${expected} bytes.`);
8383
8162
  return out.length === expected ? out : out.subarray(0, expected);
@@ -8465,6 +8244,36 @@ function encodeRle(decoded2, l) {
8465
8244
  out.set(packed.subarray(0, at), counts.length);
8466
8245
  return out;
8467
8246
  }
8247
+ function predict(buf, l) {
8248
+ const rb = rowBytes(l.width, l.depth);
8249
+ if (rb === 0) return;
8250
+ const w = l.width;
8251
+ const scratch = l.depth === 32 ? new Uint8Array(rb) : null;
8252
+ for (let o = 0; o + rb <= buf.length; o += rb) {
8253
+ if (l.depth === 1 || l.depth === 8) {
8254
+ for (let i = rb - 1; i > 0; i--) buf[o + i] = buf[o + i] - buf[o + i - 1] & 255;
8255
+ } else if (l.depth === 16) {
8256
+ for (let i = w - 1; i > 0; i--) {
8257
+ const a = buf[o + 2 * i] << 8 | buf[o + 2 * i + 1];
8258
+ const b = buf[o + 2 * i - 2] << 8 | buf[o + 2 * i - 1];
8259
+ const v = a - b & 65535;
8260
+ buf[o + 2 * i] = v >> 8;
8261
+ buf[o + 2 * i + 1] = v & 255;
8262
+ }
8263
+ } else if (l.depth === 32) {
8264
+ scratch.set(buf.subarray(o, o + rb));
8265
+ for (let i = 0; i < w; i++) for (let k = 0; k < 4; k++) buf[o + k * w + i] = scratch[4 * i + k];
8266
+ for (let i = rb - 1; i > 0; i--) buf[o + i] = buf[o + i] - buf[o + i - 1] & 255;
8267
+ } else {
8268
+ throw new PsdError(`ZIP prediction is not defined for depth ${l.depth}.`);
8269
+ }
8270
+ }
8271
+ }
8272
+ function encodeZipPredicted(decoded2, l) {
8273
+ const buf = decoded2.slice();
8274
+ predict(buf, l);
8275
+ return _chunk643B2HKCcjs.deflate.call(void 0, buf);
8276
+ }
8468
8277
 
8469
8278
  // src/image-editor/psd/smart.ts
8470
8279
  var dbl2 = (value) => ({ type: "doub", value });
@@ -8476,15 +8285,15 @@ var textV = (value) => ({ type: "TEXT", value });
8476
8285
  var obj2 = (d) => ({ type: "Objc", value: d });
8477
8286
  var text = (d, key) => {
8478
8287
  const v = descGet(d, key);
8479
- return _optionalChain([v, 'optionalAccess', _219 => _219.type]) === "TEXT" ? v.value : void 0;
8288
+ return _optionalChain([v, 'optionalAccess', _213 => _213.type]) === "TEXT" ? v.value : void 0;
8480
8289
  };
8481
8290
  var enumOf2 = (d, key) => {
8482
8291
  const v = descGet(d, key);
8483
- return _optionalChain([v, 'optionalAccess', _220 => _220.type]) === "enum" ? v.value : void 0;
8292
+ return _optionalChain([v, 'optionalAccess', _214 => _214.type]) === "enum" ? v.value : void 0;
8484
8293
  };
8485
8294
  var numbers = (d, key) => {
8486
8295
  const v = descGet(d, key);
8487
- if (_optionalChain([v, 'optionalAccess', _221 => _221.type]) !== "VlLs") return null;
8296
+ if (_optionalChain([v, 'optionalAccess', _215 => _215.type]) !== "VlLs") return null;
8488
8297
  const out = [];
8489
8298
  for (const it of v.items) {
8490
8299
  if (it.type === "doub" || it.type === "UntF" || it.type === "long") out.push(it.value);
@@ -8528,7 +8337,7 @@ function readLinkedItem(item) {
8528
8337
  try {
8529
8338
  const d = readVersionedDescriptor(r);
8530
8339
  path = _nullishCoalesce(_nullishCoalesce(text(d, "fullPath"), () => ( text(d, "originalPath"))), () => ( text(d, "relPath")));
8531
- } catch (e19) {
8340
+ } catch (e20) {
8532
8341
  path = void 0;
8533
8342
  }
8534
8343
  void version;
@@ -8545,7 +8354,7 @@ function parseLinkedFiles(data) {
8545
8354
  try {
8546
8355
  const item = readLinkedItem(data.subarray(at + 8, at + 8 + len));
8547
8356
  if (item) out.push(item);
8548
- } catch (e20) {
8357
+ } catch (e21) {
8549
8358
  }
8550
8359
  at = at + 8 + len + 3 & ~3;
8551
8360
  }
@@ -8672,21 +8481,21 @@ function filterMaskFromItem(item) {
8672
8481
  const height = rect.bottom - rect.top;
8673
8482
  if (!(width > 0 && height > 0) || width * height > 1 << 28) return null;
8674
8483
  const bytes = decodePlanes(plane.compression, plane.data, { planes: 1, width, height, depth: 8, psb: true });
8675
- const surface = _chunkXIOMMGPDcjs.surfaceFromPixels.call(void 0, { width, height, data: bytes }, 1, rect.left, rect.top, 255);
8484
+ const surface = _chunkTFOPHZ3Ucjs.surfaceFromPixels.call(void 0, { width, height, data: bytes }, 1, rect.left, rect.top, 255);
8676
8485
  return { surface, defaultValue: 255 };
8677
8486
  }
8678
8487
  function filterMaskItem(placed, mask, area) {
8679
- const painted = _chunkXIOMMGPDcjs.contentBounds.call(void 0, mask.surface);
8488
+ const painted = _chunkTFOPHZ3Ucjs.contentBounds.call(void 0, mask.surface);
8680
8489
  let b = _nullishCoalesce(painted, () => ( { x: 0, y: 0, width: 1, height: 1 }));
8681
8490
  if (mask.defaultValue !== 255 && area) {
8682
- const x0 = Math.min(area.x, _nullishCoalesce(_optionalChain([painted, 'optionalAccess', _222 => _222.x]), () => ( area.x)));
8683
- const y0 = Math.min(area.y, _nullishCoalesce(_optionalChain([painted, 'optionalAccess', _223 => _223.y]), () => ( area.y)));
8491
+ const x0 = Math.min(area.x, _nullishCoalesce(_optionalChain([painted, 'optionalAccess', _216 => _216.x]), () => ( area.x)));
8492
+ const y0 = Math.min(area.y, _nullishCoalesce(_optionalChain([painted, 'optionalAccess', _217 => _217.y]), () => ( area.y)));
8684
8493
  const x1 = Math.max(area.x + area.width, painted ? painted.x + painted.width : 0);
8685
8494
  const y1 = Math.max(area.y + area.height, painted ? painted.y + painted.height : 0);
8686
8495
  b = { x: x0, y: y0, width: x1 - x0, height: y1 - y0 };
8687
8496
  }
8688
8497
  const rect = { top: b.y, left: b.x, bottom: b.y + b.height, right: b.x + b.width };
8689
- const values = _chunkXIOMMGPDcjs.readRegion.call(void 0, mask.surface, b);
8498
+ const values = _chunkTFOPHZ3Ucjs.readRegion.call(void 0, mask.surface, b);
8690
8499
  const plane = new Uint8Array(values.buffer, values.byteOffset, values.length);
8691
8500
  return {
8692
8501
  id: placed,
@@ -8700,8 +8509,8 @@ function filterMaskItem(placed, mask, area) {
8700
8509
  }
8701
8510
  var warpStyleOf = (name) => {
8702
8511
  if (!name.startsWith("warp")) return null;
8703
- const s = _optionalChain([name, 'access', _224 => _224[4], 'optionalAccess', _225 => _225.toLowerCase, 'call', _226 => _226()]) + name.slice(5);
8704
- return _chunkW3GXSUSQcjs.WARP_STYLES.includes(s) ? s : null;
8512
+ const s = _optionalChain([name, 'access', _218 => _218[4], 'optionalAccess', _219 => _219.toLowerCase, 'call', _220 => _220()]) + name.slice(5);
8513
+ return _chunkLPLCWZTMcjs.WARP_STYLES.includes(s) ? s : null;
8705
8514
  };
8706
8515
  function warpFromDescriptor(w, contents) {
8707
8516
  const full = { x: 0, y: 0, width: contents.width, height: contents.height };
@@ -8722,7 +8531,7 @@ function warpFromDescriptor(w, contents) {
8722
8531
  if (!arr || arr.type !== "ObAr") return void 0;
8723
8532
  const xs = descGet(arr.body, "Hrzn");
8724
8533
  const ys = descGet(arr.body, "Vrtc");
8725
- if (_optionalChain([xs, 'optionalAccess', _227 => _227.type]) !== "UnFl" || _optionalChain([ys, 'optionalAccess', _228 => _228.type]) !== "UnFl" || xs.values.length !== 16 || ys.values.length !== 16) return void 0;
8534
+ if (_optionalChain([xs, 'optionalAccess', _221 => _221.type]) !== "UnFl" || _optionalChain([ys, 'optionalAccess', _222 => _222.type]) !== "UnFl" || xs.values.length !== 16 || ys.values.length !== 16) return void 0;
8726
8535
  mesh = { us: [0, 1], vs: [0, 1], points: xs.values.map((x, i) => ({ x, y: ys.values[i] })) };
8727
8536
  const px2 = mesh.points.map((p) => p.x);
8728
8537
  const py = mesh.points.map((p) => p.y);
@@ -8731,7 +8540,7 @@ function warpFromDescriptor(w, contents) {
8731
8540
  } else {
8732
8541
  const style = warpStyleOf(styleName);
8733
8542
  if (!style) return void 0;
8734
- mesh = _chunkW3GXSUSQcjs.warpPresetMesh.call(void 0,
8543
+ mesh = _chunkLPLCWZTMcjs.warpPresetMesh.call(void 0,
8735
8544
  {
8736
8545
  style,
8737
8546
  bend: _nullishCoalesce(descNumber(w, "warpValue"), () => ( 0)),
@@ -8746,7 +8555,7 @@ function warpFromDescriptor(w, contents) {
8746
8555
  const same = Math.abs(bounds.x) < 1e-6 && Math.abs(bounds.y) < 1e-6 && Math.abs(bounds.width - contents.width) < 1e-6 && Math.abs(bounds.height - contents.height) < 1e-6;
8747
8556
  if (!same) {
8748
8557
  const m = mesh;
8749
- mesh = _chunkW3GXSUSQcjs.fitWarpMesh.call(void 0, (s, t) => _chunkW3GXSUSQcjs.evalWarpMesh.call(void 0, m, (s * contents.width - bounds.x) / bounds.width, (t * contents.height - bounds.y) / bounds.height), [0, 1], [0, 1]);
8558
+ mesh = _chunkLPLCWZTMcjs.fitWarpMesh.call(void 0, (s, t) => _chunkLPLCWZTMcjs.evalWarpMesh.call(void 0, m, (s * contents.width - bounds.x) / bounds.width, (t * contents.height - bounds.y) / bounds.height), [0, 1], [0, 1]);
8750
8559
  }
8751
8560
  return { mesh, frame };
8752
8561
  }
@@ -8843,13 +8652,13 @@ function parsePlaced(key, data) {
8843
8652
  r.u32();
8844
8653
  try {
8845
8654
  warp = readVersionedDescriptor(r);
8846
- } catch (e21) {
8655
+ } catch (e22) {
8847
8656
  warp = void 0;
8848
8657
  }
8849
8658
  }
8850
8659
  return { key, idnt, placed: idnt, quad, warp };
8851
8660
  }
8852
- } catch (e22) {
8661
+ } catch (e23) {
8853
8662
  return null;
8854
8663
  }
8855
8664
  return null;
@@ -8889,13 +8698,13 @@ function blendOptions(f) {
8889
8698
  function smartFiltersFromPsd(fx, newId, notes) {
8890
8699
  const filters = [];
8891
8700
  const list2 = descGet(fx, "filterFXList");
8892
- for (const v of _optionalChain([list2, 'optionalAccess', _229 => _229.type]) === "VlLs" ? list2.items : []) {
8701
+ for (const v of _optionalChain([list2, 'optionalAccess', _223 => _223.type]) === "VlLs" ? list2.items : []) {
8893
8702
  if (v.type !== "Objc" && v.type !== "GlbO") continue;
8894
8703
  const item = v.value;
8895
8704
  const { blend, opacity } = blendOptionsOf(item);
8896
8705
  const enabled = descBool(item, "enab") !== false;
8897
8706
  const fltr = descObject(item, "Fltr");
8898
- const radius = _optionalChain([fltr, 'optionalAccess', _230 => _230.classId]) === BOX_BLUR.classId ? descNumber(fltr, "Rds ") : void 0;
8707
+ const radius = _optionalChain([fltr, 'optionalAccess', _224 => _224.classId]) === BOX_BLUR.classId ? descNumber(fltr, "Rds ") : void 0;
8899
8708
  if (radius !== void 0 && radius >= 0 && radius <= 50) {
8900
8709
  filters.push({ id: newId(), kind: "blur", enabled, radius, blend, opacity });
8901
8710
  continue;
@@ -9174,7 +8983,7 @@ function parseMask(d) {
9174
8983
  }
9175
8984
  if (!realFirst) m.real = readReal();
9176
8985
  return m;
9177
- } catch (e23) {
8986
+ } catch (e24) {
9178
8987
  return void 0;
9179
8988
  }
9180
8989
  }
@@ -9248,14 +9057,14 @@ function readPsd(bytes) {
9248
9057
  return { header, colorModeData, resources, layers, mergedAlpha, globalBlocks, imageCompression, imageData: r.rest() };
9249
9058
  }
9250
9059
  function layerBlock(rec, key) {
9251
- return _optionalChain([rec, 'access', _231 => _231.blocks, 'access', _232 => _232.find, 'call', _233 => _233((b) => b.key === key), 'optionalAccess', _234 => _234.data]);
9060
+ return _optionalChain([rec, 'access', _225 => _225.blocks, 'access', _226 => _226.find, 'call', _227 => _227((b) => b.key === key), 'optionalAccess', _228 => _228.data]);
9252
9061
  }
9253
9062
  function layerName(rec) {
9254
9063
  const luni = layerBlock(rec, "luni");
9255
9064
  if (luni) {
9256
9065
  try {
9257
9066
  return new PsdReader(luni).unicode();
9258
- } catch (e24) {
9067
+ } catch (e25) {
9259
9068
  }
9260
9069
  }
9261
9070
  return rec.legacyName;
@@ -9279,7 +9088,7 @@ function u8Block(rec, key) {
9279
9088
  function layerTree(file) {
9280
9089
  const stack = [[]];
9281
9090
  file.layers.forEach((rec, index) => {
9282
- const kind = _nullishCoalesce(_optionalChain([sectionDivider, 'call', _235 => _235(rec), 'optionalAccess', _236 => _236.kind]), () => ( SECTION_OTHER));
9091
+ const kind = _nullishCoalesce(_optionalChain([sectionDivider, 'call', _229 => _229(rec), 'optionalAccess', _230 => _230.kind]), () => ( SECTION_OTHER));
9283
9092
  if (kind === SECTION_DIVIDER) {
9284
9093
  stack.push([]);
9285
9094
  } else if (kind === SECTION_OPEN || kind === SECTION_CLOSED) {
@@ -9297,7 +9106,7 @@ function layerTree(file) {
9297
9106
  }
9298
9107
  function channelRect(rec, id) {
9299
9108
  if (id === CHANNEL_USER_MASK && rec.mask) return rec.mask.rect;
9300
- if (id === CHANNEL_REAL_USER_MASK && rec.mask) return _nullishCoalesce(_optionalChain([rec, 'access', _237 => _237.mask, 'access', _238 => _238.real, 'optionalAccess', _239 => _239.rect]), () => ( rec.mask.rect));
9109
+ if (id === CHANNEL_REAL_USER_MASK && rec.mask) return _nullishCoalesce(_optionalChain([rec, 'access', _231 => _231.mask, 'access', _232 => _232.real, 'optionalAccess', _233 => _233.rect]), () => ( rec.mask.rect));
9301
9110
  return rec.rect;
9302
9111
  }
9303
9112
  function decodeLayerChannel(file, rec, id) {
@@ -9315,7 +9124,7 @@ function decodeMergedImage(file) {
9315
9124
  return decodePlanes(file.imageCompression, file.imageData, { planes: channels, width, height, depth, psb });
9316
9125
  }
9317
9126
  function resource(file, id) {
9318
- return _optionalChain([file, 'access', _240 => _240.resources, 'access', _241 => _241.find, 'call', _242 => _242((r) => r.id === id), 'optionalAccess', _243 => _243.data]);
9127
+ return _optionalChain([file, 'access', _234 => _234.resources, 'access', _235 => _235.find, 'call', _236 => _236((r) => r.id === id), 'optionalAccess', _237 => _237.data]);
9319
9128
  }
9320
9129
  function resolution(file) {
9321
9130
  const d = resource(file, 1005);
@@ -9405,23 +9214,31 @@ function writePsd(file, encodeName) {
9405
9214
  w.endLen(res);
9406
9215
  const lm = w.beginLen(psb);
9407
9216
  if (file.layers.length || file.globalBlocks.length) {
9408
- const li = w.beginLen(psb);
9409
- if (file.layers.length) {
9410
- const start = w.length;
9411
- w.i16(file.mergedAlpha ? -file.layers.length : file.layers.length);
9412
- for (const rec of file.layers) writeLayerRecord(w, rec, psb, encodeName(rec.legacyName));
9217
+ const writeLayerInfo = (out) => {
9218
+ const start = out.length;
9219
+ out.i16(file.mergedAlpha ? -file.layers.length : file.layers.length);
9220
+ for (const rec of file.layers) writeLayerRecord(out, rec, psb, encodeName(rec.legacyName));
9413
9221
  for (const rec of file.layers) {
9414
9222
  for (const c of rec.channels) {
9415
9223
  if (c.compression === null) continue;
9416
- w.u16(c.compression);
9417
- w.bytes(c.data);
9224
+ out.u16(c.compression);
9225
+ out.bytes(c.data);
9418
9226
  }
9419
9227
  }
9420
- if ((w.length - start) % 2) w.u8(0);
9421
- }
9228
+ if ((out.length - start) % 2) out.u8(0);
9229
+ };
9230
+ const deepKey = header.depth === 16 ? "Lr16" : header.depth === 32 ? "Lr32" : null;
9231
+ let blocks = file.globalBlocks;
9232
+ const li = w.beginLen(psb);
9233
+ if (file.layers.length && !deepKey) writeLayerInfo(w);
9422
9234
  w.endLen(li);
9235
+ if (file.layers.length && deepKey) {
9236
+ const lw = new PsdWriter();
9237
+ writeLayerInfo(lw);
9238
+ blocks = [{ key: deepKey, data: lw.result() }, ...blocks];
9239
+ }
9423
9240
  w.u32(0);
9424
- writeBlocks(w, file.globalBlocks, psb, 4);
9241
+ writeBlocks(w, blocks, psb, 4);
9425
9242
  }
9426
9243
  w.endLen(lm);
9427
9244
  w.u16(file.imageCompression);
@@ -9430,6 +9247,7 @@ function writePsd(file, encodeName) {
9430
9247
  }
9431
9248
 
9432
9249
  // src/image-editor/psd/pixels.ts
9250
+ var MODE_BITMAP = 0;
9433
9251
  var MODE_INDEXED = 2;
9434
9252
  var MODE_RGB = 3;
9435
9253
  var MODE_CMYK = 4;
@@ -9509,6 +9327,15 @@ function toRgba8(set) {
9509
9327
  }
9510
9328
  return out;
9511
9329
  }
9330
+ if (mode === MODE_CMYK && set.cmykToRgb) {
9331
+ const ink = new Uint8Array(n * 4);
9332
+ for (let i = 0, o = 0; i < n; i++, o += 4) {
9333
+ for (let c = 0; c < 4; c++) ink[o + c] = Math.round((1 - (planes[c] ? planes[c](i) : 1)) * 255);
9334
+ out[o + 3] = Math.round(alpha(i) * 255);
9335
+ }
9336
+ set.cmykToRgb(ink, out);
9337
+ return out;
9338
+ }
9512
9339
  const palette = set.palette;
9513
9340
  for (let i = 0, o = 0; i < n; i++, o += 4) {
9514
9341
  let r;
@@ -9553,6 +9380,99 @@ function toRgba8(set) {
9553
9380
  }
9554
9381
  return out;
9555
9382
  }
9383
+ function toRgbaDeep(set) {
9384
+ const { width, height, depth, mode } = set;
9385
+ if (depth !== 16 && depth !== 32 || mode === MODE_INDEXED || mode === MODE_BITMAP) return null;
9386
+ const n = width * height;
9387
+ const isLab = mode === MODE_LAB;
9388
+ const cmyk = mode === MODE_CMYK;
9389
+ const raw = (plane, fill) => {
9390
+ if (!plane) return () => fill;
9391
+ if (depth === 16) return (i) => (plane[2 * i] << 8 | plane[2 * i + 1]) / 65535;
9392
+ const view = new DataView(plane.buffer, plane.byteOffset, plane.byteLength);
9393
+ return (i) => view.getFloat32(4 * i, false) || 0;
9394
+ };
9395
+ const planes = set.color.map((p) => raw(p, cmyk ? 1 : 0));
9396
+ const alpha = raw(set.alpha, 1);
9397
+ if (depth === 16) {
9398
+ const out2 = new Uint16Array(n * 4);
9399
+ const q2 = (v) => Math.round(clamp012(v) * 65535);
9400
+ for (let i = 0, o = 0; i < n; i++, o += 4) {
9401
+ let r;
9402
+ let g;
9403
+ let b;
9404
+ if (mode === MODE_CMYK) {
9405
+ const k = planes[3] ? planes[3](i) : 1;
9406
+ r = planes[0](i) * k;
9407
+ g = planes[1](i) * k;
9408
+ b = planes[2](i) * k;
9409
+ } else if (isLab) {
9410
+ [r, g, b] = labToSrgb(planes[0](i) * 100, planes[1](i) * 255 - 128, planes[2](i) * 255 - 128);
9411
+ } else if (mode === MODE_RGB || mode === MODE_MULTICHANNEL) {
9412
+ r = planes[0](i);
9413
+ g = planes[1] ? planes[1](i) : r;
9414
+ b = planes[2] ? planes[2](i) : r;
9415
+ } else r = g = b = planes[0](i);
9416
+ out2[o] = q2(r);
9417
+ out2[o + 1] = q2(g);
9418
+ out2[o + 2] = q2(b);
9419
+ out2[o + 3] = q2(alpha(i));
9420
+ }
9421
+ return out2;
9422
+ }
9423
+ const out = new Float32Array(n * 4);
9424
+ for (let i = 0, o = 0; i < n; i++, o += 4) {
9425
+ let r;
9426
+ let g;
9427
+ let b;
9428
+ if (isLab) {
9429
+ [r, g, b] = labToSrgb(planes[0](i) * 100, planes[1](i) * 255 - 128, planes[2](i) * 255 - 128).map(srgbToLinear);
9430
+ } else if (cmyk) {
9431
+ const k = planes[3] ? planes[3](i) : 1;
9432
+ r = planes[0](i) * k;
9433
+ g = planes[1](i) * k;
9434
+ b = planes[2](i) * k;
9435
+ } else if (mode === MODE_RGB || mode === MODE_MULTICHANNEL) {
9436
+ r = planes[0](i);
9437
+ g = planes[1] ? planes[1](i) : r;
9438
+ b = planes[2] ? planes[2](i) : r;
9439
+ } else r = g = b = planes[0](i);
9440
+ out[o] = r;
9441
+ out[o + 1] = g;
9442
+ out[o + 2] = b;
9443
+ out[o + 3] = clamp012(alpha(i));
9444
+ }
9445
+ return out;
9446
+ }
9447
+ function deepToPlanes(data, n) {
9448
+ const bytes = data instanceof Uint16Array ? 2 : 4;
9449
+ const planes = [0, 1, 2, 3].map(() => new Uint8Array(n * bytes));
9450
+ if (data instanceof Uint16Array) {
9451
+ for (let i = 0; i < n; i++) {
9452
+ for (let c = 0; c < 4; c++) {
9453
+ const v = data[i * 4 + c];
9454
+ planes[c][2 * i] = v >> 8;
9455
+ planes[c][2 * i + 1] = v & 255;
9456
+ }
9457
+ }
9458
+ } else {
9459
+ const views = planes.map((p) => new DataView(p.buffer));
9460
+ for (let i = 0; i < n; i++) for (let c = 0; c < 4; c++) views[c].setFloat32(4 * i, data[i * 4 + c], false);
9461
+ }
9462
+ return planes;
9463
+ }
9464
+ function planeAtDepth(plane, depth) {
9465
+ if (depth === 8) return plane;
9466
+ if (depth === 16) {
9467
+ const out2 = new Uint8Array(plane.length * 2);
9468
+ for (let i = 0; i < plane.length; i++) out2[2 * i] = out2[2 * i + 1] = plane[i];
9469
+ return out2;
9470
+ }
9471
+ const out = new Uint8Array(plane.length * 4);
9472
+ const view = new DataView(out.buffer);
9473
+ for (let i = 0; i < plane.length; i++) view.setFloat32(4 * i, plane[i] / 255, false);
9474
+ return out;
9475
+ }
9556
9476
  function toMask8(plane, width, height, depth) {
9557
9477
  if (depth === 8) return new Uint8ClampedArray(plane.buffer, plane.byteOffset, width * height);
9558
9478
  const s = sampler(plane, depth, width, false, 0);
@@ -9587,6 +9507,16 @@ function matteWhite(data) {
9587
9507
  }
9588
9508
  return out;
9589
9509
  }
9510
+ function matteWhiteDeep(data) {
9511
+ const out = data.slice();
9512
+ const one = out instanceof Uint16Array ? 65535 : 1;
9513
+ for (let i = 0; i < out.length; i += 4) {
9514
+ const a = Math.min(1, Math.max(0, out[i + 3] / one));
9515
+ if (a >= 1) continue;
9516
+ for (let c = 0; c < 3; c++) out[i + c] = out instanceof Uint16Array ? Math.round(out[i + c] * a + one * (1 - a)) : out[i + c] * a + one * (1 - a);
9517
+ }
9518
+ return out;
9519
+ }
9590
9520
 
9591
9521
  // src/image-editor/psd/patterns.ts
9592
9522
  var MAX_EDGE = 3e4;
@@ -9818,21 +9748,24 @@ function safeSize(ctx, rect, name) {
9818
9748
  }
9819
9749
  function recordPixels(ctx, rec, name) {
9820
9750
  const { width, height } = safeSize(ctx, rec.rect, name);
9821
- if (!width || !height || ctx.skipPixels) return _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4);
9751
+ if (!width || !height || ctx.skipPixels) return _chunkTFOPHZ3Ucjs.emptySurface.call(void 0, 4);
9822
9752
  const ids = [...Array.from({ length: ctx.colorCount }, (_, i) => i), CHANNEL_ALPHA];
9823
9753
  const planes = ids.map((id) => rec.channels.some((c) => c.id === id) ? _nullishCoalesce(decodeOr(ctx, rec, id, name), () => ( null)) : void 0);
9824
- if (planes.some((p) => p === null)) return _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4);
9825
- if (planes.every((p) => p === void 0)) return _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4);
9826
- const data = toRgba8({
9754
+ if (planes.some((p) => p === null)) return _chunkTFOPHZ3Ucjs.emptySurface.call(void 0, 4);
9755
+ if (planes.every((p) => p === void 0)) return _chunkTFOPHZ3Ucjs.emptySurface.call(void 0, 4);
9756
+ const set = {
9827
9757
  width,
9828
9758
  height,
9829
9759
  depth: ctx.file.header.depth,
9830
9760
  mode: ctx.file.header.colorMode,
9831
9761
  color: planes.slice(0, ctx.colorCount),
9832
9762
  alpha: planes[ctx.colorCount],
9833
- palette: ctx.palette
9834
- });
9835
- return _chunkXIOMMGPDcjs.surfaceFromPixels.call(void 0, { width, height, data }, 4, rec.rect.left, rec.rect.top);
9763
+ palette: ctx.palette,
9764
+ cmykToRgb: ctx.cmykToRgb
9765
+ };
9766
+ const deep = set.cmykToRgb ? null : toRgbaDeep(set);
9767
+ if (deep) return _chunkST7E3NEEcjs.surfaceFromDeepPixels.call(void 0, { width, height, data: deep }, 4, rec.rect.left, rec.rect.top);
9768
+ return _chunkTFOPHZ3Ucjs.surfaceFromPixels.call(void 0, { width, height, data: toRgba8(set) }, 4, rec.rect.left, rec.rect.top);
9836
9769
  }
9837
9770
  function recordMask(ctx, rec, name) {
9838
9771
  const m = rec.mask;
@@ -9843,11 +9776,11 @@ function recordMask(ctx, rec, name) {
9843
9776
  const rect = useReal ? m.real.rect : m.rect;
9844
9777
  const def = (useReal ? m.real.background : m.defaultColor) >= 128 ? 255 : 0;
9845
9778
  const flags = useReal ? m.real.flags : m.flags;
9846
- let surface = _chunkXIOMMGPDcjs.emptySurface.call(void 0, 1, def);
9779
+ let surface = _chunkTFOPHZ3Ucjs.emptySurface.call(void 0, 1, def);
9847
9780
  const { width, height } = safeSize(ctx, rect, name);
9848
9781
  if (width && height && !ctx.skipPixels) {
9849
9782
  const plane = decodeOr(ctx, rec, id, name);
9850
- if (plane) surface = _chunkXIOMMGPDcjs.surfaceFromPixels.call(void 0, { width, height, data: toMask8(plane, width, height, ctx.file.header.depth) }, 1, rect.left, rect.top, def);
9783
+ if (plane) surface = _chunkTFOPHZ3Ucjs.surfaceFromPixels.call(void 0, { width, height, data: toMask8(plane, width, height, ctx.file.header.depth) }, 1, rect.left, rect.top, def);
9851
9784
  }
9852
9785
  const mask = { surface, defaultValue: def };
9853
9786
  if (m.userDensity !== void 0 && m.userDensity < 255) mask.density = percent(m.userDensity);
@@ -9907,7 +9840,7 @@ function recordEffects(ctx, rec, name, notes, group) {
9907
9840
  }
9908
9841
  for (const e of parsed.effects.items) {
9909
9842
  for (const id of patternIds(e)) {
9910
- if (ctx.patterns.has(id) || _chunkPOGBUYWEcjs.builtinPattern.call(void 0, id)) continue;
9843
+ if (ctx.patterns.has(id) || _chunkST7E3NEEcjs.builtinPattern.call(void 0, id)) continue;
9911
9844
  ctx.warn.add("A pattern effect uses a pattern the file does not contain, and paints nothing", name);
9912
9845
  notes.push(`pattern "${id}" is not in the file`);
9913
9846
  }
@@ -9936,7 +9869,7 @@ function importNode(ctx, node, depth) {
9936
9869
  if (node.children) {
9937
9870
  const props2 = baseProps(ctx, rec, name, notes);
9938
9871
  const divider = sectionDivider(rec);
9939
- const key = _nullishCoalesce(_optionalChain([divider, 'optionalAccess', _244 => _244.blendKey]), () => ( rec.blendKey));
9872
+ const key = _nullishCoalesce(_optionalChain([divider, 'optionalAccess', _238 => _238.blendKey]), () => ( rec.blendKey));
9940
9873
  const groupBlend = key === "pass" ? "pass-through" : _nullishCoalesce(PSD_BLEND_KEYS[key], () => ( "normal"));
9941
9874
  const children = [];
9942
9875
  for (const child of node.children) {
@@ -9946,7 +9879,7 @@ function importNode(ctx, node, depth) {
9946
9879
  const group = { type: "group", id: ctx.newId(name), ...props2, blend: groupBlend, children };
9947
9880
  const effects2 = recordEffects(ctx, rec, name, notes, true);
9948
9881
  if (effects2) group.effects = effects2;
9949
- if (_optionalChain([divider, 'optionalAccess', _245 => _245.kind]) === SECTION_CLOSED) group.collapsed = true;
9882
+ if (_optionalChain([divider, 'optionalAccess', _239 => _239.kind]) === SECTION_CLOSED) group.collapsed = true;
9950
9883
  const mask2 = recordMask(ctx, rec, name);
9951
9884
  if (mask2) group.mask = mask2;
9952
9885
  entry.type = "group";
@@ -9986,7 +9919,7 @@ function importNode(ctx, node, depth) {
9986
9919
  if (!file || file.kind !== "liFD") notes.push("linked contents come in as the stored pixels");
9987
9920
  entry.type = "smart";
9988
9921
  entry.status = notes.length ? "approximated" : "mapped";
9989
- return { type: "pixel", id: ctx.newId(name), ...props, surface: _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4), offset: { x: 0, y: 0 } };
9922
+ return { type: "pixel", id: ctx.newId(name), ...props, surface: _chunkTFOPHZ3Ucjs.emptySurface.call(void 0, 4), offset: { x: 0, y: 0 } };
9990
9923
  }
9991
9924
  }
9992
9925
  if (kind === "smart-object" && !ctx.skipPixels) {
@@ -10049,7 +9982,7 @@ function importShape(ctx, rec, name, notes, props) {
10049
9982
  components: data.components,
10050
9983
  fill: data.fill,
10051
9984
  stroke: data.stroke,
10052
- surface: _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4),
9985
+ surface: _chunkTFOPHZ3Ucjs.emptySurface.call(void 0, 4),
10053
9986
  offset: { x: 0, y: 0 }
10054
9987
  };
10055
9988
  if (data.inverted) layer.inverted = true;
@@ -10117,8 +10050,8 @@ function contentsFor(ctx, placed, name, notes) {
10117
10050
  document: { layers: nested.layers, globalLight: nested.globalLight, patterns: nested.patterns.length ? nested.patterns : void 0 }
10118
10051
  };
10119
10052
  } else if (t.ext === "png") {
10120
- const png = _chunkPOGBUYWEcjs.decodePng.call(void 0, file.bytes);
10121
- out = { ...base, kind: "raster", width: png.width, height: png.height, raster: _chunkXIOMMGPDcjs.surfaceFromPixels.call(void 0, png, 4, 0, 0) };
10053
+ const png = _chunkST7E3NEEcjs.decodePng.call(void 0, file.bytes);
10054
+ out = { ...base, kind: "raster", width: png.width, height: png.height, raster: _chunkTFOPHZ3Ucjs.surfaceFromPixels.call(void 0, png, 4, 0, 0) };
10122
10055
  } else {
10123
10056
  const size = _nullishCoalesce(placed.size, () => ( { width: 0, height: 0 }));
10124
10057
  if (!(size.width > 0 && size.height > 0)) throw new PsdError("the contents have no stored size");
@@ -10159,7 +10092,7 @@ function importSmart(ctx, rec, name, notes, props) {
10159
10092
  if (placement && (size.width !== contents.width || size.height !== contents.height)) {
10160
10093
  const kx = contents.width / size.width;
10161
10094
  const ky = contents.height / size.height;
10162
- if (placement.warp) placement = { ...placement, warp: _chunkW3GXSUSQcjs.mapWarpMeshPoints.call(void 0, placement.warp, (p) => ({ x: p.x * kx, y: p.y * ky })) };
10095
+ if (placement.warp) placement = { ...placement, warp: _chunkLPLCWZTMcjs.mapWarpMeshPoints.call(void 0, placement.warp, (p) => ({ x: p.x * kx, y: p.y * ky })) };
10163
10096
  }
10164
10097
  }
10165
10098
  if (!contents || !placement) {
@@ -10169,11 +10102,11 @@ function importSmart(ctx, rec, name, notes, props) {
10169
10102
  const file = ctx.linked.get(placed.idnt);
10170
10103
  contents = {
10171
10104
  id: placed.idnt || ctx.newId(`${name}-contents`),
10172
- name: _optionalChain([file, 'optionalAccess', _246 => _246.name]) || `${name}.png`,
10105
+ name: _optionalChain([file, 'optionalAccess', _240 => _240.name]) || `${name}.png`,
10173
10106
  width,
10174
10107
  height,
10175
10108
  kind: "raster",
10176
- raster: _chunkXIOMMGPDcjs.translateSurface.call(void 0, surface, -rec.rect.left, -rec.rect.top)
10109
+ raster: _chunkTFOPHZ3Ucjs.translateSurface.call(void 0, surface, -rec.rect.left, -rec.rect.top)
10177
10110
  };
10178
10111
  if (file && file.kind !== "liFD") {
10179
10112
  contents.linked = { path: _nullishCoalesce(file.path, () => ( file.name)) };
@@ -10230,16 +10163,24 @@ function mergedLayer(ctx) {
10230
10163
  const plane = (i) => i < header.channels ? planes.subarray(i * size, (i + 1) * size) : void 0;
10231
10164
  const cc = ctx.colorCount;
10232
10165
  const hasAlpha = header.channels > cc && (ctx.file.layers.length === 0 || ctx.file.mergedAlpha);
10233
- const data = toRgba8({
10166
+ const set = {
10234
10167
  width,
10235
10168
  height,
10236
10169
  depth: header.depth,
10237
10170
  mode: header.colorMode,
10238
10171
  color: Array.from({ length: cc }, (_, i) => plane(i)),
10239
10172
  alpha: hasAlpha ? plane(cc) : void 0,
10240
- palette: ctx.palette
10241
- });
10242
- if (hasAlpha) unmatteWhite(data);
10173
+ palette: ctx.palette,
10174
+ cmykToRgb: ctx.cmykToRgb
10175
+ };
10176
+ const deep = hasAlpha || set.cmykToRgb ? null : toRgbaDeep(set);
10177
+ let surface;
10178
+ if (deep) surface = _chunkST7E3NEEcjs.surfaceFromDeepPixels.call(void 0, { width, height, data: deep }, 4);
10179
+ else {
10180
+ const data = toRgba8(set);
10181
+ if (hasAlpha) unmatteWhite(data);
10182
+ surface = _chunkTFOPHZ3Ucjs.surfaceFromPixels.call(void 0, { width, height, data }, 4);
10183
+ }
10243
10184
  return {
10244
10185
  type: "pixel",
10245
10186
  id: ctx.newId("Background"),
@@ -10247,7 +10188,7 @@ function mergedLayer(ctx) {
10247
10188
  visible: true,
10248
10189
  opacity: 1,
10249
10190
  blend: "normal",
10250
- surface: _chunkXIOMMGPDcjs.surfaceFromPixels.call(void 0, { width, height, data }, 4),
10191
+ surface,
10251
10192
  offset: { x: 0, y: 0 }
10252
10193
  };
10253
10194
  }
@@ -10270,6 +10211,28 @@ function psdToLayers(file, options = {}) {
10270
10211
  depth: _nullishCoalesce(options.depth, () => ( 0)),
10271
10212
  dpi: _nullishCoalesce(resolution(file), () => ( 72))
10272
10213
  };
10214
+ let cmykProfile = null;
10215
+ if (header.colorMode === MODE_CMYK && !ctx.skipPixels) {
10216
+ const icc = resource(file, 1039);
10217
+ let src = null;
10218
+ if (icc) {
10219
+ try {
10220
+ const p = _chunkG5NMLUVFcjs.parseProfile.call(void 0, icc);
10221
+ if (p.colorSpace === "cmyk") {
10222
+ src = p;
10223
+ cmykProfile = { name: p.description || "Embedded CMYK profile", icc: icc.slice() };
10224
+ } else warn.extra.push(`The CMYK file embeds a ${p.colorSpace.toUpperCase()} profile; the default coated CMYK profile was used.`);
10225
+ } catch (e) {
10226
+ warn.extra.push(`The CMYK profile could not be read (${e instanceof Error ? e.message : String(e)}); the default coated CMYK profile was used.`);
10227
+ }
10228
+ }
10229
+ if (!src) {
10230
+ src = _chunkG5NMLUVFcjs.builtinProfile.call(void 0, "coated-cmyk");
10231
+ cmykProfile = { builtin: "coated-cmyk", name: src.description };
10232
+ }
10233
+ const t = _chunkG5NMLUVFcjs.Transform.create(src, _chunkG5NMLUVFcjs.srgbProfile.call(void 0, ), { intent: "relative", bpc: true });
10234
+ ctx.cmykToRgb = (ink, out) => t.convert8(ink, 4, out, 4, false);
10235
+ }
10273
10236
  for (const block of file.globalBlocks) {
10274
10237
  if (LINKED_FILE_KEYS.includes(block.key)) {
10275
10238
  for (const f of parseLinkedFiles(block.data)) if (!ctx.linked.has(f.uuid)) ctx.linked.set(f.uuid, f);
@@ -10291,10 +10254,12 @@ function psdToLayers(file, options = {}) {
10291
10254
  }
10292
10255
  }
10293
10256
  const mode = _nullishCoalesce(COLOR_MODES[header.colorMode], () => ( `mode ${header.colorMode}`));
10294
- if (mode !== "rgb" || header.depth !== 8) {
10295
- warn.extra.push(`The file is ${header.depth}-bit ${mode}; it was converted to 8-bit RGB.`);
10257
+ if (mode !== "rgb" && header.depth > 8 && header.colorMode !== MODE_INDEXED && header.colorMode !== MODE_BITMAP) {
10258
+ warn.extra.push(`The file is ${header.depth}-bit ${mode}; it was converted to ${header.depth}-bit RGB.`);
10259
+ } else if (mode !== "rgb" || header.depth !== 8 && header.depth !== 16 && header.depth !== 32) {
10260
+ const how = header.colorMode === MODE_CMYK ? ` through ${_nullishCoalesce(_optionalChain([cmykProfile, 'optionalAccess', _241 => _241.name]), () => ( "its profile"))}` : "";
10261
+ warn.extra.push(`The file is ${header.depth}-bit ${mode}; it was converted to 8-bit RGB${how}.`);
10296
10262
  }
10297
- if (resource(file, 1039)) warn.extra.push("The embedded ICC profile is ignored; colours are read as sRGB.");
10298
10263
  let layers = [];
10299
10264
  if (file.layers.length) {
10300
10265
  const tree = layerTree(file);
@@ -10327,7 +10292,10 @@ function psdToLayers(file, options = {}) {
10327
10292
  resolution: resolution(file),
10328
10293
  patterns: [...ctx.patterns.values()],
10329
10294
  ...angle !== void 0 || altitude !== void 0 ? { globalLight: { angle: Math.max(-360, Math.min(360, _nullishCoalesce(angle, () => ( 120)))), altitude: Math.max(0, Math.min(90, _nullishCoalesce(altitude, () => ( 30)))) } } : {},
10330
- info: { psb: header.psb, depth: header.depth, colorMode: mode, channels: header.channels }
10295
+ info: { psb: header.psb, depth: header.depth, colorMode: mode, channels: header.channels },
10296
+ ...cmykProfile ? { sourceMode: { mode: "cmyk", profile: cmykProfile } } : header.colorMode === MODE_LAB ? { sourceMode: { mode: "lab" } } : {},
10297
+ ...resource(file, 1039) ? { iccProfile: resource(file, 1039).slice() } : {},
10298
+ bitDepth: (header.depth === 16 || header.depth === 32) && header.colorMode !== MODE_INDEXED && header.colorMode !== MODE_BITMAP ? header.depth : 8
10331
10299
  };
10332
10300
  }
10333
10301
  function importPsd(bytes, options = {}) {
@@ -10395,15 +10363,15 @@ var pct = (d, key, fallback) => num3(d, key, fallback * 100) / 100;
10395
10363
  var bool = (d, key) => descBool(d, key) === true;
10396
10364
  var enumOf3 = (d, key) => {
10397
10365
  const v = descGet(d, key);
10398
- return _optionalChain([v, 'optionalAccess', _247 => _247.type]) === "enum" ? v.value : void 0;
10366
+ return _optionalChain([v, 'optionalAccess', _242 => _242.type]) === "enum" ? v.value : void 0;
10399
10367
  };
10400
10368
  var text2 = (d, key) => {
10401
10369
  const v = d ? descGet(d, key) : void 0;
10402
- return _optionalChain([v, 'optionalAccess', _248 => _248.type]) === "TEXT" ? v.value : "";
10370
+ return _optionalChain([v, 'optionalAccess', _243 => _243.type]) === "TEXT" ? v.value : "";
10403
10371
  };
10404
10372
  var list = (d, key) => {
10405
10373
  const v = descGet(d, key);
10406
- if (_optionalChain([v, 'optionalAccess', _249 => _249.type]) !== "VlLs") return [];
10374
+ if (_optionalChain([v, 'optionalAccess', _244 => _244.type]) !== "VlLs") return [];
10407
10375
  return v.items.flatMap((it) => it.type === "Objc" || it.type === "GlbO" ? [it.value] : []);
10408
10376
  };
10409
10377
  var clamp3 = (v, lo, hi) => Number.isFinite(v) ? Math.min(hi, Math.max(lo, v)) : lo;
@@ -10425,34 +10393,34 @@ function blendOf(d, key, fallback, notes) {
10425
10393
  function colorOf(d, fallback = "#000000") {
10426
10394
  if (!d) return fallback;
10427
10395
  const g = (k) => descNumber(d, k);
10428
- if (g("redFloat") !== void 0) return _chunkPOGBUYWEcjs.effectColorHex.call(void 0, [g("redFloat"), _nullishCoalesce(g("greenFloat"), () => ( 0)), _nullishCoalesce(g("blueFloat"), () => ( 0))]);
10396
+ if (g("redFloat") !== void 0) return _chunkST7E3NEEcjs.effectColorHex.call(void 0, [g("redFloat"), _nullishCoalesce(g("greenFloat"), () => ( 0)), _nullishCoalesce(g("blueFloat"), () => ( 0))]);
10429
10397
  switch (d.classId) {
10430
10398
  case "HSBC": {
10431
10399
  const rgb = decodePsdColor(1, [(_nullishCoalesce(g("H "), () => ( 0))) / 360 * 65535, (_nullishCoalesce(g("Strt"), () => ( 0))) / 100 * 65535, (_nullishCoalesce(g("Brgh"), () => ( 0))) / 100 * 65535]);
10432
- return rgb ? _chunkPOGBUYWEcjs.effectColorHex.call(void 0, rgb) : fallback;
10400
+ return rgb ? _chunkST7E3NEEcjs.effectColorHex.call(void 0, rgb) : fallback;
10433
10401
  }
10434
10402
  case "CMYC": {
10435
10403
  const inv = (k) => (1 - (_nullishCoalesce(g(k), () => ( 0))) / 100) * 65535;
10436
10404
  const rgb = decodePsdColor(2, [inv("Cyn "), inv("Mgnt"), inv("Ylw "), inv("Blck")]);
10437
- return rgb ? _chunkPOGBUYWEcjs.effectColorHex.call(void 0, rgb) : fallback;
10405
+ return rgb ? _chunkST7E3NEEcjs.effectColorHex.call(void 0, rgb) : fallback;
10438
10406
  }
10439
10407
  case "LbCl": {
10440
10408
  const rgb = decodePsdColor(7, [(_nullishCoalesce(g("Lmnc"), () => ( 0))) * 100, Math.round((_nullishCoalesce(g("A "), () => ( 0))) * 100) & 65535, Math.round((_nullishCoalesce(g("B "), () => ( 0))) * 100) & 65535]);
10441
- return rgb ? _chunkPOGBUYWEcjs.effectColorHex.call(void 0, rgb) : fallback;
10409
+ return rgb ? _chunkST7E3NEEcjs.effectColorHex.call(void 0, rgb) : fallback;
10442
10410
  }
10443
10411
  case "Grsc": {
10444
10412
  const v = 1 - (_nullishCoalesce(g("Gry "), () => ( 0))) / 100;
10445
- return _chunkPOGBUYWEcjs.effectColorHex.call(void 0, [v, v, v]);
10413
+ return _chunkST7E3NEEcjs.effectColorHex.call(void 0, [v, v, v]);
10446
10414
  }
10447
10415
  }
10448
10416
  const r = g("Rd ");
10449
10417
  const gr = g("Grn ");
10450
10418
  const b = g("Bl ");
10451
10419
  if (r === void 0 || gr === void 0 || b === void 0) return fallback;
10452
- return _chunkPOGBUYWEcjs.effectColorHex.call(void 0, [r / 255, gr / 255, b / 255]);
10420
+ return _chunkST7E3NEEcjs.effectColorHex.call(void 0, [r / 255, gr / 255, b / 255]);
10453
10421
  }
10454
10422
  function colorDesc(hex) {
10455
- const [r, g, b] = _nullishCoalesce(_chunkPOGBUYWEcjs.parseEffectColor.call(void 0, hex), () => ( [0, 0, 0]));
10423
+ const [r, g, b] = _nullishCoalesce(_chunkST7E3NEEcjs.parseEffectColor.call(void 0, hex), () => ( [0, 0, 0]));
10456
10424
  return descriptor("RGBC", [
10457
10425
  ["Rd ", dbl3(r * 255)],
10458
10426
  ["Grn ", dbl3(g * 255)],
@@ -10473,8 +10441,8 @@ function contourOf(d, key) {
10473
10441
  return { name, points };
10474
10442
  }
10475
10443
  function contourDesc(c) {
10476
- const name = _nullishCoalesce(_optionalChain([c, 'optionalAccess', _250 => _250.name]), () => ( "Linear"));
10477
- const points = _nullishCoalesce(_optionalChain([c, 'optionalAccess', _251 => _251.points]), () => ( [
10444
+ const name = _nullishCoalesce(_optionalChain([c, 'optionalAccess', _245 => _245.name]), () => ( "Linear"));
10445
+ const points = _nullishCoalesce(_optionalChain([c, 'optionalAccess', _246 => _246.points]), () => ( [
10478
10446
  { input: 0, output: 0 },
10479
10447
  { input: 1, output: 1 }
10480
10448
  ]));
@@ -10509,7 +10477,7 @@ function gradientOf(d, notes) {
10509
10477
  { position: 0, color: "#000000" },
10510
10478
  { position: 1, color: "#ffffff" }
10511
10479
  ],
10512
- style: _nullishCoalesce(_optionalChain([GRADIENT_STYLES, 'access', _252 => _252.find, 'call', _253 => _253(([, id]) => id === enumOf3(d, "Type")), 'optionalAccess', _254 => _254[0]]), () => ( "linear")),
10480
+ style: _nullishCoalesce(_optionalChain([GRADIENT_STYLES, 'access', _247 => _247.find, 'call', _248 => _248(([, id]) => id === enumOf3(d, "Type")), 'optionalAccess', _249 => _249[0]]), () => ( "linear")),
10513
10481
  angle: clamp3(num3(d, "Angl", 90), -360, 360),
10514
10482
  scale: clamp3(pct(d, "Scl ", 1), 0.1, 1.5),
10515
10483
  reverse: bool(d, "Rvrs"),
@@ -10535,9 +10503,9 @@ function gradientOf(d, notes) {
10535
10503
  raw.forEach((s, i) => {
10536
10504
  if (i > 0 && Math.abs(s.mid - 0.5) > 1e-3) {
10537
10505
  const a = raw[i - 1];
10538
- const ca = _chunkPOGBUYWEcjs.parseEffectColor.call(void 0, a.color);
10539
- const cb = _chunkPOGBUYWEcjs.parseEffectColor.call(void 0, s.color);
10540
- stops.push({ position: a.position + (s.position - a.position) * s.mid, color: _chunkPOGBUYWEcjs.effectColorHex.call(void 0, ca.map((v, k) => (v + cb[k]) / 2)) });
10506
+ const ca = _chunkST7E3NEEcjs.parseEffectColor.call(void 0, a.color);
10507
+ const cb = _chunkST7E3NEEcjs.parseEffectColor.call(void 0, s.color);
10508
+ stops.push({ position: a.position + (s.position - a.position) * s.mid, color: _chunkST7E3NEEcjs.effectColorHex.call(void 0, ca.map((v, k) => (v + cb[k]) / 2)) });
10541
10509
  notes.add("gradient midpoints are drawn as straight segments");
10542
10510
  }
10543
10511
  stops.push({ position: s.position, color: s.color });
@@ -10563,7 +10531,7 @@ function gradientItems(g) {
10563
10531
  )
10564
10532
  )
10565
10533
  };
10566
- const op = _optionalChain([g, 'access', _255 => _255.opacityStops, 'optionalAccess', _256 => _256.length]) ? g.opacityStops : g.stops.map((s) => ({ position: s.position, opacity: 1 }));
10534
+ const op = _optionalChain([g, 'access', _250 => _250.opacityStops, 'optionalAccess', _251 => _251.length]) ? g.opacityStops : g.stops.map((s) => ({ position: s.position, opacity: 1 }));
10567
10535
  const trns = {
10568
10536
  type: "VlLs",
10569
10537
  items: op.map(
@@ -10649,8 +10617,8 @@ var KINDS = [
10649
10617
  ["FrFX", "frameFXMulti", "stroke"]
10650
10618
  ];
10651
10619
  function common(d, kind, notes) {
10652
- const def = _chunkPOGBUYWEcjs.defaultLayerEffect.call(void 0, kind, "x");
10653
- return { id: _chunkPOGBUYWEcjs.newEffectId.call(void 0, ), enabled: descBool(d, "enab") !== false, blend: blendOf(d, "Md ", def.blend, notes), opacity: clamp3(pct(d, "Opct", def.opacity), 0, 1) };
10620
+ const def = _chunkST7E3NEEcjs.defaultLayerEffect.call(void 0, kind, "x");
10621
+ return { id: _chunkST7E3NEEcjs.newEffectId.call(void 0, ), enabled: descBool(d, "enab") !== false, blend: blendOf(d, "Md ", def.blend, notes), opacity: clamp3(pct(d, "Opct", def.opacity), 0, 1) };
10654
10622
  }
10655
10623
  function readOne(kind, d, notes) {
10656
10624
  const size = (key, fallback) => clamp3(num3(d, key, fallback), 0, 250);
@@ -10693,7 +10661,7 @@ function readOne(kind, d, notes) {
10693
10661
  case "bevel-emboss": {
10694
10662
  const styles = { OtrB: "outer-bevel", InrB: "inner-bevel", Embs: "emboss", PlEb: "pillow-emboss", strokeEmboss: "stroke-emboss" };
10695
10663
  const out = {
10696
- id: _chunkPOGBUYWEcjs.newEffectId.call(void 0, ),
10664
+ id: _chunkST7E3NEEcjs.newEffectId.call(void 0, ),
10697
10665
  enabled: descBool(d, "enab") !== false,
10698
10666
  kind,
10699
10667
  style: _nullishCoalesce(styles[_nullishCoalesce(enumOf3(d, "bvlS"), () => ( ""))], () => ( "inner-bevel")),
@@ -10759,7 +10727,7 @@ function parseLfx2(data) {
10759
10727
  let d;
10760
10728
  try {
10761
10729
  d = parseVersionedDescriptor(data.subarray(4));
10762
- } catch (e25) {
10730
+ } catch (e26) {
10763
10731
  return null;
10764
10732
  }
10765
10733
  const notes = /* @__PURE__ */ new Set();
@@ -10904,10 +10872,10 @@ function writeLfx2(effects) {
10904
10872
  ["Scl ", unit3("#Prc", 100)],
10905
10873
  ["masterFXSwitch", boolV3(effects.enabled)]
10906
10874
  ];
10907
- const scale = _chunkPOGBUYWEcjs.effectsScale.call(void 0, effects);
10875
+ const scale = _chunkST7E3NEEcjs.effectsScale.call(void 0, effects);
10908
10876
  let dropped = 0;
10909
10877
  for (const [single, multi, kind] of KINDS) {
10910
- const of = effects.items.filter((e) => e.kind === kind).map((e) => writeOne(_chunkPOGBUYWEcjs.scaleLayerEffect.call(void 0, e, scale)));
10878
+ const of = effects.items.filter((e) => e.kind === kind).map((e) => writeOne(_chunkST7E3NEEcjs.scaleLayerEffect.call(void 0, e, scale)));
10911
10879
  if (!of.length) continue;
10912
10880
  if (of.length === 1) items.push([single, obj3(of[0])]);
10913
10881
  else if (multi) items.push([multi, { type: "VlLs", items: of.map(obj3) }]);
@@ -10939,7 +10907,7 @@ function parseLrfx(data) {
10939
10907
  const colorAt = (rd) => {
10940
10908
  rd.u16();
10941
10909
  const c = [rd.u16(), rd.u16(), rd.u16(), rd.u16()];
10942
- return _chunkPOGBUYWEcjs.effectColorHex.call(void 0, [c[0] >> 8, c[1] >> 8, c[2] >> 8].map((v) => v / 255));
10910
+ return _chunkST7E3NEEcjs.effectColorHex.call(void 0, [c[0] >> 8, c[1] >> 8, c[2] >> 8].map((v) => v / 255));
10943
10911
  };
10944
10912
  const blendAt = (rd) => {
10945
10913
  rd.skip(4);
@@ -10958,7 +10926,7 @@ function parseLrfx(data) {
10958
10926
  const enabled = b.u8() !== 0;
10959
10927
  const useGlobalLight = b.u8() !== 0;
10960
10928
  const opacity = b.u8() / 255;
10961
- const base = { id: _chunkPOGBUYWEcjs.newEffectId.call(void 0, ), enabled, blend, opacity, color, angle, useGlobalLight, distance: clamp3(distance, 0, 3e4), size: clamp3(blur, 0, 250), antiAlias: false, noise: 0 };
10929
+ const base = { id: _chunkST7E3NEEcjs.newEffectId.call(void 0, ), enabled, blend, opacity, color, angle, useGlobalLight, distance: clamp3(distance, 0, 3e4), size: clamp3(blur, 0, 250), antiAlias: false, noise: 0 };
10962
10930
  items.push(key === "dsdw" ? { ...base, kind: "drop-shadow", spread: 0, knocksOut: true } : { ...base, kind: "inner-shadow", choke: 0 });
10963
10931
  } else if (key === "oglw" || key === "iglw") {
10964
10932
  b.u32();
@@ -10968,7 +10936,7 @@ function parseLrfx(data) {
10968
10936
  const blend = blendAt(b);
10969
10937
  const enabled = b.u8() !== 0;
10970
10938
  const opacity = b.u8() / 255;
10971
- const base = { id: _chunkPOGBUYWEcjs.newEffectId.call(void 0, ), enabled, blend, opacity, fill: { type: "color", color }, technique: "softer", size: clamp3(blur, 0, 250), antiAlias: false, range: 0.5, jitter: 0, noise: 0 };
10939
+ const base = { id: _chunkST7E3NEEcjs.newEffectId.call(void 0, ), enabled, blend, opacity, fill: { type: "color", color }, technique: "softer", size: clamp3(blur, 0, 250), antiAlias: false, range: 0.5, jitter: 0, noise: 0 };
10972
10940
  items.push(key === "oglw" ? { ...base, kind: "outer-glow", spread: 0 } : { ...base, kind: "inner-glow", choke: 0, source: "edge" });
10973
10941
  } else if (key === "sofi") {
10974
10942
  b.u32();
@@ -10976,11 +10944,11 @@ function parseLrfx(data) {
10976
10944
  const color = colorAt(b);
10977
10945
  const opacity = b.u8() / 255;
10978
10946
  const enabled = b.u8() !== 0;
10979
- items.push({ id: _chunkPOGBUYWEcjs.newEffectId.call(void 0, ), kind: "color-overlay", enabled, blend, opacity, color });
10947
+ items.push({ id: _chunkST7E3NEEcjs.newEffectId.call(void 0, ), kind: "color-overlay", enabled, blend, opacity, color });
10980
10948
  } else if (key === "bevl") notes.add("legacy bevels are not read");
10981
10949
  }
10982
10950
  return { effects: { enabled: true, items }, notes: [...notes] };
10983
- } catch (e26) {
10951
+ } catch (e27) {
10984
10952
  return null;
10985
10953
  }
10986
10954
  }
@@ -11020,22 +10988,30 @@ function sectionBlock(kind, blendKey) {
11020
10988
  return w.result();
11021
10989
  }
11022
10990
  var toRect = (r) => ({ top: r.y, left: r.x, bottom: r.y + r.height, right: r.x + r.width });
11023
- function rleChannel(id, plane, width, height, psb) {
11024
- return { id, compression: 1, data: encodeRle(plane, { planes: 1, width, height, depth: 8, psb }) };
10991
+ function rleChannel(id, plane, width, height, psb, depth = 8) {
10992
+ const layout = { planes: 1, width, height, depth, psb };
10993
+ if (depth === 32) return { id, compression: 3, data: encodeZipPredicted(plane, layout) };
10994
+ return { id, compression: 1, data: encodeRle(plane, layout) };
10995
+ }
10996
+ function surfacePlanes(surface, bounds, depth) {
10997
+ const n = bounds.width * bounds.height;
10998
+ if (depth === 8) return rgbaToPlanes(_chunkTFOPHZ3Ucjs.readRegion.call(void 0, surface, bounds), n);
10999
+ return deepToPlanes(_chunkST7E3NEEcjs.readDeepRegion.call(void 0, surface, bounds, depth), n);
11025
11000
  }
11026
11001
  var emptyChannel = (id) => ({ id, compression: 0, data: new Uint8Array(0) });
11027
- function maskChannel(mask, ox, oy, psb) {
11002
+ function maskChannel(mask, ox, oy, psb, depth = 8) {
11028
11003
  if (mask.source) throw new PsdError("A parametric mask must be baked before export.");
11029
- const bounds = _chunkXIOMMGPDcjs.contentBounds.call(void 0, mask.surface);
11004
+ const bounds = _chunkTFOPHZ3Ucjs.contentBounds.call(void 0, mask.surface);
11030
11005
  const def = mask.defaultValue;
11031
11006
  const flags = (mask.enabled === false ? MASK_FLAG_DISABLED : 0) | (mask.linked === false ? MASK_FLAG_UNLINKED : 0);
11032
11007
  const m = { rect: EMPTY_RECT, defaultColor: def, flags };
11033
11008
  if ((_nullishCoalesce(mask.density, () => ( 1))) < 1) m.userDensity = Math.round(Math.max(0, _nullishCoalesce(mask.density, () => ( 1))) * 255);
11034
11009
  if ((_nullishCoalesce(mask.feather, () => ( 0))) > 0) m.userFeather = mask.feather;
11035
11010
  if (!bounds) return { channel: emptyChannel(CHANNEL_USER_MASK), mask: m };
11036
- const plane = _chunkXIOMMGPDcjs.readRegion.call(void 0, mask.surface, bounds);
11011
+ const plane = _chunkTFOPHZ3Ucjs.readRegion.call(void 0, mask.surface, bounds);
11037
11012
  m.rect = toRect({ ...bounds, x: bounds.x + ox, y: bounds.y + oy });
11038
- return { channel: rleChannel(CHANNEL_USER_MASK, new Uint8Array(plane.buffer, plane.byteOffset, plane.length), bounds.width, bounds.height, psb), mask: m };
11013
+ const bytes = planeAtDepth(new Uint8Array(plane.buffer, plane.byteOffset, plane.length), depth);
11014
+ return { channel: rleChannel(CHANNEL_USER_MASK, bytes, bounds.width, bounds.height, psb, depth), mask: m };
11039
11015
  }
11040
11016
  function lockBits(layer) {
11041
11017
  const l = layer.locks;
@@ -11048,9 +11024,9 @@ function prepareNestedLayers(layers) {
11048
11024
  if (l.type === "annotation") continue;
11049
11025
  let next = l;
11050
11026
  if (l.type === "group") next = { ...l, children: prepareNestedLayers(l.children) };
11051
- else if (l.type === "pixel" && (_optionalChain([l, 'access', _257 => _257.filters, 'optionalAccess', _258 => _258.length]) || l.source === "document")) {
11027
+ else if (l.type === "pixel" && (_optionalChain([l, 'access', _252 => _252.filters, 'optionalAccess', _253 => _253.length]) || l.source === "document")) {
11052
11028
  const p = { ...l };
11053
- if (_optionalChain([l, 'access', _259 => _259.filters, 'optionalAccess', _260 => _260.some, 'call', _261 => _261(isActiveFilter)])) {
11029
+ if (_optionalChain([l, 'access', _254 => _254.filters, 'optionalAccess', _255 => _255.some, 'call', _256 => _256(isActiveFilter)])) {
11054
11030
  const b = l.surface.bounds;
11055
11031
  if (b) {
11056
11032
  const r = { x: b.x + l.offset.x - 64, y: b.y + l.offset.y - 64, width: b.width + 128, height: b.height + 128 };
@@ -11060,14 +11036,14 @@ function prepareNestedLayers(layers) {
11060
11036
  delete plain.effects;
11061
11037
  delete plain.fillOpacity;
11062
11038
  const data = new LayerCompositor().composite([plain], r, { width: r.x + r.width, height: r.y + r.height });
11063
- p.surface = _chunkXIOMMGPDcjs.surfaceFromPixels.call(void 0, { width: r.width, height: r.height, data }, 4, r.x - l.offset.x, r.y - l.offset.y);
11039
+ p.surface = _chunkTFOPHZ3Ucjs.surfaceFromPixels.call(void 0, { width: r.width, height: r.height, data }, 4, r.x - l.offset.x, r.y - l.offset.y);
11064
11040
  }
11065
11041
  }
11066
11042
  delete p.filters;
11067
11043
  delete p.source;
11068
11044
  next = p;
11069
11045
  }
11070
- if (_optionalChain([next, 'access', _262 => _262.mask, 'optionalAccess', _263 => _263.source])) {
11046
+ if (_optionalChain([next, 'access', _257 => _257.mask, 'optionalAccess', _258 => _258.source])) {
11071
11047
  next = { ...next };
11072
11048
  delete next.mask;
11073
11049
  }
@@ -11079,11 +11055,11 @@ function smartContentsFile(c) {
11079
11055
  const base = c.name.replace(/\.\w+$/, "") || "Contents";
11080
11056
  if (c.file) return { name: c.name, bytes: c.file.bytes };
11081
11057
  if (c.kind === "raster") {
11082
- const data = _chunkXIOMMGPDcjs.readRegion.call(void 0, contentsSurface(c), { x: 0, y: 0, width: c.width, height: c.height });
11083
- return { name: `${base}.png`, bytes: _chunkPOGBUYWEcjs.encodePng.call(void 0, c.width, c.height, data) };
11058
+ const data = _chunkTFOPHZ3Ucjs.readRegion.call(void 0, contentsSurface(c), { x: 0, y: 0, width: c.width, height: c.height });
11059
+ return { name: `${base}.png`, bytes: _chunkST7E3NEEcjs.encodePng.call(void 0, c.width, c.height, data) };
11084
11060
  }
11085
11061
  const doc = c.document;
11086
- const merged2 = _chunkXIOMMGPDcjs.readRegion.call(void 0, contentsSurface(c), { x: 0, y: 0, width: c.width, height: c.height });
11062
+ const merged2 = _chunkTFOPHZ3Ucjs.readRegion.call(void 0, contentsSurface(c), { x: 0, y: 0, width: c.width, height: c.height });
11087
11063
  const res = exportPsd({ width: c.width, height: c.height, layers: prepareNestedLayers(doc.layers), merged: merged2, patterns: doc.patterns, globalLight: doc.globalLight });
11088
11064
  return { name: `${base}.${res.psb ? "psb" : "psd"}`, bytes: res.bytes };
11089
11065
  }
@@ -11114,7 +11090,23 @@ function placedUnchanged(layer, idnt, placedId) {
11114
11090
  }
11115
11091
  function exportPsd(input) {
11116
11092
  const { width, height } = input;
11093
+ const depth = _nullishCoalesce(input.depth, () => ( 8));
11117
11094
  if (width < 1 || height < 1) throw new PsdError("The document is empty.");
11095
+ const mode = _nullishCoalesce(input.colorMode, () => ( "rgb"));
11096
+ if (mode !== "rgb" && !input.colorPlanes) throw new PsdError(`A ${mode.toUpperCase()} file needs colorPlanes to convert the pixels.`);
11097
+ if (mode !== "rgb" && depth !== 8) throw new PsdError(`${mode.toUpperCase()} files are written at 8 bits per channel.`);
11098
+ const colorIds = mode === "cmyk" ? [0, 1, 2, 3] : [0, 1, 2];
11099
+ const colorPlanes = (rgba, n2) => mode === "rgb" ? rgbaToPlanes(rgba, n2).slice(0, 3) : input.colorPlanes(rgba, n2);
11100
+ const pixelChannels = (rgba, w, h) => {
11101
+ const n2 = w * h;
11102
+ const alpha = rgbaToPlanes(rgba, n2)[3];
11103
+ return [rleChannel(CHANNEL_ALPHA, alpha, w, h, psb), ...colorPlanes(rgba, n2).map((p, i) => rleChannel(i, p, w, h, psb))];
11104
+ };
11105
+ const surfaceChannels = (surface, bounds) => {
11106
+ if (mode !== "rgb") return pixelChannels(_chunkTFOPHZ3Ucjs.readRegion.call(void 0, surface, bounds), bounds.width, bounds.height);
11107
+ const [r, g, b, a2] = surfacePlanes(surface, bounds, depth);
11108
+ return [CHANNEL_ALPHA, 0, 1, 2].map((id, i) => rleChannel(id, [a2, r, g, b][i], bounds.width, bounds.height, psb, depth));
11109
+ };
11118
11110
  const psb = width > PSD_MAX_DIMENSION || height > PSD_MAX_DIMENSION;
11119
11111
  const records = [];
11120
11112
  let nextId = 0;
@@ -11131,7 +11123,7 @@ function exportPsd(input) {
11131
11123
  const key = layer.type === "group" ? "lfxs" : "lfx2";
11132
11124
  if (fx.psd) {
11133
11125
  const original = parseLfx2(fx.psd.data);
11134
- if (original ? _chunkPOGBUYWEcjs.effectsFingerprint.call(void 0, original.effects) === _chunkPOGBUYWEcjs.effectsFingerprint.call(void 0, fx) : !fx.items.length) return { key, data: padEven(fx.psd.data) };
11126
+ if (original ? _chunkST7E3NEEcjs.effectsFingerprint.call(void 0, original.effects) === _chunkST7E3NEEcjs.effectsFingerprint.call(void 0, fx) : !fx.items.length) return { key, data: padEven(fx.psd.data) };
11135
11127
  }
11136
11128
  if (!fx.items.length && fx.enabled && (_nullishCoalesce(fx.scale, () => ( 1))) === 1) return null;
11137
11129
  const { data, dropped } = writeLfx2(fx);
@@ -11148,7 +11140,7 @@ function exportPsd(input) {
11148
11140
  return {
11149
11141
  opacity: Math.round(Math.min(1, Math.max(0, layer.opacity)) * 255),
11150
11142
  clipping: layer.clipped ? 1 : 0,
11151
- flags: (layer.visible ? 0 : LAYER_FLAG_HIDDEN) | (_optionalChain([layer, 'access', _264 => _264.locks, 'optionalAccess', _265 => _265.transparency]) ? LAYER_FLAG_TRANSPARENCY_PROTECTED : 0),
11143
+ flags: (layer.visible ? 0 : LAYER_FLAG_HIDDEN) | (_optionalChain([layer, 'access', _259 => _259.locks, 'optionalAccess', _260 => _260.transparency]) ? LAYER_FLAG_TRANSPARENCY_PROTECTED : 0),
11152
11144
  legacyName: name,
11153
11145
  blocks
11154
11146
  };
@@ -11158,7 +11150,7 @@ function exportPsd(input) {
11158
11150
  case "group": {
11159
11151
  records.push({
11160
11152
  rect: EMPTY_RECT,
11161
- channels: [CHANNEL_ALPHA, 0, 1, 2].map(emptyChannel),
11153
+ channels: [CHANNEL_ALPHA, ...colorIds].map(emptyChannel),
11162
11154
  blendKey: "norm",
11163
11155
  opacity: 255,
11164
11156
  clipping: 0,
@@ -11175,12 +11167,12 @@ function exportPsd(input) {
11175
11167
  const rec = {
11176
11168
  ...base,
11177
11169
  rect: EMPTY_RECT,
11178
- channels: [CHANNEL_ALPHA, 0, 1, 2].map(emptyChannel),
11170
+ channels: [CHANNEL_ALPHA, ...colorIds].map(emptyChannel),
11179
11171
  blendKey,
11180
11172
  flags: base.flags | FLAG_PIXELS_IRRELEVANT
11181
11173
  };
11182
11174
  if (layer.mask) {
11183
- const m = maskChannel(layer.mask, 0, 0, psb);
11175
+ const m = maskChannel(layer.mask, 0, 0, psb, depth);
11184
11176
  rec.channels.push(m.channel);
11185
11177
  rec.mask = m.mask;
11186
11178
  }
@@ -11192,11 +11184,11 @@ function exportPsd(input) {
11192
11184
  const rec = {
11193
11185
  ...common2(layer, [{ key: block.key, data: block.data }]),
11194
11186
  rect: EMPTY_RECT,
11195
- channels: [CHANNEL_ALPHA, 0, 1, 2].map(emptyChannel),
11187
+ channels: [CHANNEL_ALPHA, ...colorIds].map(emptyChannel),
11196
11188
  blendKey: _nullishCoalesce(BLEND_TO_PSD[layer.blend], () => ( "norm"))
11197
11189
  };
11198
11190
  if (layer.mask) {
11199
- const m = maskChannel(layer.mask, 0, 0, psb);
11191
+ const m = maskChannel(layer.mask, 0, 0, psb, depth);
11200
11192
  rec.channels.push(m.channel);
11201
11193
  rec.mask = m.mask;
11202
11194
  }
@@ -11205,28 +11197,21 @@ function exportPsd(input) {
11205
11197
  }
11206
11198
  case "pixel": {
11207
11199
  if (layer.source === "document") throw new PsdError(`Layer "${layer.name}" reads the document image; resolve its pixels before export.`);
11208
- if (_optionalChain([layer, 'access', _266 => _266.filters, 'optionalAccess', _267 => _267.some, 'call', _268 => _268(isActiveFilter)])) throw new PsdError(`Layer "${layer.name}" has live filters; bake them before export.`);
11200
+ if (_optionalChain([layer, 'access', _261 => _261.filters, 'optionalAccess', _262 => _262.some, 'call', _263 => _263(isActiveFilter)])) throw new PsdError(`Layer "${layer.name}" has live filters; bake them before export.`);
11209
11201
  const extra = [];
11210
11202
  if (layer.fillOpacity !== void 0 && layer.fillOpacity < 1) {
11211
11203
  extra.push({ key: "iOpa", data: Uint8Array.from([Math.round(Math.max(0, layer.fillOpacity) * 255), 0, 0, 0]) });
11212
11204
  }
11213
11205
  const rec = { ...common2(layer, extra), rect: EMPTY_RECT, channels: [], blendKey: _nullishCoalesce(BLEND_TO_PSD[layer.blend], () => ( "norm")) };
11214
- const bounds = _chunkXIOMMGPDcjs.contentBounds.call(void 0, layer.surface);
11206
+ const bounds = _chunkTFOPHZ3Ucjs.contentBounds.call(void 0, layer.surface);
11215
11207
  if (bounds) {
11216
- const n2 = bounds.width * bounds.height;
11217
- const [r2, g2, b2, a2] = rgbaToPlanes(_chunkXIOMMGPDcjs.readRegion.call(void 0, layer.surface, bounds), n2);
11218
11208
  rec.rect = toRect({ ...bounds, x: bounds.x + layer.offset.x, y: bounds.y + layer.offset.y });
11219
- rec.channels = [
11220
- rleChannel(CHANNEL_ALPHA, a2, bounds.width, bounds.height, psb),
11221
- rleChannel(0, r2, bounds.width, bounds.height, psb),
11222
- rleChannel(1, g2, bounds.width, bounds.height, psb),
11223
- rleChannel(2, b2, bounds.width, bounds.height, psb)
11224
- ];
11209
+ rec.channels = surfaceChannels(layer.surface, bounds);
11225
11210
  } else {
11226
- rec.channels = [CHANNEL_ALPHA, 0, 1, 2].map(emptyChannel);
11211
+ rec.channels = [CHANNEL_ALPHA, ...colorIds].map(emptyChannel);
11227
11212
  }
11228
11213
  if (layer.mask) {
11229
- const m = maskChannel(layer.mask, layer.offset.x, layer.offset.y, psb);
11214
+ const m = maskChannel(layer.mask, layer.offset.x, layer.offset.y, psb, depth);
11230
11215
  rec.channels.push(m.channel);
11231
11216
  rec.mask = m.mask;
11232
11217
  }
@@ -11244,7 +11229,7 @@ function exportPsd(input) {
11244
11229
  if (c.linked) note("Linked smart objects were embedded (their preview is written as the contents)", layer.name);
11245
11230
  linkedFiles.set(idnt, smartContentsFile(c));
11246
11231
  }
11247
- let placedId = _nullishCoalesce(_optionalChain([layer, 'access', _269 => _269.psd, 'optionalAccess', _270 => _270.placed]), () => ( psdUuid(`${layer.id}:placed`)));
11232
+ let placedId = _nullishCoalesce(_optionalChain([layer, 'access', _264 => _264.psd, 'optionalAccess', _265 => _265.placed]), () => ( psdUuid(`${layer.id}:placed`)));
11248
11233
  if (placedIds.has(placedId)) placedId = psdUuid(`${layer.id}:placed:${placedIds.size}`);
11249
11234
  placedIds.add(placedId);
11250
11235
  if (placedUnchanged(layer, idnt, placedId)) {
@@ -11254,30 +11239,23 @@ function exportPsd(input) {
11254
11239
  const filterFX = layer.smartFilters ? filterFXDescriptor(layer.smartFilters, dropped) : void 0;
11255
11240
  if (dropped.length) note("Develop smart filters have no Photoshop filter and were left out of the filter list (the layer\u2019s pixels still show them)", layer.name);
11256
11241
  const raw = layer.psd && layer.psd.key !== "PlLd" ? parsePlaced(layer.psd.key, layer.psd.data) : null;
11257
- const spec = { idnt, placed: placedId, placement: layer.placement, size: { width: c.width, height: c.height }, filterFX, template: _optionalChain([raw, 'optionalAccess', _271 => _271.descriptor]) };
11242
+ const spec = { idnt, placed: placedId, placement: layer.placement, size: { width: c.width, height: c.height }, filterFX, template: _optionalChain([raw, 'optionalAccess', _266 => _266.descriptor]) };
11258
11243
  const wnotes = [];
11259
11244
  extra.push({ key: "PlLd", data: plldBytes(spec) }, { key: "SoLd", data: soldBytes(spec, wnotes) });
11260
11245
  for (const n2 of wnotes) note(`A smart object: ${n2}`, layer.name);
11261
11246
  }
11262
- const fm = _optionalChain([layer, 'access', _272 => _272.smartFilters, 'optionalAccess', _273 => _273.mask]);
11247
+ const fm = _optionalChain([layer, 'access', _267 => _267.smartFilters, 'optionalAccess', _268 => _268.mask]);
11263
11248
  if (fm && !fm.source) filterItems.push(filterMaskItem(placedId, fm, { x: 0, y: 0, width, height }));
11264
11249
  const rec = { ...common2(layer, extra), rect: EMPTY_RECT, channels: [], blendKey: _nullishCoalesce(BLEND_TO_PSD[layer.blend], () => ( "norm")) };
11265
- const bounds = _chunkXIOMMGPDcjs.contentBounds.call(void 0, layer.surface);
11250
+ const bounds = _chunkTFOPHZ3Ucjs.contentBounds.call(void 0, layer.surface);
11266
11251
  if (bounds) {
11267
- const n2 = bounds.width * bounds.height;
11268
- const [r2, g2, b2, a2] = rgbaToPlanes(_chunkXIOMMGPDcjs.readRegion.call(void 0, layer.surface, bounds), n2);
11269
11252
  rec.rect = toRect(bounds);
11270
- rec.channels = [
11271
- rleChannel(CHANNEL_ALPHA, a2, bounds.width, bounds.height, psb),
11272
- rleChannel(0, r2, bounds.width, bounds.height, psb),
11273
- rleChannel(1, g2, bounds.width, bounds.height, psb),
11274
- rleChannel(2, b2, bounds.width, bounds.height, psb)
11275
- ];
11253
+ rec.channels = surfaceChannels(layer.surface, bounds);
11276
11254
  } else {
11277
- rec.channels = [CHANNEL_ALPHA, 0, 1, 2].map(emptyChannel);
11255
+ rec.channels = [CHANNEL_ALPHA, ...colorIds].map(emptyChannel);
11278
11256
  }
11279
11257
  if (layer.mask) {
11280
- const m = maskChannel(layer.mask, 0, 0, psb);
11258
+ const m = maskChannel(layer.mask, 0, 0, psb, depth);
11281
11259
  rec.channels.push(m.channel);
11282
11260
  rec.mask = m.mask;
11283
11261
  }
@@ -11292,30 +11270,23 @@ function exportPsd(input) {
11292
11270
  }
11293
11271
  if (layer.type === "shape") {
11294
11272
  const losses = /* @__PURE__ */ new Set();
11295
- for (const b2 of shapeBlocks(layer, width, height, _nullishCoalesce(input.resolution, () => ( 72)), losses)) extra.push({ key: b2.key, data: padEven(b2.data) });
11273
+ for (const b of shapeBlocks(layer, width, height, _nullishCoalesce(input.resolution, () => ( 72)), losses)) extra.push({ key: b.key, data: padEven(b.data) });
11296
11274
  for (const n2 of losses) note(n2, layer.name);
11297
- if (_optionalChain([layer, 'access', _274 => _274.fill, 'optionalAccess', _275 => _275.type]) === "pattern") patternIds2.add(layer.fill.patternId);
11298
- if (_optionalChain([layer, 'access', _276 => _276.stroke, 'optionalAccess', _277 => _277.paint, 'access', _278 => _278.type]) === "pattern") patternIds2.add(layer.stroke.paint.patternId);
11275
+ if (_optionalChain([layer, 'access', _269 => _269.fill, 'optionalAccess', _270 => _270.type]) === "pattern") patternIds2.add(layer.fill.patternId);
11276
+ if (_optionalChain([layer, 'access', _271 => _271.stroke, 'optionalAccess', _272 => _272.paint, 'access', _273 => _273.type]) === "pattern") patternIds2.add(layer.stroke.paint.patternId);
11299
11277
  } else {
11300
11278
  extra.push({ key: "TySh", data: padEven(tyShForLayer(layer)) });
11301
11279
  }
11302
11280
  const rec = { ...common2(layer, extra), rect: EMPTY_RECT, channels: [], blendKey: _nullishCoalesce(BLEND_TO_PSD[layer.blend], () => ( "norm")) };
11303
- const bounds = _chunkXIOMMGPDcjs.contentBounds.call(void 0, layer.surface);
11281
+ const bounds = _chunkTFOPHZ3Ucjs.contentBounds.call(void 0, layer.surface);
11304
11282
  if (bounds) {
11305
- const n2 = bounds.width * bounds.height;
11306
- const [r2, g2, b2, a2] = rgbaToPlanes(_chunkXIOMMGPDcjs.readRegion.call(void 0, layer.surface, bounds), n2);
11307
11283
  rec.rect = toRect(bounds);
11308
- rec.channels = [
11309
- rleChannel(CHANNEL_ALPHA, a2, bounds.width, bounds.height, psb),
11310
- rleChannel(0, r2, bounds.width, bounds.height, psb),
11311
- rleChannel(1, g2, bounds.width, bounds.height, psb),
11312
- rleChannel(2, b2, bounds.width, bounds.height, psb)
11313
- ];
11284
+ rec.channels = surfaceChannels(layer.surface, bounds);
11314
11285
  } else {
11315
- rec.channels = [CHANNEL_ALPHA, 0, 1, 2].map(emptyChannel);
11286
+ rec.channels = [CHANNEL_ALPHA, ...colorIds].map(emptyChannel);
11316
11287
  }
11317
11288
  if (layer.mask) {
11318
- const m = maskChannel(layer.mask, 0, 0, psb);
11289
+ const m = maskChannel(layer.mask, 0, 0, psb, depth);
11319
11290
  rec.channels.push(m.channel);
11320
11291
  rec.mask = m.mask;
11321
11292
  }
@@ -11330,11 +11301,18 @@ function exportPsd(input) {
11330
11301
  if (records.length > 32767) throw new PsdError("A PSD holds at most 32767 layer records.");
11331
11302
  const n = width * height;
11332
11303
  if (input.merged.length < n * 4) throw new PsdError(`The merged image has ${input.merged.length} bytes, expected ${n * 4}.`);
11333
- const [r, g, b, a] = rgbaToPlanes(matteWhite(input.merged), n);
11304
+ const matted = matteWhite(input.merged);
11305
+ const a = rgbaToPlanes(matted, n)[3];
11334
11306
  const transparent = a.some((v) => v !== 255);
11335
- const planes = transparent ? [r, g, b, a] : [r, g, b];
11336
- const merged2 = new Uint8Array(n * planes.length);
11337
- planes.forEach((p, i) => merged2.set(p, i * n));
11307
+ let planes = [...colorPlanes(matted, n), ...transparent ? [a] : []].map((p) => planeAtDepth(p, depth));
11308
+ const deep = input.mergedDeep;
11309
+ if (deep && depth !== 8 && deep.length >= n * 4 && (deep instanceof Uint16Array ? depth === 16 : depth === 32)) {
11310
+ const dp = deepToPlanes(matteWhiteDeep(deep), n);
11311
+ planes = transparent ? dp : dp.slice(0, 3);
11312
+ }
11313
+ const planeBytes = n * (depth >> 3);
11314
+ const merged2 = new Uint8Array(planeBytes * planes.length);
11315
+ planes.forEach((p, i) => merged2.set(p, i * planeBytes));
11338
11316
  const res = Math.max(1, _nullishCoalesce(input.resolution, () => ( 72)));
11339
11317
  const rw = new PsdWriter();
11340
11318
  for (let k = 0; k < 2; k++) {
@@ -11352,6 +11330,7 @@ function exportPsd(input) {
11352
11330
  { id: 1005, name: "", data: rw.result() },
11353
11331
  { id: 1057, name: "", data: version.result() }
11354
11332
  ];
11333
+ if (_optionalChain([input, 'access', _274 => _274.iccProfile, 'optionalAccess', _275 => _275.length])) resources.push({ id: 1039, name: "", data: input.iccProfile });
11355
11334
  if (input.globalLight) {
11356
11335
  const i32 = (v) => {
11357
11336
  const w = new PsdWriter();
@@ -11365,7 +11344,7 @@ function exportPsd(input) {
11365
11344
  const byId = new Map((_nullishCoalesce(input.patterns, () => ( []))).map((p) => [p.id, p]));
11366
11345
  const embed = [];
11367
11346
  for (const id of patternIds2) {
11368
- const p = _nullishCoalesce(byId.get(id), () => ( _chunkPOGBUYWEcjs.builtinPattern.call(void 0, id)));
11347
+ const p = _nullishCoalesce(byId.get(id), () => ( _chunkST7E3NEEcjs.builtinPattern.call(void 0, id)));
11369
11348
  if (p) embed.push(p);
11370
11349
  else note(`Pattern "${id}" is not in the document and was not embedded`, id);
11371
11350
  }
@@ -11384,14 +11363,14 @@ function exportPsd(input) {
11384
11363
  if (filterItems.length) globalBlocks.push({ key: "FEid", data: writeFilterEffects(filterItems) });
11385
11364
  const bytes = writePsd(
11386
11365
  {
11387
- header: { psb, channels: planes.length, width, height, depth: 8, colorMode: 3 },
11366
+ header: { psb, channels: planes.length, width, height, depth, colorMode: mode === "cmyk" ? 4 : mode === "lab" ? 9 : 3 },
11388
11367
  colorModeData: new Uint8Array(0),
11389
11368
  resources,
11390
11369
  layers: records,
11391
11370
  mergedAlpha: transparent && records.length > 0,
11392
11371
  globalBlocks,
11393
- imageCompression: 1,
11394
- imageData: encodeRle(merged2, { planes: planes.length, width, height, depth: 8, psb })
11372
+ imageCompression: depth === 32 ? 0 : 1,
11373
+ imageData: depth === 32 ? merged2 : encodeRle(merged2, { planes: planes.length, width, height, depth, psb })
11395
11374
  },
11396
11375
  encodeLegacyName
11397
11376
  );
@@ -11755,13 +11734,5 @@ function exportPsd(input) {
11755
11734
 
11756
11735
 
11757
11736
 
11758
-
11759
-
11760
-
11761
-
11762
-
11763
-
11764
-
11765
-
11766
- exports.LEGACY_PROCESS_VERSION = LEGACY_PROCESS_VERSION; exports.LATEST_PROCESS_VERSION = LATEST_PROCESS_VERSION; exports.normalizeProcessVersion = normalizeProcessVersion; exports.srgbToLinear = srgbToLinear; exports.linearToSrgb = linearToSrgb; exports.LUMA_709 = LUMA_709; exports.IDENTITY_MATRIX3 = IDENTITY_MATRIX3; exports.mulMatrix3 = mulMatrix3; exports.applyMatrix3 = applyMatrix3; exports.invertMatrix3 = invertMatrix3; exports.D65 = D65; exports.bradfordAdaptation = bradfordAdaptation; exports.wbMatrix = wbMatrix; exports.linearSrgbToXy = linearSrgbToXy; exports.TINT_SCALE = TINT_SCALE; exports.MIN_KELVIN = MIN_KELVIN; exports.MAX_KELVIN = MAX_KELVIN; exports.xyToUv = xyToUv; exports.uvToXy = uvToXy; exports.tempTintToXy = tempTintToXy; exports.xyToTempTint = xyToTempTint; exports.AS_SHOT_KELVIN = AS_SHOT_KELVIN; exports.MIRED_PER_TEMPERATURE_UNIT = MIRED_PER_TEMPERATURE_UNIT; exports.temperatureToKelvin = temperatureToKelvin; exports.kelvinToTemperature = kelvinToTemperature; exports.whiteBalanceMatrix = whiteBalanceMatrix; exports.whiteBalanceFromSample = whiteBalanceFromSample; exports.TONE_LUT_SIZE = TONE_LUT_SIZE; exports.toneCurve = toneCurve; exports.buildToneLut = buildToneLut; exports.sampleToneLut = sampleToneLut; exports.normalizeAngle = normalizeAngle; exports.isQuarterTurnSwapped = isQuarterTurnSwapped; exports.getRotatedSize = getRotatedSize; exports.projectImagePoint = projectImagePoint; exports.unprojectCanvasPoint = unprojectCanvasPoint; exports.applyImageProjectionToContext = applyImageProjectionToContext; exports.projectImageRect = projectImageRect; exports.clampCropToImage = clampCropToImage; exports.getViewportProjection = getViewportProjection; exports.getViewportMetrics = getViewportMetrics; exports.canvasToImagePoint = canvasToImagePoint; exports.imageToCanvasPoint = imageToCanvasPoint; exports.mapCropHandle = mapCropHandle; exports.hitTestCrop = hitTestCrop; exports.getCropCursor = getCropCursor; exports.calculateCropDrag = calculateCropDrag; exports.getAnnotationBounds = getAnnotationBounds; exports.hitTestAnnotation = hitTestAnnotation; exports.SELECTION_MODES = SELECTION_MODES; exports.isSelectionMode = isSelectionMode; exports.parseSelectionMode = parseSelectionMode; exports.computeSelectionBounds = computeSelectionBounds; exports.createSelectionMask = createSelectionMask; exports.fullSelection = fullSelection; exports.isSelectionEmpty = isSelectionEmpty; exports.selectionValueAt = selectionValueAt; exports.coverageToByte = coverageToByte; exports.selectionFromCoverage = selectionFromCoverage; exports.selectionToCoverage = selectionToCoverage; exports.selectionArea = selectionArea; exports.combineSelections = combineSelections; exports.invertSelection = invertSelection; exports.resizeSelection = resizeSelection; exports.selectionFromPixels = selectionFromPixels; exports.selectionToPixels = selectionToPixels; exports.encodeSelectionRle = encodeSelectionRle; exports.decodeSelectionRle = decodeSelectionRle; exports.serializeSelection = serializeSelection; exports.deserializeSelection = deserializeSelection; exports.hashMaskContent = hashMaskContent; exports.EMPTY_DISTANCE = EMPTY_DISTANCE; exports.distanceTransform = distanceTransform; exports.expandCoverage = expandCoverage; exports.contractCoverage = contractCoverage; exports.borderCoverage = borderCoverage; exports.smoothCoverage = smoothCoverage; exports.featherCoverage = featherCoverage; exports.greyMorphology = greyMorphology; exports.shiftCoverage = shiftCoverage; exports.SELECTION_MODIFY_OPS = SELECTION_MODIFY_OPS; exports.modifySelection = modifySelection; exports.normalizeLayerMask = normalizeLayerMask; exports.layerMaskFromSelection = layerMaskFromSelection; exports.updateLayerMaskProps = updateLayerMaskProps; exports.decodeLayerMask = decodeLayerMask; exports.layerMaskKey = layerMaskKey; exports.layerMaskCoverage = layerMaskCoverage; exports.projectMaskCoverage = projectMaskCoverage; exports.buildLayerMaskPlanes = buildLayerMaskPlanes; exports.ADJUSTMENT_LUT_SIZE = ADJUSTMENT_LUT_SIZE; exports.sampleLut = sampleLut; exports.ADJUSTMENT_KINDS = ADJUSTMENT_KINDS; exports.isAdjustmentKind = isAdjustmentKind; exports.adjustmentKindLabel = adjustmentKindLabel; exports.HUE_RANGE_LABELS = HUE_RANGE_LABELS; exports.neutralHueRange = neutralHueRange; exports.identityCurve = identityCurve; exports.identityLevels = identityLevels; exports.defaultAdjustmentParams = defaultAdjustmentParams; exports.createAdjustmentLayer = createAdjustmentLayer; exports.normalizeAdjustmentLayer = normalizeAdjustmentLayer; exports.normalizeAdjustmentLayers = normalizeAdjustmentLayers; exports.curveLutFromLevels = curveLutFromLevels; exports.levelsValue = levelsValue; exports.rgbToHsl = rgbToHsl; exports.hslToRgb = hslToRgb; exports.hueRangeWeight = hueRangeWeight; exports.hueRangeTables = hueRangeTables; exports.hueSaturation = hueSaturation; exports.rangeLightness = rangeLightness; exports.VIBRANCE_GREY = VIBRANCE_GREY; exports.vibranceLinear = vibranceLinear; exports.vibrancePixel = vibrancePixel; exports.colorBalanceChannel = colorBalanceChannel; exports.blackWhiteGray = blackWhiteGray; exports.D50 = D50; exports.XYZ_D50_TO_SRGB = XYZ_D50_TO_SRGB; exports.photoFilterMatrix = photoFilterMatrix; exports.posterizeValue = posterizeValue; exports.rgbToGray = rgbToGray; exports.hexToRgb = hexToRgb; exports.toneLuts = toneLuts; exports.compileAdjustmentLayer = compileAdjustmentLayer; exports.activeAdjustmentLayers = activeAdjustmentLayers; exports.evaluateAdjustmentLayers = evaluateAdjustmentLayers; exports.applyAdjustmentLayers = applyAdjustmentLayers; exports.adjustmentLayersKey = adjustmentLayersKey; exports.applyAdjustments = applyAdjustments; exports.applyLegacyAdjustments = applyLegacyAdjustments; exports.applyProcess2Adjustments = applyProcess2Adjustments; exports.applyBoxBlur = applyBoxBlur; exports.applyDepthMask = applyDepthMask; exports.removeAlpha = removeAlpha; exports.SHAPE_OPERATIONS = SHAPE_OPERATIONS; exports.LIVE_SHAPE_KINDS = LIVE_SHAPE_KINDS; exports.TEXT_ALIGNS = TEXT_ALIGNS; exports.newLayerId = newLayerId; exports.pixelLayers = pixelLayers; exports.developFilter = developFilter; exports.blurFilter = blurFilter; exports.isActiveFilter = isActiveFilter; exports.isSpatialFilter = isSpatialFilter; exports.pixelLayerBounds = pixelLayerBounds; exports.layerTypeLabel = layerTypeLabel; exports.hasSurface = hasSurface; exports.isRenderedLayer = isRenderedLayer; exports.shapeLayers = shapeLayers; exports.smartObjectLayers = smartObjectLayers; exports.adjustmentNodeAsLayer = adjustmentNodeAsLayer; exports.depthMaskAlpha = depthMaskAlpha; exports.runLayerFilters = runLayerFilters; exports.LayerCompositor = LayerCompositor; exports.DEFAULT_ADJUSTMENTS_VALUES = DEFAULT_ADJUSTMENTS_VALUES; exports.DEFAULT_TRANSFORM_VALUES = DEFAULT_TRANSFORM_VALUES; exports.DEFAULT_DEPTH_MASK_VALUES = DEFAULT_DEPTH_MASK_VALUES; exports.flattenPath = flattenPath; exports.rasterizeCoverage = rasterizeCoverage; exports.parseCssColor = parseCssColor; exports.LayerOperationError = LayerOperationError; exports.requireLayer = requireLayer; exports.requireUnlocked = requireUnlocked; exports.placeLayer = placeLayer; exports.removeLayer = removeLayer; exports.moveLayer = moveLayer; exports.withNewIds = withNewIds; exports.duplicateLayer = duplicateLayer; exports.setLayerProperties = setLayerProperties; exports.groupLayers = groupLayers; exports.ungroupLayer = ungroupLayer; exports.offsetLayer = offsetLayer; exports.setLayerMask = setLayerMask; exports.normalizeFilter = normalizeFilter; exports.addLayerFilter = addLayerFilter; exports.updateLayerFilter = updateLayerFilter; exports.removeLayerFilter = removeLayerFilter; exports.layerEffectsOf = layerEffectsOf; exports.setLayerEffects = setLayerEffects; exports.addLayerEffect = addLayerEffect; exports.updateLayerEffect = updateLayerEffect; exports.removeLayerEffect = removeLayerEffect; exports.setLayerEffectsEnabled = setLayerEffectsEnabled; exports.parseBlend = parseBlend; exports.unionRect = unionRect; exports.SHAPE_RENDER_MARGIN = SHAPE_RENDER_MARGIN; exports.DEFAULT_MITER_LIMIT = DEFAULT_MITER_LIMIT; exports.mapSubpaths = mapSubpaths; exports.liveShapeSubpaths = liveShapeSubpaths; exports.liveComponent = liveComponent; exports.componentPath = componentPath; exports.shapeOutline = shapeOutline; exports.shapeGeometryBounds = shapeGeometryBounds; exports.shapeRenderClip = shapeRenderClip; exports.renderShapeRect = renderShapeRect; exports.renderShape = renderShape; exports.rerenderShape = rerenderShape; exports.normalizeShapePaint = normalizeShapePaint; exports.normalizeShapeStroke = normalizeShapeStroke; exports.normalizeLiveShape = normalizeLiveShape; exports.normalizeSubpaths = normalizeSubpaths; exports.requireOperation = requireOperation; exports.requireShapeLayer = requireShapeLayer; exports.createShapeLayer = createShapeLayer; exports.defaultShapeName = defaultShapeName; exports.updateShapeLayer = updateShapeLayer; exports.transformShapeComponents = transformShapeComponents; exports.offsetShape = offsetShape; exports.mergeShapeComponents = mergeShapeComponents; exports.shapeAsPixelLayer = shapeAsPixelLayer; exports.shapeFromAnnotation = shapeFromAnnotation; exports.annotationBlend = annotationBlend; exports.annotationOfShape = annotationOfShape; exports.DEFAULT_TEXT_STYLE = DEFAULT_TEXT_STYLE; exports.DEFAULT_AUTO_LEADING = DEFAULT_AUTO_LEADING; exports.fitRuns = fitRuns; exports.styleAt = styleAt; exports.restyleRange = restyleRange; exports.spliceRuns = spliceRuns; exports.paragraphRanges = paragraphRanges; exports.fitParagraphRuns = fitParagraphRuns; exports.fontOf = fontOf; exports.layoutText = layoutText; exports.textIndexAt = textIndexAt; exports.caretAt = caretAt; exports.TEXT_RENDER_MARGIN = TEXT_RENDER_MARGIN; exports.textMatrix = textMatrix; exports.textOutlines = textOutlines; exports.renderText = renderText; exports.rerenderText = rerenderText; exports.TEXT_STYLE_FIELDS = TEXT_STYLE_FIELDS; exports.patchTextStyle = patchTextStyle; exports.PARAGRAPH_STYLE_FIELDS = PARAGRAPH_STYLE_FIELDS; exports.patchParagraphStyle = patchParagraphStyle; exports.textRange = textRange; exports.requireTypeLayer = requireTypeLayer; exports.normalizeText = normalizeText; exports.typeLayerName = typeLayerName; exports.createTypeLayer = createTypeLayer; exports.updateTypeLayer = updateTypeLayer; exports.replaceTextRange = replaceTextRange; exports.transformTypeLayer = transformTypeLayer; exports.typeFrame = typeFrame; exports.typeAsPixelLayer = typeAsPixelLayer; exports.toTextSpace = toTextSpace; exports.typeFromAnnotation = typeFromAnnotation; exports.annotationOfType = annotationOfType; exports.BACKGROUND_LAYER_ID = BACKGROUND_LAYER_ID; exports.BACKGROUND_LAYER_NAME = BACKGROUND_LAYER_NAME; exports.DEVELOP_FILTER_ID = DEVELOP_FILTER_ID; exports.BLUR_FILTER_ID = BLUR_FILTER_ID; exports.rasterMaskFromLegacy = rasterMaskFromLegacy; exports.hasResampledLegacyMask = hasResampledLegacyMask; exports.legacyMaskOf = legacyMaskOf; exports.isDefaultDepthMask = isDefaultDepthMask; exports.developFromAdjustments = developFromAdjustments; exports.annotationLayerName = annotationLayerName; exports.annotationLayerFor = annotationLayerFor; exports.annotationOfLayer = annotationOfLayer; exports.adjustmentNodeFromLegacy = adjustmentNodeFromLegacy; exports.backgroundLayer = backgroundLayer; exports.depthRasterMask = depthRasterMask; exports.layersFromLegacy = layersFromLegacy; exports.legacyAdjustmentLayer = legacyAdjustmentLayer; exports.developTarget = developTarget; exports.legacyView = legacyView; exports.isLegacyShape = isLegacyShape; exports.FREE_TRANSFORM_MODES = FREE_TRANSFORM_MODES; exports.TRANSFORM_ANCHORS = TRANSFORM_ANCHORS; exports.isTransformAnchor = isTransformAnchor; exports.identityTransform = identityTransform; exports.cornersFromMatrix = cornersFromMatrix; exports.matrixFromCorners = matrixFromCorners; exports.transformHomography = transformHomography; exports.hasWarp = hasWarp; exports.isIdentityTransform = isIdentityTransform; exports.transformMap = transformMap; exports.transformedPoint = transformedPoint; exports.anchorPoint = anchorPoint; exports.transformedBox = transformedBox; exports.referencePoint = referencePoint; exports.matrixFromParams = matrixFromParams; exports.describeTransform = describeTransform; exports.applyParams = applyParams; exports.flipCorners = flipCorners; exports.boxPointOf = boxPointOf; exports.presetWarp = presetWarp; exports.isValidWarp = isValidWarp; exports.geometryHomography = geometryHomography; exports.SMART_RENDER_MARGIN = SMART_RENDER_MARGIN; exports.newContentsId = newContentsId; exports.contentsBox = contentsBox; exports.placementGeometry = placementGeometry; exports.placementAt = placementAt; exports.isContentsDecoded = isContentsDecoded; exports.requireSmartObject = requireSmartObject; exports.contentsSurface = contentsSurface; exports.rasterContents = rasterContents; exports.documentContents = documentContents; exports.placeContents = placeContents; exports.activeSmartFilters = activeSmartFilters; exports.filterMaskCoverage = filterMaskCoverage; exports.applySmartFilters = applySmartFilters; exports.renderSmartObject = renderSmartObject; exports.rerender = rerender; exports.normalizePlacement = normalizePlacement; exports.setSmartPlacement = setSmartPlacement; exports.offsetSmartObject = offsetSmartObject; exports.convertToSmartObject = convertToSmartObject; exports.rasterizeSmartObject = rasterizeSmartObject; exports.copySmartObject = copySmartObject; exports.instancesOf = instancesOf; exports.replaceContents = replaceContents; exports.normalizeSmartFilter = normalizeSmartFilter; exports.addSmartFilter = addSmartFilter; exports.updateSmartFilter = updateSmartFilter; exports.removeSmartFilter = removeSmartFilter; exports.moveSmartFilter = moveSmartFilter; exports.setSmartFiltersEnabled = setSmartFiltersEnabled; exports.setSmartFilterMask = setSmartFilterMask; exports.withFilterMaskSurface = withFilterMaskSurface; exports.placementBounds = placementBounds; exports.LAYERED_SCHEMA_VERSION = LAYERED_SCHEMA_VERSION; exports.serializePatterns = serializePatterns; exports.deserializePatterns = deserializePatterns; exports.encodeSurface = encodeSurface; exports.serializeEffects = serializeEffects; exports.deserializeEffects = deserializeEffects; exports.serializeLayer = serializeLayer; exports.serializeContents = serializeContents; exports.serializeLayers = serializeLayers; exports.serializeLayersExternal = serializeLayersExternal; exports.resolveExternalAssets = resolveExternalAssets; exports.decodePngDataUrl = decodePngDataUrl; exports.deserializeLayer = deserializeLayer; exports.deserializeLayers = deserializeLayers; exports.PsdError = PsdError; exports.parseVersionedDescriptor = parseVersionedDescriptor; exports.versionedDescriptorBytes = versionedDescriptorBytes; exports.ADJUSTMENT_KEYS = ADJUSTMENT_KEYS; exports.SUPPORTED_ADJUSTMENT_KEYS = SUPPORTED_ADJUSTMENT_KEYS; exports.parseAdjustmentBlock = parseAdjustmentBlock; exports.writeAdjustmentBlock = writeAdjustmentBlock; exports.parseLfx2 = parseLfx2; exports.writeLfx2 = writeLfx2; exports.parseLrfx = parseLrfx; exports.decodePlanes = decodePlanes; exports.encodeRle = encodeRle; exports.BROWSER_IMAGE_TYPES = BROWSER_IMAGE_TYPES; exports.readPsd = readPsd; exports.layerName = layerName; exports.layerTree = layerTree; exports.decodeLayerChannel = decodeLayerChannel; exports.decodeMergedImage = decodeMergedImage; exports.writePsd = writePsd; exports.PATTERN_BLOCK_KEYS = PATTERN_BLOCK_KEYS; exports.parsePatternBlock = parsePatternBlock; exports.psdPatternToEffectPattern = psdPatternToEffectPattern; exports.writePatternBlock = writePatternBlock; exports.PSD_BLEND_KEYS = PSD_BLEND_KEYS; exports.psdToLayers = psdToLayers; exports.importPsd = importPsd; exports.smartContentsFile = smartContentsFile; exports.exportPsd = exportPsd;
11767
- //# sourceMappingURL=chunk-YGIMK4NX.cjs.map
11737
+ exports.LEGACY_PROCESS_VERSION = LEGACY_PROCESS_VERSION; exports.LATEST_PROCESS_VERSION = LATEST_PROCESS_VERSION; exports.normalizeProcessVersion = normalizeProcessVersion; exports.srgbToLinear = srgbToLinear; exports.linearToSrgb = linearToSrgb; exports.LUMA_709 = LUMA_709; exports.IDENTITY_MATRIX3 = IDENTITY_MATRIX3; exports.mulMatrix3 = mulMatrix3; exports.applyMatrix3 = applyMatrix3; exports.invertMatrix3 = invertMatrix3; exports.D65 = D65; exports.bradfordAdaptation = bradfordAdaptation; exports.wbMatrix = wbMatrix; exports.linearSrgbToXy = linearSrgbToXy; exports.TINT_SCALE = TINT_SCALE; exports.MIN_KELVIN = MIN_KELVIN; exports.MAX_KELVIN = MAX_KELVIN; exports.xyToUv = xyToUv; exports.uvToXy = uvToXy; exports.tempTintToXy = tempTintToXy; exports.xyToTempTint = xyToTempTint; exports.AS_SHOT_KELVIN = AS_SHOT_KELVIN; exports.MIRED_PER_TEMPERATURE_UNIT = MIRED_PER_TEMPERATURE_UNIT; exports.temperatureToKelvin = temperatureToKelvin; exports.kelvinToTemperature = kelvinToTemperature; exports.whiteBalanceMatrix = whiteBalanceMatrix; exports.whiteBalanceFromSample = whiteBalanceFromSample; exports.TONE_LUT_SIZE = TONE_LUT_SIZE; exports.toneCurve = toneCurve; exports.buildToneLut = buildToneLut; exports.sampleToneLut = sampleToneLut; exports.normalizeAngle = normalizeAngle; exports.isQuarterTurnSwapped = isQuarterTurnSwapped; exports.getRotatedSize = getRotatedSize; exports.projectImagePoint = projectImagePoint; exports.unprojectCanvasPoint = unprojectCanvasPoint; exports.applyImageProjectionToContext = applyImageProjectionToContext; exports.projectImageRect = projectImageRect; exports.clampCropToImage = clampCropToImage; exports.getViewportProjection = getViewportProjection; exports.getViewportMetrics = getViewportMetrics; exports.canvasToImagePoint = canvasToImagePoint; exports.imageToCanvasPoint = imageToCanvasPoint; exports.mapCropHandle = mapCropHandle; exports.hitTestCrop = hitTestCrop; exports.getCropCursor = getCropCursor; exports.calculateCropDrag = calculateCropDrag; exports.getAnnotationBounds = getAnnotationBounds; exports.hitTestAnnotation = hitTestAnnotation; exports.SELECTION_MODES = SELECTION_MODES; exports.isSelectionMode = isSelectionMode; exports.parseSelectionMode = parseSelectionMode; exports.computeSelectionBounds = computeSelectionBounds; exports.createSelectionMask = createSelectionMask; exports.fullSelection = fullSelection; exports.isSelectionEmpty = isSelectionEmpty; exports.selectionValueAt = selectionValueAt; exports.coverageToByte = coverageToByte; exports.selectionFromCoverage = selectionFromCoverage; exports.selectionToCoverage = selectionToCoverage; exports.selectionArea = selectionArea; exports.combineSelections = combineSelections; exports.invertSelection = invertSelection; exports.resizeSelection = resizeSelection; exports.selectionFromPixels = selectionFromPixels; exports.selectionToPixels = selectionToPixels; exports.encodeSelectionRle = encodeSelectionRle; exports.decodeSelectionRle = decodeSelectionRle; exports.serializeSelection = serializeSelection; exports.deserializeSelection = deserializeSelection; exports.hashMaskContent = hashMaskContent; exports.EMPTY_DISTANCE = EMPTY_DISTANCE; exports.distanceTransform = distanceTransform; exports.expandCoverage = expandCoverage; exports.contractCoverage = contractCoverage; exports.borderCoverage = borderCoverage; exports.smoothCoverage = smoothCoverage; exports.featherCoverage = featherCoverage; exports.greyMorphology = greyMorphology; exports.shiftCoverage = shiftCoverage; exports.SELECTION_MODIFY_OPS = SELECTION_MODIFY_OPS; exports.modifySelection = modifySelection; exports.normalizeLayerMask = normalizeLayerMask; exports.layerMaskFromSelection = layerMaskFromSelection; exports.updateLayerMaskProps = updateLayerMaskProps; exports.decodeLayerMask = decodeLayerMask; exports.layerMaskKey = layerMaskKey; exports.layerMaskCoverage = layerMaskCoverage; exports.projectMaskCoverage = projectMaskCoverage; exports.buildLayerMaskPlanes = buildLayerMaskPlanes; exports.ADJUSTMENT_LUT_SIZE = ADJUSTMENT_LUT_SIZE; exports.sampleLut = sampleLut; exports.ADJUSTMENT_KINDS = ADJUSTMENT_KINDS; exports.isAdjustmentKind = isAdjustmentKind; exports.adjustmentKindLabel = adjustmentKindLabel; exports.HUE_RANGE_LABELS = HUE_RANGE_LABELS; exports.neutralHueRange = neutralHueRange; exports.identityCurve = identityCurve; exports.identityLevels = identityLevels; exports.defaultAdjustmentParams = defaultAdjustmentParams; exports.createAdjustmentLayer = createAdjustmentLayer; exports.normalizeAdjustmentLayer = normalizeAdjustmentLayer; exports.normalizeAdjustmentLayers = normalizeAdjustmentLayers; exports.curveLutFromLevels = curveLutFromLevels; exports.levelsValue = levelsValue; exports.rgbToHsl = rgbToHsl; exports.hslToRgb = hslToRgb; exports.hueRangeWeight = hueRangeWeight; exports.hueRangeTables = hueRangeTables; exports.hueSaturation = hueSaturation; exports.rangeLightness = rangeLightness; exports.VIBRANCE_GREY = VIBRANCE_GREY; exports.vibranceLinear = vibranceLinear; exports.vibrancePixel = vibrancePixel; exports.colorBalanceChannel = colorBalanceChannel; exports.blackWhiteGray = blackWhiteGray; exports.D50 = D50; exports.XYZ_D50_TO_SRGB = XYZ_D50_TO_SRGB; exports.photoFilterMatrix = photoFilterMatrix; exports.posterizeValue = posterizeValue; exports.rgbToGray = rgbToGray; exports.hexToRgb = hexToRgb; exports.toneLuts = toneLuts; exports.compileAdjustmentLayer = compileAdjustmentLayer; exports.activeAdjustmentLayers = activeAdjustmentLayers; exports.evaluateAdjustmentLayers = evaluateAdjustmentLayers; exports.applyAdjustmentLayers = applyAdjustmentLayers; exports.applyAdjustmentLayersFloat = applyAdjustmentLayersFloat; exports.adjustmentLayersKey = adjustmentLayersKey; exports.applyAdjustments = applyAdjustments; exports.applyLegacyAdjustments = applyLegacyAdjustments; exports.applyProcess2Adjustments = applyProcess2Adjustments; exports.applyBoxBlur = applyBoxBlur; exports.applyDepthMask = applyDepthMask; exports.removeAlpha = removeAlpha; exports.TEXT_ALIGNS = TEXT_ALIGNS; exports.SHAPE_OPERATIONS = SHAPE_OPERATIONS; exports.LIVE_SHAPE_KINDS = LIVE_SHAPE_KINDS; exports.newLayerId = newLayerId; exports.pixelLayers = pixelLayers; exports.developFilter = developFilter; exports.blurFilter = blurFilter; exports.isActiveFilter = isActiveFilter; exports.isSpatialFilter = isSpatialFilter; exports.pixelLayerBounds = pixelLayerBounds; exports.layerTypeLabel = layerTypeLabel; exports.hasSurface = hasSurface; exports.isRenderedLayer = isRenderedLayer; exports.shapeLayers = shapeLayers; exports.smartObjectLayers = smartObjectLayers; exports.adjustmentNodeAsLayer = adjustmentNodeAsLayer; exports.depthMaskAlpha = depthMaskAlpha; exports.runLayerFilters = runLayerFilters; exports.LayerCompositor = LayerCompositor; exports.compositeDeep = compositeDeep; exports.DEFAULT_ADJUSTMENTS_VALUES = DEFAULT_ADJUSTMENTS_VALUES; exports.DEFAULT_TRANSFORM_VALUES = DEFAULT_TRANSFORM_VALUES; exports.DEFAULT_DEPTH_MASK_VALUES = DEFAULT_DEPTH_MASK_VALUES; exports.flattenPath = flattenPath; exports.rasterizeCoverage = rasterizeCoverage; exports.parseCssColor = parseCssColor; exports.LayerOperationError = LayerOperationError; exports.requireLayer = requireLayer; exports.requireUnlocked = requireUnlocked; exports.placeLayer = placeLayer; exports.removeLayer = removeLayer; exports.moveLayer = moveLayer; exports.withNewIds = withNewIds; exports.duplicateLayer = duplicateLayer; exports.setLayerProperties = setLayerProperties; exports.groupLayers = groupLayers; exports.ungroupLayer = ungroupLayer; exports.offsetLayer = offsetLayer; exports.setLayerMask = setLayerMask; exports.normalizeFilter = normalizeFilter; exports.addLayerFilter = addLayerFilter; exports.updateLayerFilter = updateLayerFilter; exports.removeLayerFilter = removeLayerFilter; exports.layerEffectsOf = layerEffectsOf; exports.setLayerEffects = setLayerEffects; exports.addLayerEffect = addLayerEffect; exports.updateLayerEffect = updateLayerEffect; exports.removeLayerEffect = removeLayerEffect; exports.setLayerEffectsEnabled = setLayerEffectsEnabled; exports.parseBlend = parseBlend; exports.unionRect = unionRect; exports.SHAPE_RENDER_MARGIN = SHAPE_RENDER_MARGIN; exports.DEFAULT_MITER_LIMIT = DEFAULT_MITER_LIMIT; exports.mapSubpaths = mapSubpaths; exports.liveShapeSubpaths = liveShapeSubpaths; exports.liveComponent = liveComponent; exports.componentPath = componentPath; exports.shapeOutline = shapeOutline; exports.shapeGeometryBounds = shapeGeometryBounds; exports.shapeRenderClip = shapeRenderClip; exports.renderShapeRect = renderShapeRect; exports.renderShape = renderShape; exports.rerenderShape = rerenderShape; exports.normalizeShapePaint = normalizeShapePaint; exports.normalizeShapeStroke = normalizeShapeStroke; exports.normalizeLiveShape = normalizeLiveShape; exports.normalizeSubpaths = normalizeSubpaths; exports.requireOperation = requireOperation; exports.requireShapeLayer = requireShapeLayer; exports.createShapeLayer = createShapeLayer; exports.defaultShapeName = defaultShapeName; exports.updateShapeLayer = updateShapeLayer; exports.transformShapeComponents = transformShapeComponents; exports.offsetShape = offsetShape; exports.mergeShapeComponents = mergeShapeComponents; exports.shapeAsPixelLayer = shapeAsPixelLayer; exports.shapeFromAnnotation = shapeFromAnnotation; exports.annotationBlend = annotationBlend; exports.annotationOfShape = annotationOfShape; exports.TEXT_RENDER_MARGIN = TEXT_RENDER_MARGIN; exports.textMatrix = textMatrix; exports.textOutlines = textOutlines; exports.renderText = renderText; exports.rerenderText = rerenderText; exports.TEXT_STYLE_FIELDS = TEXT_STYLE_FIELDS; exports.patchTextStyle = patchTextStyle; exports.PARAGRAPH_STYLE_FIELDS = PARAGRAPH_STYLE_FIELDS; exports.patchParagraphStyle = patchParagraphStyle; exports.textRange = textRange; exports.requireTypeLayer = requireTypeLayer; exports.normalizeText = normalizeText; exports.typeLayerName = typeLayerName; exports.createTypeLayer = createTypeLayer; exports.updateTypeLayer = updateTypeLayer; exports.replaceTextRange = replaceTextRange; exports.transformTypeLayer = transformTypeLayer; exports.typeFrame = typeFrame; exports.typeAsPixelLayer = typeAsPixelLayer; exports.toTextSpace = toTextSpace; exports.typeFromAnnotation = typeFromAnnotation; exports.annotationOfType = annotationOfType; exports.BACKGROUND_LAYER_ID = BACKGROUND_LAYER_ID; exports.BACKGROUND_LAYER_NAME = BACKGROUND_LAYER_NAME; exports.DEVELOP_FILTER_ID = DEVELOP_FILTER_ID; exports.BLUR_FILTER_ID = BLUR_FILTER_ID; exports.rasterMaskFromLegacy = rasterMaskFromLegacy; exports.hasResampledLegacyMask = hasResampledLegacyMask; exports.legacyMaskOf = legacyMaskOf; exports.isDefaultDepthMask = isDefaultDepthMask; exports.developFromAdjustments = developFromAdjustments; exports.annotationLayerName = annotationLayerName; exports.annotationLayerFor = annotationLayerFor; exports.annotationOfLayer = annotationOfLayer; exports.adjustmentNodeFromLegacy = adjustmentNodeFromLegacy; exports.backgroundLayer = backgroundLayer; exports.depthRasterMask = depthRasterMask; exports.layersFromLegacy = layersFromLegacy; exports.legacyAdjustmentLayer = legacyAdjustmentLayer; exports.developTarget = developTarget; exports.legacyView = legacyView; exports.isLegacyShape = isLegacyShape; exports.FREE_TRANSFORM_MODES = FREE_TRANSFORM_MODES; exports.TRANSFORM_ANCHORS = TRANSFORM_ANCHORS; exports.isTransformAnchor = isTransformAnchor; exports.identityTransform = identityTransform; exports.cornersFromMatrix = cornersFromMatrix; exports.matrixFromCorners = matrixFromCorners; exports.transformHomography = transformHomography; exports.hasWarp = hasWarp; exports.isIdentityTransform = isIdentityTransform; exports.transformMap = transformMap; exports.transformedPoint = transformedPoint; exports.anchorPoint = anchorPoint; exports.transformedBox = transformedBox; exports.referencePoint = referencePoint; exports.matrixFromParams = matrixFromParams; exports.describeTransform = describeTransform; exports.applyParams = applyParams; exports.flipCorners = flipCorners; exports.boxPointOf = boxPointOf; exports.presetWarp = presetWarp; exports.isValidWarp = isValidWarp; exports.geometryHomography = geometryHomography; exports.SMART_RENDER_MARGIN = SMART_RENDER_MARGIN; exports.newContentsId = newContentsId; exports.contentsBox = contentsBox; exports.placementGeometry = placementGeometry; exports.placementAt = placementAt; exports.isContentsDecoded = isContentsDecoded; exports.requireSmartObject = requireSmartObject; exports.contentsSurface = contentsSurface; exports.rasterContents = rasterContents; exports.documentContents = documentContents; exports.placeContents = placeContents; exports.activeSmartFilters = activeSmartFilters; exports.filterMaskCoverage = filterMaskCoverage; exports.applySmartFilters = applySmartFilters; exports.renderSmartObject = renderSmartObject; exports.rerender = rerender; exports.normalizePlacement = normalizePlacement; exports.setSmartPlacement = setSmartPlacement; exports.offsetSmartObject = offsetSmartObject; exports.convertToSmartObject = convertToSmartObject; exports.rasterizeSmartObject = rasterizeSmartObject; exports.copySmartObject = copySmartObject; exports.instancesOf = instancesOf; exports.replaceContents = replaceContents; exports.normalizeSmartFilter = normalizeSmartFilter; exports.addSmartFilter = addSmartFilter; exports.updateSmartFilter = updateSmartFilter; exports.removeSmartFilter = removeSmartFilter; exports.moveSmartFilter = moveSmartFilter; exports.setSmartFiltersEnabled = setSmartFiltersEnabled; exports.setSmartFilterMask = setSmartFilterMask; exports.withFilterMaskSurface = withFilterMaskSurface; exports.placementBounds = placementBounds; exports.LAYERED_SCHEMA_VERSION = LAYERED_SCHEMA_VERSION; exports.serializePatterns = serializePatterns; exports.deserializePatterns = deserializePatterns; exports.encodeSurface = encodeSurface; exports.encodeDeepSurface = encodeDeepSurface; exports.decodeDeepSurface = decodeDeepSurface; exports.serializeEffects = serializeEffects; exports.deserializeEffects = deserializeEffects; exports.serializeLayer = serializeLayer; exports.serializeContents = serializeContents; exports.serializeLayers = serializeLayers; exports.serializeLayersExternal = serializeLayersExternal; exports.resolveExternalAssets = resolveExternalAssets; exports.decodePngDataUrl = decodePngDataUrl; exports.deserializeLayer = deserializeLayer; exports.deserializeLayers = deserializeLayers; exports.PsdError = PsdError; exports.parseVersionedDescriptor = parseVersionedDescriptor; exports.versionedDescriptorBytes = versionedDescriptorBytes; exports.ADJUSTMENT_KEYS = ADJUSTMENT_KEYS; exports.SUPPORTED_ADJUSTMENT_KEYS = SUPPORTED_ADJUSTMENT_KEYS; exports.parseAdjustmentBlock = parseAdjustmentBlock; exports.writeAdjustmentBlock = writeAdjustmentBlock; exports.parseLfx2 = parseLfx2; exports.writeLfx2 = writeLfx2; exports.parseLrfx = parseLrfx; exports.decodePlanes = decodePlanes; exports.encodeRle = encodeRle; exports.BROWSER_IMAGE_TYPES = BROWSER_IMAGE_TYPES; exports.readPsd = readPsd; exports.layerName = layerName; exports.layerTree = layerTree; exports.decodeLayerChannel = decodeLayerChannel; exports.decodeMergedImage = decodeMergedImage; exports.writePsd = writePsd; exports.PATTERN_BLOCK_KEYS = PATTERN_BLOCK_KEYS; exports.parsePatternBlock = parsePatternBlock; exports.psdPatternToEffectPattern = psdPatternToEffectPattern; exports.writePatternBlock = writePatternBlock; exports.PSD_BLEND_KEYS = PSD_BLEND_KEYS; exports.psdToLayers = psdToLayers; exports.importPsd = importPsd; exports.smartContentsFile = smartContentsFile; exports.exportPsd = exportPsd;
11738
+ //# sourceMappingURL=chunk-I7FQBWMQ.cjs.map