@pixerate/editor 0.92.0 → 0.94.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.
- package/THIRD_PARTY_NOTICES.md +2 -0
- package/dist/{chunk-PDCITYBT.cjs → chunk-4F3YDIWW.cjs} +367 -2
- package/dist/chunk-4F3YDIWW.cjs.map +1 -0
- package/dist/chunk-73L6TROJ.cjs +3685 -0
- package/dist/chunk-73L6TROJ.cjs.map +1 -0
- package/dist/chunk-747CGOT2.js +3685 -0
- package/dist/chunk-747CGOT2.js.map +1 -0
- package/dist/{chunk-YLB2WVNA.js → chunk-ISDCJHTO.js} +367 -2
- package/dist/chunk-ISDCJHTO.js.map +1 -0
- package/dist/image-editor/index.cjs +787 -302
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +84 -18
- package/dist/image-editor/index.d.ts +84 -18
- package/dist/image-editor/index.js +560 -75
- package/dist/image-editor/index.js.map +1 -1
- package/dist/paint/index.cjs +26 -2
- package/dist/paint/index.cjs.map +1 -1
- package/dist/paint/index.d.cts +96 -2
- package/dist/paint/index.d.ts +96 -2
- package/dist/paint/index.js +25 -1
- package/dist/raster/index.cjs +78 -2
- package/dist/raster/index.cjs.map +1 -1
- package/dist/raster/index.d.cts +99 -348
- package/dist/raster/index.d.ts +99 -348
- package/dist/raster/index.js +78 -2
- package/dist/{surface-fJhkmNQn.d.cts → surface-CuBg2c6k.d.cts} +1 -1
- package/dist/{surface-fJhkmNQn.d.ts → surface-CuBg2c6k.d.ts} +1 -1
- package/dist/zlib-BJ6U7LuB.d.cts +795 -0
- package/dist/zlib-BjQkpMFi.d.ts +795 -0
- package/package.json +3 -3
- package/skills/pixerate-image-editor/SKILL.md +63 -4
- package/dist/chunk-H543GD6T.cjs +0 -1696
- package/dist/chunk-H543GD6T.cjs.map +0 -1
- package/dist/chunk-P5TPUNBZ.js +0 -1696
- package/dist/chunk-P5TPUNBZ.js.map +0 -1
- package/dist/chunk-PDCITYBT.cjs.map +0 -1
- package/dist/chunk-YLB2WVNA.js.map +0 -1
|
@@ -28,7 +28,6 @@ var _chunkVJUVNERTcjs = require('../chunk-VJUVNERT.cjs');
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
var _chunkH543GD6Tcjs = require('../chunk-H543GD6T.cjs');
|
|
32
31
|
|
|
33
32
|
|
|
34
33
|
|
|
@@ -43,10 +42,37 @@ var _chunkH543GD6Tcjs = require('../chunk-H543GD6T.cjs');
|
|
|
43
42
|
|
|
44
43
|
|
|
45
44
|
|
|
45
|
+
var _chunk73L6TROJcjs = require('../chunk-73L6TROJ.cjs');
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
var _chunk4F3YDIWWcjs = require('../chunk-4F3YDIWW.cjs');
|
|
50
76
|
|
|
51
77
|
|
|
52
78
|
|
|
@@ -1094,7 +1120,7 @@ function smoothCoverage(m, w, h, r) {
|
|
|
1094
1120
|
return src;
|
|
1095
1121
|
}
|
|
1096
1122
|
function featherCoverage(m, w, h, radius) {
|
|
1097
|
-
const out =
|
|
1123
|
+
const out = _chunk73L6TROJcjs.gaussianBlur.call(void 0, m, w, h, Number.isFinite(radius) ? Math.max(0, radius) : 0, "zero");
|
|
1098
1124
|
for (let i = 0; i < out.length; i++) if (Math.abs(out[i]) < 1e-7) out[i] = 0;
|
|
1099
1125
|
return out;
|
|
1100
1126
|
}
|
|
@@ -1242,7 +1268,7 @@ function layerMaskCoverage(mask) {
|
|
|
1242
1268
|
let v = new Float32Array(sel.data.length);
|
|
1243
1269
|
for (let i = 0; i < v.length; i++) v[i] = sel.data[i] / 255;
|
|
1244
1270
|
const feather = _nullishCoalesce(mask.feather, () => ( 0));
|
|
1245
|
-
if (feather > 0) v =
|
|
1271
|
+
if (feather > 0) v = _chunk73L6TROJcjs.gaussianBlur.call(void 0, v, mask.width, mask.height, feather, "clamp");
|
|
1246
1272
|
const density = _nullishCoalesce(mask.density, () => ( 1));
|
|
1247
1273
|
if (density !== 1) for (let i = 0; i < v.length; i++) v[i] = 1 - density * (1 - v[i]);
|
|
1248
1274
|
return v;
|
|
@@ -1484,61 +1510,8 @@ function normalizeAdjustmentLayers(raw) {
|
|
|
1484
1510
|
}
|
|
1485
1511
|
return out;
|
|
1486
1512
|
}
|
|
1487
|
-
function curveLut(points, size = ADJUSTMENT_LUT_SIZE) {
|
|
1488
|
-
const pts = points.filter((p) => Number.isFinite(p.input) && Number.isFinite(p.output)).map((p) => [p.input, p.output]).sort((a, b) => a[0] - b[0]);
|
|
1489
|
-
const dedup = [];
|
|
1490
|
-
for (const p of pts) {
|
|
1491
|
-
if (dedup.length && Math.abs(dedup[dedup.length - 1][0] - p[0]) < 1e-6) continue;
|
|
1492
|
-
dedup.push(p);
|
|
1493
|
-
}
|
|
1494
|
-
const out = new Float32Array(size);
|
|
1495
|
-
const n = dedup.length;
|
|
1496
|
-
if (n < 2) {
|
|
1497
|
-
for (let k = 0; k < size; k++) out[k] = k / (size - 1);
|
|
1498
|
-
return out;
|
|
1499
|
-
}
|
|
1500
|
-
const x = dedup.map((p) => p[0]);
|
|
1501
|
-
const y = dedup.map((p) => p[1]);
|
|
1502
|
-
const m2 = new Float64Array(n);
|
|
1503
|
-
if (n > 2) {
|
|
1504
|
-
const c = new Float64Array(n);
|
|
1505
|
-
const d = new Float64Array(n);
|
|
1506
|
-
for (let i = 1; i < n - 1; i++) {
|
|
1507
|
-
const h0 = x[i] - x[i - 1];
|
|
1508
|
-
const h1 = x[i + 1] - x[i];
|
|
1509
|
-
const a = h0 / 6;
|
|
1510
|
-
const b = (h0 + h1) / 3;
|
|
1511
|
-
const cc = h1 / 6;
|
|
1512
|
-
const r = (y[i + 1] - y[i]) / h1 - (y[i] - y[i - 1]) / h0;
|
|
1513
|
-
const denom = b - a * c[i - 1];
|
|
1514
|
-
c[i] = cc / denom;
|
|
1515
|
-
d[i] = (r - a * d[i - 1]) / denom;
|
|
1516
|
-
}
|
|
1517
|
-
for (let i = n - 2; i >= 1; i--) m2[i] = d[i] - c[i] * m2[i + 1];
|
|
1518
|
-
}
|
|
1519
|
-
let seg = 0;
|
|
1520
|
-
for (let k = 0; k < size; k++) {
|
|
1521
|
-
const xv = k / (size - 1);
|
|
1522
|
-
if (xv <= x[0]) {
|
|
1523
|
-
out[k] = clamp01(y[0]);
|
|
1524
|
-
continue;
|
|
1525
|
-
}
|
|
1526
|
-
if (xv >= x[n - 1]) {
|
|
1527
|
-
out[k] = clamp01(y[n - 1]);
|
|
1528
|
-
continue;
|
|
1529
|
-
}
|
|
1530
|
-
while (seg < n - 2 && xv > x[seg + 1]) seg++;
|
|
1531
|
-
const x0 = x[seg], x1 = x[seg + 1];
|
|
1532
|
-
const h = x1 - x0;
|
|
1533
|
-
const a = (x1 - xv) / h;
|
|
1534
|
-
const b = (xv - x0) / h;
|
|
1535
|
-
const v = a * y[seg] + b * y[seg + 1] + ((a * a * a - a) * m2[seg] + (b * b * b - b) * m2[seg + 1]) * (h * h) / 6;
|
|
1536
|
-
out[k] = clamp01(v);
|
|
1537
|
-
}
|
|
1538
|
-
return out;
|
|
1539
|
-
}
|
|
1540
1513
|
function curveLutFromLevels(points) {
|
|
1541
|
-
return curveLut(points.map((p) => ({ input: p.input / 255, output: p.output / 255 })));
|
|
1514
|
+
return _chunk73L6TROJcjs.curveLut.call(void 0, points.map((p) => ({ input: p.input / 255, output: p.output / 255 })));
|
|
1542
1515
|
}
|
|
1543
1516
|
var toUnitLevels = (c) => ({
|
|
1544
1517
|
inBlack: c.inBlack / 255,
|
|
@@ -2360,7 +2333,7 @@ function newLayerId(prefix = "layer") {
|
|
|
2360
2333
|
return `${prefix}_${Date.now().toString(36)}_${(++idCounter).toString(36)}`;
|
|
2361
2334
|
}
|
|
2362
2335
|
function pixelLayers(layers) {
|
|
2363
|
-
return
|
|
2336
|
+
return _chunk73L6TROJcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "pixel");
|
|
2364
2337
|
}
|
|
2365
2338
|
function developFilter(layer) {
|
|
2366
2339
|
return _optionalChain([layer, 'access', _8 => _8.filters, 'optionalAccess', _9 => _9.find, 'call', _10 => _10((f) => f.kind === "develop")]);
|
|
@@ -2481,7 +2454,7 @@ var PHOTO_PROFILE = {
|
|
|
2481
2454
|
return v;
|
|
2482
2455
|
}
|
|
2483
2456
|
};
|
|
2484
|
-
var LayerCompositor = class extends
|
|
2457
|
+
var LayerCompositor = class extends _chunk73L6TROJcjs.RasterCompositor {
|
|
2485
2458
|
constructor(options = {}) {
|
|
2486
2459
|
super(PHOTO_PROFILE, options);
|
|
2487
2460
|
}
|
|
@@ -2688,7 +2661,7 @@ function developTarget(layers, activeLayerId) {
|
|
|
2688
2661
|
}
|
|
2689
2662
|
return _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(pixels.find((l) => l.source === "document"), () => ( pixels.find((l) => l.id === BACKGROUND_LAYER_ID))), () => ( pixels[0])), () => ( null));
|
|
2690
2663
|
}
|
|
2691
|
-
var isPlain = (l) => l.visible && l.opacity === 1 && l.blend === "normal" && !l.clipped && !l.mask && !l.locks;
|
|
2664
|
+
var isPlain = (l) => l.visible && l.opacity === 1 && l.blend === "normal" && !l.clipped && !l.mask && !l.locks && !l.effects;
|
|
2692
2665
|
function legacyView(stack, width, height, activeLayerId = null) {
|
|
2693
2666
|
const { layers } = stack;
|
|
2694
2667
|
const target = developTarget(layers, activeLayerId);
|
|
@@ -2728,7 +2701,7 @@ function isLegacyShape(stack) {
|
|
|
2728
2701
|
const bg = layers[0];
|
|
2729
2702
|
if (!bg || bg.type !== "pixel" || bg.source !== "document") return false;
|
|
2730
2703
|
if (bg.id !== BACKGROUND_LAYER_ID || bg.name !== BACKGROUND_LAYER_NAME) return false;
|
|
2731
|
-
if (!bg.visible || bg.opacity !== 1 || bg.blend !== "normal" || bg.clipped || bg.locks) return false;
|
|
2704
|
+
if (!bg.visible || bg.opacity !== 1 || bg.blend !== "normal" || bg.clipped || bg.locks || bg.effects) return false;
|
|
2732
2705
|
if ((_nullishCoalesce(bg.fillOpacity, () => ( 1))) !== 1 || bg.offset.x !== 0 || bg.offset.y !== 0) return false;
|
|
2733
2706
|
const filters = _nullishCoalesce(bg.filters, () => ( []));
|
|
2734
2707
|
if (filters.length < 1 || filters.length > 2) return false;
|
|
@@ -2744,7 +2717,7 @@ function isLegacyShape(stack) {
|
|
|
2744
2717
|
let adjustments = 0;
|
|
2745
2718
|
for (; i < layers.length && layers[i].type === "adjustment"; i++) {
|
|
2746
2719
|
const l = layers[i];
|
|
2747
|
-
if (l.clipped || l.locks || _optionalChain([l, 'access', _23 => _23.mask, 'optionalAccess', _24 => _24.source])) return false;
|
|
2720
|
+
if (l.clipped || l.locks || _optionalChain([l, 'access', _23 => _23.mask, 'optionalAccess', _24 => _24.source]) || l.effects) return false;
|
|
2748
2721
|
adjustments++;
|
|
2749
2722
|
}
|
|
2750
2723
|
for (; i < layers.length; i++) {
|
|
@@ -3250,22 +3223,24 @@ var ImageEditorRenderer = (_class2 = class {constructor() { _class2.prototype.__
|
|
|
3250
3223
|
return _nullishCoalesce(this.depthMaps.get(`${source.maskSource}|${width}x${height}`), () => ( null));
|
|
3251
3224
|
},
|
|
3252
3225
|
rasterizeAnnotation: (annotation, rect) => this.rasterizeAnnotation(annotation, rect),
|
|
3253
|
-
version: `${_nullishCoalesce(_optionalChain([host, 'optionalAccess', _52 => _52.version, 'call', _53 => _53()]), () => ( ""))}:${this.assetVersion}
|
|
3226
|
+
version: `${_nullishCoalesce(_optionalChain([host, 'optionalAccess', _52 => _52.version, 'call', _53 => _53()]), () => ( ""))}:${this.assetVersion}`,
|
|
3227
|
+
globalLight: _optionalChain([host, 'optionalAccess', _54 => _54.globalLight, 'optionalCall', _55 => _55()]),
|
|
3228
|
+
pattern: _optionalChain([host, 'optionalAccess', _56 => _56.pattern]) ? (id) => host.pattern(id) : void 0
|
|
3254
3229
|
};
|
|
3255
3230
|
}
|
|
3256
3231
|
/** Loads what the compositor reads synchronously: depth maps (at canvas size) and annotation images. */
|
|
3257
3232
|
/** Loads depth maps and annotation images the compositor reads synchronously. */
|
|
3258
3233
|
async prepareLayerAssets(layers, width, height) {
|
|
3259
|
-
for (const l of
|
|
3260
|
-
const source = _optionalChain([l, 'access',
|
|
3261
|
-
if (_optionalChain([source, 'optionalAccess',
|
|
3234
|
+
for (const l of _chunk73L6TROJcjs.flattenLayers.call(void 0, layers)) {
|
|
3235
|
+
const source = _optionalChain([l, 'access', _57 => _57.mask, 'optionalAccess', _58 => _58.source]);
|
|
3236
|
+
if (_optionalChain([source, 'optionalAccess', _59 => _59.enabled]) && source.maskSource) {
|
|
3262
3237
|
const key = `${source.maskSource}|${width}x${height}`;
|
|
3263
3238
|
if (this.depthMaps.has(key)) continue;
|
|
3264
3239
|
try {
|
|
3265
3240
|
const maskImg = await this.imageCache.get(source.maskSource);
|
|
3266
3241
|
const canvas = this.createCanvas(width, height);
|
|
3267
3242
|
const mctx = canvas.getContext("2d");
|
|
3268
|
-
const data = mctx ? (mctx.drawImage(maskImg, 0, 0, width, height), _optionalChain([mctx, 'access',
|
|
3243
|
+
const data = mctx ? (mctx.drawImage(maskImg, 0, 0, width, height), _optionalChain([mctx, 'access', _60 => _60.getImageData, 'optionalCall', _61 => _61(0, 0, width, height)])) : null;
|
|
3269
3244
|
if (data) {
|
|
3270
3245
|
this.depthMaps.set(key, { width, height, data: data.data });
|
|
3271
3246
|
this.assetVersion++;
|
|
@@ -3385,7 +3360,7 @@ var ImageEditorRenderer = (_class2 = class {constructor() { _class2.prototype.__
|
|
|
3385
3360
|
const opacity = _nullishCoalesce(state.outputOpacity, () => ( 1));
|
|
3386
3361
|
const blur = _nullishCoalesce(state.legacyOutputBlur, () => ( 0));
|
|
3387
3362
|
if (!(opacity < 1) && !(blur > 0)) return null;
|
|
3388
|
-
const data = _optionalChain([ctx, 'access',
|
|
3363
|
+
const data = _optionalChain([ctx, 'access', _62 => _62.getImageData, 'optionalCall', _63 => _63(0, 0, w, h)]);
|
|
3389
3364
|
if (!data) return null;
|
|
3390
3365
|
applyOutputStage(data, opacity, blur);
|
|
3391
3366
|
ctx.putImageData(data, 0, 0);
|
|
@@ -3394,7 +3369,7 @@ var ImageEditorRenderer = (_class2 = class {constructor() { _class2.prototype.__
|
|
|
3394
3369
|
publishHistogram(histogram) {
|
|
3395
3370
|
if (histogram === this.previewHistogram) return;
|
|
3396
3371
|
this.previewHistogram = histogram;
|
|
3397
|
-
_optionalChain([this, 'access',
|
|
3372
|
+
_optionalChain([this, 'access', _64 => _64.onPreviewHistogram, 'optionalCall', _65 => _65(histogram)]);
|
|
3398
3373
|
}
|
|
3399
3374
|
__init19() {this.quickMaskCache = /* @__PURE__ */ new WeakMap()}
|
|
3400
3375
|
__init20() {this.outlineCache = /* @__PURE__ */ new WeakMap()}
|
|
@@ -3807,8 +3782,8 @@ var ImageEditorRenderer = (_class2 = class {constructor() { _class2.prototype.__
|
|
|
3807
3782
|
if (!ctx) return maskCanvas;
|
|
3808
3783
|
ctx.fillStyle = MASK_BLACK;
|
|
3809
3784
|
ctx.fillRect(0, 0, naturalWidth, naturalHeight);
|
|
3810
|
-
const useCrop = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
3811
|
-
const useAnnotations = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
3785
|
+
const useCrop = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _66 => _66.useCrop]), () => ( true));
|
|
3786
|
+
const useAnnotations = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _67 => _67.useAnnotations]), () => ( true));
|
|
3812
3787
|
if (useCrop && state.crop) {
|
|
3813
3788
|
ctx.fillStyle = MASK_WHITE;
|
|
3814
3789
|
ctx.fillRect(state.crop.x, state.crop.y, state.crop.width, state.crop.height);
|
|
@@ -3818,8 +3793,8 @@ var ImageEditorRenderer = (_class2 = class {constructor() { _class2.prototype.__
|
|
|
3818
3793
|
this.drawAnnotationMask(ctx, ann);
|
|
3819
3794
|
}
|
|
3820
3795
|
}
|
|
3821
|
-
const imageData = _optionalChain([ctx, 'access',
|
|
3822
|
-
const selection = (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
3796
|
+
const imageData = _optionalChain([ctx, 'access', _68 => _68.getImageData, 'optionalCall', _69 => _69(0, 0, naturalWidth, naturalHeight)]);
|
|
3797
|
+
const selection = (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _70 => _70.useSelection]), () => ( true))) && _optionalChain([state, 'access', _71 => _71.selection, 'optionalAccess', _72 => _72.bounds]) && state.selection.width === naturalWidth && state.selection.height === naturalHeight ? state.selection : null;
|
|
3823
3798
|
if (imageData) {
|
|
3824
3799
|
const d = imageData.data;
|
|
3825
3800
|
for (let i = 0; i < d.length; i += 4) {
|
|
@@ -4439,11 +4414,11 @@ function refineCoverage(guide, m, w, h, params = {}) {
|
|
|
4439
4414
|
}
|
|
4440
4415
|
const ss = smoothSigma(p);
|
|
4441
4416
|
if (ss >= 0.3) {
|
|
4442
|
-
a =
|
|
4417
|
+
a = _chunk73L6TROJcjs.gaussianBlur.call(void 0, a, w, h, ss, "clamp");
|
|
4443
4418
|
const gain = 1 + ss;
|
|
4444
4419
|
for (let i = 0; i < a.length; i++) a[i] = Math.min(1, Math.max(0, (a[i] - 0.5) * gain + 0.5));
|
|
4445
4420
|
}
|
|
4446
|
-
a =
|
|
4421
|
+
a = _chunk73L6TROJcjs.gaussianBlur.call(void 0, a, w, h, featherSigma(p), "clamp");
|
|
4447
4422
|
if (p.contrast > 0) {
|
|
4448
4423
|
const gain = 1 / (1 - 0.99 * p.contrast / 100);
|
|
4449
4424
|
for (let i = 0; i < a.length; i++) a[i] = Math.min(1, Math.max(0, (a[i] - 0.5) * gain + 0.5));
|
|
@@ -4507,7 +4482,7 @@ function encodeSurface(surface) {
|
|
|
4507
4482
|
let out = null;
|
|
4508
4483
|
if (b) {
|
|
4509
4484
|
const data = _chunkZOOEX3WTcjs.readRegion.call(void 0, surface, b);
|
|
4510
|
-
out = { url:
|
|
4485
|
+
out = { url: _chunk73L6TROJcjs.pngDataUrl.call(void 0, b.width, b.height, data, surface.channels), x: b.x, y: b.y };
|
|
4511
4486
|
}
|
|
4512
4487
|
encodedCache.set(surface, out);
|
|
4513
4488
|
return out;
|
|
@@ -4523,8 +4498,29 @@ function baseFields(layer, ctx) {
|
|
|
4523
4498
|
if (layer.clipped) out.clipped = true;
|
|
4524
4499
|
if (layer.mask) out.mask = serializeMask(layer.mask, `${layer.id}-mask`, ctx);
|
|
4525
4500
|
if (layer.locks && Object.values(layer.locks).some(Boolean)) out.locks = { ...layer.locks };
|
|
4501
|
+
if (layer.effects) out.effects = serializeEffects(layer.effects);
|
|
4526
4502
|
return out;
|
|
4527
4503
|
}
|
|
4504
|
+
function serializeEffects(effects) {
|
|
4505
|
+
const out = { enabled: effects.enabled, items: JSON.parse(JSON.stringify(effects.items)) };
|
|
4506
|
+
if (effects.scale !== void 0 && effects.scale !== 1) out.scale = effects.scale;
|
|
4507
|
+
if (effects.psd) out.psd = { key: effects.psd.key, data: _chunk73L6TROJcjs.bytesToBase64.call(void 0, effects.psd.data) };
|
|
4508
|
+
return out;
|
|
4509
|
+
}
|
|
4510
|
+
function deserializeEffects(raw) {
|
|
4511
|
+
if (!raw || typeof raw !== "object") return void 0;
|
|
4512
|
+
const r = raw;
|
|
4513
|
+
let psd;
|
|
4514
|
+
const p = r.psd;
|
|
4515
|
+
if (p && typeof p.key === "string" && typeof p.data === "string") {
|
|
4516
|
+
try {
|
|
4517
|
+
psd = { key: p.key, data: _chunk73L6TROJcjs.base64ToBytes.call(void 0, p.data) };
|
|
4518
|
+
} catch (e12) {
|
|
4519
|
+
psd = void 0;
|
|
4520
|
+
}
|
|
4521
|
+
}
|
|
4522
|
+
return _chunk73L6TROJcjs.normalizeLayerEffects.call(void 0, { ...r, psd });
|
|
4523
|
+
}
|
|
4528
4524
|
function serializeMask(mask, hint, ctx) {
|
|
4529
4525
|
const out = { defaultValue: mask.defaultValue };
|
|
4530
4526
|
if (!mask.source) {
|
|
@@ -4557,7 +4553,7 @@ function serializeLayer(layer, ctx) {
|
|
|
4557
4553
|
}
|
|
4558
4554
|
}
|
|
4559
4555
|
if (layer.fillOpacity !== void 0 && layer.fillOpacity !== 1) out.fillOpacity = layer.fillOpacity;
|
|
4560
|
-
if (_optionalChain([layer, 'access',
|
|
4556
|
+
if (_optionalChain([layer, 'access', _73 => _73.filters, 'optionalAccess', _74 => _74.length])) out.filters = JSON.parse(JSON.stringify(layer.filters));
|
|
4561
4557
|
return out;
|
|
4562
4558
|
}
|
|
4563
4559
|
case "adjustment":
|
|
@@ -4595,7 +4591,7 @@ async function serializeLayersExternal(layers, store) {
|
|
|
4595
4591
|
for (const [id, url] of Object.entries(inline.assets)) {
|
|
4596
4592
|
let ref = refs.get(url);
|
|
4597
4593
|
if (!ref) {
|
|
4598
|
-
const parsed =
|
|
4594
|
+
const parsed = _chunk73L6TROJcjs.parseDataUrl.call(void 0, url);
|
|
4599
4595
|
const png = decodePngHeader(parsed.bytes);
|
|
4600
4596
|
ref = await store.put(new Blob([parsed.bytes], { type: "image/png" }), { id, width: png.width, height: png.height });
|
|
4601
4597
|
if (typeof ref !== "string" || !ref) throw new Error(`The asset store returned no reference for "${id}".`);
|
|
@@ -4623,7 +4619,7 @@ async function resolveExternalAssets(assets, store, problems) {
|
|
|
4623
4619
|
try {
|
|
4624
4620
|
const blob = await store.get(ref);
|
|
4625
4621
|
const bytes = new Uint8Array(await blob.arrayBuffer());
|
|
4626
|
-
out[id] = `data:image/png;base64,${
|
|
4622
|
+
out[id] = `data:image/png;base64,${_chunk73L6TROJcjs.bytesToBase64.call(void 0, bytes)}`;
|
|
4627
4623
|
} catch (err) {
|
|
4628
4624
|
problems.push(`Asset "${id}" (${ref}) could not be fetched: ${err.message}`);
|
|
4629
4625
|
}
|
|
@@ -4631,9 +4627,9 @@ async function resolveExternalAssets(assets, store, problems) {
|
|
|
4631
4627
|
return out;
|
|
4632
4628
|
}
|
|
4633
4629
|
function decodePngDataUrl(url, channels) {
|
|
4634
|
-
const parsed =
|
|
4630
|
+
const parsed = _chunk73L6TROJcjs.parseDataUrl.call(void 0, url);
|
|
4635
4631
|
if (!parsed) throw new Error("Asset is not a data URL.");
|
|
4636
|
-
const png =
|
|
4632
|
+
const png = _chunk73L6TROJcjs.decodePng.call(void 0, parsed.bytes, { keepGray: channels === 1 });
|
|
4637
4633
|
if (png.channels === channels) return png;
|
|
4638
4634
|
if (channels === 1) {
|
|
4639
4635
|
const out2 = new Uint8ClampedArray(png.width * png.height);
|
|
@@ -4727,13 +4723,15 @@ function deserializeLayer(raw, ctx) {
|
|
|
4727
4723
|
for (const k of ["pixels", "transparency", "position", "all"]) if (r.locks[k] === true) locks[k] = true;
|
|
4728
4724
|
if (Object.keys(locks).length) base.locks = locks;
|
|
4729
4725
|
}
|
|
4726
|
+
const effects = deserializeEffects(r.effects);
|
|
4727
|
+
if (effects && r.type !== "adjustment") base.effects = effects;
|
|
4730
4728
|
switch (r.type) {
|
|
4731
4729
|
case "pixel": {
|
|
4732
4730
|
const layer = {
|
|
4733
4731
|
...base,
|
|
4734
4732
|
type: "pixel",
|
|
4735
4733
|
surface: r.source === "document" ? _chunkZOOEX3WTcjs.emptySurface.call(void 0, 4) : readSurface(r.asset, r.x, r.y, 4, 0, ctx, `Layer "${base.name || id}"`),
|
|
4736
|
-
offset: { x: Math.round(num(_optionalChain([r, 'access',
|
|
4734
|
+
offset: { x: Math.round(num(_optionalChain([r, 'access', _75 => _75.offset, 'optionalAccess', _76 => _76.x]), -1e7, 1e7, 0)), y: Math.round(num(_optionalChain([r, 'access', _77 => _77.offset, 'optionalAccess', _78 => _78.y]), -1e7, 1e7, 0)) }
|
|
4737
4735
|
};
|
|
4738
4736
|
if (r.source === "document") layer.source = "document";
|
|
4739
4737
|
if (typeof r.fillOpacity === "number" && r.fillOpacity !== 1) layer.fillOpacity = num(r.fillOpacity, 0, 1, 1);
|
|
@@ -4793,47 +4791,47 @@ var fail = (message) => {
|
|
|
4793
4791
|
throw new LayerOperationError(message);
|
|
4794
4792
|
};
|
|
4795
4793
|
function requireLayer(layers, id) {
|
|
4796
|
-
const loc =
|
|
4794
|
+
const loc = _chunk73L6TROJcjs.findLayer.call(void 0, layers, id);
|
|
4797
4795
|
if (!loc) {
|
|
4798
|
-
const ids =
|
|
4796
|
+
const ids = _chunk73L6TROJcjs.flattenLayers.call(void 0, layers).map((l) => l.id);
|
|
4799
4797
|
fail(`Unknown layer "${id}". ${ids.length ? `Layers: ${ids.join(", ")}.` : "The document has no layers."} Call list_layers for ids.`);
|
|
4800
4798
|
}
|
|
4801
4799
|
return loc;
|
|
4802
4800
|
}
|
|
4803
4801
|
function requireUnlocked(layer, what, action) {
|
|
4804
|
-
if (
|
|
4805
|
-
if (what !== "all" &&
|
|
4802
|
+
if (_chunk73L6TROJcjs.isLayerLocked.call(void 0, layer, "all")) fail(`Layer "${layer.name || layer.id}" is locked (all); unlock it before you ${action}.`);
|
|
4803
|
+
if (what !== "all" && _chunk73L6TROJcjs.isLayerLocked.call(void 0, layer, what)) fail(`Layer "${layer.name || layer.id}" has its ${what} locked; unlock it before you ${action}.`);
|
|
4806
4804
|
}
|
|
4807
4805
|
function placeLayer(layers, layer, placement = {}, defaultIndex) {
|
|
4808
4806
|
const given = [placement.aboveId, placement.belowId, placement.parentId].filter((v) => v !== void 0).length;
|
|
4809
4807
|
if (given > 1) fail("Give only one of aboveId, belowId and parentId.");
|
|
4810
4808
|
if (placement.aboveId || placement.belowId) {
|
|
4811
4809
|
const ref = requireLayer(layers, _nullishCoalesce(placement.aboveId, () => ( placement.belowId)));
|
|
4812
|
-
return
|
|
4810
|
+
return _chunk73L6TROJcjs.insertLayer.call(void 0, layers, layer, _nullishCoalesce(_optionalChain([ref, 'access', _79 => _79.parent, 'optionalAccess', _80 => _80.id]), () => ( null)), ref.index + (placement.aboveId ? 1 : 0));
|
|
4813
4811
|
}
|
|
4814
4812
|
if (placement.parentId) {
|
|
4815
4813
|
const ref = requireLayer(layers, placement.parentId);
|
|
4816
4814
|
if (ref.layer.type !== "group") fail(`Layer "${placement.parentId}" is not a group; parentId must be a group id.`);
|
|
4817
|
-
return
|
|
4815
|
+
return _chunk73L6TROJcjs.insertLayer.call(void 0, layers, layer, ref.layer.id, placement.index);
|
|
4818
4816
|
}
|
|
4819
|
-
return
|
|
4817
|
+
return _chunk73L6TROJcjs.insertLayer.call(void 0, layers, layer, null, _nullishCoalesce(placement.index, () => ( defaultIndex)));
|
|
4820
4818
|
}
|
|
4821
4819
|
function removeLayer(layers, id) {
|
|
4822
4820
|
const loc = requireLayer(layers, id);
|
|
4823
4821
|
requireUnlocked(loc.layer, "all", "delete it");
|
|
4824
|
-
return
|
|
4822
|
+
return _chunk73L6TROJcjs.mapLayer.call(void 0, layers, id, () => null);
|
|
4825
4823
|
}
|
|
4826
4824
|
function moveLayer(layers, id, placement) {
|
|
4827
4825
|
const loc = requireLayer(layers, id);
|
|
4828
4826
|
requireUnlocked(loc.layer, "all", "move it");
|
|
4829
4827
|
const target = _nullishCoalesce(_nullishCoalesce(placement.aboveId, () => ( placement.belowId)), () => ( placement.parentId));
|
|
4830
4828
|
if (target === id) fail("A layer cannot be placed relative to itself.");
|
|
4831
|
-
if (target && loc.layer.type === "group" &&
|
|
4829
|
+
if (target && loc.layer.type === "group" && _chunk73L6TROJcjs.flattenLayers.call(void 0, loc.layer.children).some((l) => l.id === target)) {
|
|
4832
4830
|
fail(`Group "${id}" cannot be moved into its own child "${target}".`);
|
|
4833
4831
|
}
|
|
4834
4832
|
if (target) requireLayer(layers, target);
|
|
4835
4833
|
if (!target && placement.index === void 0) fail("Give aboveId, belowId, parentId or index.");
|
|
4836
|
-
const without =
|
|
4834
|
+
const without = _chunk73L6TROJcjs.mapLayer.call(void 0, layers, id, () => null);
|
|
4837
4835
|
return placeLayer(without, loc.layer, placement);
|
|
4838
4836
|
}
|
|
4839
4837
|
function withNewIds(layer) {
|
|
@@ -4847,7 +4845,7 @@ function duplicateLayer(layers, id, name) {
|
|
|
4847
4845
|
const copy = withNewIds(loc.layer);
|
|
4848
4846
|
copy.name = _nullishCoalesce(name, () => ( `${loc.layer.name || "Layer"} copy`));
|
|
4849
4847
|
delete copy.locks;
|
|
4850
|
-
return { layers:
|
|
4848
|
+
return { layers: _chunk73L6TROJcjs.insertLayer.call(void 0, layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _81 => _81.parent, 'optionalAccess', _82 => _82.id]), () => ( null)), loc.index + 1), id: copy.id };
|
|
4851
4849
|
}
|
|
4852
4850
|
function setLayerProperties(layers, id, props) {
|
|
4853
4851
|
const loc = requireLayer(layers, id);
|
|
@@ -4894,13 +4892,13 @@ function setLayerProperties(layers, id, props) {
|
|
|
4894
4892
|
if (props.collapsed) g.collapsed = true;
|
|
4895
4893
|
else delete g.collapsed;
|
|
4896
4894
|
}
|
|
4897
|
-
return
|
|
4895
|
+
return _chunk73L6TROJcjs.mapLayer.call(void 0, layers, id, () => next);
|
|
4898
4896
|
}
|
|
4899
4897
|
function groupLayers(layers, ids, name = "Group") {
|
|
4900
4898
|
if (!ids.length) fail("Give at least one layer id to group.");
|
|
4901
4899
|
const locs = ids.map((id) => requireLayer(layers, id));
|
|
4902
|
-
const parent = _nullishCoalesce(_optionalChain([locs, 'access',
|
|
4903
|
-
if (locs.some((l) => (_nullishCoalesce(_optionalChain([l, 'access',
|
|
4900
|
+
const parent = _nullishCoalesce(_optionalChain([locs, 'access', _83 => _83[0], 'access', _84 => _84.parent, 'optionalAccess', _85 => _85.id]), () => ( null));
|
|
4901
|
+
if (locs.some((l) => (_nullishCoalesce(_optionalChain([l, 'access', _86 => _86.parent, 'optionalAccess', _87 => _87.id]), () => ( null))) !== parent)) fail("Layers to group must share one parent; move them next to each other first.");
|
|
4904
4902
|
for (const l of locs) requireUnlocked(l.layer, "all", "group it");
|
|
4905
4903
|
const ordered = [...new Set(locs)].sort((a, b) => a.index - b.index);
|
|
4906
4904
|
const top = ordered[ordered.length - 1].index;
|
|
@@ -4917,23 +4915,23 @@ function groupLayers(layers, ids, name = "Group") {
|
|
|
4917
4915
|
return c;
|
|
4918
4916
|
})
|
|
4919
4917
|
};
|
|
4920
|
-
if (_optionalChain([group, 'access',
|
|
4918
|
+
if (_optionalChain([group, 'access', _88 => _88.children, 'access', _89 => _89[0], 'optionalAccess', _90 => _90.clipped])) {
|
|
4921
4919
|
const c = { ...group.children[0] };
|
|
4922
4920
|
delete c.clipped;
|
|
4923
4921
|
group.children[0] = c;
|
|
4924
4922
|
}
|
|
4925
4923
|
let out = layers;
|
|
4926
|
-
for (const l of ordered) out =
|
|
4927
|
-
return { layers:
|
|
4924
|
+
for (const l of ordered) out = _chunk73L6TROJcjs.mapLayer.call(void 0, out, l.layer.id, () => null);
|
|
4925
|
+
return { layers: _chunk73L6TROJcjs.insertLayer.call(void 0, out, group, parent, top - below), id: group.id };
|
|
4928
4926
|
}
|
|
4929
4927
|
function ungroupLayer(layers, id) {
|
|
4930
4928
|
const loc = requireLayer(layers, id);
|
|
4931
4929
|
if (loc.layer.type !== "group") fail(`Layer "${id}" is not a group.`);
|
|
4932
4930
|
requireUnlocked(loc.layer, "all", "ungroup it");
|
|
4933
4931
|
const group = loc.layer;
|
|
4934
|
-
let out =
|
|
4932
|
+
let out = _chunk73L6TROJcjs.mapLayer.call(void 0, layers, id, () => null);
|
|
4935
4933
|
group.children.forEach((c, i) => {
|
|
4936
|
-
out =
|
|
4934
|
+
out = _chunk73L6TROJcjs.insertLayer.call(void 0, out, c, _nullishCoalesce(_optionalChain([loc, 'access', _91 => _91.parent, 'optionalAccess', _92 => _92.id]), () => ( null)), loc.index + i);
|
|
4937
4935
|
});
|
|
4938
4936
|
return { layers: out, ids: group.children.map((c) => c.id) };
|
|
4939
4937
|
}
|
|
@@ -4943,12 +4941,12 @@ function offsetLayer(layers, id, offset) {
|
|
|
4943
4941
|
requireUnlocked(loc.layer, "position", "move it");
|
|
4944
4942
|
if (!Number.isFinite(offset.x) || !Number.isFinite(offset.y)) fail("x and y must be numbers.");
|
|
4945
4943
|
const layer = loc.layer;
|
|
4946
|
-
return
|
|
4944
|
+
return _chunk73L6TROJcjs.mapLayer.call(void 0, layers, id, () => ({ ...layer, offset: { x: Math.round(offset.x), y: Math.round(offset.y) } }));
|
|
4947
4945
|
}
|
|
4948
4946
|
function setLayerMask(layers, id, mask) {
|
|
4949
4947
|
const loc = requireLayer(layers, id);
|
|
4950
4948
|
requireUnlocked(loc.layer, "all", "change its mask");
|
|
4951
|
-
return
|
|
4949
|
+
return _chunk73L6TROJcjs.mapLayer.call(void 0, layers, id, (l) => {
|
|
4952
4950
|
const next = { ...l };
|
|
4953
4951
|
if (mask) next.mask = mask;
|
|
4954
4952
|
else delete next.mask;
|
|
@@ -4986,8 +4984,8 @@ function requirePixelLayer(layers, id) {
|
|
|
4986
4984
|
}
|
|
4987
4985
|
function addLayerFilter(layers, id, filter) {
|
|
4988
4986
|
const layer = requirePixelLayer(layers, id);
|
|
4989
|
-
if (_optionalChain([layer, 'access',
|
|
4990
|
-
return
|
|
4987
|
+
if (_optionalChain([layer, 'access', _93 => _93.filters, 'optionalAccess', _94 => _94.some, 'call', _95 => _95((f) => f.kind === filter.kind)])) fail(`Layer "${id}" already has a ${filter.kind} filter; change it with update_layer_filter.`);
|
|
4988
|
+
return _chunk73L6TROJcjs.mapLayer.call(void 0, layers, id, () => ({ ...layer, filters: [..._nullishCoalesce(layer.filters, () => ( [])), filter] }));
|
|
4991
4989
|
}
|
|
4992
4990
|
function updateLayerFilter(layers, id, filterId, changes) {
|
|
4993
4991
|
const layer = requirePixelLayer(layers, id);
|
|
@@ -4998,7 +4996,7 @@ function updateLayerFilter(layers, id, filterId, changes) {
|
|
|
4998
4996
|
const merged = normalizeFilter({ ...current, ...changes, kind: current.kind }, current.id);
|
|
4999
4997
|
const filters = [...layer.filters];
|
|
5000
4998
|
filters[i] = merged;
|
|
5001
|
-
return
|
|
4999
|
+
return _chunk73L6TROJcjs.mapLayer.call(void 0, layers, id, () => ({ ...layer, filters }));
|
|
5002
5000
|
}
|
|
5003
5001
|
function removeLayerFilter(layers, id, filterId) {
|
|
5004
5002
|
const layer = requirePixelLayer(layers, id);
|
|
@@ -5007,7 +5005,78 @@ function removeLayerFilter(layers, id, filterId) {
|
|
|
5007
5005
|
const next = { ...layer };
|
|
5008
5006
|
if (filters.length) next.filters = filters;
|
|
5009
5007
|
else delete next.filters;
|
|
5010
|
-
return
|
|
5008
|
+
return _chunk73L6TROJcjs.mapLayer.call(void 0, layers, id, () => next);
|
|
5009
|
+
}
|
|
5010
|
+
function requireEffectLayer(layers, id, action) {
|
|
5011
|
+
const layer = requireLayer(layers, id).layer;
|
|
5012
|
+
if (layer.type === "adjustment") fail(`Layer "${layer.name || id}" is an adjustment layer; effects go on pixel, annotation and group layers.`);
|
|
5013
|
+
requireUnlocked(layer, "all", action);
|
|
5014
|
+
return layer;
|
|
5015
|
+
}
|
|
5016
|
+
function layerEffectsOf(layer) {
|
|
5017
|
+
return _nullishCoalesce(layer.effects, () => ( { enabled: true, items: [] }));
|
|
5018
|
+
}
|
|
5019
|
+
function guard(fn) {
|
|
5020
|
+
try {
|
|
5021
|
+
return fn();
|
|
5022
|
+
} catch (e) {
|
|
5023
|
+
if (e instanceof _chunk73L6TROJcjs.LayerEffectError) fail(e.message);
|
|
5024
|
+
throw e;
|
|
5025
|
+
}
|
|
5026
|
+
}
|
|
5027
|
+
function setLayerEffects(layers, id, effects) {
|
|
5028
|
+
const layer = requireEffectLayer(layers, id, "change its effects");
|
|
5029
|
+
const next = { ...layer };
|
|
5030
|
+
if (effects && (effects.items.length || effects.psd || effects.scale !== void 0 || !effects.enabled)) {
|
|
5031
|
+
guard(() => _chunk73L6TROJcjs.validateLayerEffects.call(void 0, effects));
|
|
5032
|
+
next.effects = effects;
|
|
5033
|
+
} else delete next.effects;
|
|
5034
|
+
return _chunk73L6TROJcjs.mapLayer.call(void 0, layers, id, () => next);
|
|
5035
|
+
}
|
|
5036
|
+
function addLayerEffect(layers, id, kind, params = {}, index) {
|
|
5037
|
+
if (!_chunk73L6TROJcjs.isLayerEffectKind.call(void 0, kind)) fail(`Unknown effect kind "${String(kind)}". Kinds: ${_chunk73L6TROJcjs.LAYER_EFFECT_KINDS.join(", ")}.`);
|
|
5038
|
+
const layer = requireEffectLayer(layers, id, "add effects");
|
|
5039
|
+
const current = layerEffectsOf(layer);
|
|
5040
|
+
const ids = new Set(current.items.map((e) => e.id));
|
|
5041
|
+
let effectId = _chunk73L6TROJcjs.newEffectId.call(void 0, );
|
|
5042
|
+
while (ids.has(effectId)) effectId = _chunk73L6TROJcjs.newEffectId.call(void 0, );
|
|
5043
|
+
const { id: _ignored, kind: _kind, ...rest } = params;
|
|
5044
|
+
const effect = guard(() => _chunk73L6TROJcjs.mergeLayerEffect.call(void 0, _chunk73L6TROJcjs.defaultLayerEffect.call(void 0, kind, effectId), rest));
|
|
5045
|
+
const items = [...current.items];
|
|
5046
|
+
const at = index === void 0 ? items.length : Math.max(0, Math.min(items.length, Math.floor(index)));
|
|
5047
|
+
items.splice(at, 0, effect);
|
|
5048
|
+
return { layers: setLayerEffects(layers, id, { ...current, items }), effect };
|
|
5049
|
+
}
|
|
5050
|
+
function requireEffect(layer, effectId) {
|
|
5051
|
+
const items = _nullishCoalesce(_optionalChain([layer, 'access', _96 => _96.effects, 'optionalAccess', _97 => _97.items]), () => ( []));
|
|
5052
|
+
const i = items.findIndex((e) => e.id === effectId);
|
|
5053
|
+
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.`);
|
|
5054
|
+
return i;
|
|
5055
|
+
}
|
|
5056
|
+
function updateLayerEffect(layers, id, effectId, changes) {
|
|
5057
|
+
const layer = requireEffectLayer(layers, id, "change its effects");
|
|
5058
|
+
const i = requireEffect(layer, effectId);
|
|
5059
|
+
const current = layer.effects;
|
|
5060
|
+
const items = [...current.items];
|
|
5061
|
+
items[i] = guard(() => _chunk73L6TROJcjs.mergeLayerEffect.call(void 0, items[i], changes));
|
|
5062
|
+
return setLayerEffects(layers, id, { ...current, items });
|
|
5063
|
+
}
|
|
5064
|
+
function removeLayerEffect(layers, id, effectId) {
|
|
5065
|
+
const layer = requireEffectLayer(layers, id, "change its effects");
|
|
5066
|
+
requireEffect(layer, effectId);
|
|
5067
|
+
const current = layer.effects;
|
|
5068
|
+
return setLayerEffects(layers, id, { ...current, items: current.items.filter((e) => e.id !== effectId) });
|
|
5069
|
+
}
|
|
5070
|
+
function setLayerEffectsEnabled(layers, id, enabled, scale) {
|
|
5071
|
+
const layer = requireEffectLayer(layers, id, "change its effects");
|
|
5072
|
+
if (scale !== void 0 && !(Number.isFinite(scale) && scale >= 0.01 && scale <= 10)) fail(`scale must be from 0.01 to 10 (1 = 100 %), got ${scale}.`);
|
|
5073
|
+
const current = layerEffectsOf(layer);
|
|
5074
|
+
const next = { ...current, enabled };
|
|
5075
|
+
if (scale !== void 0) {
|
|
5076
|
+
if (scale === 1) delete next.scale;
|
|
5077
|
+
else next.scale = scale;
|
|
5078
|
+
}
|
|
5079
|
+
return setLayerEffects(layers, id, next);
|
|
5011
5080
|
}
|
|
5012
5081
|
function parseBlend(value, allowPassThrough = false) {
|
|
5013
5082
|
if (value === void 0) return void 0;
|
|
@@ -5246,7 +5315,7 @@ var PsdWriter = (_class4 = class {constructor() { _class4.prototype.__init24.cal
|
|
|
5246
5315
|
function decodeLegacyName(b) {
|
|
5247
5316
|
try {
|
|
5248
5317
|
return new TextDecoder("utf-8", { fatal: true }).decode(b);
|
|
5249
|
-
} catch (
|
|
5318
|
+
} catch (e13) {
|
|
5250
5319
|
return String.fromCharCode(...b);
|
|
5251
5320
|
}
|
|
5252
5321
|
}
|
|
@@ -5267,7 +5336,7 @@ function descriptor(classId, items = []) {
|
|
|
5267
5336
|
return { name: "", classId, items };
|
|
5268
5337
|
}
|
|
5269
5338
|
function descGet(d, key) {
|
|
5270
|
-
return _optionalChain([d, 'access',
|
|
5339
|
+
return _optionalChain([d, 'access', _98 => _98.items, 'access', _99 => _99.find, 'call', _100 => _100(([k]) => k === key), 'optionalAccess', _101 => _101[1]]);
|
|
5271
5340
|
}
|
|
5272
5341
|
function descNumber(d, key) {
|
|
5273
5342
|
const v = descGet(d, key);
|
|
@@ -5277,7 +5346,7 @@ function descNumber(d, key) {
|
|
|
5277
5346
|
}
|
|
5278
5347
|
function descBool(d, key) {
|
|
5279
5348
|
const v = descGet(d, key);
|
|
5280
|
-
return _optionalChain([v, 'optionalAccess',
|
|
5349
|
+
return _optionalChain([v, 'optionalAccess', _102 => _102.type]) === "bool" ? v.value : void 0;
|
|
5281
5350
|
}
|
|
5282
5351
|
function descObject(d, key) {
|
|
5283
5352
|
const v = descGet(d, key);
|
|
@@ -5748,7 +5817,7 @@ function parseAdjustmentBlock(key, data) {
|
|
|
5748
5817
|
default:
|
|
5749
5818
|
return null;
|
|
5750
5819
|
}
|
|
5751
|
-
} catch (
|
|
5820
|
+
} catch (e14) {
|
|
5752
5821
|
return null;
|
|
5753
5822
|
}
|
|
5754
5823
|
}
|
|
@@ -5924,9 +5993,9 @@ function packbitsDecodeInto(src, expected, out, at) {
|
|
|
5924
5993
|
function inflateChecked(data, expected) {
|
|
5925
5994
|
let out;
|
|
5926
5995
|
try {
|
|
5927
|
-
out =
|
|
5996
|
+
out = _chunk73L6TROJcjs.inflate.call(void 0, data, { maxOutput: expected + (1 << 20), sizeHint: expected, verify: false });
|
|
5928
5997
|
} catch (e) {
|
|
5929
|
-
throw new PsdError(`ZIP channel data: ${e instanceof
|
|
5998
|
+
throw new PsdError(`ZIP channel data: ${e instanceof _chunk73L6TROJcjs.ZlibError || e instanceof Error ? e.message : String(e)}`);
|
|
5930
5999
|
}
|
|
5931
6000
|
if (out.length < expected) throw new PsdError(`ZIP stream produced ${out.length} of ${expected} bytes.`);
|
|
5932
6001
|
return out.length === expected ? out : out.subarray(0, expected);
|
|
@@ -6165,7 +6234,7 @@ function parseMask(d) {
|
|
|
6165
6234
|
}
|
|
6166
6235
|
if (!realFirst) m.real = readReal();
|
|
6167
6236
|
return m;
|
|
6168
|
-
} catch (
|
|
6237
|
+
} catch (e15) {
|
|
6169
6238
|
return void 0;
|
|
6170
6239
|
}
|
|
6171
6240
|
}
|
|
@@ -6239,14 +6308,14 @@ function readPsd(bytes) {
|
|
|
6239
6308
|
return { header, colorModeData, resources, layers, mergedAlpha, globalBlocks, imageCompression, imageData: r.rest() };
|
|
6240
6309
|
}
|
|
6241
6310
|
function layerBlock(rec, key) {
|
|
6242
|
-
return _optionalChain([rec, 'access',
|
|
6311
|
+
return _optionalChain([rec, 'access', _103 => _103.blocks, 'access', _104 => _104.find, 'call', _105 => _105((b) => b.key === key), 'optionalAccess', _106 => _106.data]);
|
|
6243
6312
|
}
|
|
6244
6313
|
function layerName(rec) {
|
|
6245
6314
|
const luni = layerBlock(rec, "luni");
|
|
6246
6315
|
if (luni) {
|
|
6247
6316
|
try {
|
|
6248
6317
|
return new PsdReader(luni).unicode();
|
|
6249
|
-
} catch (
|
|
6318
|
+
} catch (e16) {
|
|
6250
6319
|
}
|
|
6251
6320
|
}
|
|
6252
6321
|
return rec.legacyName;
|
|
@@ -6270,7 +6339,7 @@ function u8Block(rec, key) {
|
|
|
6270
6339
|
function layerTree(file) {
|
|
6271
6340
|
const stack = [[]];
|
|
6272
6341
|
file.layers.forEach((rec, index) => {
|
|
6273
|
-
const kind = _nullishCoalesce(_optionalChain([sectionDivider, 'call',
|
|
6342
|
+
const kind = _nullishCoalesce(_optionalChain([sectionDivider, 'call', _107 => _107(rec), 'optionalAccess', _108 => _108.kind]), () => ( SECTION_OTHER));
|
|
6274
6343
|
if (kind === SECTION_DIVIDER) {
|
|
6275
6344
|
stack.push([]);
|
|
6276
6345
|
} else if (kind === SECTION_OPEN || kind === SECTION_CLOSED) {
|
|
@@ -6288,7 +6357,7 @@ function layerTree(file) {
|
|
|
6288
6357
|
}
|
|
6289
6358
|
function channelRect(rec, id) {
|
|
6290
6359
|
if (id === CHANNEL_USER_MASK && rec.mask) return rec.mask.rect;
|
|
6291
|
-
if (id === CHANNEL_REAL_USER_MASK && rec.mask) return _nullishCoalesce(_optionalChain([rec, 'access',
|
|
6360
|
+
if (id === CHANNEL_REAL_USER_MASK && rec.mask) return _nullishCoalesce(_optionalChain([rec, 'access', _109 => _109.mask, 'access', _110 => _110.real, 'optionalAccess', _111 => _111.rect]), () => ( rec.mask.rect));
|
|
6292
6361
|
return rec.rect;
|
|
6293
6362
|
}
|
|
6294
6363
|
function decodeLayerChannel(file, rec, id) {
|
|
@@ -6306,7 +6375,7 @@ function decodeMergedImage(file) {
|
|
|
6306
6375
|
return decodePlanes(file.imageCompression, file.imageData, { planes: channels, width, height, depth, psb });
|
|
6307
6376
|
}
|
|
6308
6377
|
function resource(file, id) {
|
|
6309
|
-
return _optionalChain([file, 'access',
|
|
6378
|
+
return _optionalChain([file, 'access', _112 => _112.resources, 'access', _113 => _113.find, 'call', _114 => _114((r) => r.id === id), 'optionalAccess', _115 => _115.data]);
|
|
6310
6379
|
}
|
|
6311
6380
|
function resolution(file) {
|
|
6312
6381
|
const d = resource(file, 1005);
|
|
@@ -6755,7 +6824,7 @@ function importNode(ctx, node, depth) {
|
|
|
6755
6824
|
if (node.children) {
|
|
6756
6825
|
const props2 = baseProps(ctx, rec, name, notes);
|
|
6757
6826
|
const divider = sectionDivider(rec);
|
|
6758
|
-
const key = _nullishCoalesce(_optionalChain([divider, 'optionalAccess',
|
|
6827
|
+
const key = _nullishCoalesce(_optionalChain([divider, 'optionalAccess', _116 => _116.blendKey]), () => ( rec.blendKey));
|
|
6759
6828
|
const groupBlend = key === "pass" ? "pass-through" : _nullishCoalesce(PSD_BLEND_KEYS[key], () => ( "normal"));
|
|
6760
6829
|
const children = [];
|
|
6761
6830
|
for (const child of node.children) {
|
|
@@ -6763,7 +6832,7 @@ function importNode(ctx, node, depth) {
|
|
|
6763
6832
|
if (layer2) children.push(layer2);
|
|
6764
6833
|
}
|
|
6765
6834
|
const group = { type: "group", id: ctx.newId(name), ...props2, blend: groupBlend, children };
|
|
6766
|
-
if (_optionalChain([divider, 'optionalAccess',
|
|
6835
|
+
if (_optionalChain([divider, 'optionalAccess', _117 => _117.kind]) === SECTION_CLOSED) group.collapsed = true;
|
|
6767
6836
|
const mask2 = recordMask(ctx, rec, name);
|
|
6768
6837
|
if (mask2) group.mask = mask2;
|
|
6769
6838
|
entry.type = "group";
|
|
@@ -6956,7 +7025,7 @@ function exportPsd(input) {
|
|
|
6956
7025
|
return {
|
|
6957
7026
|
opacity: Math.round(Math.min(1, Math.max(0, layer.opacity)) * 255),
|
|
6958
7027
|
clipping: layer.clipped ? 1 : 0,
|
|
6959
|
-
flags: (layer.visible ? 0 : LAYER_FLAG_HIDDEN) | (_optionalChain([layer, 'access',
|
|
7028
|
+
flags: (layer.visible ? 0 : LAYER_FLAG_HIDDEN) | (_optionalChain([layer, 'access', _118 => _118.locks, 'optionalAccess', _119 => _119.transparency]) ? LAYER_FLAG_TRANSPARENCY_PROTECTED : 0),
|
|
6960
7029
|
legacyName: name,
|
|
6961
7030
|
blocks
|
|
6962
7031
|
};
|
|
@@ -7013,7 +7082,7 @@ function exportPsd(input) {
|
|
|
7013
7082
|
}
|
|
7014
7083
|
case "pixel": {
|
|
7015
7084
|
if (layer.source === "document") throw new PsdError(`Layer "${layer.name}" reads the document image; resolve its pixels before export.`);
|
|
7016
|
-
if (_optionalChain([layer, 'access',
|
|
7085
|
+
if (_optionalChain([layer, 'access', _120 => _120.filters, 'optionalAccess', _121 => _121.some, 'call', _122 => _122(isActiveFilter)])) throw new PsdError(`Layer "${layer.name}" has live filters; bake them before export.`);
|
|
7017
7086
|
const extra = [];
|
|
7018
7087
|
if (layer.fillOpacity !== void 0 && layer.fillOpacity < 1) {
|
|
7019
7088
|
extra.push({ key: "iOpa", data: Uint8Array.from([Math.round(Math.max(0, layer.fillOpacity) * 255), 0, 0, 0]) });
|
|
@@ -7097,8 +7166,8 @@ function paintCoverageInto(base, coverage, apply, rects) {
|
|
|
7097
7166
|
const key = _chunkZOOEX3WTcjs.tileKey.call(void 0, t.tx, t.ty);
|
|
7098
7167
|
if (done.has(key)) continue;
|
|
7099
7168
|
done.add(key);
|
|
7100
|
-
const src = _nullishCoalesce(_optionalChain([base, 'access',
|
|
7101
|
-
const data =
|
|
7169
|
+
const src = _nullishCoalesce(_optionalChain([base, 'access', _123 => _123.tiles, 'access', _124 => _124.get, 'call', _125 => _125(key), 'optionalAccess', _126 => _126.data]), () => ( defaultTile(base)));
|
|
7170
|
+
const data = _chunk4F3YDIWWcjs.applyStrokeToTile.call(void 0, coverage, src, base.channels, t.tx, t.ty, apply);
|
|
7102
7171
|
const tile = _chunkZOOEX3WTcjs.finishTile.call(void 0, data, base.channels, base.defaultValue);
|
|
7103
7172
|
if (tile) tiles.set(key, tile);
|
|
7104
7173
|
else tiles.delete(key);
|
|
@@ -7152,10 +7221,10 @@ var PaintStrokeSession = (_class6 = class {
|
|
|
7152
7221
|
}
|
|
7153
7222
|
}
|
|
7154
7223
|
for (const [key, { tx, ty, r }] of regions) {
|
|
7155
|
-
const src = _nullishCoalesce(_optionalChain([this, 'access',
|
|
7156
|
-
const prev = this.touched.has(key) ? _optionalChain([this, 'access',
|
|
7224
|
+
const src = _nullishCoalesce(_optionalChain([this, 'access', _127 => _127.base, 'access', _128 => _128.tiles, 'access', _129 => _129.get, 'call', _130 => _130(key), 'optionalAccess', _131 => _131.data]), () => ( defaultTile(this.base)));
|
|
7225
|
+
const prev = this.touched.has(key) ? _optionalChain([this, 'access', _132 => _132.live, 'access', _133 => _133.get, 'call', _134 => _134(key), 'optionalAccess', _135 => _135.data]) : void 0;
|
|
7157
7226
|
this.touched.add(key);
|
|
7158
|
-
const data =
|
|
7227
|
+
const data = _chunk4F3YDIWWcjs.applyStrokeToTile.call(void 0, this.stroke.coverage, src, ch, tx, ty, this.apply, prev ? { into: prev, region: r } : {});
|
|
7159
7228
|
this.live.set(key, { data, uniform: null });
|
|
7160
7229
|
}
|
|
7161
7230
|
this.controller._strokeUpdate(this.target.id, this.target.channel, new (0, _chunkZOOEX3WTcjs.TiledSurface)(ch, new Map(this.live), this.base.defaultValue), rects);
|
|
@@ -7224,14 +7293,14 @@ function migrateSerializedImageEditorState(data) {
|
|
|
7224
7293
|
const legacy = data;
|
|
7225
7294
|
const adjustments = normalizeStoredAdjustments(legacy.adjustments);
|
|
7226
7295
|
return {
|
|
7227
|
-
version: _optionalChain([adjustments, 'access',
|
|
7296
|
+
version: _optionalChain([adjustments, 'access', _136 => _136.layers, 'optionalAccess', _137 => _137.length]) ? 2 : 1,
|
|
7228
7297
|
crop: legacy.crop ? { ...legacy.crop } : null,
|
|
7229
7298
|
transform: { ...DEFAULT_TRANSFORM, ...legacy.transform },
|
|
7230
7299
|
adjustments: serializeAdjustments(adjustments),
|
|
7231
7300
|
depthMask: {
|
|
7232
7301
|
...DEFAULT_DEPTH_MASK,
|
|
7233
7302
|
...legacy.depthMask,
|
|
7234
|
-
depthRange: [..._nullishCoalesce(_optionalChain([legacy, 'access',
|
|
7303
|
+
depthRange: [..._nullishCoalesce(_optionalChain([legacy, 'access', _138 => _138.depthMask, 'optionalAccess', _139 => _139.depthRange]), () => ( DEFAULT_DEPTH_MASK.depthRange))]
|
|
7235
7304
|
},
|
|
7236
7305
|
annotations: JSON.parse(JSON.stringify(_nullishCoalesce(legacy.annotations, () => ( [])))),
|
|
7237
7306
|
...legacy.selection ? { selection: { ...legacy.selection } } : {}
|
|
@@ -7293,7 +7362,8 @@ var ImageEditorController = (_class7 = class {
|
|
|
7293
7362
|
this.renderer.layerSources = {
|
|
7294
7363
|
surfaceOf: (layer) => this.surfaceOf(layer),
|
|
7295
7364
|
sourceIsOpaque: () => this.sourceIsOpaque(),
|
|
7296
|
-
version: () => this.sourceVersion()
|
|
7365
|
+
version: () => this.sourceVersion(),
|
|
7366
|
+
globalLight: () => this.state.globalLight
|
|
7297
7367
|
};
|
|
7298
7368
|
this.state = {
|
|
7299
7369
|
sourceUrl: typeof options.image === "string" ? options.image : null,
|
|
@@ -7314,7 +7384,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7314
7384
|
activeLayerId: null,
|
|
7315
7385
|
activeTarget: "pixels",
|
|
7316
7386
|
outputOpacity: 1,
|
|
7317
|
-
paint: { brush: { ...
|
|
7387
|
+
paint: { brush: { ..._chunk4F3YDIWWcjs.DEFAULT_BRUSH }, foreground: "#000000", background: "#ffffff" },
|
|
7318
7388
|
fit: _nullishCoalesce(options.fit, () => ( "margin"))
|
|
7319
7389
|
};
|
|
7320
7390
|
if (options.image instanceof Object && "width" in options.image) {
|
|
@@ -7326,10 +7396,10 @@ var ImageEditorController = (_class7 = class {
|
|
|
7326
7396
|
};
|
|
7327
7397
|
}
|
|
7328
7398
|
this.applyStored(_nullishCoalesce(options.initialState, () => ( {})));
|
|
7329
|
-
if (_optionalChain([options, 'access',
|
|
7399
|
+
if (_optionalChain([options, 'access', _140 => _140.initialState, 'optionalAccess', _141 => _141.selection])) {
|
|
7330
7400
|
try {
|
|
7331
7401
|
this.state.selection = normalizeSelection(deserializeSelection(options.initialState.selection));
|
|
7332
|
-
} catch (
|
|
7402
|
+
} catch (e17) {
|
|
7333
7403
|
}
|
|
7334
7404
|
}
|
|
7335
7405
|
this.initialSnapshot = this.captureHistoryEntry();
|
|
@@ -7370,7 +7440,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7370
7440
|
height: img.naturalHeight || img.height || 600
|
|
7371
7441
|
}
|
|
7372
7442
|
};
|
|
7373
|
-
} catch (
|
|
7443
|
+
} catch (e18) {
|
|
7374
7444
|
return { sourceUrl: src, element: null, dimensions: { ...this.state.imageDimensions } };
|
|
7375
7445
|
}
|
|
7376
7446
|
}
|
|
@@ -7409,7 +7479,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7409
7479
|
else if (!strokeRects) this.pendingDirty = "all";
|
|
7410
7480
|
this.syncViews();
|
|
7411
7481
|
const currentState = { ...this.state };
|
|
7412
|
-
_optionalChain([this, 'access',
|
|
7482
|
+
_optionalChain([this, 'access', _142 => _142.onStateChange, 'optionalCall', _143 => _143(currentState)]);
|
|
7413
7483
|
this.listeners.forEach((l) => l(currentState));
|
|
7414
7484
|
}
|
|
7415
7485
|
/** Recomputes the compatibility views (`adjustments`, `depthMask`, `annotations`) when the stack changed. */
|
|
@@ -7447,6 +7517,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7447
7517
|
}
|
|
7448
7518
|
};
|
|
7449
7519
|
if (s.legacyOutputBlur !== void 0) entry.legacyOutputBlur = s.legacyOutputBlur;
|
|
7520
|
+
if (s.globalLight) entry.globalLight = { ...s.globalLight };
|
|
7450
7521
|
return entry;
|
|
7451
7522
|
}
|
|
7452
7523
|
restoreHistoryEntry(entry) {
|
|
@@ -7459,6 +7530,8 @@ var ImageEditorController = (_class7 = class {
|
|
|
7459
7530
|
s.outputOpacity = entry.outputOpacity;
|
|
7460
7531
|
if (entry.legacyOutputBlur !== void 0) s.legacyOutputBlur = entry.legacyOutputBlur;
|
|
7461
7532
|
else delete s.legacyOutputBlur;
|
|
7533
|
+
if (entry.globalLight) s.globalLight = { ...entry.globalLight };
|
|
7534
|
+
else delete s.globalLight;
|
|
7462
7535
|
s.selection = entry.selection;
|
|
7463
7536
|
if (this.imageElement !== entry.source.element && !this.samplePixelsOverride) this.samplePixels = null;
|
|
7464
7537
|
this.imageElement = entry.source.element;
|
|
@@ -7614,7 +7687,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7614
7687
|
return this.state.layers;
|
|
7615
7688
|
}
|
|
7616
7689
|
getLayer(id) {
|
|
7617
|
-
return _optionalChain([
|
|
7690
|
+
return _optionalChain([_chunk73L6TROJcjs.findLayer.call(void 0, this.state.layers, id), 'optionalAccess', _144 => _144.layer]);
|
|
7618
7691
|
}
|
|
7619
7692
|
/** The active layer, or `undefined`. */
|
|
7620
7693
|
getActiveLayer() {
|
|
@@ -7627,7 +7700,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7627
7700
|
setActiveLayer(id, target = "pixels") {
|
|
7628
7701
|
if (id !== null && !this.getLayer(id)) return false;
|
|
7629
7702
|
const layer = id ? this.getLayer(id) : void 0;
|
|
7630
|
-
const t = target === "mask" && _optionalChain([layer, 'optionalAccess',
|
|
7703
|
+
const t = target === "mask" && _optionalChain([layer, 'optionalAccess', _145 => _145.mask]) ? "mask" : "pixels";
|
|
7631
7704
|
if (this.state.activeLayerId === id && this.state.activeTarget === t) return true;
|
|
7632
7705
|
this.state.activeLayerId = id;
|
|
7633
7706
|
this.state.activeTarget = t;
|
|
@@ -7673,14 +7746,14 @@ var ImageEditorController = (_class7 = class {
|
|
|
7673
7746
|
let layers = this.state.layers;
|
|
7674
7747
|
if (options.layerIds) {
|
|
7675
7748
|
const keep = new Set(options.layerIds);
|
|
7676
|
-
layers =
|
|
7749
|
+
layers = _chunk73L6TROJcjs.flattenLayers.call(void 0, layers).filter((l) => keep.has(l.id) && l.type !== "group");
|
|
7677
7750
|
}
|
|
7678
7751
|
const data = this.compositor.composite(layers, r, this.compositorSources());
|
|
7679
7752
|
return { width: r.width, height: r.height, data };
|
|
7680
7753
|
}
|
|
7681
7754
|
compositorSources() {
|
|
7682
7755
|
const { width, height } = this.naturalSize;
|
|
7683
|
-
return { width, height, surfaceOf: (l) => this.surfaceOf(l), version: this.sourceVersion() };
|
|
7756
|
+
return { width, height, surfaceOf: (l) => this.surfaceOf(l), version: this.sourceVersion(), globalLight: this.state.globalLight };
|
|
7684
7757
|
}
|
|
7685
7758
|
__init44() {this.sourceIds = /* @__PURE__ */ new WeakMap()}
|
|
7686
7759
|
__init45() {this.nextSourceId = 1}
|
|
@@ -7756,9 +7829,9 @@ var ImageEditorController = (_class7 = class {
|
|
|
7756
7829
|
if (!ctx || typeof ctx.getImageData !== "function") return null;
|
|
7757
7830
|
ctx.drawImage(el, 0, 0, width, height);
|
|
7758
7831
|
const data = ctx.getImageData(0, 0, width, height);
|
|
7759
|
-
if (!_optionalChain([data, 'optionalAccess',
|
|
7832
|
+
if (!_optionalChain([data, 'optionalAccess', _146 => _146.data]) || data.data.length < width * height * 4) return null;
|
|
7760
7833
|
return { width, height, data: data.data };
|
|
7761
|
-
} catch (
|
|
7834
|
+
} catch (e19) {
|
|
7762
7835
|
return null;
|
|
7763
7836
|
}
|
|
7764
7837
|
}
|
|
@@ -7767,8 +7840,8 @@ var ImageEditorController = (_class7 = class {
|
|
|
7767
7840
|
commitLayers(next, extra, commitToHistory = true) {
|
|
7768
7841
|
if (commitToHistory) this.recordHistory();
|
|
7769
7842
|
this.state.layers = next;
|
|
7770
|
-
_optionalChain([extra, 'optionalCall',
|
|
7771
|
-
if (this.state.activeLayerId && !
|
|
7843
|
+
_optionalChain([extra, 'optionalCall', _147 => _147()]);
|
|
7844
|
+
if (this.state.activeLayerId && !_chunk73L6TROJcjs.findLayer.call(void 0, next, this.state.activeLayerId)) {
|
|
7772
7845
|
this.state.activeLayerId = null;
|
|
7773
7846
|
this.state.activeTarget = "pixels";
|
|
7774
7847
|
}
|
|
@@ -7777,7 +7850,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7777
7850
|
/** The default position of a new layer: above the active layer, else the top of the stack. */
|
|
7778
7851
|
newLayerPlacement(placement) {
|
|
7779
7852
|
if (placement.aboveId || placement.belowId || placement.parentId || placement.index !== void 0) return placement;
|
|
7780
|
-
const active = this.state.activeLayerId ?
|
|
7853
|
+
const active = this.state.activeLayerId ? _chunk73L6TROJcjs.findLayer.call(void 0, this.state.layers, this.state.activeLayerId) : null;
|
|
7781
7854
|
return active ? { aboveId: active.layer.id } : {};
|
|
7782
7855
|
}
|
|
7783
7856
|
/**
|
|
@@ -7800,11 +7873,11 @@ var ImageEditorController = (_class7 = class {
|
|
|
7800
7873
|
}
|
|
7801
7874
|
const blend = parseBlend(init.blend);
|
|
7802
7875
|
if (init.opacity !== void 0 && !(init.opacity >= 0 && init.opacity <= 1)) throw new LayerOperationError("opacity must be from 0 to 1.");
|
|
7803
|
-
const ids = new Set(
|
|
7876
|
+
const ids = new Set(_chunk73L6TROJcjs.flattenLayers.call(void 0, this.state.layers).map((l) => l.id));
|
|
7804
7877
|
const layer = {
|
|
7805
7878
|
type: "pixel",
|
|
7806
7879
|
id: init.id && !ids.has(init.id) ? init.id : newLayerId(),
|
|
7807
|
-
name: _optionalChain([init, 'access',
|
|
7880
|
+
name: _optionalChain([init, 'access', _148 => _148.name, 'optionalAccess', _149 => _149.trim, 'call', _150 => _150()]) || this.nextLayerName(),
|
|
7808
7881
|
visible: _nullishCoalesce(init.visible, () => ( true)),
|
|
7809
7882
|
opacity: _nullishCoalesce(init.opacity, () => ( 1)),
|
|
7810
7883
|
blend: _nullishCoalesce(blend, () => ( "normal")),
|
|
@@ -7831,27 +7904,27 @@ var ImageEditorController = (_class7 = class {
|
|
|
7831
7904
|
async decodeImage(image) {
|
|
7832
7905
|
const trimmed = image.trim();
|
|
7833
7906
|
let png = null;
|
|
7834
|
-
if (/^data:image\/png/i.test(trimmed)) png = _nullishCoalesce(_optionalChain([
|
|
7907
|
+
if (/^data:image\/png/i.test(trimmed)) png = _nullishCoalesce(_optionalChain([_chunk73L6TROJcjs.parseDataUrl.call(void 0, trimmed), 'optionalAccess', _151 => _151.bytes]), () => ( null));
|
|
7835
7908
|
else if (/^[A-Za-z0-9+/=\s]+$/.test(trimmed) && trimmed.length > 16) {
|
|
7836
7909
|
try {
|
|
7837
|
-
const bytes =
|
|
7838
|
-
if (
|
|
7839
|
-
} catch (
|
|
7910
|
+
const bytes = _chunk73L6TROJcjs.base64ToBytes.call(void 0, trimmed);
|
|
7911
|
+
if (_chunk73L6TROJcjs.isPng.call(void 0, bytes)) png = bytes;
|
|
7912
|
+
} catch (e20) {
|
|
7840
7913
|
png = null;
|
|
7841
7914
|
}
|
|
7842
7915
|
}
|
|
7843
7916
|
if (png) {
|
|
7844
7917
|
try {
|
|
7845
|
-
const d =
|
|
7918
|
+
const d = _chunk73L6TROJcjs.decodePng.call(void 0, png);
|
|
7846
7919
|
return { width: d.width, height: d.height, data: d.data };
|
|
7847
|
-
} catch (
|
|
7920
|
+
} catch (e21) {
|
|
7848
7921
|
}
|
|
7849
7922
|
}
|
|
7850
|
-
const src = png ? `data:image/png;base64,${
|
|
7923
|
+
const src = png ? `data:image/png;base64,${_chunk73L6TROJcjs.bytesToBase64.call(void 0, png)}` : trimmed;
|
|
7851
7924
|
let img;
|
|
7852
7925
|
try {
|
|
7853
7926
|
img = await this.renderer.imageCache.get(src);
|
|
7854
|
-
} catch (
|
|
7927
|
+
} catch (e22) {
|
|
7855
7928
|
throw new LayerOperationError("The image could not be decoded here. Pass a PNG (data URL or base64), or run in a browser for other formats and URLs.");
|
|
7856
7929
|
}
|
|
7857
7930
|
const w = img.naturalWidth || img.width;
|
|
@@ -7863,7 +7936,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7863
7936
|
return { width: w, height: h, data: data.data };
|
|
7864
7937
|
}
|
|
7865
7938
|
nextLayerName() {
|
|
7866
|
-
const names = new Set(
|
|
7939
|
+
const names = new Set(_chunk73L6TROJcjs.flattenLayers.call(void 0, this.state.layers).map((l) => l.name));
|
|
7867
7940
|
let n = 1;
|
|
7868
7941
|
while (names.has(`Layer ${n}`)) n++;
|
|
7869
7942
|
return `Layer ${n}`;
|
|
@@ -7880,7 +7953,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7880
7953
|
removeLayer(id) {
|
|
7881
7954
|
const next = removeLayer(this.state.layers, id);
|
|
7882
7955
|
this.commitLayers(next, () => {
|
|
7883
|
-
if (this.state.selectedAnnotationId && !
|
|
7956
|
+
if (this.state.selectedAnnotationId && !_chunk73L6TROJcjs.flattenLayers.call(void 0, next).some((l) => l.type === "annotation" && l.annotation.id === this.state.selectedAnnotationId)) {
|
|
7884
7957
|
this.state.selectedAnnotationId = null;
|
|
7885
7958
|
}
|
|
7886
7959
|
});
|
|
@@ -7888,10 +7961,10 @@ var ImageEditorController = (_class7 = class {
|
|
|
7888
7961
|
/** Moves a layer above / below another, or into a group, as one undo step. Returns its new parent and index. */
|
|
7889
7962
|
moveLayer(id, placement) {
|
|
7890
7963
|
const next = moveLayer(this.state.layers, id, placement);
|
|
7891
|
-
const loc =
|
|
7892
|
-
if (next === this.state.layers) return { parentId: _nullishCoalesce(_optionalChain([loc, 'access',
|
|
7964
|
+
const loc = _chunk73L6TROJcjs.findLayer.call(void 0, next, id);
|
|
7965
|
+
if (next === this.state.layers) return { parentId: _nullishCoalesce(_optionalChain([loc, 'access', _152 => _152.parent, 'optionalAccess', _153 => _153.id]), () => ( null)), index: loc.index };
|
|
7893
7966
|
this.commitLayers(next);
|
|
7894
|
-
return { parentId: _nullishCoalesce(_optionalChain([loc, 'access',
|
|
7967
|
+
return { parentId: _nullishCoalesce(_optionalChain([loc, 'access', _154 => _154.parent, 'optionalAccess', _155 => _155.id]), () => ( null)), index: loc.index };
|
|
7895
7968
|
}
|
|
7896
7969
|
/**
|
|
7897
7970
|
* Changes name, visibility, opacity, fill, blend, clipping, locks or (groups) collapsed state, as
|
|
@@ -7900,7 +7973,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7900
7973
|
setLayerProperties(id, props, commitToHistory = true) {
|
|
7901
7974
|
const next = setLayerProperties(this.state.layers, id, props);
|
|
7902
7975
|
this.commitLayers(next, void 0, commitToHistory);
|
|
7903
|
-
return
|
|
7976
|
+
return _chunk73L6TROJcjs.findLayer.call(void 0, next, id).layer;
|
|
7904
7977
|
}
|
|
7905
7978
|
/** Adds an empty pass-through group above the active layer (or at `placement`) and makes it active. Returns its id. */
|
|
7906
7979
|
addGroup(init = {}) {
|
|
@@ -7908,7 +7981,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7908
7981
|
const group = {
|
|
7909
7982
|
type: "group",
|
|
7910
7983
|
id: newLayerId("group"),
|
|
7911
|
-
name: _optionalChain([init, 'access',
|
|
7984
|
+
name: _optionalChain([init, 'access', _156 => _156.name, 'optionalAccess', _157 => _157.trim, 'call', _158 => _158()]) || "Group",
|
|
7912
7985
|
visible: true,
|
|
7913
7986
|
opacity: 1,
|
|
7914
7987
|
blend,
|
|
@@ -7958,7 +8031,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7958
8031
|
let mask;
|
|
7959
8032
|
if (from === "selection") {
|
|
7960
8033
|
const sel = this.state.selection;
|
|
7961
|
-
if (!_optionalChain([sel, 'optionalAccess',
|
|
8034
|
+
if (!_optionalChain([sel, 'optionalAccess', _159 => _159.bounds])) throw new LayerOperationError("Nothing is selected; select first, or use reveal-all / hide-all.");
|
|
7962
8035
|
mask = this.maskFromSelection(sel, props);
|
|
7963
8036
|
if (layer.type === "pixel" && (layer.offset.x || layer.offset.y)) {
|
|
7964
8037
|
mask = { ...mask, surface: _chunkZOOEX3WTcjs.translateSurface.call(void 0, mask.surface, -layer.offset.x, -layer.offset.y) };
|
|
@@ -8021,7 +8094,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8021
8094
|
const next = { ...layer, surface: out };
|
|
8022
8095
|
delete next.mask;
|
|
8023
8096
|
delete next.source;
|
|
8024
|
-
this.commitLayers(
|
|
8097
|
+
this.commitLayers(_chunk73L6TROJcjs.mapLayer.call(void 0, this.state.layers, id, () => next), () => {
|
|
8025
8098
|
if (this.state.activeLayerId === id) this.state.activeTarget = "pixels";
|
|
8026
8099
|
});
|
|
8027
8100
|
}
|
|
@@ -8036,7 +8109,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8036
8109
|
const layer = loc.layer;
|
|
8037
8110
|
if (layer.type !== "pixel") throw new LayerOperationError(`Layer via copy needs a pixel layer; "${id}" is a ${layer.type} layer.`);
|
|
8038
8111
|
const sel = this.state.selection;
|
|
8039
|
-
if (!_optionalChain([sel, 'optionalAccess',
|
|
8112
|
+
if (!_optionalChain([sel, 'optionalAccess', _160 => _160.bounds])) throw new LayerOperationError("Nothing is selected; select the pixels to copy first.");
|
|
8040
8113
|
if (options.cut) requireUnlocked(layer, "pixels", "cut from it");
|
|
8041
8114
|
const surface = this.surfaceOf(layer);
|
|
8042
8115
|
const sb = sel.bounds;
|
|
@@ -8054,18 +8127,18 @@ var ImageEditorController = (_class7 = class {
|
|
|
8054
8127
|
const copy = {
|
|
8055
8128
|
type: "pixel",
|
|
8056
8129
|
id: newLayerId(),
|
|
8057
|
-
name: _optionalChain([options, 'access',
|
|
8130
|
+
name: _optionalChain([options, 'access', _161 => _161.name, 'optionalAccess', _162 => _162.trim, 'call', _163 => _163()]) || `${layer.name || "Layer"} ${options.cut ? "cut" : "copy"}`,
|
|
8058
8131
|
visible: true,
|
|
8059
8132
|
opacity: 1,
|
|
8060
8133
|
blend: "normal",
|
|
8061
8134
|
surface: _chunkZOOEX3WTcjs.surfaceFromPixels.call(void 0, { width: src.width, height: src.height, data: px }, 4, src.x, src.y),
|
|
8062
8135
|
offset: { ...layer.offset }
|
|
8063
8136
|
};
|
|
8064
|
-
let next =
|
|
8137
|
+
let next = _chunk73L6TROJcjs.insertLayer.call(void 0, this.state.layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _164 => _164.parent, 'optionalAccess', _165 => _165.id]), () => ( null)), loc.index + 1);
|
|
8065
8138
|
if (kept) {
|
|
8066
8139
|
const cutLayer = { ...layer, surface: _chunkZOOEX3WTcjs.writeRegion.call(void 0, surface, src, kept) };
|
|
8067
8140
|
delete cutLayer.source;
|
|
8068
|
-
next =
|
|
8141
|
+
next = _chunk73L6TROJcjs.mapLayer.call(void 0, next, id, () => cutLayer);
|
|
8069
8142
|
}
|
|
8070
8143
|
this.commitLayers(next, () => {
|
|
8071
8144
|
this.state.activeLayerId = copy.id;
|
|
@@ -8078,24 +8151,73 @@ var ImageEditorController = (_class7 = class {
|
|
|
8078
8151
|
const f = normalizeFilter(filter);
|
|
8079
8152
|
const next = addLayerFilter(this.state.layers, id, f);
|
|
8080
8153
|
this.commitLayers(next);
|
|
8081
|
-
return _nullishCoalesce(
|
|
8154
|
+
return _nullishCoalesce(_chunk73L6TROJcjs.findLayer.call(void 0, next, id).layer.filters, () => ( []));
|
|
8082
8155
|
}
|
|
8083
8156
|
/** Changes one filter (one undo step, or none with `commitToHistory = false` during a drag). Returns the filters. */
|
|
8084
8157
|
updateLayerFilter(id, filterId, changes, commitToHistory = true) {
|
|
8085
8158
|
const next = updateLayerFilter(this.state.layers, id, filterId, changes);
|
|
8086
8159
|
this.commitLayers(next, void 0, commitToHistory);
|
|
8087
|
-
return _nullishCoalesce(
|
|
8160
|
+
return _nullishCoalesce(_chunk73L6TROJcjs.findLayer.call(void 0, next, id).layer.filters, () => ( []));
|
|
8088
8161
|
}
|
|
8089
8162
|
/** Removes one filter (one undo step). Returns the remaining filters. */
|
|
8090
8163
|
removeLayerFilter(id, filterId) {
|
|
8091
8164
|
const next = removeLayerFilter(this.state.layers, id, filterId);
|
|
8092
8165
|
this.commitLayers(next);
|
|
8093
|
-
return _nullishCoalesce(
|
|
8166
|
+
return _nullishCoalesce(_chunk73L6TROJcjs.findLayer.call(void 0, next, id).layer.filters, () => ( []));
|
|
8167
|
+
}
|
|
8168
|
+
// --- Layer effects ---
|
|
8169
|
+
/** A layer's effects (an empty, enabled list when it has none). */
|
|
8170
|
+
getLayerEffects(id) {
|
|
8171
|
+
return layerEffectsOf(requireLayer(this.state.layers, id).layer);
|
|
8172
|
+
}
|
|
8173
|
+
/**
|
|
8174
|
+
* Adds an effect of `kind` with Photoshop's defaults and `params` applied (one undo step), at
|
|
8175
|
+
* `index` in the layer's effect list (default the end). Returns the new effect and the effects.
|
|
8176
|
+
*/
|
|
8177
|
+
addLayerEffect(id, kind, params = {}, index) {
|
|
8178
|
+
const res = addLayerEffect(this.state.layers, id, kind, params, index);
|
|
8179
|
+
this.commitLayers(res.layers);
|
|
8180
|
+
return { effect: res.effect, effects: this.getLayerEffects(id) };
|
|
8181
|
+
}
|
|
8182
|
+
/** Changes one effect (one undo step, or none with `commitToHistory = false` during a drag). Returns the effects. */
|
|
8183
|
+
updateLayerEffect(id, effectId, changes, commitToHistory = true) {
|
|
8184
|
+
this.commitLayers(updateLayerEffect(this.state.layers, id, effectId, changes), void 0, commitToHistory);
|
|
8185
|
+
return this.getLayerEffects(id);
|
|
8186
|
+
}
|
|
8187
|
+
/** Removes one effect (one undo step). Returns the remaining effects. */
|
|
8188
|
+
removeLayerEffect(id, effectId) {
|
|
8189
|
+
this.commitLayers(removeLayerEffect(this.state.layers, id, effectId));
|
|
8190
|
+
return this.getLayerEffects(id);
|
|
8191
|
+
}
|
|
8192
|
+
/** Turns a layer's effects on or off as a whole and, when given, sets Scale Effects (one undo step). */
|
|
8193
|
+
setLayerEffectsEnabled(id, enabled, scale, commitToHistory = true) {
|
|
8194
|
+
this.commitLayers(setLayerEffectsEnabled(this.state.layers, id, enabled, scale), void 0, commitToHistory);
|
|
8195
|
+
return this.getLayerEffects(id);
|
|
8196
|
+
}
|
|
8197
|
+
/** Replaces a layer's effects (one undo step; `null` removes them). Returns the effects. */
|
|
8198
|
+
setLayerEffects(id, effects, commitToHistory = true) {
|
|
8199
|
+
this.commitLayers(setLayerEffects(this.state.layers, id, effects), void 0, commitToHistory);
|
|
8200
|
+
return this.getLayerEffects(id);
|
|
8201
|
+
}
|
|
8202
|
+
/** The light effects with "use global light" follow. */
|
|
8203
|
+
getGlobalLight() {
|
|
8204
|
+
return { ..._nullishCoalesce(this.state.globalLight, () => ( _chunk73L6TROJcjs.DEFAULT_GLOBAL_LIGHT)) };
|
|
8205
|
+
}
|
|
8206
|
+
/** Sets the global light (one undo step). `angle` -360..360°, `altitude` 0..90°. Returns it. */
|
|
8207
|
+
setGlobalLight(light, commitToHistory = true) {
|
|
8208
|
+
const next = { ...this.getGlobalLight(), ...light };
|
|
8209
|
+
if (!(Number.isFinite(next.angle) && next.angle >= -360 && next.angle <= 360)) throw new LayerOperationError(`angle must be from -360 to 360 degrees, got ${next.angle}.`);
|
|
8210
|
+
if (!(Number.isFinite(next.altitude) && next.altitude >= 0 && next.altitude <= 90)) throw new LayerOperationError(`altitude must be from 0 to 90 degrees, got ${next.altitude}.`);
|
|
8211
|
+
if (commitToHistory) this.recordHistory();
|
|
8212
|
+
if (next.angle === _chunk73L6TROJcjs.DEFAULT_GLOBAL_LIGHT.angle && next.altitude === _chunk73L6TROJcjs.DEFAULT_GLOBAL_LIGHT.altitude) delete this.state.globalLight;
|
|
8213
|
+
else this.state.globalLight = next;
|
|
8214
|
+
this.notify();
|
|
8215
|
+
return this.getGlobalLight();
|
|
8094
8216
|
}
|
|
8095
8217
|
/** Composites `layers` (in isolation) over `rect` into a surface, loading depth maps first. */
|
|
8096
8218
|
async compositeToSurface(layers, rect) {
|
|
8097
8219
|
const { width, height } = this.naturalSize;
|
|
8098
|
-
if (
|
|
8220
|
+
if (_chunk73L6TROJcjs.flattenLayers.call(void 0, layers).some((l) => l.type === "annotation" && l.visible) && !this.renderer.canRasterize()) {
|
|
8099
8221
|
throw new LayerOperationError("Merging annotation layers needs a canvas (a browser); hide or delete them first, or merge in the browser.");
|
|
8100
8222
|
}
|
|
8101
8223
|
await this.renderer.prepareLayerAssets(layers, width, height);
|
|
@@ -8121,7 +8243,8 @@ var ImageEditorController = (_class7 = class {
|
|
|
8121
8243
|
}
|
|
8122
8244
|
/**
|
|
8123
8245
|
* Merge Down: composites a layer onto the pixel layer directly below it (which keeps its name,
|
|
8124
|
-
* opacity and blend; masks, fill and
|
|
8246
|
+
* opacity and blend; masks, fill, filters and both layers' effects are baked), as one undo step.
|
|
8247
|
+
* Returns the merged id.
|
|
8125
8248
|
*/
|
|
8126
8249
|
async mergeDown(id) {
|
|
8127
8250
|
const loc = requireLayer(this.state.layers, id);
|
|
@@ -8133,7 +8256,9 @@ var ImageEditorController = (_class7 = class {
|
|
|
8133
8256
|
if (!upper.visible) throw new LayerOperationError(`Layer "${upper.name || id}" is hidden; show it or delete it instead of merging.`);
|
|
8134
8257
|
requireUnlocked(upper, "all", "merge it");
|
|
8135
8258
|
requireUnlocked(lower, "pixels", "merge into it");
|
|
8136
|
-
|
|
8259
|
+
let rect = _nullishCoalesce(unionRect(this.paintBounds(lower), upper.type === "adjustment" ? null : this.paintBounds(upper)), () => ( { x: 0, y: 0, width: 1, height: 1 }));
|
|
8260
|
+
const reach = Math.max(_chunk73L6TROJcjs.effectsMargin.call(void 0, lower.effects), upper.type === "adjustment" ? 0 : _chunk73L6TROJcjs.effectsMargin.call(void 0, upper.effects));
|
|
8261
|
+
if (reach) rect = { x: rect.x - reach, y: rect.y - reach, width: rect.width + 2 * reach, height: rect.height + 2 * reach };
|
|
8137
8262
|
const base = { ...lower, blend: "normal", opacity: 1 };
|
|
8138
8263
|
delete base.clipped;
|
|
8139
8264
|
const surface = await this.compositeToSurface([base, upper], rect);
|
|
@@ -8142,8 +8267,9 @@ var ImageEditorController = (_class7 = class {
|
|
|
8142
8267
|
delete merged.fillOpacity;
|
|
8143
8268
|
delete merged.filters;
|
|
8144
8269
|
delete merged.source;
|
|
8145
|
-
|
|
8146
|
-
next =
|
|
8270
|
+
delete merged.effects;
|
|
8271
|
+
let next = _chunk73L6TROJcjs.mapLayer.call(void 0, this.state.layers, id, () => null);
|
|
8272
|
+
next = _chunk73L6TROJcjs.mapLayer.call(void 0, next, lower.id, () => merged);
|
|
8147
8273
|
this.commitLayers(next, () => {
|
|
8148
8274
|
this.state.activeLayerId = merged.id;
|
|
8149
8275
|
this.state.activeTarget = "pixels";
|
|
@@ -8219,7 +8345,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8219
8345
|
const oy = layer.type === "pixel" ? layer.offset.y : 0;
|
|
8220
8346
|
const key = `${tw}x${th}:${ox},${oy}`;
|
|
8221
8347
|
let byKey = this.thumbCache.get(surface);
|
|
8222
|
-
const hit = _optionalChain([byKey, 'optionalAccess',
|
|
8348
|
+
const hit = _optionalChain([byKey, 'optionalAccess', _166 => _166.get, 'call', _167 => _167(key)]);
|
|
8223
8349
|
if (hit) return hit;
|
|
8224
8350
|
const out = new Uint8ClampedArray(tw * th * 4);
|
|
8225
8351
|
for (let y = 0; y < th; y++) {
|
|
@@ -8247,7 +8373,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8247
8373
|
setPaintOptions(options) {
|
|
8248
8374
|
const cur = this.state.paint;
|
|
8249
8375
|
const next = {
|
|
8250
|
-
brush: options.brush ?
|
|
8376
|
+
brush: options.brush ? _chunk4F3YDIWWcjs.normalizeBrush.call(void 0, { ...cur.brush, ...options.brush }) : cur.brush,
|
|
8251
8377
|
foreground: options.foreground !== void 0 ? toHex2(parseColor(options.foreground)) : cur.foreground,
|
|
8252
8378
|
background: options.background !== void 0 ? toHex2(parseColor(options.background)) : cur.background
|
|
8253
8379
|
};
|
|
@@ -8281,7 +8407,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8281
8407
|
if (!layer.visible) throw new LayerOperationError(`Layer "${layer.name || id}" is hidden; show it before you ${action}.`);
|
|
8282
8408
|
const offset = layer.type === "pixel" ? layer.offset : { x: 0, y: 0 };
|
|
8283
8409
|
const surface = ch === "mask" ? layer.mask.surface : this.surfaceOf(layer);
|
|
8284
|
-
const lockTransparency = ch === "pixels" && Boolean(_optionalChain([layer, 'access',
|
|
8410
|
+
const lockTransparency = ch === "pixels" && Boolean(_optionalChain([layer, 'access', _168 => _168.locks, 'optionalAccess', _169 => _169.transparency]));
|
|
8285
8411
|
return { id, layer, channel: ch, offset, surface, lockTransparency };
|
|
8286
8412
|
}
|
|
8287
8413
|
/** The layer with its pixels (or mask) replaced by `surface`. */
|
|
@@ -8300,7 +8426,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8300
8426
|
beginStroke(init = {}) {
|
|
8301
8427
|
const tool = _nullishCoalesce(init.tool, () => ( "brush"));
|
|
8302
8428
|
const target = this.paintTarget(init.layerId, init.channel, tool === "eraser" ? "erase" : "paint");
|
|
8303
|
-
const brush =
|
|
8429
|
+
const brush = _chunk4F3YDIWWcjs.normalizeBrush.call(void 0, { ...this.state.paint.brush, ..._nullishCoalesce(init.brush, () => ( {})) });
|
|
8304
8430
|
const color = parseColor(_nullishCoalesce(init.color, () => ( this.state.paint.foreground)));
|
|
8305
8431
|
const background = parseColor(_nullishCoalesce(init.background, () => ( this.state.paint.background)));
|
|
8306
8432
|
const toMaskGrey = (c) => {
|
|
@@ -8314,19 +8440,19 @@ var ImageEditorController = (_class7 = class {
|
|
|
8314
8440
|
opacity: brush.opacity,
|
|
8315
8441
|
blend: target.channel === "mask" ? "normal" : brush.blend,
|
|
8316
8442
|
lockTransparency: target.lockTransparency,
|
|
8317
|
-
selection: _optionalChain([this, 'access',
|
|
8443
|
+
selection: _optionalChain([this, 'access', _170 => _170.state, 'access', _171 => _171.selection, 'optionalAccess', _172 => _172.bounds]) ? this.state.selection : null,
|
|
8318
8444
|
offset: target.offset
|
|
8319
8445
|
};
|
|
8320
|
-
return new PaintStrokeSession(this, target, new (0,
|
|
8446
|
+
return new PaintStrokeSession(this, target, new (0, _chunk4F3YDIWWcjs.StrokeCoverage)(brush), apply);
|
|
8321
8447
|
}
|
|
8322
8448
|
/** @internal Shows a stroke's live surface (no history). */
|
|
8323
8449
|
_strokeUpdate(layerId, channel, surface, rects) {
|
|
8324
|
-
this.state.layers =
|
|
8450
|
+
this.state.layers = _chunk73L6TROJcjs.mapLayer.call(void 0, this.state.layers, layerId, (l) => this.withSurface(l, channel, surface));
|
|
8325
8451
|
this.notify(rects);
|
|
8326
8452
|
}
|
|
8327
8453
|
/** @internal Commits a finished stroke as one undo step (`before` is the pre-stroke state). */
|
|
8328
8454
|
_strokeCommit(before, layerId, channel, surface) {
|
|
8329
|
-
if (surface) this.state.layers =
|
|
8455
|
+
if (surface) this.state.layers = _chunk73L6TROJcjs.mapLayer.call(void 0, this.state.layers, layerId, (l) => this.withSurface(l, channel, surface));
|
|
8330
8456
|
else this.state.layers = before.layers;
|
|
8331
8457
|
if (surface && !this.isApplyingHistory) {
|
|
8332
8458
|
this.undoStack.push(before);
|
|
@@ -8348,7 +8474,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8348
8474
|
paintStroke(init) {
|
|
8349
8475
|
if (!Array.isArray(init.points) || !init.points.length) throw new LayerOperationError("points must hold at least one { x, y } point.");
|
|
8350
8476
|
for (const p of init.points) {
|
|
8351
|
-
if (!Number.isFinite(_optionalChain([p, 'optionalAccess',
|
|
8477
|
+
if (!Number.isFinite(_optionalChain([p, 'optionalAccess', _173 => _173.x])) || !Number.isFinite(_optionalChain([p, 'optionalAccess', _174 => _174.y]))) throw new LayerOperationError("Every point needs finite x and y (document pixels).");
|
|
8352
8478
|
}
|
|
8353
8479
|
const session = this.beginStroke(init);
|
|
8354
8480
|
session.push(init.points);
|
|
@@ -8376,9 +8502,9 @@ var ImageEditorController = (_class7 = class {
|
|
|
8376
8502
|
const opacity = _nullishCoalesce(options.opacity, () => ( 1));
|
|
8377
8503
|
if (!(opacity >= 0 && opacity <= 1)) throw new LayerOperationError("opacity must be from 0 to 1.");
|
|
8378
8504
|
const blend = _nullishCoalesce(parseBlend(options.blend), () => ( "normal"));
|
|
8379
|
-
const sel = options.useSelection !== false && _optionalChain([this, 'access',
|
|
8380
|
-
const region = _nullishCoalesce(_optionalChain([sel, 'optionalAccess',
|
|
8381
|
-
const coverage = new (0,
|
|
8505
|
+
const sel = options.useSelection !== false && _optionalChain([this, 'access', _175 => _175.state, 'access', _176 => _176.selection, 'optionalAccess', _177 => _177.bounds]) ? this.state.selection : null;
|
|
8506
|
+
const region = _nullishCoalesce(_optionalChain([sel, 'optionalAccess', _178 => _178.bounds]), () => ( { x: 0, y: 0, width, height }));
|
|
8507
|
+
const coverage = new (0, _chunk4F3YDIWWcjs.CoverageMap)();
|
|
8382
8508
|
const ones = new Float32Array(region.width * region.height);
|
|
8383
8509
|
if (sel) {
|
|
8384
8510
|
for (let y = 0; y < region.height; y++) {
|
|
@@ -8403,7 +8529,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8403
8529
|
offset: target.offset
|
|
8404
8530
|
};
|
|
8405
8531
|
const surface = paintCoverageInto(target.surface, coverage, apply, [region]);
|
|
8406
|
-
const next =
|
|
8532
|
+
const next = _chunk73L6TROJcjs.mapLayer.call(void 0, this.state.layers, target.id, (l) => this.withSurface(l, target.channel, surface));
|
|
8407
8533
|
this.commitLayers(next);
|
|
8408
8534
|
return { layerId: target.id, channel: target.channel, bounds: region, dabs: 0 };
|
|
8409
8535
|
}
|
|
@@ -8425,12 +8551,12 @@ var ImageEditorController = (_class7 = class {
|
|
|
8425
8551
|
const target = this.developLayer();
|
|
8426
8552
|
let layers = this.state.layers;
|
|
8427
8553
|
if (target && (DEVELOP_KEYS.some((k) => k in partial) || "process" in partial)) {
|
|
8428
|
-
layers =
|
|
8554
|
+
layers = _chunk73L6TROJcjs.mapLayer.call(void 0, layers, target.id, (l) => withDevelop(l, partial));
|
|
8429
8555
|
}
|
|
8430
8556
|
if ("blur" in partial && typeof partial.blur === "number") {
|
|
8431
8557
|
const blur = Math.max(0, partial.blur);
|
|
8432
8558
|
if (this.state.legacyOutputBlur !== void 0) this.state.legacyOutputBlur = blur;
|
|
8433
|
-
else if (target) layers =
|
|
8559
|
+
else if (target) layers = _chunk73L6TROJcjs.mapLayer.call(void 0, layers, target.id, (l) => withBlur(l, blur));
|
|
8434
8560
|
}
|
|
8435
8561
|
if ("opacity" in partial && typeof partial.opacity === "number") {
|
|
8436
8562
|
this.state.outputOpacity = Math.min(1, Math.max(0, partial.opacity));
|
|
@@ -8460,7 +8586,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8460
8586
|
this.recordHistory();
|
|
8461
8587
|
const target = this.developLayer();
|
|
8462
8588
|
if (target) {
|
|
8463
|
-
this.state.layers =
|
|
8589
|
+
this.state.layers = _chunk73L6TROJcjs.mapLayer.call(void 0,
|
|
8464
8590
|
this.state.layers,
|
|
8465
8591
|
target.id,
|
|
8466
8592
|
(l) => withBlur(withDevelop(l, { ...DEFAULT_ADJUSTMENTS, process: LATEST_PROCESS_VERSION }), 0)
|
|
@@ -8480,7 +8606,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8480
8606
|
return this.getAdjustmentLayers().find((l) => l.id === id);
|
|
8481
8607
|
}
|
|
8482
8608
|
adjustmentNodes(layers = this.state.layers) {
|
|
8483
|
-
return
|
|
8609
|
+
return _chunk73L6TROJcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "adjustment");
|
|
8484
8610
|
}
|
|
8485
8611
|
/**
|
|
8486
8612
|
* Where a new layer goes when no position is given: directly above the topmost layer that is
|
|
@@ -8494,26 +8620,26 @@ var ImageEditorController = (_class7 = class {
|
|
|
8494
8620
|
/** Inserts `node` by `aboveId` / `parentId` / adjustment index / default position. */
|
|
8495
8621
|
placeLayer(layers, node, where) {
|
|
8496
8622
|
if (where.aboveId) {
|
|
8497
|
-
const loc =
|
|
8498
|
-
if (loc) return
|
|
8623
|
+
const loc = _chunk73L6TROJcjs.findLayer.call(void 0, layers, where.aboveId);
|
|
8624
|
+
if (loc) return _chunk73L6TROJcjs.insertLayer.call(void 0, layers, node, _nullishCoalesce(_optionalChain([loc, 'access', _179 => _179.parent, 'optionalAccess', _180 => _180.id]), () => ( null)), loc.index + 1);
|
|
8499
8625
|
}
|
|
8500
8626
|
if (where.parentId) {
|
|
8501
|
-
const loc =
|
|
8502
|
-
if (loc && loc.layer.type === "group") return
|
|
8627
|
+
const loc = _chunk73L6TROJcjs.findLayer.call(void 0, layers, where.parentId);
|
|
8628
|
+
if (loc && loc.layer.type === "group") return _chunk73L6TROJcjs.insertLayer.call(void 0, layers, node, loc.layer.id);
|
|
8503
8629
|
}
|
|
8504
8630
|
if (where.adjustmentIndex !== void 0) {
|
|
8505
8631
|
const nodes = this.adjustmentNodes(layers);
|
|
8506
8632
|
const at = Math.max(0, Math.min(nodes.length, Math.round(where.adjustmentIndex)));
|
|
8507
8633
|
if (at < nodes.length) {
|
|
8508
|
-
const loc =
|
|
8509
|
-
return
|
|
8634
|
+
const loc = _chunk73L6TROJcjs.findLayer.call(void 0, layers, nodes[at].id);
|
|
8635
|
+
return _chunk73L6TROJcjs.insertLayer.call(void 0, layers, node, _nullishCoalesce(_optionalChain([loc, 'access', _181 => _181.parent, 'optionalAccess', _182 => _182.id]), () => ( null)), loc.index);
|
|
8510
8636
|
}
|
|
8511
8637
|
if (nodes.length) {
|
|
8512
|
-
const loc =
|
|
8513
|
-
return
|
|
8638
|
+
const loc = _chunk73L6TROJcjs.findLayer.call(void 0, layers, nodes[nodes.length - 1].id);
|
|
8639
|
+
return _chunk73L6TROJcjs.insertLayer.call(void 0, layers, node, _nullishCoalesce(_optionalChain([loc, 'access', _183 => _183.parent, 'optionalAccess', _184 => _184.id]), () => ( null)), loc.index + 1);
|
|
8514
8640
|
}
|
|
8515
8641
|
}
|
|
8516
|
-
return
|
|
8642
|
+
return _chunk73L6TROJcjs.insertLayer.call(void 0, layers, node, null, this.defaultInsertIndex(layers));
|
|
8517
8643
|
}
|
|
8518
8644
|
/** `setAdjustments({ layers })`: updates nodes by id in place, removes missing ones, adds new ones. */
|
|
8519
8645
|
replaceAdjustmentNodes(layers, next) {
|
|
@@ -8522,7 +8648,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8522
8648
|
let out = layers;
|
|
8523
8649
|
for (const node of this.adjustmentNodes(layers)) {
|
|
8524
8650
|
const update = byId.get(node.id);
|
|
8525
|
-
out =
|
|
8651
|
+
out = _chunk73L6TROJcjs.mapLayer.call(void 0, out, node.id, () => update ? mergeAdjustmentNode(node, update, width, height) : null);
|
|
8526
8652
|
}
|
|
8527
8653
|
const existing = new Set(this.adjustmentNodes(out).map((n) => n.id));
|
|
8528
8654
|
for (const l of next) {
|
|
@@ -8541,7 +8667,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8541
8667
|
*/
|
|
8542
8668
|
addAdjustmentLayer(init, index) {
|
|
8543
8669
|
const spec = typeof init === "string" ? { kind: init } : init;
|
|
8544
|
-
const ids = new Set(
|
|
8670
|
+
const ids = new Set(_chunk73L6TROJcjs.flattenLayers.call(void 0, this.state.layers).map((l) => l.id));
|
|
8545
8671
|
const layer = createAdjustmentLayer(spec.kind, {
|
|
8546
8672
|
id: spec.id && !ids.has(spec.id) ? spec.id : void 0,
|
|
8547
8673
|
name: spec.name,
|
|
@@ -8570,7 +8696,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8570
8696
|
* Returns false for an unknown id.
|
|
8571
8697
|
*/
|
|
8572
8698
|
updateAdjustmentLayer(id, update, commitToHistory = true) {
|
|
8573
|
-
const loc =
|
|
8699
|
+
const loc = _chunk73L6TROJcjs.findLayer.call(void 0, this.state.layers, id);
|
|
8574
8700
|
if (!loc || loc.layer.type !== "adjustment") return false;
|
|
8575
8701
|
const { width, height } = this.naturalSize;
|
|
8576
8702
|
const node = loc.layer;
|
|
@@ -8598,16 +8724,16 @@ var ImageEditorController = (_class7 = class {
|
|
|
8598
8724
|
if (mask) next.mask = mask;
|
|
8599
8725
|
else delete next.mask;
|
|
8600
8726
|
}
|
|
8601
|
-
this.state.layers =
|
|
8727
|
+
this.state.layers = _chunk73L6TROJcjs.mapLayer.call(void 0, this.state.layers, id, () => next);
|
|
8602
8728
|
this.notify();
|
|
8603
8729
|
return true;
|
|
8604
8730
|
}
|
|
8605
8731
|
/** Removes a layer as one undo step. Returns false for an unknown id. */
|
|
8606
8732
|
removeAdjustmentLayer(id) {
|
|
8607
|
-
const loc =
|
|
8733
|
+
const loc = _chunk73L6TROJcjs.findLayer.call(void 0, this.state.layers, id);
|
|
8608
8734
|
if (!loc || loc.layer.type !== "adjustment") return false;
|
|
8609
8735
|
this.recordHistory();
|
|
8610
|
-
this.state.layers =
|
|
8736
|
+
this.state.layers = _chunk73L6TROJcjs.mapLayer.call(void 0, this.state.layers, id, () => null);
|
|
8611
8737
|
if (this.state.activeLayerId === id) this.state.activeLayerId = null;
|
|
8612
8738
|
this.notify();
|
|
8613
8739
|
return true;
|
|
@@ -8620,9 +8746,9 @@ var ImageEditorController = (_class7 = class {
|
|
|
8620
8746
|
if (to === from) return layers;
|
|
8621
8747
|
const node = nodes[from];
|
|
8622
8748
|
const anchor = nodes[to];
|
|
8623
|
-
const without =
|
|
8624
|
-
const loc =
|
|
8625
|
-
return
|
|
8749
|
+
const without = _chunk73L6TROJcjs.mapLayer.call(void 0, layers, id, () => null);
|
|
8750
|
+
const loc = _chunk73L6TROJcjs.findLayer.call(void 0, without, anchor.id);
|
|
8751
|
+
return _chunk73L6TROJcjs.insertLayer.call(void 0, without, node, _nullishCoalesce(_optionalChain([loc, 'access', _185 => _185.parent, 'optionalAccess', _186 => _186.id]), () => ( null)), to > from ? loc.index + 1 : loc.index);
|
|
8626
8752
|
}
|
|
8627
8753
|
/** Moves a layer to `toIndex` among the adjustment layers (0 = bottom) as one undo step. Returns false if nothing moved. */
|
|
8628
8754
|
moveAdjustmentLayer(id, toIndex) {
|
|
@@ -8647,7 +8773,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8647
8773
|
if (!nodes.length) return;
|
|
8648
8774
|
this.recordHistory();
|
|
8649
8775
|
let layers = this.state.layers;
|
|
8650
|
-
for (const n of nodes) layers =
|
|
8776
|
+
for (const n of nodes) layers = _chunk73L6TROJcjs.mapLayer.call(void 0, layers, n.id, () => null);
|
|
8651
8777
|
this.state.layers = layers;
|
|
8652
8778
|
if (nodes.some((n) => n.id === this.state.activeLayerId)) this.state.activeLayerId = null;
|
|
8653
8779
|
this.notify();
|
|
@@ -8658,7 +8784,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8658
8784
|
return _nullishCoalesce(this.state.selection, () => ( null));
|
|
8659
8785
|
}
|
|
8660
8786
|
get hasSelection() {
|
|
8661
|
-
return Boolean(_optionalChain([this, 'access',
|
|
8787
|
+
return Boolean(_optionalChain([this, 'access', _187 => _187.state, 'access', _188 => _188.selection, 'optionalAccess', _189 => _189.bounds]));
|
|
8662
8788
|
}
|
|
8663
8789
|
get naturalSize() {
|
|
8664
8790
|
return {
|
|
@@ -8748,13 +8874,13 @@ var ImageEditorController = (_class7 = class {
|
|
|
8748
8874
|
try {
|
|
8749
8875
|
const canvas = await this.renderSource();
|
|
8750
8876
|
const ctx = canvas.getContext("2d");
|
|
8751
|
-
const data2 = _optionalChain([ctx, 'optionalAccess',
|
|
8877
|
+
const data2 = _optionalChain([ctx, 'optionalAccess', _190 => _190.getImageData, 'optionalCall', _191 => _191(0, 0, width, height)]);
|
|
8752
8878
|
if (data2 && data2.data && data2.data.length >= width * height * 4) {
|
|
8753
8879
|
base = { width, height, data: data2.data };
|
|
8754
8880
|
this.samplePixels = base;
|
|
8755
8881
|
this.samplePixelsOverride = false;
|
|
8756
8882
|
}
|
|
8757
|
-
} catch (
|
|
8883
|
+
} catch (e23) {
|
|
8758
8884
|
base = null;
|
|
8759
8885
|
}
|
|
8760
8886
|
}
|
|
@@ -8814,7 +8940,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8814
8940
|
/** Select › Modify: grow, shrink, feather, border or smooth by `radius` pixels (one undo step). */
|
|
8815
8941
|
modifySelection(op, radius) {
|
|
8816
8942
|
const sel = this.state.selection;
|
|
8817
|
-
if (!_optionalChain([sel, 'optionalAccess',
|
|
8943
|
+
if (!_optionalChain([sel, 'optionalAccess', _192 => _192.bounds])) return false;
|
|
8818
8944
|
return this.setSelection(modifySelection(sel, op, radius));
|
|
8819
8945
|
}
|
|
8820
8946
|
/**
|
|
@@ -8823,7 +8949,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8823
8949
|
*/
|
|
8824
8950
|
async refineSelection(params, options = {}) {
|
|
8825
8951
|
const sel = this.state.selection;
|
|
8826
|
-
if (!_optionalChain([sel, 'optionalAccess',
|
|
8952
|
+
if (!_optionalChain([sel, 'optionalAccess', _193 => _193.bounds])) return false;
|
|
8827
8953
|
const pixels = (_nullishCoalesce(params.radius, () => ( 0))) > 0 ? await this.requirePixels(options) : null;
|
|
8828
8954
|
return this.setSelection(refineSelection(pixels, sel, params));
|
|
8829
8955
|
}
|
|
@@ -8840,7 +8966,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8840
8966
|
const canvas = this.renderer.createCanvas(w, h);
|
|
8841
8967
|
const ctx = canvas.getContext("2d");
|
|
8842
8968
|
if (ctx) ctx.drawImage(img, 0, 0, w, h);
|
|
8843
|
-
const data = _optionalChain([ctx, 'optionalAccess',
|
|
8969
|
+
const data = _optionalChain([ctx, 'optionalAccess', _194 => _194.getImageData, 'optionalCall', _195 => _195(0, 0, w, h)]);
|
|
8844
8970
|
if (!data) throw new Error("The mask image pixels are not available (no canvas access); pass pixels.");
|
|
8845
8971
|
pixels = { width: w, height: h, data: data.data };
|
|
8846
8972
|
} else {
|
|
@@ -8868,14 +8994,14 @@ var ImageEditorController = (_class7 = class {
|
|
|
8868
8994
|
*/
|
|
8869
8995
|
applySelectionAsLayerMask(layerId, props = {}) {
|
|
8870
8996
|
const sel = this.state.selection;
|
|
8871
|
-
if (!_optionalChain([sel, 'optionalAccess',
|
|
8997
|
+
if (!_optionalChain([sel, 'optionalAccess', _196 => _196.bounds]) || !this.getAdjustmentLayer(layerId)) return false;
|
|
8872
8998
|
return this.setLayerMask(layerId, this.maskFromSelection(sel, props));
|
|
8873
8999
|
}
|
|
8874
9000
|
setLayerMask(layerId, mask, commitToHistory = true) {
|
|
8875
|
-
const loc =
|
|
9001
|
+
const loc = _chunk73L6TROJcjs.findLayer.call(void 0, this.state.layers, layerId);
|
|
8876
9002
|
if (!loc) return false;
|
|
8877
9003
|
if (commitToHistory) this.recordHistory();
|
|
8878
|
-
this.state.layers =
|
|
9004
|
+
this.state.layers = _chunk73L6TROJcjs.mapLayer.call(void 0, this.state.layers, layerId, (l) => {
|
|
8879
9005
|
const next = { ...l };
|
|
8880
9006
|
if (mask) next.mask = mask;
|
|
8881
9007
|
else delete next.mask;
|
|
@@ -8899,7 +9025,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8899
9025
|
/** Load Selection from a layer mask (its pixels; density and feather are not applied). */
|
|
8900
9026
|
selectionFromLayerMask(layerId, mode = "replace") {
|
|
8901
9027
|
const layer = this.getLayer(layerId);
|
|
8902
|
-
if (!_optionalChain([layer, 'optionalAccess',
|
|
9028
|
+
if (!_optionalChain([layer, 'optionalAccess', _197 => _197.mask]) || layer.mask.source) return false;
|
|
8903
9029
|
const { width, height } = this.naturalSize;
|
|
8904
9030
|
const ox = layer.type === "pixel" ? layer.offset.x : 0;
|
|
8905
9031
|
const oy = layer.type === "pixel" ? layer.offset.y : 0;
|
|
@@ -8932,10 +9058,10 @@ var ImageEditorController = (_class7 = class {
|
|
|
8932
9058
|
if (target) {
|
|
8933
9059
|
const merged = { ...this.state.depthMask, ...partial };
|
|
8934
9060
|
merged.depthRange = [...merged.depthRange];
|
|
8935
|
-
this.state.layers =
|
|
9061
|
+
this.state.layers = _chunk73L6TROJcjs.mapLayer.call(void 0, this.state.layers, target.id, (l) => {
|
|
8936
9062
|
const next = { ...l };
|
|
8937
9063
|
if (isDefaultDepthMask(merged)) {
|
|
8938
|
-
if (_optionalChain([next, 'access',
|
|
9064
|
+
if (_optionalChain([next, 'access', _198 => _198.mask, 'optionalAccess', _199 => _199.source])) delete next.mask;
|
|
8939
9065
|
} else next.mask = depthRasterMask(merged);
|
|
8940
9066
|
return next;
|
|
8941
9067
|
});
|
|
@@ -8945,8 +9071,8 @@ var ImageEditorController = (_class7 = class {
|
|
|
8945
9071
|
resetDepthMask() {
|
|
8946
9072
|
this.recordHistory();
|
|
8947
9073
|
const target = this.developLayer();
|
|
8948
|
-
if (_optionalChain([target, 'optionalAccess',
|
|
8949
|
-
this.state.layers =
|
|
9074
|
+
if (_optionalChain([target, 'optionalAccess', _200 => _200.mask, 'optionalAccess', _201 => _201.source])) {
|
|
9075
|
+
this.state.layers = _chunk73L6TROJcjs.mapLayer.call(void 0, this.state.layers, target.id, (l) => {
|
|
8950
9076
|
const next = { ...l };
|
|
8951
9077
|
delete next.mask;
|
|
8952
9078
|
return next;
|
|
@@ -8956,7 +9082,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8956
9082
|
}
|
|
8957
9083
|
// --- Annotations & Layers ---
|
|
8958
9084
|
annotationLayer(id) {
|
|
8959
|
-
return
|
|
9085
|
+
return _chunk73L6TROJcjs.flattenLayers.call(void 0, this.state.layers).find(
|
|
8960
9086
|
(l) => l.type === "annotation" && l.annotation.id === id
|
|
8961
9087
|
);
|
|
8962
9088
|
}
|
|
@@ -8966,8 +9092,8 @@ var ImageEditorController = (_class7 = class {
|
|
|
8966
9092
|
const id = `ann_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`;
|
|
8967
9093
|
const fullAnnotation = { ...annotation, id };
|
|
8968
9094
|
const layer = annotationLayerFor(fullAnnotation);
|
|
8969
|
-
const loc = placement.aboveId ?
|
|
8970
|
-
this.state.layers = loc ?
|
|
9095
|
+
const loc = placement.aboveId ? _chunk73L6TROJcjs.findLayer.call(void 0, this.state.layers, placement.aboveId) : null;
|
|
9096
|
+
this.state.layers = loc ? _chunk73L6TROJcjs.insertLayer.call(void 0, this.state.layers, layer, _nullishCoalesce(_optionalChain([loc, 'access', _202 => _202.parent, 'optionalAccess', _203 => _203.id]), () => ( null)), loc.index + 1) : _chunk73L6TROJcjs.insertLayer.call(void 0, this.state.layers, layer, null);
|
|
8971
9097
|
this.state.selectedAnnotationId = id;
|
|
8972
9098
|
this.notify();
|
|
8973
9099
|
return id;
|
|
@@ -8980,14 +9106,14 @@ var ImageEditorController = (_class7 = class {
|
|
|
8980
9106
|
if (layer) {
|
|
8981
9107
|
const annotation = { ...layer.annotation, ...partial, id };
|
|
8982
9108
|
const name = layer.name === annotationLayerName(layer.annotation) ? annotationLayerName(annotation) : layer.name;
|
|
8983
|
-
this.state.layers =
|
|
9109
|
+
this.state.layers = _chunk73L6TROJcjs.mapLayer.call(void 0, this.state.layers, layer.id, () => ({ ...layer, annotation, name }));
|
|
8984
9110
|
}
|
|
8985
9111
|
this.notify();
|
|
8986
9112
|
}
|
|
8987
9113
|
removeAnnotation(id) {
|
|
8988
9114
|
this.recordHistory();
|
|
8989
9115
|
const layer = this.annotationLayer(id);
|
|
8990
|
-
if (layer) this.state.layers =
|
|
9116
|
+
if (layer) this.state.layers = _chunk73L6TROJcjs.mapLayer.call(void 0, this.state.layers, layer.id, () => null);
|
|
8991
9117
|
if (this.state.selectedAnnotationId === id) {
|
|
8992
9118
|
this.state.selectedAnnotationId = null;
|
|
8993
9119
|
}
|
|
@@ -8996,7 +9122,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8996
9122
|
clearAnnotations() {
|
|
8997
9123
|
this.recordHistory();
|
|
8998
9124
|
let layers = this.state.layers;
|
|
8999
|
-
for (const l of
|
|
9125
|
+
for (const l of _chunk73L6TROJcjs.flattenLayers.call(void 0, layers)) if (l.type === "annotation") layers = _chunk73L6TROJcjs.mapLayer.call(void 0, layers, l.id, () => null);
|
|
9000
9126
|
this.state.layers = layers;
|
|
9001
9127
|
this.state.selectedAnnotationId = null;
|
|
9002
9128
|
this.notify();
|
|
@@ -9064,7 +9190,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9064
9190
|
dirty: dirty === "all" ? void 0 : dirty,
|
|
9065
9191
|
checkpointLayerId: this.state.activeLayerId
|
|
9066
9192
|
});
|
|
9067
|
-
} catch (
|
|
9193
|
+
} catch (e24) {
|
|
9068
9194
|
}
|
|
9069
9195
|
}
|
|
9070
9196
|
async renderExport(options) {
|
|
@@ -9073,9 +9199,9 @@ var ImageEditorController = (_class7 = class {
|
|
|
9073
9199
|
return this.renderer.createCanvas(1, 1);
|
|
9074
9200
|
}
|
|
9075
9201
|
this.syncViews();
|
|
9076
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
9202
|
+
if (_optionalChain([options, 'optionalAccess', _204 => _204.layerIds])) {
|
|
9077
9203
|
const keep = new Set(options.layerIds);
|
|
9078
|
-
const layers =
|
|
9204
|
+
const layers = _chunk73L6TROJcjs.flattenLayers.call(void 0, this.state.layers).filter((l) => keep.has(l.id));
|
|
9079
9205
|
return this.renderer.renderExport(source, { ...this.state, layers }, options);
|
|
9080
9206
|
}
|
|
9081
9207
|
return this.renderer.renderExport(source, this.state, options);
|
|
@@ -9185,10 +9311,10 @@ var ImageEditorController = (_class7 = class {
|
|
|
9185
9311
|
/** No source image, and no layer reading one (an opened PSD): the layers are the whole document. */
|
|
9186
9312
|
isSourceless() {
|
|
9187
9313
|
if (this.imageElement || this.state.sourceUrl || !this.state.layers.length) return false;
|
|
9188
|
-
return !
|
|
9314
|
+
return !_chunk73L6TROJcjs.flattenLayers.call(void 0, this.state.layers).some((l) => l.type === "pixel" && l.source === "document");
|
|
9189
9315
|
}
|
|
9190
9316
|
get isMultiLayer() {
|
|
9191
|
-
return
|
|
9317
|
+
return _chunk73L6TROJcjs.flattenLayers.call(void 0, this.state.layers).filter((l) => l.type === "pixel" || l.type === "group").length > 1;
|
|
9192
9318
|
}
|
|
9193
9319
|
/**
|
|
9194
9320
|
* Applies an inpainted result (natural image space, see `toSourceDataURL`) as ONE undoable step.
|
|
@@ -9206,7 +9332,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9206
9332
|
let px = await this.decodeImage(newDataUrl);
|
|
9207
9333
|
if (px.width !== width || px.height !== height) px = resizePixels(px, width, height);
|
|
9208
9334
|
const data = new Uint8ClampedArray(px.data);
|
|
9209
|
-
const sel = _optionalChain([this, 'access',
|
|
9335
|
+
const sel = _optionalChain([this, 'access', _205 => _205.state, 'access', _206 => _206.selection, 'optionalAccess', _207 => _207.bounds]) ? this.state.selection : null;
|
|
9210
9336
|
if (sel) for (let p = 0, i = 3; p < width * height; p++, i += 4) data[i] = Math.round(data[i] * sel.data[p] / 255);
|
|
9211
9337
|
return this.addPixelLayer({ name: "Inpaint", pixels: { width, height, data } });
|
|
9212
9338
|
}
|
|
@@ -9258,7 +9384,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9258
9384
|
if (layer.locks) next.locks = layer.locks;
|
|
9259
9385
|
if (this.state.selectedAnnotationId === layer.annotation.id) this.state.selectedAnnotationId = null;
|
|
9260
9386
|
} else if (layer.type === "pixel") {
|
|
9261
|
-
if (!_optionalChain([layer, 'access',
|
|
9387
|
+
if (!_optionalChain([layer, 'access', _208 => _208.filters, 'optionalAccess', _209 => _209.length])) throw new LayerOperationError(`Layer "${layer.name || id}" is already pixels with no filters to bake.`);
|
|
9262
9388
|
requireUnlocked(layer, "pixels", "rasterize it");
|
|
9263
9389
|
const spatial = layer.filters.some((f) => f.enabled && f.kind === "blur");
|
|
9264
9390
|
const content = { ...layer, visible: true, opacity: 1, blend: "normal" };
|
|
@@ -9276,7 +9402,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9276
9402
|
} else {
|
|
9277
9403
|
throw new LayerOperationError(`Only annotation layers and pixel layers with filters rasterize; "${layer.name || id}" is a ${layer.type} layer. Merge it down or flatten instead.`);
|
|
9278
9404
|
}
|
|
9279
|
-
this.commitLayers(
|
|
9405
|
+
this.commitLayers(_chunk73L6TROJcjs.mapLayer.call(void 0, this.state.layers, id, () => next));
|
|
9280
9406
|
return id;
|
|
9281
9407
|
}
|
|
9282
9408
|
// --- PSD ---
|
|
@@ -9303,14 +9429,14 @@ var ImageEditorController = (_class7 = class {
|
|
|
9303
9429
|
delete s.legacyOutputBlur;
|
|
9304
9430
|
s.selection = null;
|
|
9305
9431
|
s.selectedAnnotationId = null;
|
|
9306
|
-
const pixels =
|
|
9432
|
+
const pixels = _chunk73L6TROJcjs.flattenLayers.call(void 0, result.layers).filter((l) => l.type === "pixel");
|
|
9307
9433
|
s.activeLayerId = pixels.length ? pixels[pixels.length - 1].id : null;
|
|
9308
9434
|
s.activeTarget = "pixels";
|
|
9309
9435
|
this.psdResolution = result.resolution;
|
|
9310
9436
|
this.lastLoadProblems = result.warnings;
|
|
9311
9437
|
this.notify();
|
|
9312
9438
|
return {
|
|
9313
|
-
layerIds:
|
|
9439
|
+
layerIds: _chunk73L6TROJcjs.flattenLayers.call(void 0, result.layers).map((l) => l.id),
|
|
9314
9440
|
warnings: result.warnings,
|
|
9315
9441
|
width: result.width,
|
|
9316
9442
|
height: result.height,
|
|
@@ -9335,7 +9461,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9335
9461
|
const compositor = new LayerCompositor();
|
|
9336
9462
|
const bakeMask = (layer) => {
|
|
9337
9463
|
const mask = layer.mask;
|
|
9338
|
-
if (!_optionalChain([mask, 'optionalAccess',
|
|
9464
|
+
if (!_optionalChain([mask, 'optionalAccess', _210 => _210.source])) return mask;
|
|
9339
9465
|
add("Parametric (depth) masks were baked into pixel masks", layer.name);
|
|
9340
9466
|
const plain3 = { ...layer, mask: { ...mask, density: 1, feather: 0, enabled: true } };
|
|
9341
9467
|
const ox = layer.type === "pixel" ? layer.offset.x : 0;
|
|
@@ -9392,7 +9518,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9392
9518
|
out.surface = this.surfaceOf(layer);
|
|
9393
9519
|
delete out.source;
|
|
9394
9520
|
}
|
|
9395
|
-
const active = _nullishCoalesce(_optionalChain([layer, 'access',
|
|
9521
|
+
const active = _nullishCoalesce(_optionalChain([layer, 'access', _211 => _211.filters, 'optionalAccess', _212 => _212.filter, 'call', _213 => _213(isActiveFilter)]), () => ( []));
|
|
9396
9522
|
if (active.length) {
|
|
9397
9523
|
add("Layer filters (develop, blur) were baked into the pixels", layer.name);
|
|
9398
9524
|
const content = { ...out, visible: true, opacity: 1, blend: "normal" };
|
|
@@ -9402,7 +9528,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9402
9528
|
const data = compositor.composite([content], canvas, sources);
|
|
9403
9529
|
out = { ...out, surface: _chunkZOOEX3WTcjs.surfaceFromPixels.call(void 0, { width, height, data }, 4, -layer.offset.x, -layer.offset.y) };
|
|
9404
9530
|
}
|
|
9405
|
-
if (_optionalChain([layer, 'access',
|
|
9531
|
+
if (_optionalChain([layer, 'access', _214 => _214.filters, 'optionalAccess', _215 => _215.some, 'call', _216 => _216((f) => !f.enabled)])) add("Disabled layer filters were left out", layer.name);
|
|
9406
9532
|
delete out.filters;
|
|
9407
9533
|
const mask = bakeMask(layer);
|
|
9408
9534
|
if (mask) out.mask = mask;
|
|
@@ -9454,16 +9580,16 @@ var ImageEditorController = (_class7 = class {
|
|
|
9454
9580
|
);
|
|
9455
9581
|
}
|
|
9456
9582
|
layers = resizeLegacyMasks(layers, prev, next.dimensions);
|
|
9457
|
-
for (const l of
|
|
9583
|
+
for (const l of _chunk73L6TROJcjs.flattenLayers.call(void 0, layers)) {
|
|
9458
9584
|
if (l.type === "annotation") {
|
|
9459
|
-
layers =
|
|
9585
|
+
layers = _chunk73L6TROJcjs.mapLayer.call(void 0, layers, l.id, () => ({ ...l, annotation: scaleAnnotation(l.annotation, sx, sy) }));
|
|
9460
9586
|
}
|
|
9461
9587
|
}
|
|
9462
9588
|
}
|
|
9463
9589
|
const bg = developTarget(layers, null);
|
|
9464
|
-
if (bg && bg.source !== "document") layers =
|
|
9590
|
+
if (bg && bg.source !== "document") layers = _chunk73L6TROJcjs.mapLayer.call(void 0, layers, bg.id, () => ({ ...bg, source: "document" }));
|
|
9465
9591
|
if (clearAnnotations) {
|
|
9466
|
-
for (const l of
|
|
9592
|
+
for (const l of _chunk73L6TROJcjs.flattenLayers.call(void 0, layers)) if (l.type === "annotation") layers = _chunk73L6TROJcjs.mapLayer.call(void 0, layers, l.id, () => null);
|
|
9467
9593
|
this.state.selectedAnnotationId = null;
|
|
9468
9594
|
}
|
|
9469
9595
|
this.state.layers = layers;
|
|
@@ -9471,7 +9597,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9471
9597
|
}
|
|
9472
9598
|
toJSON(options) {
|
|
9473
9599
|
const out = this.serializeState();
|
|
9474
|
-
if (_optionalChain([this, 'access',
|
|
9600
|
+
if (_optionalChain([this, 'access', _217 => _217.state, 'access', _218 => _218.selection, 'optionalAccess', _219 => _219.bounds])) out.selection = serializeSelection(this.state.selection);
|
|
9475
9601
|
if (!options || out.version !== LAYERED_SCHEMA_VERSION) return options ? Promise.resolve(out) : out;
|
|
9476
9602
|
return serializeLayersExternal(this.state.layers, options.store).then(({ layers, assets }) => ({ ...out, layers, assets }));
|
|
9477
9603
|
}
|
|
@@ -9498,7 +9624,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9498
9624
|
if (data.selection) {
|
|
9499
9625
|
try {
|
|
9500
9626
|
selection = normalizeSelection(deserializeSelection(data.selection));
|
|
9501
|
-
} catch (
|
|
9627
|
+
} catch (e25) {
|
|
9502
9628
|
selection = null;
|
|
9503
9629
|
}
|
|
9504
9630
|
}
|
|
@@ -9521,7 +9647,10 @@ var ImageEditorController = (_class7 = class {
|
|
|
9521
9647
|
s.outputOpacity = data.opacity;
|
|
9522
9648
|
if (typeof data.legacyOutputBlur === "number" && data.legacyOutputBlur >= 0) s.legacyOutputBlur = data.legacyOutputBlur;
|
|
9523
9649
|
else delete s.legacyOutputBlur;
|
|
9524
|
-
s.activeLayerId = data.activeLayerId &&
|
|
9650
|
+
s.activeLayerId = data.activeLayerId && _chunk73L6TROJcjs.findLayer.call(void 0, s.layers, data.activeLayerId) ? data.activeLayerId : null;
|
|
9651
|
+
const light = data.globalLight;
|
|
9652
|
+
if (light && Number.isFinite(light.angle) && Number.isFinite(light.altitude)) s.globalLight = { angle: light.angle, altitude: Math.min(90, Math.max(0, light.altitude)) };
|
|
9653
|
+
else delete s.globalLight;
|
|
9525
9654
|
if (!this.imageElement && typeof data.width === "number" && typeof data.height === "number" && data.width > 0 && data.height > 0) {
|
|
9526
9655
|
s.imageDimensions = { width: data.width, height: data.height };
|
|
9527
9656
|
}
|
|
@@ -9535,6 +9664,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9535
9664
|
s.crop = data.crop ? { ...data.crop } : null;
|
|
9536
9665
|
s.transform = { ...data.transform };
|
|
9537
9666
|
s.activeLayerId = null;
|
|
9667
|
+
delete s.globalLight;
|
|
9538
9668
|
}
|
|
9539
9669
|
s.activeTarget = "pixels";
|
|
9540
9670
|
this.viewKey = [];
|
|
@@ -9544,10 +9674,10 @@ var ImageEditorController = (_class7 = class {
|
|
|
9544
9674
|
serializeState() {
|
|
9545
9675
|
const { width, height } = this.naturalSize;
|
|
9546
9676
|
const view = legacyView(this.stack(), width, height, null);
|
|
9547
|
-
if (view.exact) {
|
|
9677
|
+
if (view.exact && !this.state.globalLight) {
|
|
9548
9678
|
return {
|
|
9549
9679
|
// States without adjustment layers keep schema 1, so they round-trip unchanged.
|
|
9550
|
-
version: _optionalChain([view, 'access',
|
|
9680
|
+
version: _optionalChain([view, 'access', _220 => _220.adjustments, 'access', _221 => _221.layers, 'optionalAccess', _222 => _222.length]) ? 2 : 1,
|
|
9551
9681
|
crop: this.state.crop ? { ...this.state.crop } : null,
|
|
9552
9682
|
transform: { ...this.state.transform },
|
|
9553
9683
|
adjustments: serializeAdjustments(view.adjustments),
|
|
@@ -9571,12 +9701,13 @@ var ImageEditorController = (_class7 = class {
|
|
|
9571
9701
|
opacity: this.state.outputOpacity
|
|
9572
9702
|
};
|
|
9573
9703
|
if (this.state.legacyOutputBlur !== void 0) out.legacyOutputBlur = this.state.legacyOutputBlur;
|
|
9704
|
+
if (this.state.globalLight) out.globalLight = { ...this.state.globalLight };
|
|
9574
9705
|
return out;
|
|
9575
9706
|
}
|
|
9576
9707
|
}, _class7);
|
|
9577
9708
|
function serializeAdjustments(adjustments) {
|
|
9578
9709
|
const out = { ...adjustments };
|
|
9579
|
-
if (_optionalChain([out, 'access',
|
|
9710
|
+
if (_optionalChain([out, 'access', _223 => _223.layers, 'optionalAccess', _224 => _224.length])) out.layers = JSON.parse(JSON.stringify(out.layers));
|
|
9580
9711
|
else delete out.layers;
|
|
9581
9712
|
if (normalizeProcessVersion(out.process) === LEGACY_PROCESS_VERSION) {
|
|
9582
9713
|
delete out.process;
|
|
@@ -9612,11 +9743,11 @@ function withDevelop(layer, partial) {
|
|
|
9612
9743
|
return { ...layer, filters };
|
|
9613
9744
|
}
|
|
9614
9745
|
function withBlur(layer, radius) {
|
|
9615
|
-
const existing = _optionalChain([layer, 'access',
|
|
9746
|
+
const existing = _optionalChain([layer, 'access', _225 => _225.filters, 'optionalAccess', _226 => _226.find, 'call', _227 => _227((f) => f.kind === "blur")]);
|
|
9616
9747
|
const filters = (_nullishCoalesce(layer.filters, () => ( []))).filter((f) => f.kind !== "blur");
|
|
9617
9748
|
if (radius > 0) {
|
|
9618
9749
|
filters.push({
|
|
9619
|
-
id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess',
|
|
9750
|
+
id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _228 => _228.id]), () => ( (layer.source === "document" ? BLUR_FILTER_ID : newLayerId("flt")))),
|
|
9620
9751
|
kind: "blur",
|
|
9621
9752
|
enabled: true,
|
|
9622
9753
|
radius
|
|
@@ -9680,12 +9811,12 @@ function resizeLegacyMasks(layers, from, to) {
|
|
|
9680
9811
|
const th = Math.max(1, Math.round(to.height));
|
|
9681
9812
|
if (fw === tw && fh === th) return layers;
|
|
9682
9813
|
let out = layers;
|
|
9683
|
-
for (const l of
|
|
9814
|
+
for (const l of _chunk73L6TROJcjs.flattenLayers.call(void 0, layers)) {
|
|
9684
9815
|
if (l.type !== "adjustment" || !l.mask || l.mask.source) continue;
|
|
9685
9816
|
const old = l.mask;
|
|
9686
9817
|
const mask = rasterMaskFromLegacy(legacyMaskOf(old, fw, fh), tw, th);
|
|
9687
9818
|
if (!mask) continue;
|
|
9688
|
-
out =
|
|
9819
|
+
out = _chunk73L6TROJcjs.mapLayer.call(void 0, out, l.id, (n) => ({ ...n, mask: { ...mask, density: old.density, feather: old.feather, enabled: old.enabled } }));
|
|
9689
9820
|
}
|
|
9690
9821
|
return out;
|
|
9691
9822
|
}
|
|
@@ -9698,7 +9829,7 @@ function isOpaqueInside(surface, width, height) {
|
|
|
9698
9829
|
return true;
|
|
9699
9830
|
}
|
|
9700
9831
|
function collectStateTiles(layers, into) {
|
|
9701
|
-
for (const l of
|
|
9832
|
+
for (const l of _chunk73L6TROJcjs.flattenLayers.call(void 0, layers)) {
|
|
9702
9833
|
if (l.type === "pixel" && l.source !== "document") _chunkZOOEX3WTcjs.collectTiles.call(void 0, l.surface, into);
|
|
9703
9834
|
if (l.mask && !l.mask.source) _chunkZOOEX3WTcjs.collectTiles.call(void 0, l.mask.surface, into);
|
|
9704
9835
|
}
|
|
@@ -9708,7 +9839,7 @@ function pixelsOnly(layers) {
|
|
|
9708
9839
|
for (const l of layers) {
|
|
9709
9840
|
if (l.type === "adjustment") continue;
|
|
9710
9841
|
if (l.type === "group") out.push({ ...l, children: pixelsOnly(l.children) });
|
|
9711
|
-
else if (l.type === "pixel" && _optionalChain([l, 'access',
|
|
9842
|
+
else if (l.type === "pixel" && _optionalChain([l, 'access', _229 => _229.filters, 'optionalAccess', _230 => _230.length])) {
|
|
9712
9843
|
const p = { ...l };
|
|
9713
9844
|
delete p.filters;
|
|
9714
9845
|
out.push(p);
|
|
@@ -9766,7 +9897,7 @@ function toHex2(c) {
|
|
|
9766
9897
|
return "#" + [c[0], c[1], c[2]].map((v) => Math.round(v).toString(16).padStart(2, "0")).join("");
|
|
9767
9898
|
}
|
|
9768
9899
|
function normalizeSelection(mask) {
|
|
9769
|
-
return _optionalChain([mask, 'optionalAccess',
|
|
9900
|
+
return _optionalChain([mask, 'optionalAccess', _231 => _231.bounds]) ? mask : null;
|
|
9770
9901
|
}
|
|
9771
9902
|
function sameSelection(a, b) {
|
|
9772
9903
|
if (a.width !== b.width || a.height !== b.height) return false;
|
|
@@ -9871,7 +10002,7 @@ function loadImageEditorDocument(input) {
|
|
|
9871
10002
|
if (typeof input === "string") {
|
|
9872
10003
|
try {
|
|
9873
10004
|
parsed = JSON.parse(input);
|
|
9874
|
-
} catch (
|
|
10005
|
+
} catch (e26) {
|
|
9875
10006
|
parsed = input;
|
|
9876
10007
|
}
|
|
9877
10008
|
}
|
|
@@ -9927,7 +10058,7 @@ function loadImageEditorDocument(input) {
|
|
|
9927
10058
|
}
|
|
9928
10059
|
const state = { version: 1, ...result.value };
|
|
9929
10060
|
if (isV2) {
|
|
9930
|
-
if (_optionalChain([state, 'access',
|
|
10061
|
+
if (_optionalChain([state, 'access', _232 => _232.adjustments, 'access', _233 => _233.layers, 'optionalAccess', _234 => _234.length])) state.version = 2;
|
|
9931
10062
|
result.report.version = 2;
|
|
9932
10063
|
}
|
|
9933
10064
|
if (state.selection === void 0) delete state.selection;
|
|
@@ -10127,7 +10258,7 @@ function findAdjustmentControl(id) {
|
|
|
10127
10258
|
}
|
|
10128
10259
|
function findLayerControl(kind, id) {
|
|
10129
10260
|
if (id === "opacity") return ADJUSTMENT_LAYER_OPACITY_CONTROL;
|
|
10130
|
-
return _optionalChain([ADJUSTMENT_LAYER_CONTROLS, 'access',
|
|
10261
|
+
return _optionalChain([ADJUSTMENT_LAYER_CONTROLS, 'access', _235 => _235[kind], 'optionalAccess', _236 => _236.find, 'call', _237 => _237((c) => c.id === id)]);
|
|
10131
10262
|
}
|
|
10132
10263
|
function clampControlValue(spec, v) {
|
|
10133
10264
|
if (typeof v !== "number" || !Number.isFinite(v)) return spec.default;
|
|
@@ -10246,7 +10377,7 @@ function summary(controller) {
|
|
|
10246
10377
|
const area = selectionArea(sel);
|
|
10247
10378
|
return {
|
|
10248
10379
|
empty: !sel,
|
|
10249
|
-
bounds: _nullishCoalesce(_optionalChain([sel, 'optionalAccess',
|
|
10380
|
+
bounds: _nullishCoalesce(_optionalChain([sel, 'optionalAccess', _238 => _238.bounds]), () => ( null)),
|
|
10250
10381
|
/** Σ coverage in pixels. */
|
|
10251
10382
|
area: Math.round(area),
|
|
10252
10383
|
percent: Math.round(area / Math.max(1, width * height) * 1e4) / 100,
|
|
@@ -10490,7 +10621,7 @@ async function renderImageRegion(controller, request) {
|
|
|
10490
10621
|
if (request.includeOverlays) {
|
|
10491
10622
|
const s = request.scale;
|
|
10492
10623
|
const selection = state.selection;
|
|
10493
|
-
if (_optionalChain([selection, 'optionalAccess',
|
|
10624
|
+
if (_optionalChain([selection, 'optionalAccess', _239 => _239.bounds]) && selection.width === state.imageDimensions.width && selection.height === state.imageDimensions.height) {
|
|
10494
10625
|
const shade = selectionShade(selection, document);
|
|
10495
10626
|
if (shade) context.drawImage(shade, rect.x, rect.y, rect.width, rect.height, 0, 0, out.width, out.height);
|
|
10496
10627
|
}
|
|
@@ -10515,7 +10646,7 @@ function createImageCaptureSurface(controller) {
|
|
|
10515
10646
|
return {
|
|
10516
10647
|
units: "image pixels",
|
|
10517
10648
|
content: whole,
|
|
10518
|
-
selection: () => ({ rect: _nullishCoalesce(_optionalChain([controller, 'access',
|
|
10649
|
+
selection: () => ({ rect: _nullishCoalesce(_optionalChain([controller, 'access', _240 => _240.getState, 'call', _241 => _241(), 'access', _242 => _242.selection, 'optionalAccess', _243 => _243.bounds]), () => ( null)) }),
|
|
10519
10650
|
overlays: "a shade over unselected pixels and the crop box outline",
|
|
10520
10651
|
maxScale: 8,
|
|
10521
10652
|
render: (request) => renderImageRegion(controller, request)
|
|
@@ -10808,6 +10939,7 @@ function describeLayer(layer, activeId, boundsOf) {
|
|
|
10808
10939
|
clipped: Boolean(layer.clipped),
|
|
10809
10940
|
locks: layer.locks ? { ...layer.locks } : {},
|
|
10810
10941
|
mask: maskSummary(layer.mask),
|
|
10942
|
+
effects: layer.effects ? { enabled: layer.effects.enabled, scale: _nullishCoalesce(layer.effects.scale, () => ( 1)), items: layer.effects.items.map((e) => ({ id: e.id, kind: e.kind, enabled: e.enabled })) } : null,
|
|
10811
10943
|
active: layer.id === activeId
|
|
10812
10944
|
};
|
|
10813
10945
|
switch (layer.type) {
|
|
@@ -10851,11 +10983,11 @@ function placementFrom(args) {
|
|
|
10851
10983
|
function createImageLayerTools(controller) {
|
|
10852
10984
|
const describe = (id) => {
|
|
10853
10985
|
const s = controller.getState();
|
|
10854
|
-
const loc =
|
|
10986
|
+
const loc = _chunk73L6TROJcjs.findLayer.call(void 0, s.layers, id);
|
|
10855
10987
|
if (!loc) return null;
|
|
10856
10988
|
return {
|
|
10857
10989
|
...describeLayer(loc.layer, s.activeLayerId, (x) => controller.getLayerBounds(x.id)),
|
|
10858
|
-
parentId: _nullishCoalesce(_optionalChain([loc, 'access',
|
|
10990
|
+
parentId: _nullishCoalesce(_optionalChain([loc, 'access', _244 => _244.parent, 'optionalAccess', _245 => _245.id]), () => ( null)),
|
|
10859
10991
|
index: loc.index
|
|
10860
10992
|
};
|
|
10861
10993
|
};
|
|
@@ -10867,7 +10999,7 @@ function createImageLayerTools(controller) {
|
|
|
10867
10999
|
const listLayers = {
|
|
10868
11000
|
name: "list_layers",
|
|
10869
11001
|
title: "List image layers",
|
|
10870
|
-
description: "Returns the layer stack bottom to top as a tree: id, type (pixel, adjustment, group, annotation), name, document bounds (pixel layers), visible, opacity, fillOpacity, blend, clipped, locks, a mask summary, filters (pixel layers), kind and params (adjustment layers), children (groups) and which layer is active. Also returns the active layer id and target (pixels or mask) and the canvas size.",
|
|
11002
|
+
description: "Returns the layer stack bottom to top as a tree: id, type (pixel, adjustment, group, annotation), name, document bounds (pixel layers), visible, opacity, fillOpacity, blend, clipped, locks, a mask summary, an effects summary (master switch, scale, effect ids and kinds; details from list_layer_effects), filters (pixel layers), kind and params (adjustment layers), children (groups) and which layer is active. Also returns the active layer id and target (pixels or mask) and the canvas size.",
|
|
10871
11003
|
inputSchema: { type: "object", properties: {}, additionalProperties: false },
|
|
10872
11004
|
annotations: { title: "List image layers", ...READ2 },
|
|
10873
11005
|
handler: () => {
|
|
@@ -11303,9 +11435,338 @@ function createImageLayerTools(controller) {
|
|
|
11303
11435
|
];
|
|
11304
11436
|
}
|
|
11305
11437
|
|
|
11306
|
-
// src/image-editor/
|
|
11438
|
+
// src/image-editor/effect-tools.ts
|
|
11439
|
+
var READ3 = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
11307
11440
|
var WRITE3 = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false };
|
|
11441
|
+
var WRITE_IDEMPOTENT3 = { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
11308
11442
|
var DESTRUCTIVE2 = { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false };
|
|
11443
|
+
var LAYER_ID3 = { type: "string", description: "Layer id from list_layers (a pixel, annotation or group layer)." };
|
|
11444
|
+
var EFFECT_ID = { type: "string", description: "Effect id from list_layer_effects or add_layer_effect." };
|
|
11445
|
+
var BLEND_IDS = _chunkZOOEX3WTcjs.BLEND_MODES.map((m) => m.id);
|
|
11446
|
+
var DEFS = {
|
|
11447
|
+
color: { type: "string", pattern: "^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$", description: "Colour as #rrggbb." },
|
|
11448
|
+
contour: {
|
|
11449
|
+
type: "object",
|
|
11450
|
+
description: "A transfer curve over the effect coverage: points { input, output } from 0 to 1 (at least 2), sorted by input. Linear is [{0,0},{1,1}].",
|
|
11451
|
+
properties: {
|
|
11452
|
+
name: { type: "string", description: 'Display name (e.g. "Cone", "Gaussian").' },
|
|
11453
|
+
points: {
|
|
11454
|
+
type: "array",
|
|
11455
|
+
minItems: 2,
|
|
11456
|
+
description: "Curve points.",
|
|
11457
|
+
items: {
|
|
11458
|
+
type: "object",
|
|
11459
|
+
properties: {
|
|
11460
|
+
input: { type: "number", minimum: 0, maximum: 1, description: "Coverage in (0..1)." },
|
|
11461
|
+
output: { type: "number", minimum: 0, maximum: 1, description: "Coverage out (0..1)." },
|
|
11462
|
+
corner: { type: "boolean", description: "Sharp corner instead of a smooth point (default false)." }
|
|
11463
|
+
},
|
|
11464
|
+
required: ["input", "output"],
|
|
11465
|
+
additionalProperties: false
|
|
11466
|
+
}
|
|
11467
|
+
}
|
|
11468
|
+
},
|
|
11469
|
+
required: ["name", "points"],
|
|
11470
|
+
additionalProperties: false
|
|
11471
|
+
},
|
|
11472
|
+
gradient: {
|
|
11473
|
+
type: "object",
|
|
11474
|
+
description: "A gradient: colour stops, optional opacity stops and its layout.",
|
|
11475
|
+
properties: {
|
|
11476
|
+
stops: {
|
|
11477
|
+
type: "array",
|
|
11478
|
+
minItems: 1,
|
|
11479
|
+
description: "Colour stops { position 0..1, color #rrggbb }.",
|
|
11480
|
+
items: {
|
|
11481
|
+
type: "object",
|
|
11482
|
+
properties: { position: { type: "number", minimum: 0, maximum: 1, description: "0..1 along the gradient." }, color: { $ref: "#/$defs/color" } },
|
|
11483
|
+
required: ["position", "color"],
|
|
11484
|
+
additionalProperties: false
|
|
11485
|
+
}
|
|
11486
|
+
},
|
|
11487
|
+
opacityStops: {
|
|
11488
|
+
type: "array",
|
|
11489
|
+
description: "Opacity stops { position 0..1, opacity 0..1 } (default opaque).",
|
|
11490
|
+
items: {
|
|
11491
|
+
type: "object",
|
|
11492
|
+
properties: {
|
|
11493
|
+
position: { type: "number", minimum: 0, maximum: 1, description: "0..1 along the gradient." },
|
|
11494
|
+
opacity: { type: "number", minimum: 0, maximum: 1, description: "0..1." }
|
|
11495
|
+
},
|
|
11496
|
+
required: ["position", "opacity"],
|
|
11497
|
+
additionalProperties: false
|
|
11498
|
+
}
|
|
11499
|
+
},
|
|
11500
|
+
style: { type: "string", enum: ["linear", "radial", "angle", "reflected", "diamond"], description: "Geometry." },
|
|
11501
|
+
angle: { type: "number", minimum: -360, maximum: 360, description: "Degrees, 90 = bottom to top." },
|
|
11502
|
+
scale: { type: "number", minimum: 0.1, maximum: 1.5, description: "1 = 100 %." },
|
|
11503
|
+
reverse: { type: "boolean", description: "Swap the ends." },
|
|
11504
|
+
align: { type: "boolean", description: "Lay out over the layer bounds (true) or the canvas." },
|
|
11505
|
+
offset: {
|
|
11506
|
+
type: "object",
|
|
11507
|
+
description: "Centre offset as fractions of the bounds.",
|
|
11508
|
+
properties: { x: { type: "number", minimum: -1, maximum: 1, description: "Fraction of the width." }, y: { type: "number", minimum: -1, maximum: 1, description: "Fraction of the height." } },
|
|
11509
|
+
required: ["x", "y"],
|
|
11510
|
+
additionalProperties: false
|
|
11511
|
+
}
|
|
11512
|
+
},
|
|
11513
|
+
required: ["stops", "style", "angle", "scale", "reverse", "align", "offset"],
|
|
11514
|
+
additionalProperties: false
|
|
11515
|
+
},
|
|
11516
|
+
phase: {
|
|
11517
|
+
type: "object",
|
|
11518
|
+
description: "Pattern origin offset in px.",
|
|
11519
|
+
properties: { x: { type: "number", description: "px." }, y: { type: "number", description: "px." } },
|
|
11520
|
+
required: ["x", "y"],
|
|
11521
|
+
additionalProperties: false
|
|
11522
|
+
},
|
|
11523
|
+
fill: {
|
|
11524
|
+
description: "What a stroke or glow paints with. Glows take color or gradient only.",
|
|
11525
|
+
anyOf: [
|
|
11526
|
+
{
|
|
11527
|
+
type: "object",
|
|
11528
|
+
properties: { type: { const: "color", description: "Solid colour." }, color: { $ref: "#/$defs/color" } },
|
|
11529
|
+
required: ["type", "color"],
|
|
11530
|
+
additionalProperties: false
|
|
11531
|
+
},
|
|
11532
|
+
{
|
|
11533
|
+
type: "object",
|
|
11534
|
+
properties: { type: { const: "gradient", description: "Gradient." }, gradient: { $ref: "#/$defs/gradient" } },
|
|
11535
|
+
required: ["type", "gradient"],
|
|
11536
|
+
additionalProperties: false
|
|
11537
|
+
},
|
|
11538
|
+
{
|
|
11539
|
+
type: "object",
|
|
11540
|
+
properties: {
|
|
11541
|
+
type: { const: "pattern", description: "Pattern (strokes only)." },
|
|
11542
|
+
patternId: { type: "string", description: "Pattern id from list_layer_effects.patterns." },
|
|
11543
|
+
name: { type: "string", description: "Display name." },
|
|
11544
|
+
scale: { type: "number", minimum: 0.01, maximum: 10, description: "1 = 100 %." },
|
|
11545
|
+
angle: { type: "number", minimum: -360, maximum: 360, description: "Rotation in degrees (default 0)." },
|
|
11546
|
+
link: { type: "boolean", description: "Tile from the layer (default true) or the canvas origin." },
|
|
11547
|
+
phase: { $ref: "#/$defs/phase" }
|
|
11548
|
+
},
|
|
11549
|
+
required: ["type", "patternId", "scale"],
|
|
11550
|
+
additionalProperties: false
|
|
11551
|
+
}
|
|
11552
|
+
]
|
|
11553
|
+
}
|
|
11554
|
+
};
|
|
11555
|
+
var nullable = (schema, description) => ({ anyOf: [schema, { type: "null" }], description });
|
|
11556
|
+
function settingsSchema(forUpdate) {
|
|
11557
|
+
const opt = (schema, description) => forUpdate ? nullable(schema, `${description} null removes it.`) : { ...schema, description };
|
|
11558
|
+
return {
|
|
11559
|
+
type: "object",
|
|
11560
|
+
description: forUpdate ? "Settings to change (only these; nested objects are replaced whole). Which settings a kind takes: see add_layer_effect." : "Settings to change from Photoshop's defaults (all optional). Unknown settings for the kind are refused with the list of its settings.",
|
|
11561
|
+
properties: {
|
|
11562
|
+
enabled: { type: "boolean", description: "All kinds: false keeps the effect but hides it (default true)." },
|
|
11563
|
+
blend: { type: "string", enum: BLEND_IDS, description: "All but bevel-emboss: blend mode (shadows multiply, glows screen, others normal)." },
|
|
11564
|
+
opacity: { type: "number", minimum: 0, maximum: 1, description: "All but bevel-emboss: 0..1 (shadows / glows 0.75, satin 0.5, others 1)." },
|
|
11565
|
+
color: { $ref: "#/$defs/color", description: "drop-shadow, inner-shadow, satin, color-overlay: #rrggbb." },
|
|
11566
|
+
angle: { type: "number", minimum: -360, maximum: 360, description: "Shadows, satin, bevel-emboss: light direction in degrees, counter-clockwise from 3 o'clock (default 120; satin 19)." },
|
|
11567
|
+
useGlobalLight: { type: "boolean", description: "Shadows, bevel-emboss: follow the document global light instead of angle (default true)." },
|
|
11568
|
+
distance: { type: "number", minimum: 0, maximum: 3e4, description: "Shadows, satin: offset in px (default 5; satin 11)." },
|
|
11569
|
+
spread: { type: "number", minimum: 0, maximum: 1, description: "drop-shadow, outer-glow: 0..1 of the size made solid (default 0)." },
|
|
11570
|
+
choke: { type: "number", minimum: 0, maximum: 1, description: "inner-shadow, inner-glow: 0..1 of the size made solid (default 0)." },
|
|
11571
|
+
size: { type: "number", minimum: 0, maximum: 250, description: "Shadows, glows, satin, bevel-emboss: blur / size in px (default 5; satin 14); stroke: width in px (default 3)." },
|
|
11572
|
+
contour: opt({ $ref: "#/$defs/contour" }, "Shadows, glows, satin: coverage contour (default linear)."),
|
|
11573
|
+
antiAlias: { type: "boolean", description: "Shadows, glows, satin: smooth the contour (default false; satin true)." },
|
|
11574
|
+
noise: { type: "number", minimum: 0, maximum: 1, description: "Shadows, glows: speckle 0..1 (default 0)." },
|
|
11575
|
+
knocksOut: { type: "boolean", description: "drop-shadow: the layer hides the shadow beneath its see-through fill (default true)." },
|
|
11576
|
+
fill: { $ref: "#/$defs/fill", description: "outer-glow, inner-glow (color or gradient), stroke (color, gradient or pattern)." },
|
|
11577
|
+
technique: { type: "string", enum: ["softer", "precise", "smooth", "chisel-hard", "chisel-soft"], description: "Glows: softer | precise (default softer); bevel-emboss: smooth | chisel-hard | chisel-soft (default smooth)." },
|
|
11578
|
+
range: { type: "number", minimum: 0.01, maximum: 1, description: "Glows: the part of the glow the contour spans (default 0.5)." },
|
|
11579
|
+
jitter: { type: "number", minimum: 0, maximum: 1, description: "Glows: gradient jitter 0..1 (stored, not rendered; default 0)." },
|
|
11580
|
+
source: { type: "string", enum: ["edge", "center"], description: "inner-glow: glow from the edge (default) or the centre." },
|
|
11581
|
+
style: { type: "string", enum: ["inner-bevel", "outer-bevel", "emboss", "pillow-emboss", "stroke-emboss"], description: "bevel-emboss: style (default inner-bevel)." },
|
|
11582
|
+
depth: { type: "number", minimum: 0, maximum: 10, description: "bevel-emboss: depth, 1 = 100 % (default 1)." },
|
|
11583
|
+
direction: { type: "string", enum: ["up", "down"], description: "bevel-emboss: raised (up, default) or sunk (down)." },
|
|
11584
|
+
soften: { type: "number", minimum: 0, maximum: 16, description: "bevel-emboss: blur of the height in px (default 0)." },
|
|
11585
|
+
altitude: { type: "number", minimum: 0, maximum: 90, description: "bevel-emboss: light altitude in degrees (default 30)." },
|
|
11586
|
+
glossContour: opt({ $ref: "#/$defs/contour" }, "bevel-emboss: gloss contour over the shading (default linear)."),
|
|
11587
|
+
highlightColor: { $ref: "#/$defs/color", description: "bevel-emboss: highlight colour (default #ffffff)." },
|
|
11588
|
+
highlightBlend: { type: "string", enum: BLEND_IDS, description: "bevel-emboss: highlight mode (default screen)." },
|
|
11589
|
+
highlightOpacity: { type: "number", minimum: 0, maximum: 1, description: "bevel-emboss: highlight opacity (default 0.75)." },
|
|
11590
|
+
shadowColor: { $ref: "#/$defs/color", description: "bevel-emboss: shadow colour (default #000000)." },
|
|
11591
|
+
shadowBlend: { type: "string", enum: BLEND_IDS, description: "bevel-emboss: shadow mode (default multiply)." },
|
|
11592
|
+
shadowOpacity: { type: "number", minimum: 0, maximum: 1, description: "bevel-emboss: shadow opacity (default 0.75)." },
|
|
11593
|
+
contourElement: opt(
|
|
11594
|
+
{
|
|
11595
|
+
type: "object",
|
|
11596
|
+
properties: {
|
|
11597
|
+
contour: { $ref: "#/$defs/contour" },
|
|
11598
|
+
range: { type: "number", minimum: 0, maximum: 1, description: "Stored range (default 0.5)." },
|
|
11599
|
+
antiAlias: { type: "boolean", description: "Smooth the contour." }
|
|
11600
|
+
},
|
|
11601
|
+
required: ["contour", "range", "antiAlias"],
|
|
11602
|
+
additionalProperties: false
|
|
11603
|
+
},
|
|
11604
|
+
"bevel-emboss: the Contour element, shaping the bevel's height profile (default off)."
|
|
11605
|
+
),
|
|
11606
|
+
texture: opt(
|
|
11607
|
+
{
|
|
11608
|
+
type: "object",
|
|
11609
|
+
properties: {
|
|
11610
|
+
patternId: { type: "string", description: "Pattern id from list_layer_effects.patterns." },
|
|
11611
|
+
name: { type: "string", description: "Display name." },
|
|
11612
|
+
scale: { type: "number", minimum: 0.01, maximum: 10, description: "1 = 100 %." },
|
|
11613
|
+
depth: { type: "number", minimum: -10, maximum: 10, description: "1 = +100 %; negative carves the pattern in." },
|
|
11614
|
+
invert: { type: "boolean", description: "Invert the pattern." },
|
|
11615
|
+
link: { type: "boolean", description: "Tile from the layer (default true)." },
|
|
11616
|
+
phase: { $ref: "#/$defs/phase" }
|
|
11617
|
+
},
|
|
11618
|
+
required: ["patternId", "scale", "depth", "invert"],
|
|
11619
|
+
additionalProperties: false
|
|
11620
|
+
},
|
|
11621
|
+
"bevel-emboss: the Texture element, a pattern's luminance as extra height (default off)."
|
|
11622
|
+
),
|
|
11623
|
+
invert: { type: "boolean", description: "satin: invert (default true)." },
|
|
11624
|
+
gradient: { $ref: "#/$defs/gradient", description: "gradient-overlay: the gradient (default black to white, 90\xB0)." },
|
|
11625
|
+
dither: { type: "boolean", description: "gradient-overlay: dither (stored; default false)." },
|
|
11626
|
+
patternId: { type: "string", description: "pattern-overlay: pattern id from list_layer_effects.patterns (default checker)." },
|
|
11627
|
+
name: { type: "string", description: "pattern-overlay: pattern display name." },
|
|
11628
|
+
scale: { type: "number", minimum: 0.01, maximum: 10, description: "pattern-overlay: 1 = 100 % (default 1)." },
|
|
11629
|
+
link: { type: "boolean", description: "pattern-overlay: tile from the layer (default true) or the canvas origin." },
|
|
11630
|
+
phase: { $ref: "#/$defs/phase", description: "pattern-overlay: origin offset in px (default 0, 0)." },
|
|
11631
|
+
position: { type: "string", enum: ["outside", "inside", "center"], description: "stroke: where the stroke sits on the edge (default outside)." }
|
|
11632
|
+
},
|
|
11633
|
+
additionalProperties: false
|
|
11634
|
+
};
|
|
11635
|
+
}
|
|
11636
|
+
function patternList() {
|
|
11637
|
+
return _chunk73L6TROJcjs.builtinPatternIds.call(void 0, ).map((id) => {
|
|
11638
|
+
const p = _chunk73L6TROJcjs.builtinPattern.call(void 0, id);
|
|
11639
|
+
return { id, name: p.name, width: p.width, height: p.height, builtin: true };
|
|
11640
|
+
});
|
|
11641
|
+
}
|
|
11642
|
+
function describeLayerEffects(effects) {
|
|
11643
|
+
return {
|
|
11644
|
+
enabled: effects.enabled,
|
|
11645
|
+
scale: _nullishCoalesce(effects.scale, () => ( 1)),
|
|
11646
|
+
margin: _chunk73L6TROJcjs.effectsMargin.call(void 0, effects),
|
|
11647
|
+
fromPsd: Boolean(effects.psd),
|
|
11648
|
+
effects: effects.items.map((e) => ({ ...JSON.parse(JSON.stringify(e)), label: _chunk73L6TROJcjs.layerEffectLabel.call(void 0, e.kind) }))
|
|
11649
|
+
};
|
|
11650
|
+
}
|
|
11651
|
+
function createImageEffectTools(controller) {
|
|
11652
|
+
const layerArg = (id) => {
|
|
11653
|
+
if (typeof id !== "string" || !id) throw new LayerOperationError("layerId is required (a layer id from list_layers).");
|
|
11654
|
+
requireLayer(controller.getLayers(), id);
|
|
11655
|
+
return id;
|
|
11656
|
+
};
|
|
11657
|
+
const result = (layerId, extra = {}) => ({ layerId, ...extra, ...describeLayerEffects(controller.getLayerEffects(layerId)) });
|
|
11658
|
+
const list = {
|
|
11659
|
+
name: "list_layer_effects",
|
|
11660
|
+
title: "List layer effects",
|
|
11661
|
+
description: "Returns a layer's effects: the master switch (enabled), Scale Effects (scale, 1 = 100 %), margin (px the effects reach beyond the shape), whether they came from a PSD, and every effect with its id, kind, label and all settings. Also returns the document global light and the pattern ids pattern effects can use.",
|
|
11662
|
+
inputSchema: { type: "object", properties: { layerId: LAYER_ID3 }, required: ["layerId"], additionalProperties: false },
|
|
11663
|
+
annotations: { title: "List layer effects", ...READ3 },
|
|
11664
|
+
handler: ({ layerId }) => result(layerArg(layerId), { globalLight: controller.getGlobalLight(), patterns: patternList(), kinds: [..._chunk73L6TROJcjs.LAYER_EFFECT_KINDS] })
|
|
11665
|
+
};
|
|
11666
|
+
const add = {
|
|
11667
|
+
name: "add_layer_effect",
|
|
11668
|
+
title: "Add a layer effect",
|
|
11669
|
+
description: "Adds a live effect to a pixel, annotation or group layer with Photoshop's defaults, changed by settings: drop-shadow, inner-shadow, outer-glow, inner-glow, bevel-emboss, satin, color-overlay, gradient-overlay, pattern-overlay or stroke. Several of one kind are allowed (the first listed is on top). One undo step. Returns the new effect's id and the layer's effects.",
|
|
11670
|
+
inputSchema: {
|
|
11671
|
+
type: "object",
|
|
11672
|
+
$defs: DEFS,
|
|
11673
|
+
properties: {
|
|
11674
|
+
layerId: LAYER_ID3,
|
|
11675
|
+
kind: { type: "string", enum: [..._chunk73L6TROJcjs.LAYER_EFFECT_KINDS], description: "Effect kind." },
|
|
11676
|
+
settings: settingsSchema(false),
|
|
11677
|
+
index: { type: "integer", minimum: 0, description: "Position in the layer's effect list (default the end)." }
|
|
11678
|
+
},
|
|
11679
|
+
required: ["layerId", "kind"],
|
|
11680
|
+
additionalProperties: false
|
|
11681
|
+
},
|
|
11682
|
+
annotations: { title: "Add a layer effect", ...WRITE3 },
|
|
11683
|
+
handler: ({ layerId, kind, settings, index }) => {
|
|
11684
|
+
const id = layerArg(layerId);
|
|
11685
|
+
if (!_chunk73L6TROJcjs.isLayerEffectKind.call(void 0, kind)) throw new LayerOperationError(`kind must be one of ${_chunk73L6TROJcjs.LAYER_EFFECT_KINDS.join(", ")}.`);
|
|
11686
|
+
const { effect } = controller.addLayerEffect(id, kind, _nullishCoalesce(settings, () => ( {})), index);
|
|
11687
|
+
return result(id, { effectId: effect.id });
|
|
11688
|
+
}
|
|
11689
|
+
};
|
|
11690
|
+
const update = {
|
|
11691
|
+
name: "update_layer_effect",
|
|
11692
|
+
title: "Change a layer effect",
|
|
11693
|
+
description: "Changes settings of one effect (only the given ones; fill, gradient, contour and texture objects are replaced whole, null removes an optional contour or texture). The kind cannot change. Validates everything before changing anything. One undo step. Returns the layer's effects.",
|
|
11694
|
+
inputSchema: {
|
|
11695
|
+
type: "object",
|
|
11696
|
+
$defs: DEFS,
|
|
11697
|
+
properties: { layerId: LAYER_ID3, effectId: EFFECT_ID, settings: settingsSchema(true) },
|
|
11698
|
+
required: ["layerId", "effectId", "settings"],
|
|
11699
|
+
additionalProperties: false
|
|
11700
|
+
},
|
|
11701
|
+
annotations: { title: "Change a layer effect", ...WRITE_IDEMPOTENT3 },
|
|
11702
|
+
handler: ({ layerId, effectId, settings }) => {
|
|
11703
|
+
const id = layerArg(layerId);
|
|
11704
|
+
const changes = _nullishCoalesce(settings, () => ( {}));
|
|
11705
|
+
if (!Object.keys(changes).length) throw new LayerOperationError("Give at least one setting to change.");
|
|
11706
|
+
controller.updateLayerEffect(id, effectId, changes);
|
|
11707
|
+
return result(id);
|
|
11708
|
+
}
|
|
11709
|
+
};
|
|
11710
|
+
const remove = {
|
|
11711
|
+
name: "remove_layer_effect",
|
|
11712
|
+
title: "Remove a layer effect",
|
|
11713
|
+
description: "Removes one effect from a layer (to hide it but keep its settings, set enabled false with update_layer_effect instead). One undo step. Returns the layer's remaining effects.",
|
|
11714
|
+
inputSchema: { type: "object", properties: { layerId: LAYER_ID3, effectId: EFFECT_ID }, required: ["layerId", "effectId"], additionalProperties: false },
|
|
11715
|
+
annotations: { title: "Remove a layer effect", ...DESTRUCTIVE2 },
|
|
11716
|
+
handler: ({ layerId, effectId }) => {
|
|
11717
|
+
const id = layerArg(layerId);
|
|
11718
|
+
controller.removeLayerEffect(id, effectId);
|
|
11719
|
+
return result(id);
|
|
11720
|
+
}
|
|
11721
|
+
};
|
|
11722
|
+
const setEnabled = {
|
|
11723
|
+
name: "set_layer_effects_enabled",
|
|
11724
|
+
title: "Switch layer effects on or off",
|
|
11725
|
+
description: "Turns all of a layer's effects on or off at once (the master switch; each effect keeps its own enabled flag) and optionally sets Scale Effects, which multiplies every size, distance and pattern scale. One undo step. Returns the layer's effects.",
|
|
11726
|
+
inputSchema: {
|
|
11727
|
+
type: "object",
|
|
11728
|
+
properties: {
|
|
11729
|
+
layerId: LAYER_ID3,
|
|
11730
|
+
enabled: { type: "boolean", description: "true renders the enabled effects; false hides them all." },
|
|
11731
|
+
scale: { type: "number", minimum: 0.01, maximum: 10, description: "Scale Effects, 1 = 100 % (unchanged when left out)." }
|
|
11732
|
+
},
|
|
11733
|
+
required: ["layerId", "enabled"],
|
|
11734
|
+
additionalProperties: false
|
|
11735
|
+
},
|
|
11736
|
+
annotations: { title: "Switch layer effects on or off", ...WRITE_IDEMPOTENT3 },
|
|
11737
|
+
handler: ({ layerId, enabled, scale }) => {
|
|
11738
|
+
const id = layerArg(layerId);
|
|
11739
|
+
controller.setLayerEffectsEnabled(id, enabled, scale);
|
|
11740
|
+
return result(id);
|
|
11741
|
+
}
|
|
11742
|
+
};
|
|
11743
|
+
const light = {
|
|
11744
|
+
name: "set_global_light",
|
|
11745
|
+
title: "Set the global light",
|
|
11746
|
+
description: "Sets the document global light that shadows and bevels with useGlobalLight follow (Photoshop default: angle 120\xB0, altitude 30\xB0). One undo step. Returns the light.",
|
|
11747
|
+
inputSchema: {
|
|
11748
|
+
type: "object",
|
|
11749
|
+
properties: {
|
|
11750
|
+
angle: { type: "number", minimum: -360, maximum: 360, description: "Degrees, counter-clockwise from 3 o'clock: where the light comes from (unchanged when left out)." },
|
|
11751
|
+
altitude: { type: "number", minimum: 0, maximum: 90, description: "Degrees above the canvas, for bevels (unchanged when left out)." }
|
|
11752
|
+
},
|
|
11753
|
+
additionalProperties: false
|
|
11754
|
+
},
|
|
11755
|
+
annotations: { title: "Set the global light", ...WRITE_IDEMPOTENT3 },
|
|
11756
|
+
handler: ({ angle, altitude }) => {
|
|
11757
|
+
if (angle === void 0 && altitude === void 0) throw new LayerOperationError("Give angle, altitude or both.");
|
|
11758
|
+
const next = {};
|
|
11759
|
+
if (angle !== void 0) next.angle = angle;
|
|
11760
|
+
if (altitude !== void 0) next.altitude = altitude;
|
|
11761
|
+
return { globalLight: controller.setGlobalLight(next) };
|
|
11762
|
+
}
|
|
11763
|
+
};
|
|
11764
|
+
return [list, add, update, remove, setEnabled, light];
|
|
11765
|
+
}
|
|
11766
|
+
|
|
11767
|
+
// src/image-editor/paint-tools.ts
|
|
11768
|
+
var WRITE4 = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false };
|
|
11769
|
+
var DESTRUCTIVE3 = { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false };
|
|
11309
11770
|
var TARGET = {
|
|
11310
11771
|
layerId: { type: "string", description: "Layer to paint (default the active layer; see list_layers)." },
|
|
11311
11772
|
channel: { type: "string", enum: ["pixels", "mask"], description: "pixels (default for a pixel layer) or the layer's mask: black hides, white reveals." }
|
|
@@ -11314,7 +11775,7 @@ var BRUSH = {
|
|
|
11314
11775
|
type: "object",
|
|
11315
11776
|
description: "Brush settings; missing fields use the current paint options (default round, hard, 20 px).",
|
|
11316
11777
|
properties: {
|
|
11317
|
-
size: { type: "number", minimum: 1, maximum:
|
|
11778
|
+
size: { type: "number", minimum: 1, maximum: _chunk4F3YDIWWcjs.MAX_BRUSH_SIZE, description: "Diameter in px (default 20)." },
|
|
11318
11779
|
hardness: { type: "number", minimum: 0, maximum: 1, description: "Edge hardness 0 (soft) .. 1 (hard, default)." },
|
|
11319
11780
|
spacing: { type: "number", minimum: 0.01, maximum: 10, description: "Dab spacing as a fraction of the diameter (default 0.1)." },
|
|
11320
11781
|
angle: { type: "number", minimum: -360, maximum: 360, description: "Tip angle in degrees (default 0)." },
|
|
@@ -11363,7 +11824,7 @@ function createImagePaintTools(controller) {
|
|
|
11363
11824
|
required: ["points"],
|
|
11364
11825
|
additionalProperties: false
|
|
11365
11826
|
},
|
|
11366
|
-
annotations: { title: "Paint a brush stroke", ...
|
|
11827
|
+
annotations: { title: "Paint a brush stroke", ...WRITE4 },
|
|
11367
11828
|
handler: (args) => controller.paintStroke({
|
|
11368
11829
|
tool: args.tool,
|
|
11369
11830
|
points: args.points,
|
|
@@ -11387,7 +11848,7 @@ function createImagePaintTools(controller) {
|
|
|
11387
11848
|
},
|
|
11388
11849
|
additionalProperties: false
|
|
11389
11850
|
},
|
|
11390
|
-
annotations: { title: "Fill pixels", ...
|
|
11851
|
+
annotations: { title: "Fill pixels", ...WRITE4 },
|
|
11391
11852
|
handler: (args) => controller.fillPixels({
|
|
11392
11853
|
color: args.color,
|
|
11393
11854
|
opacity: args.opacity,
|
|
@@ -11409,15 +11870,15 @@ function createImagePaintTools(controller) {
|
|
|
11409
11870
|
},
|
|
11410
11871
|
additionalProperties: false
|
|
11411
11872
|
},
|
|
11412
|
-
annotations: { title: "Clear pixels", ...
|
|
11873
|
+
annotations: { title: "Clear pixels", ...DESTRUCTIVE3 },
|
|
11413
11874
|
handler: (args) => controller.clearPixels({ opacity: args.opacity, useSelection: args.useSelection, ...readTarget(args) })
|
|
11414
11875
|
};
|
|
11415
11876
|
return [paintStroke, fill, clear];
|
|
11416
11877
|
}
|
|
11417
11878
|
|
|
11418
11879
|
// src/image-editor/psd-tools.ts
|
|
11419
|
-
var
|
|
11420
|
-
var
|
|
11880
|
+
var READ4 = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
11881
|
+
var DESTRUCTIVE4 = { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false };
|
|
11421
11882
|
var DATA = {
|
|
11422
11883
|
type: "string",
|
|
11423
11884
|
minLength: 1,
|
|
@@ -11427,7 +11888,7 @@ function psdBytesFromBase64(data) {
|
|
|
11427
11888
|
if (typeof data !== "string" || !data.trim()) throw new PsdError("data is required: the PSD file as base64.");
|
|
11428
11889
|
const body = data.trim().replace(/^data:[^,]*;base64,/i, "");
|
|
11429
11890
|
if (!/^[A-Za-z0-9+/=_\s-]+$/.test(body)) throw new PsdError("data is not base64; send the PSD file bytes base64-encoded.");
|
|
11430
|
-
const bytes =
|
|
11891
|
+
const bytes = _chunk73L6TROJcjs.base64ToBytes.call(void 0, body);
|
|
11431
11892
|
if (bytes.length < 26) throw new PsdError(`data decodes to ${bytes.length} bytes, too short for a PSD (at least 26).`);
|
|
11432
11893
|
return bytes;
|
|
11433
11894
|
}
|
|
@@ -11437,7 +11898,7 @@ function createImagePsdTools(controller) {
|
|
|
11437
11898
|
title: "Inspect a PSD",
|
|
11438
11899
|
description: "Reads a PSD / PSB without opening it: size, bit depth, colour mode, resolution, and every layer (bottom first, a group before its children) with its PSD kind, the layer type it would become and its status (mapped, approximated or dropped, with notes), plus the import warnings. Changes nothing. Call before import_psd to see what would be lost.",
|
|
11439
11900
|
inputSchema: { type: "object", properties: { data: DATA }, required: ["data"], additionalProperties: false },
|
|
11440
|
-
annotations: { title: "Inspect a PSD", ...
|
|
11901
|
+
annotations: { title: "Inspect a PSD", ...READ4 },
|
|
11441
11902
|
handler: ({ data }) => {
|
|
11442
11903
|
const res = importPsd(psdBytesFromBase64(data), { skipPixels: true });
|
|
11443
11904
|
return {
|
|
@@ -11455,7 +11916,7 @@ function createImagePsdTools(controller) {
|
|
|
11455
11916
|
title: "Open a PSD as the document",
|
|
11456
11917
|
description: "Opens a PSD / PSB as the document, replacing the current layers, crop and rotation (one undo step; undo brings the previous document back). Pixel, group and adjustment layers, masks, blend modes, opacity, fill, clipping, visibility and locks map directly; type, smart-object, fill and shape layers come in as their pixels; unsupported adjustments are left out. Returns the new layer tree with ids, the size and the warnings (each names the affected layers).",
|
|
11457
11918
|
inputSchema: { type: "object", properties: { data: DATA }, required: ["data"], additionalProperties: false },
|
|
11458
|
-
annotations: { title: "Open a PSD as the document", ...
|
|
11919
|
+
annotations: { title: "Open a PSD as the document", ...DESTRUCTIVE4 },
|
|
11459
11920
|
handler: ({ data }) => {
|
|
11460
11921
|
const res = controller.loadPsd(psdBytesFromBase64(data));
|
|
11461
11922
|
const s = controller.getState();
|
|
@@ -11474,11 +11935,11 @@ function createImagePsdTools(controller) {
|
|
|
11474
11935
|
title: "Export the document as a PSD",
|
|
11475
11936
|
description: "Writes the document as an 8-bit RGB PSD (a PSB above 30000 px) with real layers, groups, adjustment layers and masks, in the source frame (crop and rotation are not applied). Layer filters and depth masks are baked, annotation layers are rasterized (in a browser; elsewhere left out), and the merged image is the editor's composite. Changes nothing. Returns the file as base64, its size in bytes, whether it is a PSB, and warnings for everything that was changed or left out.",
|
|
11476
11937
|
inputSchema: { type: "object", properties: {}, additionalProperties: false },
|
|
11477
|
-
annotations: { title: "Export the document as a PSD", ...
|
|
11938
|
+
annotations: { title: "Export the document as a PSD", ...READ4 },
|
|
11478
11939
|
handler: async () => {
|
|
11479
11940
|
const res = await controller.toPsd();
|
|
11480
11941
|
return {
|
|
11481
|
-
data:
|
|
11942
|
+
data: _chunk73L6TROJcjs.bytesToBase64.call(void 0, res.bytes),
|
|
11482
11943
|
mimeType: "image/vnd.adobe.photoshop",
|
|
11483
11944
|
size: res.bytes.length,
|
|
11484
11945
|
psb: res.psb,
|
|
@@ -11663,7 +12124,7 @@ function createImageEditorToolProvider(controller, options = {}) {
|
|
|
11663
12124
|
for (const ref of [aboveId, parentId]) {
|
|
11664
12125
|
if (ref !== void 0 && !controller.getLayer(ref)) throw new Error(`Unknown layer "${ref}". Call list_layers for ids.`);
|
|
11665
12126
|
}
|
|
11666
|
-
if (parentId !== void 0 && _optionalChain([controller, 'access',
|
|
12127
|
+
if (parentId !== void 0 && _optionalChain([controller, 'access', _246 => _246.getLayer, 'call', _247 => _247(parentId), 'optionalAccess', _248 => _248.type]) !== "group") throw new Error(`Layer "${parentId}" is not a group.`);
|
|
11667
12128
|
const id = controller.addAdjustmentLayer({ kind, params, opacity, blend, name, aboveId, parentId });
|
|
11668
12129
|
const layer = controller.getAdjustmentLayer(id);
|
|
11669
12130
|
return { layer: JSON.parse(JSON.stringify(layer)), index: controller.getAdjustmentLayers().findIndex((l) => l.id === id) };
|
|
@@ -11728,7 +12189,9 @@ function createImageEditorToolProvider(controller, options = {}) {
|
|
|
11728
12189
|
...createImageSelectionTools(controller),
|
|
11729
12190
|
...createImageEditTools(controller),
|
|
11730
12191
|
...createImageLayerTools(controller),
|
|
12192
|
+
...createImageEffectTools(controller),
|
|
11731
12193
|
...createImagePaintTools(controller),
|
|
12194
|
+
..._chunk4F3YDIWWcjs.createPigmentTools.call(void 0, ),
|
|
11732
12195
|
...createImagePsdTools(controller)
|
|
11733
12196
|
]
|
|
11734
12197
|
};
|
|
@@ -12072,7 +12535,7 @@ function dropZone(fraction, isGroup) {
|
|
|
12072
12535
|
}
|
|
12073
12536
|
function dropPlacement(layers, dragId, targetId, zone) {
|
|
12074
12537
|
if (dragId === targetId) return null;
|
|
12075
|
-
const target =
|
|
12538
|
+
const target = _chunk73L6TROJcjs.findLayer.call(void 0, layers, targetId);
|
|
12076
12539
|
if (!target) return null;
|
|
12077
12540
|
if (zone === "inside" && target.layer.type === "group") return { parentId: targetId };
|
|
12078
12541
|
return zone === "above" ? { aboveId: targetId } : { belowId: targetId };
|
|
@@ -12080,35 +12543,35 @@ function dropPlacement(layers, dragId, targetId, zone) {
|
|
|
12080
12543
|
function layerMenu(controller) {
|
|
12081
12544
|
const s = controller.getState();
|
|
12082
12545
|
const active = controller.getActiveLayer();
|
|
12083
|
-
const loc = active ?
|
|
12546
|
+
const loc = active ? _chunk73L6TROJcjs.findLayer.call(void 0, s.layers, active.id) : null;
|
|
12084
12547
|
const siblings = loc ? loc.parent ? loc.parent.children : s.layers : [];
|
|
12085
12548
|
const below = loc ? siblings[loc.index - 1] : void 0;
|
|
12086
12549
|
const hasSel = controller.hasSelection;
|
|
12087
|
-
const isPixel = _optionalChain([active, 'optionalAccess',
|
|
12550
|
+
const isPixel = _optionalChain([active, 'optionalAccess', _249 => _249.type]) === "pixel";
|
|
12088
12551
|
return [
|
|
12089
12552
|
{ action: "new-layer", label: "New Layer", enabled: true },
|
|
12090
12553
|
{ action: "new-group", label: "New Group", enabled: true },
|
|
12091
12554
|
{ action: "duplicate", label: "Duplicate Layer", enabled: Boolean(active) },
|
|
12092
12555
|
{ action: "delete", label: "Delete Layer", enabled: Boolean(active) },
|
|
12093
12556
|
{ action: "group-selected", label: "Group Layer", enabled: Boolean(active) },
|
|
12094
|
-
{ action: "ungroup", label: "Ungroup", enabled: _optionalChain([active, 'optionalAccess',
|
|
12095
|
-
{ action: "merge-down", label: "Merge Down", enabled: Boolean(_optionalChain([active, 'optionalAccess',
|
|
12557
|
+
{ action: "ungroup", label: "Ungroup", enabled: _optionalChain([active, 'optionalAccess', _250 => _250.type]) === "group" },
|
|
12558
|
+
{ action: "merge-down", label: "Merge Down", enabled: Boolean(_optionalChain([active, 'optionalAccess', _251 => _251.visible]) && _optionalChain([below, 'optionalAccess', _252 => _252.type]) === "pixel") },
|
|
12096
12559
|
{ action: "merge-visible", label: "Merge Visible", enabled: s.layers.some((l) => l.visible) },
|
|
12097
12560
|
{ action: "flatten", label: "Flatten Image", enabled: s.layers.length > 0 },
|
|
12098
12561
|
{ action: "via-copy", label: "Layer via Copy", enabled: isPixel && hasSel },
|
|
12099
12562
|
{ action: "via-cut", label: "Layer via Cut", enabled: isPixel && hasSel },
|
|
12100
12563
|
{ action: "add-mask", label: "Add Layer Mask", enabled: Boolean(active) },
|
|
12101
12564
|
{ action: "add-mask-selection", label: "Add Mask from Selection", enabled: Boolean(active) && hasSel },
|
|
12102
|
-
{ action: "apply-mask", label: "Apply Layer Mask", enabled: isPixel && Boolean(_optionalChain([active, 'optionalAccess',
|
|
12103
|
-
{ action: "delete-mask", label: "Delete Layer Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess',
|
|
12104
|
-
{ action: "toggle-mask", label: _optionalChain([active, 'optionalAccess',
|
|
12105
|
-
{ action: "rasterize", label: "Rasterize Layer", enabled: _optionalChain([active, 'optionalAccess',
|
|
12106
|
-
{ action: "toggle-clip", label: _optionalChain([active, 'optionalAccess',
|
|
12565
|
+
{ action: "apply-mask", label: "Apply Layer Mask", enabled: isPixel && Boolean(_optionalChain([active, 'optionalAccess', _253 => _253.mask])) },
|
|
12566
|
+
{ action: "delete-mask", label: "Delete Layer Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _254 => _254.mask])) },
|
|
12567
|
+
{ action: "toggle-mask", label: _optionalChain([active, 'optionalAccess', _255 => _255.mask, 'optionalAccess', _256 => _256.enabled]) === false ? "Enable Layer Mask" : "Disable Layer Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _257 => _257.mask])) },
|
|
12568
|
+
{ action: "rasterize", label: "Rasterize Layer", enabled: _optionalChain([active, 'optionalAccess', _258 => _258.type]) === "annotation" || isPixel && Boolean(_optionalChain([active, 'optionalAccess', _259 => _259.type]) === "pixel" && _optionalChain([active, 'access', _260 => _260.filters, 'optionalAccess', _261 => _261.length])) },
|
|
12569
|
+
{ action: "toggle-clip", label: _optionalChain([active, 'optionalAccess', _262 => _262.clipped]) ? "Release Clipping Mask" : "Create Clipping Mask", enabled: Boolean(loc && loc.index > 0) }
|
|
12107
12570
|
];
|
|
12108
12571
|
}
|
|
12109
12572
|
async function runLayerMenuAction(controller, action) {
|
|
12110
12573
|
const active = controller.getActiveLayer();
|
|
12111
|
-
const id = _optionalChain([active, 'optionalAccess',
|
|
12574
|
+
const id = _optionalChain([active, 'optionalAccess', _263 => _263.id]);
|
|
12112
12575
|
try {
|
|
12113
12576
|
switch (action) {
|
|
12114
12577
|
case "new-layer":
|
|
@@ -12155,13 +12618,13 @@ async function runLayerMenuAction(controller, action) {
|
|
|
12155
12618
|
if (id) controller.removeLayerMask(id);
|
|
12156
12619
|
break;
|
|
12157
12620
|
case "toggle-mask":
|
|
12158
|
-
if (id && _optionalChain([active, 'optionalAccess',
|
|
12621
|
+
if (id && _optionalChain([active, 'optionalAccess', _264 => _264.mask])) controller.setLayerMaskProps(id, { enabled: active.mask.enabled === false });
|
|
12159
12622
|
break;
|
|
12160
12623
|
case "rasterize":
|
|
12161
12624
|
if (id) await controller.rasterizeLayer(id);
|
|
12162
12625
|
break;
|
|
12163
12626
|
case "toggle-clip":
|
|
12164
|
-
if (id) controller.setLayerProperties(id, { clipped: !_optionalChain([active, 'optionalAccess',
|
|
12627
|
+
if (id) controller.setLayerProperties(id, { clipped: !_optionalChain([active, 'optionalAccess', _265 => _265.clipped]) });
|
|
12165
12628
|
break;
|
|
12166
12629
|
}
|
|
12167
12630
|
return null;
|
|
@@ -12221,7 +12684,7 @@ function handlePaintShortcut(controller, e) {
|
|
|
12221
12684
|
}
|
|
12222
12685
|
if (key === "]" || key === "}") {
|
|
12223
12686
|
if (e.shiftKey || key === "}") set({ hardness: Math.min(1, Math.round((brush.hardness + 0.25) * 4) / 4) });
|
|
12224
|
-
else set({ size: Math.min(
|
|
12687
|
+
else set({ size: Math.min(_chunk4F3YDIWWcjs.MAX_BRUSH_SIZE, brush.size + sizeStep(brush.size)) });
|
|
12225
12688
|
return true;
|
|
12226
12689
|
}
|
|
12227
12690
|
if (/^[0-9]$/.test(key) && isPaintTool(controller.getState().activeTool)) {
|
|
@@ -12254,7 +12717,7 @@ var PaintGesture = (_class9 = class {
|
|
|
12254
12717
|
const layer = this.controller.getActiveLayer();
|
|
12255
12718
|
if (!layer) throw new Error("Select a layer to move in the Layers panel.");
|
|
12256
12719
|
if (layer.type !== "pixel") throw new Error(`Only pixel layers move; "${layer.name}" is a ${layer.type} layer.`);
|
|
12257
|
-
if (_optionalChain([layer, 'access',
|
|
12720
|
+
if (_optionalChain([layer, 'access', _266 => _266.locks, 'optionalAccess', _267 => _267.all]) || _optionalChain([layer, 'access', _268 => _268.locks, 'optionalAccess', _269 => _269.position])) throw new Error(`Layer "${layer.name}" has its position locked.`);
|
|
12258
12721
|
this.move = { id: layer.id, start: { x: sample.x, y: sample.y }, origin: { ...layer.offset }, moved: false };
|
|
12259
12722
|
return null;
|
|
12260
12723
|
}
|
|
@@ -12303,7 +12766,7 @@ var PaintGesture = (_class9 = class {
|
|
|
12303
12766
|
this.move = null;
|
|
12304
12767
|
}
|
|
12305
12768
|
cancel() {
|
|
12306
|
-
_optionalChain([this, 'access',
|
|
12769
|
+
_optionalChain([this, 'access', _270 => _270.stroke, 'optionalAccess', _271 => _271.cancel, 'call', _272 => _272()]);
|
|
12307
12770
|
this.stroke = null;
|
|
12308
12771
|
this.move = null;
|
|
12309
12772
|
}
|
|
@@ -12737,5 +13200,27 @@ async function downloadPsd(controller, name = "image") {
|
|
|
12737
13200
|
|
|
12738
13201
|
|
|
12739
13202
|
|
|
12740
|
-
exports.ADJUSTMENT_KEYS = ADJUSTMENT_KEYS; exports.ADJUSTMENT_KINDS = ADJUSTMENT_KINDS; exports.ADJUSTMENT_LAYER_CONTROLS = ADJUSTMENT_LAYER_CONTROLS; exports.ADJUSTMENT_LAYER_OPACITY_CONTROL = ADJUSTMENT_LAYER_OPACITY_CONTROL; exports.ADJUSTMENT_LUT_SIZE = ADJUSTMENT_LUT_SIZE; exports.AS_SHOT_KELVIN = AS_SHOT_KELVIN; exports.BACKGROUND_LAYER_ID = BACKGROUND_LAYER_ID; exports.BACKGROUND_LAYER_NAME = BACKGROUND_LAYER_NAME; exports.BLEND_MODES = _chunkZOOEX3WTcjs.BLEND_MODES; exports.BLUR_FILTER_ID = BLUR_FILTER_ID; exports.BRUSH_OPTION_CONTROLS = BRUSH_OPTION_CONTROLS; exports.CoverageMap = _chunkPDCITYBTcjs.CoverageMap; exports.D50 = D50; exports.D65 = D65; exports.DEFAULT_ADJUSTMENTS = DEFAULT_ADJUSTMENTS; exports.DEFAULT_BRUSH = _chunkPDCITYBTcjs.DEFAULT_BRUSH; exports.DEFAULT_DEPTH_MASK = DEFAULT_DEPTH_MASK; exports.DEFAULT_REFINE_EDGE_PARAMS = DEFAULT_REFINE_EDGE_PARAMS; exports.DEFAULT_SELECTION_TOOL_OPTIONS = DEFAULT_SELECTION_TOOL_OPTIONS; exports.DEFAULT_TRANSFORM = DEFAULT_TRANSFORM; exports.DEVELOP_FILTER_ID = DEVELOP_FILTER_ID; exports.DIRECT_GAUSSIAN_MAX_SIGMA = _chunkH543GD6Tcjs.DIRECT_GAUSSIAN_MAX_SIGMA; exports.DabWalker = _chunkPDCITYBTcjs.DabWalker; exports.EMPTY_DISTANCE = EMPTY_DISTANCE; exports.GUIDED_FILTER_EPS = GUIDED_FILTER_EPS; exports.HISTOGRAM_BINS = HISTOGRAM_BINS; exports.HUE_RANGE_LABELS = HUE_RANGE_LABELS; exports.IDENTITY_MATRIX3 = IDENTITY_MATRIX3; exports.IMAGE_ADJUSTMENT_CONTROLS = IMAGE_ADJUSTMENT_CONTROLS; exports.IMAGE_EDITOR_SCHEMA_VERSION = IMAGE_EDITOR_SCHEMA_VERSION; exports.IMAGE_EDITOR_STATE_VERSION = IMAGE_EDITOR_STATE_VERSION; exports.ImageEditorController = ImageEditorController; exports.ImageEditorRenderer = ImageEditorRenderer; exports.LATEST_PROCESS_VERSION = LATEST_PROCESS_VERSION; exports.LAYERED_SCHEMA_VERSION = LAYERED_SCHEMA_VERSION; exports.LEGACY_PROCESS_VERSION = LEGACY_PROCESS_VERSION; exports.LUMA_709 = LUMA_709; exports.LayerCompositor = LayerCompositor; exports.LayerOperationError = LayerOperationError; exports.MAX_BRUSH_SIZE = _chunkPDCITYBTcjs.MAX_BRUSH_SIZE; exports.MAX_KELVIN = MAX_KELVIN; exports.MIN_KELVIN = MIN_KELVIN; exports.MIRED_PER_TEMPERATURE_UNIT = MIRED_PER_TEMPERATURE_UNIT; exports.PAINT_TOOLS = PAINT_TOOLS; exports.PSD_BLEND_KEYS = PSD_BLEND_KEYS; exports.PSD_FILE_ACCEPT = PSD_FILE_ACCEPT; exports.PaintGesture = PaintGesture; exports.PaintStrokeSession = PaintStrokeSession; exports.PsdError = PsdError; exports.REFINE_EDGE_CONTROLS = REFINE_EDGE_CONTROLS; exports.SELECTION_MODES = SELECTION_MODES; exports.SELECTION_MODE_LABELS = SELECTION_MODE_LABELS; exports.SELECTION_MODIFY_OPS = SELECTION_MODIFY_OPS; exports.SELECTION_TOOLS = SELECTION_TOOLS; exports.SUPPORTED_ADJUSTMENT_KEYS = SUPPORTED_ADJUSTMENT_KEYS; exports.SelectionGesture = SelectionGesture; exports.StrokeCoverage = _chunkPDCITYBTcjs.StrokeCoverage; exports.SurfaceDraft = _chunkZOOEX3WTcjs.SurfaceDraft; exports.TILE = _chunkZOOEX3WTcjs.TILE; exports.TILE_SHIFT = _chunkZOOEX3WTcjs.TILE_SHIFT; exports.TINT_SCALE = TINT_SCALE; exports.TONE_LUT_SIZE = TONE_LUT_SIZE; exports.TONE_RANGE_PRESETS = TONE_RANGE_PRESETS; exports.TiledSurface = _chunkZOOEX3WTcjs.TiledSurface; exports.VIBRANCE_GREY = VIBRANCE_GREY; exports.XYZ_D50_TO_SRGB = XYZ_D50_TO_SRGB; exports.ZlibError = _chunkH543GD6Tcjs.ZlibError; exports.activeAdjustmentLayers = activeAdjustmentLayers; exports.addLayerFilter = addLayerFilter; exports.addToHistogram = addToHistogram; exports.adjustmentKindLabel = adjustmentKindLabel; exports.adjustmentLayersKey = adjustmentLayersKey; exports.adjustmentNodeAsLayer = adjustmentNodeAsLayer; exports.adjustmentNodeFromLegacy = adjustmentNodeFromLegacy; exports.adler32 = _chunkH543GD6Tcjs.adler32; exports.annotationLayerFor = annotationLayerFor; exports.annotationLayerName = annotationLayerName; exports.applyAdjustmentLayers = applyAdjustmentLayers; exports.applyAdjustments = applyAdjustments; exports.applyBoxBlur = applyBoxBlur; exports.applyDepthMask = applyDepthMask; exports.applyImageProjectionToContext = applyImageProjectionToContext; exports.applyLegacyAdjustments = applyLegacyAdjustments; exports.applyMatrix3 = applyMatrix3; exports.applyOutputStage = applyOutputStage; exports.applyProcess2Adjustments = applyProcess2Adjustments; exports.applyRegionBlur = applyRegionBlur; exports.applyRegionMosaic = applyRegionMosaic; exports.applyStrokeToTile = _chunkPDCITYBTcjs.applyStrokeToTile; exports.backgroundLayer = backgroundLayer; exports.base64ToBytes = _chunkH543GD6Tcjs.base64ToBytes; exports.baseProjection = baseProjection; exports.blackWhiteGray = blackWhiteGray; exports.blendChannel = _chunkZOOEX3WTcjs.blendChannel; exports.blendImageData = _chunkZOOEX3WTcjs.blendImageData; exports.blendLum = _chunkZOOEX3WTcjs.blendLum; exports.blendPixel = _chunkZOOEX3WTcjs.blendPixel; exports.blendRgb = _chunkZOOEX3WTcjs.blendRgb; exports.blendTile = _chunkH543GD6Tcjs.blendTile; exports.blurFilter = blurFilter; exports.borderCoverage = borderCoverage; exports.boxMean = boxMean; exports.boxToCurvePoint = boxToCurvePoint; exports.bradfordAdaptation = bradfordAdaptation; exports.buildLayerMaskPlanes = buildLayerMaskPlanes; exports.buildToneLut = buildToneLut; exports.bytesToBase64 = _chunkH543GD6Tcjs.bytesToBase64; exports.calculateCropDrag = calculateCropDrag; exports.canvasCompositeOperation = _chunkZOOEX3WTcjs.canvasCompositeOperation; exports.canvasToImagePoint = canvasToImagePoint; exports.changedTiles = _chunkH543GD6Tcjs.changedTiles; exports.clampControlValue = clampControlValue; exports.clampCropToImage = clampCropToImage; exports.collectTiles = _chunkZOOEX3WTcjs.collectTiles; exports.colorBalanceChannel = colorBalanceChannel; exports.colorRange = colorRange; exports.combineSelections = combineSelections; exports.compileAdjustmentLayer = compileAdjustmentLayer; exports.computeHistogram = computeHistogram; exports.computeSelectionBounds = computeSelectionBounds; exports.contentBounds = _chunkZOOEX3WTcjs.contentBounds; exports.contractCoverage = contractCoverage; exports.controlPosition = controlPosition; exports.controlTrackBackground = controlTrackBackground; exports.coverageTileCoord = _chunkPDCITYBTcjs.coverageTileCoord; exports.coverageToByte = coverageToByte; exports.coveringRect = coveringRect; exports.createAdjustmentLayer = createAdjustmentLayer; exports.createImageCaptureSurface = createImageCaptureSurface; exports.createImageEditTools = createImageEditTools; exports.createImageEditorToolProvider = createImageEditorToolProvider; exports.createImageLayerTools = createImageLayerTools; exports.createImagePaintTools = createImagePaintTools; exports.createImagePsdTools = createImagePsdTools; exports.createImageSelectionTools = createImageSelectionTools; exports.createSelectionMask = createSelectionMask; exports.curveLut = curveLut; exports.curveLutFromLevels = curveLutFromLevels; exports.curvePointToBox = curvePointToBox; exports.curveSvgPath = curveSvgPath; exports.dabCoverage = _chunkPDCITYBTcjs.dabCoverage; exports.dabRect = _chunkPDCITYBTcjs.dabRect; exports.decodeLayerChannel = decodeLayerChannel; exports.decodeLayerMask = decodeLayerMask; exports.decodeMergedImage = decodeMergedImage; exports.decodePlanes = decodePlanes; exports.decodePng = _chunkH543GD6Tcjs.decodePng; exports.decodePngDataUrl = decodePngDataUrl; exports.decodeSelectionRle = decodeSelectionRle; exports.defaultAdjustmentParams = defaultAdjustmentParams; exports.deflate = _chunkH543GD6Tcjs.deflate; exports.deflateRaw = _chunkH543GD6Tcjs.deflateRaw; exports.depthMaskAlpha = depthMaskAlpha; exports.depthRasterMask = depthRasterMask; exports.describeLayer = describeLayer; exports.describeSelection = describeSelection; exports.deserializeLayer = deserializeLayer; exports.deserializeLayers = deserializeLayers; exports.deserializeSelection = deserializeSelection; exports.developFilter = developFilter; exports.developFromAdjustments = developFromAdjustments; exports.developTarget = developTarget; exports.distanceTransform = distanceTransform; exports.downloadPsd = downloadPsd; exports.dropPlacement = dropPlacement; exports.dropZone = dropZone; exports.duplicateLayer = duplicateLayer; exports.edgeWidth = edgeWidth; exports.ellipsePoints = ellipsePoints; exports.ellipseSelection = ellipseSelection; exports.emptyHistogram = emptyHistogram; exports.emptySurface = _chunkZOOEX3WTcjs.emptySurface; exports.encodePng = _chunkH543GD6Tcjs.encodePng; exports.encodeRle = encodeRle; exports.encodeSelectionRle = encodeSelectionRle; exports.encodeSurface = encodeSurface; exports.evaluateAdjustmentLayers = evaluateAdjustmentLayers; exports.expandCoverage = expandCoverage; exports.exportPsd = exportPsd; exports.featherCoverage = featherCoverage; exports.fillRect = _chunkZOOEX3WTcjs.fillRect; exports.findAdjustmentControl = findAdjustmentControl; exports.findLayer = _chunkH543GD6Tcjs.findLayer; exports.findLayerControl = findLayerControl; exports.finishTile = _chunkZOOEX3WTcjs.finishTile; exports.flattenLayers = _chunkH543GD6Tcjs.flattenLayers; exports.formatControlValue = formatControlValue; exports.fullSelection = fullSelection; exports.gaussianBlur = _chunkH543GD6Tcjs.gaussianBlur; exports.getAnnotationBounds = getAnnotationBounds; exports.getControlPath = getControlPath; exports.getCropCursor = getCropCursor; exports.getRotatedSize = getRotatedSize; exports.getViewportMetrics = getViewportMetrics; exports.getViewportProjection = getViewportProjection; exports.globalImageCache = globalImageCache; exports.greyMorphology = greyMorphology; exports.groupLayers = groupLayers; exports.guidePlanes = guidePlanes; exports.guidedFilterColor = guidedFilterColor; exports.handlePaintShortcut = handlePaintShortcut; exports.hasResampledLegacyMask = hasResampledLegacyMask; exports.hashMaskContent = hashMaskContent; exports.hexToRgb = hexToRgb; exports.histogramPath = histogramPath; exports.hitTestAnnotation = hitTestAnnotation; exports.hitTestCrop = hitTestCrop; exports.hitTestCurvePoint = hitTestCurvePoint; exports.hslToRgb = hslToRgb; exports.hueRange = hueRange; exports.hueRangeTables = hueRangeTables; exports.hueRangeWeight = hueRangeWeight; exports.hueSaturation = hueSaturation; exports.identityCurve = identityCurve; exports.identityLevels = identityLevels; exports.imageEditorStateMigrations = imageEditorStateMigrations; exports.imageToCanvasPoint = imageToCanvasPoint; exports.importPsd = importPsd; exports.inflate = _chunkH543GD6Tcjs.inflate; exports.inflateRaw = _chunkH543GD6Tcjs.inflateRaw; exports.insertCurvePoint = insertCurvePoint; exports.insertLayer = _chunkH543GD6Tcjs.insertLayer; exports.invertMatrix3 = invertMatrix3; exports.invertSelection = invertSelection; exports.isActiveFilter = isActiveFilter; exports.isAdjustmentKind = isAdjustmentKind; exports.isBlendMode = _chunkZOOEX3WTcjs.isBlendMode; exports.isDefaultDepthMask = isDefaultDepthMask; exports.isLayerLocked = _chunkH543GD6Tcjs.isLayerLocked; exports.isLegacyShape = isLegacyShape; exports.isPaintTool = isPaintTool; exports.isPng = _chunkH543GD6Tcjs.isPng; exports.isQuarterTurn = isQuarterTurn; exports.isQuarterTurnSwapped = isQuarterTurnSwapped; exports.isSelectionEmpty = isSelectionEmpty; exports.isSelectionMode = isSelectionMode; exports.isSeparableBlendMode = _chunkZOOEX3WTcjs.isSeparableBlendMode; exports.isSpatialFilter = isSpatialFilter; exports.kelvinToTemperature = kelvinToTemperature; exports.layerBadge = layerBadge; exports.layerLabel = layerLabel; exports.layerMaskCoverage = layerMaskCoverage; exports.layerMaskFromSelection = layerMaskFromSelection; exports.layerMaskKey = layerMaskKey; exports.layerMenu = layerMenu; exports.layerName = layerName; exports.layerPanelRows = layerPanelRows; exports.layerTree = layerTree; exports.layerTypeLabel = layerTypeLabel; exports.layersFromLegacy = layersFromLegacy; exports.legacyAdjustmentLayer = legacyAdjustmentLayer; exports.legacyMaskOf = legacyMaskOf; exports.legacyView = legacyView; exports.levelsValue = levelsValue; exports.linearSrgbToXy = linearSrgbToXy; exports.linearToSrgb = linearToSrgb; exports.loadImageEditorDocument = loadImageEditorDocument; exports.magicWand = magicWand; exports.mapCropHandle = mapCropHandle; exports.mapLayer = _chunkH543GD6Tcjs.mapLayer; exports.maskSummary = maskSummary; exports.migrateSerializedImageEditorState = migrateSerializedImageEditorState; exports.migrateToLayeredState = migrateToLayeredState; exports.modifySelection = modifySelection; exports.moveCurvePoint = moveCurvePoint; exports.moveLayer = moveLayer; exports.mulMatrix3 = mulMatrix3; exports.needsLegacyBase = needsLegacyBase; exports.neutralHueRange = neutralHueRange; exports.newLayerId = newLayerId; exports.normalizeAdjustmentLayer = normalizeAdjustmentLayer; exports.normalizeAdjustmentLayers = normalizeAdjustmentLayers; exports.normalizeAngle = normalizeAngle; exports.normalizeBlendMode = _chunkZOOEX3WTcjs.normalizeBlendMode; exports.normalizeBrush = _chunkPDCITYBTcjs.normalizeBrush; exports.normalizeFilter = normalizeFilter; exports.normalizeLayerMask = normalizeLayerMask; exports.normalizeProcessVersion = normalizeProcessVersion; exports.normalizeRect = normalizeRect; exports.normalizeRefineEdgeParams = normalizeRefineEdgeParams; exports.normalizeStoredAdjustments = normalizeStoredAdjustments; exports.offsetLayer = offsetLayer; exports.openPsdFile = openPsdFile; exports.packRgba = _chunkZOOEX3WTcjs.packRgba; exports.parseAdjustmentBlock = parseAdjustmentBlock; exports.parseBlend = parseBlend; exports.parseColor = parseColor; exports.parseDataUrl = _chunkH543GD6Tcjs.parseDataUrl; exports.parseSelectionMode = parseSelectionMode; exports.parseVersionedDescriptor = parseVersionedDescriptor; exports.photoFilterMatrix = photoFilterMatrix; exports.pixelLayerBounds = pixelLayerBounds; exports.pixelLayers = pixelLayers; exports.placeLayer = placeLayer; exports.pngDataUrl = _chunkH543GD6Tcjs.pngDataUrl; exports.pointerPressure = pointerPressure; exports.polygonCoverage = polygonCoverage; exports.polygonSelection = polygonSelection; exports.posterizeValue = posterizeValue; exports.projectImagePoint = projectImagePoint; exports.projectImageRect = projectImageRect; exports.projectMaskCoverage = projectMaskCoverage; exports.projectQuarterTurn = projectQuarterTurn; exports.psdBytesFromBase64 = psdBytesFromBase64; exports.psdFileName = psdFileName; exports.psdToLayers = psdToLayers; exports.quickMaskPixels = quickMaskPixels; exports.rangeLightness = rangeLightness; exports.rasterMaskFromLegacy = rasterMaskFromLegacy; exports.rasterizeDab = _chunkPDCITYBTcjs.rasterizeDab; exports.readAdjustmentControls = readAdjustmentControls; exports.readPixel = _chunkZOOEX3WTcjs.readPixel; exports.readPsd = readPsd; exports.readRegion = _chunkZOOEX3WTcjs.readRegion; exports.rectSelection = rectSelection; exports.refineCoverage = refineCoverage; exports.refineEdgeHalo = refineEdgeHalo; exports.refineSelection = refineSelection; exports.removeAlpha = removeAlpha; exports.removeCurvePoint = removeCurvePoint; exports.removeLayer = removeLayer; exports.removeLayerFilter = removeLayerFilter; exports.renderLayeredBase = renderLayeredBase; exports.requireLayer = requireLayer; exports.requireUnlocked = requireUnlocked; exports.resizePixels = resizePixels; exports.resizeSelection = resizeSelection; exports.resolveExternalAssets = resolveExternalAssets; exports.resolveMosaicRegionBounds = resolveMosaicRegionBounds; exports.rgbToGray = rgbToGray; exports.rgbToHsl = rgbToHsl; exports.runLayerMenuAction = runLayerMenuAction; exports.sampleLut = sampleLut; exports.sampleToneLut = sampleToneLut; exports.selectionArea = selectionArea; exports.selectionFromCoverage = selectionFromCoverage; exports.selectionFromPixels = selectionFromPixels; exports.selectionModeFromModifiers = selectionModeFromModifiers; exports.selectionOutline = selectionOutline; exports.selectionToCoverage = selectionToCoverage; exports.selectionToPixels = selectionToPixels; exports.selectionValueAt = selectionValueAt; exports.serializeLayer = serializeLayer; exports.serializeLayers = serializeLayers; exports.serializeLayersExternal = serializeLayersExternal; exports.serializeSelection = serializeSelection; exports.setControlPath = setControlPath; exports.setLayerMask = setLayerMask; exports.setLayerProperties = setLayerProperties; exports.setLum = _chunkZOOEX3WTcjs.setLum; exports.shiftCoverage = shiftCoverage; exports.smoothCoverage = smoothCoverage; exports.smoothPoints = _chunkPDCITYBTcjs.smoothPoints; exports.solidSurface = _chunkZOOEX3WTcjs.solidSurface; exports.splitOverlayAnnotations = splitOverlayAnnotations; exports.srgb8ToLab = srgb8ToLab; exports.srgbToLinear = srgbToLinear; exports.sumHistograms = sumHistograms; exports.surfaceBytes = _chunkZOOEX3WTcjs.surfaceBytes; exports.surfaceFromPixels = _chunkZOOEX3WTcjs.surfaceFromPixels; exports.surfacesEqual = _chunkZOOEX3WTcjs.surfacesEqual; exports.tempTintToXy = tempTintToXy; exports.temperatureToKelvin = temperatureToKelvin; exports.tileCoord = _chunkZOOEX3WTcjs.tileCoord; exports.tileKey = _chunkZOOEX3WTcjs.tileKey; exports.tileRect = _chunkZOOEX3WTcjs.tileRect; exports.tilesInRect = _chunkZOOEX3WTcjs.tilesInRect; exports.tipFalloff = _chunkPDCITYBTcjs.tipFalloff; exports.tipReach = _chunkPDCITYBTcjs.tipReach; exports.tipShape = _chunkPDCITYBTcjs.tipShape; exports.toHex = toHex2; exports.toneCurve = toneCurve; exports.toneLuts = toneLuts; exports.toneRange = toneRange; exports.translateSurface = _chunkZOOEX3WTcjs.translateSurface; exports.ungroupLayer = ungroupLayer; exports.uniformTile = _chunkZOOEX3WTcjs.uniformTile; exports.unionRect = unionRect; exports.unprojectCanvasPoint = unprojectCanvasPoint; exports.updateLayerFilter = updateLayerFilter; exports.updateLayerMaskProps = updateLayerMaskProps; exports.uvToXy = uvToXy; exports.versionedDescriptorBytes = versionedDescriptorBytes; exports.vibranceLinear = vibranceLinear; exports.vibrancePixel = vibrancePixel; exports.walkDabs = _chunkPDCITYBTcjs.walkDabs; exports.wbMatrix = wbMatrix; exports.whiteBalanceFromSample = whiteBalanceFromSample; exports.whiteBalanceMatrix = whiteBalanceMatrix; exports.withNewIds = withNewIds; exports.writeAdjustmentBlock = writeAdjustmentBlock; exports.writePsd = writePsd; exports.writeRegion = _chunkZOOEX3WTcjs.writeRegion; exports.xyToTempTint = xyToTempTint; exports.xyToUv = xyToUv;
|
|
13203
|
+
|
|
13204
|
+
|
|
13205
|
+
|
|
13206
|
+
|
|
13207
|
+
|
|
13208
|
+
|
|
13209
|
+
|
|
13210
|
+
|
|
13211
|
+
|
|
13212
|
+
|
|
13213
|
+
|
|
13214
|
+
|
|
13215
|
+
|
|
13216
|
+
|
|
13217
|
+
|
|
13218
|
+
|
|
13219
|
+
|
|
13220
|
+
|
|
13221
|
+
|
|
13222
|
+
|
|
13223
|
+
|
|
13224
|
+
|
|
13225
|
+
exports.ADJUSTMENT_KEYS = ADJUSTMENT_KEYS; exports.ADJUSTMENT_KINDS = ADJUSTMENT_KINDS; exports.ADJUSTMENT_LAYER_CONTROLS = ADJUSTMENT_LAYER_CONTROLS; exports.ADJUSTMENT_LAYER_OPACITY_CONTROL = ADJUSTMENT_LAYER_OPACITY_CONTROL; exports.ADJUSTMENT_LUT_SIZE = ADJUSTMENT_LUT_SIZE; exports.AS_SHOT_KELVIN = AS_SHOT_KELVIN; exports.BACKGROUND_LAYER_ID = BACKGROUND_LAYER_ID; exports.BACKGROUND_LAYER_NAME = BACKGROUND_LAYER_NAME; exports.BLEND_MODES = _chunkZOOEX3WTcjs.BLEND_MODES; exports.BLUR_FILTER_ID = BLUR_FILTER_ID; exports.BRUSH_OPTION_CONTROLS = BRUSH_OPTION_CONTROLS; exports.CoverageMap = _chunk4F3YDIWWcjs.CoverageMap; exports.D50 = D50; exports.D65 = D65; exports.DEFAULT_ADJUSTMENTS = DEFAULT_ADJUSTMENTS; exports.DEFAULT_BRUSH = _chunk4F3YDIWWcjs.DEFAULT_BRUSH; exports.DEFAULT_DEPTH_MASK = DEFAULT_DEPTH_MASK; exports.DEFAULT_REFINE_EDGE_PARAMS = DEFAULT_REFINE_EDGE_PARAMS; exports.DEFAULT_SELECTION_TOOL_OPTIONS = DEFAULT_SELECTION_TOOL_OPTIONS; exports.DEFAULT_TRANSFORM = DEFAULT_TRANSFORM; exports.DEVELOP_FILTER_ID = DEVELOP_FILTER_ID; exports.DIRECT_GAUSSIAN_MAX_SIGMA = _chunk73L6TROJcjs.DIRECT_GAUSSIAN_MAX_SIGMA; exports.DabWalker = _chunk4F3YDIWWcjs.DabWalker; exports.EMPTY_DISTANCE = EMPTY_DISTANCE; exports.GUIDED_FILTER_EPS = GUIDED_FILTER_EPS; exports.HISTOGRAM_BINS = HISTOGRAM_BINS; exports.HUE_RANGE_LABELS = HUE_RANGE_LABELS; exports.IDENTITY_MATRIX3 = IDENTITY_MATRIX3; exports.IMAGE_ADJUSTMENT_CONTROLS = IMAGE_ADJUSTMENT_CONTROLS; exports.IMAGE_EDITOR_SCHEMA_VERSION = IMAGE_EDITOR_SCHEMA_VERSION; exports.IMAGE_EDITOR_STATE_VERSION = IMAGE_EDITOR_STATE_VERSION; exports.ImageEditorController = ImageEditorController; exports.ImageEditorRenderer = ImageEditorRenderer; exports.LATEST_PROCESS_VERSION = LATEST_PROCESS_VERSION; exports.LAYERED_SCHEMA_VERSION = LAYERED_SCHEMA_VERSION; exports.LEGACY_PROCESS_VERSION = LEGACY_PROCESS_VERSION; exports.LUMA_709 = LUMA_709; exports.LayerCompositor = LayerCompositor; exports.LayerOperationError = LayerOperationError; exports.MAX_BRUSH_SIZE = _chunk4F3YDIWWcjs.MAX_BRUSH_SIZE; exports.MAX_KELVIN = MAX_KELVIN; exports.MIN_KELVIN = MIN_KELVIN; exports.MIRED_PER_TEMPERATURE_UNIT = MIRED_PER_TEMPERATURE_UNIT; exports.PAINT_TOOLS = PAINT_TOOLS; exports.PIGMENT_BANDS = _chunk4F3YDIWWcjs.PIGMENT_BANDS; exports.PIGMENT_LAMBDA_MIN = _chunk4F3YDIWWcjs.PIGMENT_LAMBDA_MIN; exports.PIGMENT_LAMBDA_STEP = _chunk4F3YDIWWcjs.PIGMENT_LAMBDA_STEP; exports.PIGMENT_WAVELENGTHS = _chunk4F3YDIWWcjs.PIGMENT_WAVELENGTHS; exports.PSD_BLEND_KEYS = PSD_BLEND_KEYS; exports.PSD_FILE_ACCEPT = PSD_FILE_ACCEPT; exports.PaintGesture = PaintGesture; exports.PaintStrokeSession = PaintStrokeSession; exports.PsdError = PsdError; exports.REFINE_EDGE_CONTROLS = REFINE_EDGE_CONTROLS; exports.SELECTION_MODES = SELECTION_MODES; exports.SELECTION_MODE_LABELS = SELECTION_MODE_LABELS; exports.SELECTION_MODIFY_OPS = SELECTION_MODIFY_OPS; exports.SELECTION_TOOLS = SELECTION_TOOLS; exports.SUPPORTED_ADJUSTMENT_KEYS = SUPPORTED_ADJUSTMENT_KEYS; exports.SelectionGesture = SelectionGesture; exports.StrokeCoverage = _chunk4F3YDIWWcjs.StrokeCoverage; exports.SurfaceDraft = _chunkZOOEX3WTcjs.SurfaceDraft; exports.TILE = _chunkZOOEX3WTcjs.TILE; exports.TILE_SHIFT = _chunkZOOEX3WTcjs.TILE_SHIFT; exports.TINT_SCALE = TINT_SCALE; exports.TONE_LUT_SIZE = TONE_LUT_SIZE; exports.TONE_RANGE_PRESETS = TONE_RANGE_PRESETS; exports.TiledSurface = _chunkZOOEX3WTcjs.TiledSurface; exports.VIBRANCE_GREY = VIBRANCE_GREY; exports.XYZ_D50_TO_SRGB = XYZ_D50_TO_SRGB; exports.ZlibError = _chunk73L6TROJcjs.ZlibError; exports.activeAdjustmentLayers = activeAdjustmentLayers; exports.addLayerEffect = addLayerEffect; exports.addLayerFilter = addLayerFilter; exports.addToHistogram = addToHistogram; exports.adjustmentKindLabel = adjustmentKindLabel; exports.adjustmentLayersKey = adjustmentLayersKey; exports.adjustmentNodeAsLayer = adjustmentNodeAsLayer; exports.adjustmentNodeFromLegacy = adjustmentNodeFromLegacy; exports.adler32 = _chunk73L6TROJcjs.adler32; exports.annotationLayerFor = annotationLayerFor; exports.annotationLayerName = annotationLayerName; exports.applyAdjustmentLayers = applyAdjustmentLayers; exports.applyAdjustments = applyAdjustments; exports.applyBoxBlur = applyBoxBlur; exports.applyDepthMask = applyDepthMask; exports.applyImageProjectionToContext = applyImageProjectionToContext; exports.applyLegacyAdjustments = applyLegacyAdjustments; exports.applyMatrix3 = applyMatrix3; exports.applyOutputStage = applyOutputStage; exports.applyProcess2Adjustments = applyProcess2Adjustments; exports.applyRegionBlur = applyRegionBlur; exports.applyRegionMosaic = applyRegionMosaic; exports.applyStrokeToTile = _chunk4F3YDIWWcjs.applyStrokeToTile; exports.backgroundLayer = backgroundLayer; exports.base64ToBytes = _chunk73L6TROJcjs.base64ToBytes; exports.baseProjection = baseProjection; exports.blackWhiteGray = blackWhiteGray; exports.blendChannel = _chunkZOOEX3WTcjs.blendChannel; exports.blendImageData = _chunkZOOEX3WTcjs.blendImageData; exports.blendLum = _chunkZOOEX3WTcjs.blendLum; exports.blendPixel = _chunkZOOEX3WTcjs.blendPixel; exports.blendRgb = _chunkZOOEX3WTcjs.blendRgb; exports.blendTile = _chunk73L6TROJcjs.blendTile; exports.blurFilter = blurFilter; exports.borderCoverage = borderCoverage; exports.boxMean = boxMean; exports.boxToCurvePoint = boxToCurvePoint; exports.bradfordAdaptation = bradfordAdaptation; exports.buildLayerMaskPlanes = buildLayerMaskPlanes; exports.buildToneLut = buildToneLut; exports.bytesToBase64 = _chunk73L6TROJcjs.bytesToBase64; exports.calculateCropDrag = calculateCropDrag; exports.canvasCompositeOperation = _chunkZOOEX3WTcjs.canvasCompositeOperation; exports.canvasToImagePoint = canvasToImagePoint; exports.changedTiles = _chunk73L6TROJcjs.changedTiles; exports.clampControlValue = clampControlValue; exports.clampCropToImage = clampCropToImage; exports.collectTiles = _chunkZOOEX3WTcjs.collectTiles; exports.colorBalanceChannel = colorBalanceChannel; exports.colorRange = colorRange; exports.combineSelections = combineSelections; exports.compileAdjustmentLayer = compileAdjustmentLayer; exports.computeHistogram = computeHistogram; exports.computeSelectionBounds = computeSelectionBounds; exports.contentBounds = _chunkZOOEX3WTcjs.contentBounds; exports.contractCoverage = contractCoverage; exports.controlPosition = controlPosition; exports.controlTrackBackground = controlTrackBackground; exports.coverageTileCoord = _chunk4F3YDIWWcjs.coverageTileCoord; exports.coverageToByte = coverageToByte; exports.coveringRect = coveringRect; exports.createAdjustmentLayer = createAdjustmentLayer; exports.createImageCaptureSurface = createImageCaptureSurface; exports.createImageEditTools = createImageEditTools; exports.createImageEditorToolProvider = createImageEditorToolProvider; exports.createImageEffectTools = createImageEffectTools; exports.createImageLayerTools = createImageLayerTools; exports.createImagePaintTools = createImagePaintTools; exports.createImagePsdTools = createImagePsdTools; exports.createImageSelectionTools = createImageSelectionTools; exports.createPigment = _chunk4F3YDIWWcjs.createPigment; exports.createPigmentTools = _chunk4F3YDIWWcjs.createPigmentTools; exports.createSelectionMask = createSelectionMask; exports.curveLut = _chunk73L6TROJcjs.curveLut; exports.curveLutFromLevels = curveLutFromLevels; exports.curvePointToBox = curvePointToBox; exports.curveSvgPath = curveSvgPath; exports.dabCoverage = _chunk4F3YDIWWcjs.dabCoverage; exports.dabRect = _chunk4F3YDIWWcjs.dabRect; exports.decodeLayerChannel = decodeLayerChannel; exports.decodeLayerMask = decodeLayerMask; exports.decodeMergedImage = decodeMergedImage; exports.decodePlanes = decodePlanes; exports.decodePng = _chunk73L6TROJcjs.decodePng; exports.decodePngDataUrl = decodePngDataUrl; exports.decodeSelectionRle = decodeSelectionRle; exports.defaultAdjustmentParams = defaultAdjustmentParams; exports.deflate = _chunk73L6TROJcjs.deflate; exports.deflateRaw = _chunk73L6TROJcjs.deflateRaw; exports.depthMaskAlpha = depthMaskAlpha; exports.depthRasterMask = depthRasterMask; exports.describeLayer = describeLayer; exports.describeLayerEffects = describeLayerEffects; exports.describeSelection = describeSelection; exports.deserializeEffects = deserializeEffects; exports.deserializeLayer = deserializeLayer; exports.deserializeLayers = deserializeLayers; exports.deserializeSelection = deserializeSelection; exports.developFilter = developFilter; exports.developFromAdjustments = developFromAdjustments; exports.developTarget = developTarget; exports.distanceTransform = distanceTransform; exports.downloadPsd = downloadPsd; exports.dropPlacement = dropPlacement; exports.dropZone = dropZone; exports.duplicateLayer = duplicateLayer; exports.edgeWidth = edgeWidth; exports.ellipsePoints = ellipsePoints; exports.ellipseSelection = ellipseSelection; exports.emptyHistogram = emptyHistogram; exports.emptySurface = _chunkZOOEX3WTcjs.emptySurface; exports.encodePng = _chunk73L6TROJcjs.encodePng; exports.encodeRle = encodeRle; exports.encodeSelectionRle = encodeSelectionRle; exports.encodeSurface = encodeSurface; exports.evaluateAdjustmentLayers = evaluateAdjustmentLayers; exports.expandCoverage = expandCoverage; exports.exportPsd = exportPsd; exports.featherCoverage = featherCoverage; exports.fillRect = _chunkZOOEX3WTcjs.fillRect; exports.findAdjustmentControl = findAdjustmentControl; exports.findLayer = _chunk73L6TROJcjs.findLayer; exports.findLayerControl = findLayerControl; exports.finishTile = _chunkZOOEX3WTcjs.finishTile; exports.flattenLayers = _chunk73L6TROJcjs.flattenLayers; exports.formatControlValue = formatControlValue; exports.fullSelection = fullSelection; exports.gaussianBlur = _chunk73L6TROJcjs.gaussianBlur; exports.getAnnotationBounds = getAnnotationBounds; exports.getControlPath = getControlPath; exports.getCropCursor = getCropCursor; exports.getRotatedSize = getRotatedSize; exports.getViewportMetrics = getViewportMetrics; exports.getViewportProjection = getViewportProjection; exports.globalImageCache = globalImageCache; exports.greyMorphology = greyMorphology; exports.groupLayers = groupLayers; exports.guidePlanes = guidePlanes; exports.guidedFilterColor = guidedFilterColor; exports.handlePaintShortcut = handlePaintShortcut; exports.hasResampledLegacyMask = hasResampledLegacyMask; exports.hashMaskContent = hashMaskContent; exports.hexToRgb = hexToRgb; exports.histogramPath = histogramPath; exports.hitTestAnnotation = hitTestAnnotation; exports.hitTestCrop = hitTestCrop; exports.hitTestCurvePoint = hitTestCurvePoint; exports.hslToRgb = hslToRgb; exports.hueRange = hueRange; exports.hueRangeTables = hueRangeTables; exports.hueRangeWeight = hueRangeWeight; exports.hueSaturation = hueSaturation; exports.identityCurve = identityCurve; exports.identityLevels = identityLevels; exports.imageEditorStateMigrations = imageEditorStateMigrations; exports.imageToCanvasPoint = imageToCanvasPoint; exports.importPsd = importPsd; exports.inflate = _chunk73L6TROJcjs.inflate; exports.inflateRaw = _chunk73L6TROJcjs.inflateRaw; exports.insertCurvePoint = insertCurvePoint; exports.insertLayer = _chunk73L6TROJcjs.insertLayer; exports.invertMatrix3 = invertMatrix3; exports.invertSelection = invertSelection; exports.isActiveFilter = isActiveFilter; exports.isAdjustmentKind = isAdjustmentKind; exports.isBlendMode = _chunkZOOEX3WTcjs.isBlendMode; exports.isDefaultDepthMask = isDefaultDepthMask; exports.isLayerLocked = _chunk73L6TROJcjs.isLayerLocked; exports.isLegacyShape = isLegacyShape; exports.isPaintTool = isPaintTool; exports.isPng = _chunk73L6TROJcjs.isPng; exports.isQuarterTurn = isQuarterTurn; exports.isQuarterTurnSwapped = isQuarterTurnSwapped; exports.isSelectionEmpty = isSelectionEmpty; exports.isSelectionMode = isSelectionMode; exports.isSeparableBlendMode = _chunkZOOEX3WTcjs.isSeparableBlendMode; exports.isSpatialFilter = isSpatialFilter; exports.kelvinToTemperature = kelvinToTemperature; exports.layerBadge = layerBadge; exports.layerEffectsOf = layerEffectsOf; exports.layerLabel = layerLabel; exports.layerMaskCoverage = layerMaskCoverage; exports.layerMaskFromSelection = layerMaskFromSelection; exports.layerMaskKey = layerMaskKey; exports.layerMenu = layerMenu; exports.layerName = layerName; exports.layerPanelRows = layerPanelRows; exports.layerTree = layerTree; exports.layerTypeLabel = layerTypeLabel; exports.layersFromLegacy = layersFromLegacy; exports.legacyAdjustmentLayer = legacyAdjustmentLayer; exports.legacyMaskOf = legacyMaskOf; exports.legacyView = legacyView; exports.lerpPigment = _chunk4F3YDIWWcjs.lerpPigment; exports.lerpPigmentInto = _chunk4F3YDIWWcjs.lerpPigmentInto; exports.levelsValue = levelsValue; exports.linearSrgbToXy = linearSrgbToXy; exports.linearToSrgb = linearToSrgb; exports.loadImageEditorDocument = loadImageEditorDocument; exports.magicWand = magicWand; exports.mapCropHandle = mapCropHandle; exports.mapLayer = _chunk73L6TROJcjs.mapLayer; exports.maskSummary = maskSummary; exports.migrateSerializedImageEditorState = migrateSerializedImageEditorState; exports.migrateToLayeredState = migrateToLayeredState; exports.mixPigments = _chunk4F3YDIWWcjs.mixPigments; exports.modifySelection = modifySelection; exports.moveCurvePoint = moveCurvePoint; exports.moveLayer = moveLayer; exports.mulMatrix3 = mulMatrix3; exports.needsLegacyBase = needsLegacyBase; exports.neutralHueRange = neutralHueRange; exports.newLayerId = newLayerId; exports.normalizeAdjustmentLayer = normalizeAdjustmentLayer; exports.normalizeAdjustmentLayers = normalizeAdjustmentLayers; exports.normalizeAngle = normalizeAngle; exports.normalizeBlendMode = _chunkZOOEX3WTcjs.normalizeBlendMode; exports.normalizeBrush = _chunk4F3YDIWWcjs.normalizeBrush; exports.normalizeFilter = normalizeFilter; exports.normalizeLayerMask = normalizeLayerMask; exports.normalizeProcessVersion = normalizeProcessVersion; exports.normalizeRect = normalizeRect; exports.normalizeRefineEdgeParams = normalizeRefineEdgeParams; exports.normalizeStoredAdjustments = normalizeStoredAdjustments; exports.offsetLayer = offsetLayer; exports.openPsdFile = openPsdFile; exports.packRgba = _chunkZOOEX3WTcjs.packRgba; exports.parseAdjustmentBlock = parseAdjustmentBlock; exports.parseBlend = parseBlend; exports.parseColor = parseColor; exports.parseDataUrl = _chunk73L6TROJcjs.parseDataUrl; exports.parseSelectionMode = parseSelectionMode; exports.parseVersionedDescriptor = parseVersionedDescriptor; exports.photoFilterMatrix = photoFilterMatrix; exports.pixelLayerBounds = pixelLayerBounds; exports.pixelLayers = pixelLayers; exports.placeLayer = placeLayer; exports.pngDataUrl = _chunk73L6TROJcjs.pngDataUrl; exports.pointerPressure = pointerPressure; exports.polygonCoverage = polygonCoverage; exports.polygonSelection = polygonSelection; exports.posterizeValue = posterizeValue; exports.projectImagePoint = projectImagePoint; exports.projectImageRect = projectImageRect; exports.projectMaskCoverage = projectMaskCoverage; exports.projectQuarterTurn = projectQuarterTurn; exports.psdBytesFromBase64 = psdBytesFromBase64; exports.psdFileName = psdFileName; exports.psdToLayers = psdToLayers; exports.quickMaskPixels = quickMaskPixels; exports.rangeLightness = rangeLightness; exports.rasterMaskFromLegacy = rasterMaskFromLegacy; exports.rasterizeDab = _chunk4F3YDIWWcjs.rasterizeDab; exports.readAdjustmentControls = readAdjustmentControls; exports.readPixel = _chunkZOOEX3WTcjs.readPixel; exports.readPsd = readPsd; exports.readRegion = _chunkZOOEX3WTcjs.readRegion; exports.rectSelection = rectSelection; exports.refineCoverage = refineCoverage; exports.refineEdgeHalo = refineEdgeHalo; exports.refineSelection = refineSelection; exports.reflectanceToRgb = _chunk4F3YDIWWcjs.reflectanceToRgb; exports.removeAlpha = removeAlpha; exports.removeCurvePoint = removeCurvePoint; exports.removeLayer = removeLayer; exports.removeLayerEffect = removeLayerEffect; exports.removeLayerFilter = removeLayerFilter; exports.renderLayeredBase = renderLayeredBase; exports.requireLayer = requireLayer; exports.requireUnlocked = requireUnlocked; exports.resizePixels = resizePixels; exports.resizeSelection = resizeSelection; exports.resolveExternalAssets = resolveExternalAssets; exports.resolveMosaicRegionBounds = resolveMosaicRegionBounds; exports.rgbToGray = rgbToGray; exports.rgbToHsl = rgbToHsl; exports.rgbToReflectance = _chunk4F3YDIWWcjs.rgbToReflectance; exports.runLayerMenuAction = runLayerMenuAction; exports.sampleLut = sampleLut; exports.sampleToneLut = sampleToneLut; exports.selectionArea = selectionArea; exports.selectionFromCoverage = selectionFromCoverage; exports.selectionFromPixels = selectionFromPixels; exports.selectionModeFromModifiers = selectionModeFromModifiers; exports.selectionOutline = selectionOutline; exports.selectionToCoverage = selectionToCoverage; exports.selectionToPixels = selectionToPixels; exports.selectionValueAt = selectionValueAt; exports.serializeEffects = serializeEffects; exports.serializeLayer = serializeLayer; exports.serializeLayers = serializeLayers; exports.serializeLayersExternal = serializeLayersExternal; exports.serializeSelection = serializeSelection; exports.setControlPath = setControlPath; exports.setLayerEffects = setLayerEffects; exports.setLayerEffectsEnabled = setLayerEffectsEnabled; exports.setLayerMask = setLayerMask; exports.setLayerProperties = setLayerProperties; exports.setLum = _chunkZOOEX3WTcjs.setLum; exports.setPigmentColor = _chunk4F3YDIWWcjs.setPigmentColor; exports.shiftCoverage = shiftCoverage; exports.smoothCoverage = smoothCoverage; exports.smoothPoints = _chunk4F3YDIWWcjs.smoothPoints; exports.solidSurface = _chunkZOOEX3WTcjs.solidSurface; exports.splitOverlayAnnotations = splitOverlayAnnotations; exports.srgb8ToLab = srgb8ToLab; exports.srgbToLinear = srgbToLinear; exports.sumHistograms = sumHistograms; exports.surfaceBytes = _chunkZOOEX3WTcjs.surfaceBytes; exports.surfaceFromPixels = _chunkZOOEX3WTcjs.surfaceFromPixels; exports.surfacesEqual = _chunkZOOEX3WTcjs.surfacesEqual; exports.tempTintToXy = tempTintToXy; exports.temperatureToKelvin = temperatureToKelvin; exports.tileCoord = _chunkZOOEX3WTcjs.tileCoord; exports.tileKey = _chunkZOOEX3WTcjs.tileKey; exports.tileRect = _chunkZOOEX3WTcjs.tileRect; exports.tilesInRect = _chunkZOOEX3WTcjs.tilesInRect; exports.tipFalloff = _chunk4F3YDIWWcjs.tipFalloff; exports.tipReach = _chunk4F3YDIWWcjs.tipReach; exports.tipShape = _chunk4F3YDIWWcjs.tipShape; exports.toHex = toHex2; exports.toneCurve = toneCurve; exports.toneLuts = toneLuts; exports.toneRange = toneRange; exports.translateSurface = _chunkZOOEX3WTcjs.translateSurface; exports.ungroupLayer = ungroupLayer; exports.uniformTile = _chunkZOOEX3WTcjs.uniformTile; exports.unionRect = unionRect; exports.unprojectCanvasPoint = unprojectCanvasPoint; exports.updateLayerEffect = updateLayerEffect; exports.updateLayerFilter = updateLayerFilter; exports.updateLayerMaskProps = updateLayerMaskProps; exports.uvToXy = uvToXy; exports.versionedDescriptorBytes = versionedDescriptorBytes; exports.vibranceLinear = vibranceLinear; exports.vibrancePixel = vibrancePixel; exports.walkDabs = _chunk4F3YDIWWcjs.walkDabs; exports.wbMatrix = wbMatrix; exports.whiteBalanceFromSample = whiteBalanceFromSample; exports.whiteBalanceMatrix = whiteBalanceMatrix; exports.withNewIds = withNewIds; exports.writeAdjustmentBlock = writeAdjustmentBlock; exports.writePsd = writePsd; exports.writeRegion = _chunkZOOEX3WTcjs.writeRegion; exports.xyToTempTint = xyToTempTint; exports.xyToUv = xyToUv;
|
|
12741
13226
|
//# sourceMappingURL=index.cjs.map
|