@pixerate/editor 0.93.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-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/image-editor/index.cjs +752 -292
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +83 -17
- package/dist/image-editor/index.d.ts +83 -17
- package/dist/image-editor/index.js +534 -74
- package/dist/image-editor/index.js.map +1 -1
- package/dist/paint/index.d.cts +1 -1
- package/dist/paint/index.d.ts +1 -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 +1 -1
- package/skills/pixerate-image-editor/SKILL.md +57 -6
- 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
|
@@ -28,7 +28,21 @@ var _chunkVJUVNERTcjs = require('../chunk-VJUVNERT.cjs');
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
var _chunk73L6TROJcjs = require('../chunk-73L6TROJ.cjs');
|
|
32
46
|
|
|
33
47
|
|
|
34
48
|
|
|
@@ -1106,7 +1120,7 @@ function smoothCoverage(m, w, h, r) {
|
|
|
1106
1120
|
return src;
|
|
1107
1121
|
}
|
|
1108
1122
|
function featherCoverage(m, w, h, radius) {
|
|
1109
|
-
const out =
|
|
1123
|
+
const out = _chunk73L6TROJcjs.gaussianBlur.call(void 0, m, w, h, Number.isFinite(radius) ? Math.max(0, radius) : 0, "zero");
|
|
1110
1124
|
for (let i = 0; i < out.length; i++) if (Math.abs(out[i]) < 1e-7) out[i] = 0;
|
|
1111
1125
|
return out;
|
|
1112
1126
|
}
|
|
@@ -1254,7 +1268,7 @@ function layerMaskCoverage(mask) {
|
|
|
1254
1268
|
let v = new Float32Array(sel.data.length);
|
|
1255
1269
|
for (let i = 0; i < v.length; i++) v[i] = sel.data[i] / 255;
|
|
1256
1270
|
const feather = _nullishCoalesce(mask.feather, () => ( 0));
|
|
1257
|
-
if (feather > 0) v =
|
|
1271
|
+
if (feather > 0) v = _chunk73L6TROJcjs.gaussianBlur.call(void 0, v, mask.width, mask.height, feather, "clamp");
|
|
1258
1272
|
const density = _nullishCoalesce(mask.density, () => ( 1));
|
|
1259
1273
|
if (density !== 1) for (let i = 0; i < v.length; i++) v[i] = 1 - density * (1 - v[i]);
|
|
1260
1274
|
return v;
|
|
@@ -1496,61 +1510,8 @@ function normalizeAdjustmentLayers(raw) {
|
|
|
1496
1510
|
}
|
|
1497
1511
|
return out;
|
|
1498
1512
|
}
|
|
1499
|
-
function curveLut(points, size = ADJUSTMENT_LUT_SIZE) {
|
|
1500
|
-
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]);
|
|
1501
|
-
const dedup = [];
|
|
1502
|
-
for (const p of pts) {
|
|
1503
|
-
if (dedup.length && Math.abs(dedup[dedup.length - 1][0] - p[0]) < 1e-6) continue;
|
|
1504
|
-
dedup.push(p);
|
|
1505
|
-
}
|
|
1506
|
-
const out = new Float32Array(size);
|
|
1507
|
-
const n = dedup.length;
|
|
1508
|
-
if (n < 2) {
|
|
1509
|
-
for (let k = 0; k < size; k++) out[k] = k / (size - 1);
|
|
1510
|
-
return out;
|
|
1511
|
-
}
|
|
1512
|
-
const x = dedup.map((p) => p[0]);
|
|
1513
|
-
const y = dedup.map((p) => p[1]);
|
|
1514
|
-
const m2 = new Float64Array(n);
|
|
1515
|
-
if (n > 2) {
|
|
1516
|
-
const c = new Float64Array(n);
|
|
1517
|
-
const d = new Float64Array(n);
|
|
1518
|
-
for (let i = 1; i < n - 1; i++) {
|
|
1519
|
-
const h0 = x[i] - x[i - 1];
|
|
1520
|
-
const h1 = x[i + 1] - x[i];
|
|
1521
|
-
const a = h0 / 6;
|
|
1522
|
-
const b = (h0 + h1) / 3;
|
|
1523
|
-
const cc = h1 / 6;
|
|
1524
|
-
const r = (y[i + 1] - y[i]) / h1 - (y[i] - y[i - 1]) / h0;
|
|
1525
|
-
const denom = b - a * c[i - 1];
|
|
1526
|
-
c[i] = cc / denom;
|
|
1527
|
-
d[i] = (r - a * d[i - 1]) / denom;
|
|
1528
|
-
}
|
|
1529
|
-
for (let i = n - 2; i >= 1; i--) m2[i] = d[i] - c[i] * m2[i + 1];
|
|
1530
|
-
}
|
|
1531
|
-
let seg = 0;
|
|
1532
|
-
for (let k = 0; k < size; k++) {
|
|
1533
|
-
const xv = k / (size - 1);
|
|
1534
|
-
if (xv <= x[0]) {
|
|
1535
|
-
out[k] = clamp01(y[0]);
|
|
1536
|
-
continue;
|
|
1537
|
-
}
|
|
1538
|
-
if (xv >= x[n - 1]) {
|
|
1539
|
-
out[k] = clamp01(y[n - 1]);
|
|
1540
|
-
continue;
|
|
1541
|
-
}
|
|
1542
|
-
while (seg < n - 2 && xv > x[seg + 1]) seg++;
|
|
1543
|
-
const x0 = x[seg], x1 = x[seg + 1];
|
|
1544
|
-
const h = x1 - x0;
|
|
1545
|
-
const a = (x1 - xv) / h;
|
|
1546
|
-
const b = (xv - x0) / h;
|
|
1547
|
-
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;
|
|
1548
|
-
out[k] = clamp01(v);
|
|
1549
|
-
}
|
|
1550
|
-
return out;
|
|
1551
|
-
}
|
|
1552
1513
|
function curveLutFromLevels(points) {
|
|
1553
|
-
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 })));
|
|
1554
1515
|
}
|
|
1555
1516
|
var toUnitLevels = (c) => ({
|
|
1556
1517
|
inBlack: c.inBlack / 255,
|
|
@@ -2372,7 +2333,7 @@ function newLayerId(prefix = "layer") {
|
|
|
2372
2333
|
return `${prefix}_${Date.now().toString(36)}_${(++idCounter).toString(36)}`;
|
|
2373
2334
|
}
|
|
2374
2335
|
function pixelLayers(layers) {
|
|
2375
|
-
return
|
|
2336
|
+
return _chunk73L6TROJcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "pixel");
|
|
2376
2337
|
}
|
|
2377
2338
|
function developFilter(layer) {
|
|
2378
2339
|
return _optionalChain([layer, 'access', _8 => _8.filters, 'optionalAccess', _9 => _9.find, 'call', _10 => _10((f) => f.kind === "develop")]);
|
|
@@ -2493,7 +2454,7 @@ var PHOTO_PROFILE = {
|
|
|
2493
2454
|
return v;
|
|
2494
2455
|
}
|
|
2495
2456
|
};
|
|
2496
|
-
var LayerCompositor = class extends
|
|
2457
|
+
var LayerCompositor = class extends _chunk73L6TROJcjs.RasterCompositor {
|
|
2497
2458
|
constructor(options = {}) {
|
|
2498
2459
|
super(PHOTO_PROFILE, options);
|
|
2499
2460
|
}
|
|
@@ -2700,7 +2661,7 @@ function developTarget(layers, activeLayerId) {
|
|
|
2700
2661
|
}
|
|
2701
2662
|
return _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(pixels.find((l) => l.source === "document"), () => ( pixels.find((l) => l.id === BACKGROUND_LAYER_ID))), () => ( pixels[0])), () => ( null));
|
|
2702
2663
|
}
|
|
2703
|
-
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;
|
|
2704
2665
|
function legacyView(stack, width, height, activeLayerId = null) {
|
|
2705
2666
|
const { layers } = stack;
|
|
2706
2667
|
const target = developTarget(layers, activeLayerId);
|
|
@@ -2740,7 +2701,7 @@ function isLegacyShape(stack) {
|
|
|
2740
2701
|
const bg = layers[0];
|
|
2741
2702
|
if (!bg || bg.type !== "pixel" || bg.source !== "document") return false;
|
|
2742
2703
|
if (bg.id !== BACKGROUND_LAYER_ID || bg.name !== BACKGROUND_LAYER_NAME) return false;
|
|
2743
|
-
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;
|
|
2744
2705
|
if ((_nullishCoalesce(bg.fillOpacity, () => ( 1))) !== 1 || bg.offset.x !== 0 || bg.offset.y !== 0) return false;
|
|
2745
2706
|
const filters = _nullishCoalesce(bg.filters, () => ( []));
|
|
2746
2707
|
if (filters.length < 1 || filters.length > 2) return false;
|
|
@@ -2756,7 +2717,7 @@ function isLegacyShape(stack) {
|
|
|
2756
2717
|
let adjustments = 0;
|
|
2757
2718
|
for (; i < layers.length && layers[i].type === "adjustment"; i++) {
|
|
2758
2719
|
const l = layers[i];
|
|
2759
|
-
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;
|
|
2760
2721
|
adjustments++;
|
|
2761
2722
|
}
|
|
2762
2723
|
for (; i < layers.length; i++) {
|
|
@@ -3262,22 +3223,24 @@ var ImageEditorRenderer = (_class2 = class {constructor() { _class2.prototype.__
|
|
|
3262
3223
|
return _nullishCoalesce(this.depthMaps.get(`${source.maskSource}|${width}x${height}`), () => ( null));
|
|
3263
3224
|
},
|
|
3264
3225
|
rasterizeAnnotation: (annotation, rect) => this.rasterizeAnnotation(annotation, rect),
|
|
3265
|
-
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
|
|
3266
3229
|
};
|
|
3267
3230
|
}
|
|
3268
3231
|
/** Loads what the compositor reads synchronously: depth maps (at canvas size) and annotation images. */
|
|
3269
3232
|
/** Loads depth maps and annotation images the compositor reads synchronously. */
|
|
3270
3233
|
async prepareLayerAssets(layers, width, height) {
|
|
3271
|
-
for (const l of
|
|
3272
|
-
const source = _optionalChain([l, 'access',
|
|
3273
|
-
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) {
|
|
3274
3237
|
const key = `${source.maskSource}|${width}x${height}`;
|
|
3275
3238
|
if (this.depthMaps.has(key)) continue;
|
|
3276
3239
|
try {
|
|
3277
3240
|
const maskImg = await this.imageCache.get(source.maskSource);
|
|
3278
3241
|
const canvas = this.createCanvas(width, height);
|
|
3279
3242
|
const mctx = canvas.getContext("2d");
|
|
3280
|
-
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;
|
|
3281
3244
|
if (data) {
|
|
3282
3245
|
this.depthMaps.set(key, { width, height, data: data.data });
|
|
3283
3246
|
this.assetVersion++;
|
|
@@ -3397,7 +3360,7 @@ var ImageEditorRenderer = (_class2 = class {constructor() { _class2.prototype.__
|
|
|
3397
3360
|
const opacity = _nullishCoalesce(state.outputOpacity, () => ( 1));
|
|
3398
3361
|
const blur = _nullishCoalesce(state.legacyOutputBlur, () => ( 0));
|
|
3399
3362
|
if (!(opacity < 1) && !(blur > 0)) return null;
|
|
3400
|
-
const data = _optionalChain([ctx, 'access',
|
|
3363
|
+
const data = _optionalChain([ctx, 'access', _62 => _62.getImageData, 'optionalCall', _63 => _63(0, 0, w, h)]);
|
|
3401
3364
|
if (!data) return null;
|
|
3402
3365
|
applyOutputStage(data, opacity, blur);
|
|
3403
3366
|
ctx.putImageData(data, 0, 0);
|
|
@@ -3406,7 +3369,7 @@ var ImageEditorRenderer = (_class2 = class {constructor() { _class2.prototype.__
|
|
|
3406
3369
|
publishHistogram(histogram) {
|
|
3407
3370
|
if (histogram === this.previewHistogram) return;
|
|
3408
3371
|
this.previewHistogram = histogram;
|
|
3409
|
-
_optionalChain([this, 'access',
|
|
3372
|
+
_optionalChain([this, 'access', _64 => _64.onPreviewHistogram, 'optionalCall', _65 => _65(histogram)]);
|
|
3410
3373
|
}
|
|
3411
3374
|
__init19() {this.quickMaskCache = /* @__PURE__ */ new WeakMap()}
|
|
3412
3375
|
__init20() {this.outlineCache = /* @__PURE__ */ new WeakMap()}
|
|
@@ -3819,8 +3782,8 @@ var ImageEditorRenderer = (_class2 = class {constructor() { _class2.prototype.__
|
|
|
3819
3782
|
if (!ctx) return maskCanvas;
|
|
3820
3783
|
ctx.fillStyle = MASK_BLACK;
|
|
3821
3784
|
ctx.fillRect(0, 0, naturalWidth, naturalHeight);
|
|
3822
|
-
const useCrop = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
3823
|
-
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));
|
|
3824
3787
|
if (useCrop && state.crop) {
|
|
3825
3788
|
ctx.fillStyle = MASK_WHITE;
|
|
3826
3789
|
ctx.fillRect(state.crop.x, state.crop.y, state.crop.width, state.crop.height);
|
|
@@ -3830,8 +3793,8 @@ var ImageEditorRenderer = (_class2 = class {constructor() { _class2.prototype.__
|
|
|
3830
3793
|
this.drawAnnotationMask(ctx, ann);
|
|
3831
3794
|
}
|
|
3832
3795
|
}
|
|
3833
|
-
const imageData = _optionalChain([ctx, 'access',
|
|
3834
|
-
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;
|
|
3835
3798
|
if (imageData) {
|
|
3836
3799
|
const d = imageData.data;
|
|
3837
3800
|
for (let i = 0; i < d.length; i += 4) {
|
|
@@ -4451,11 +4414,11 @@ function refineCoverage(guide, m, w, h, params = {}) {
|
|
|
4451
4414
|
}
|
|
4452
4415
|
const ss = smoothSigma(p);
|
|
4453
4416
|
if (ss >= 0.3) {
|
|
4454
|
-
a =
|
|
4417
|
+
a = _chunk73L6TROJcjs.gaussianBlur.call(void 0, a, w, h, ss, "clamp");
|
|
4455
4418
|
const gain = 1 + ss;
|
|
4456
4419
|
for (let i = 0; i < a.length; i++) a[i] = Math.min(1, Math.max(0, (a[i] - 0.5) * gain + 0.5));
|
|
4457
4420
|
}
|
|
4458
|
-
a =
|
|
4421
|
+
a = _chunk73L6TROJcjs.gaussianBlur.call(void 0, a, w, h, featherSigma(p), "clamp");
|
|
4459
4422
|
if (p.contrast > 0) {
|
|
4460
4423
|
const gain = 1 / (1 - 0.99 * p.contrast / 100);
|
|
4461
4424
|
for (let i = 0; i < a.length; i++) a[i] = Math.min(1, Math.max(0, (a[i] - 0.5) * gain + 0.5));
|
|
@@ -4519,7 +4482,7 @@ function encodeSurface(surface) {
|
|
|
4519
4482
|
let out = null;
|
|
4520
4483
|
if (b) {
|
|
4521
4484
|
const data = _chunkZOOEX3WTcjs.readRegion.call(void 0, surface, b);
|
|
4522
|
-
out = { url:
|
|
4485
|
+
out = { url: _chunk73L6TROJcjs.pngDataUrl.call(void 0, b.width, b.height, data, surface.channels), x: b.x, y: b.y };
|
|
4523
4486
|
}
|
|
4524
4487
|
encodedCache.set(surface, out);
|
|
4525
4488
|
return out;
|
|
@@ -4535,8 +4498,29 @@ function baseFields(layer, ctx) {
|
|
|
4535
4498
|
if (layer.clipped) out.clipped = true;
|
|
4536
4499
|
if (layer.mask) out.mask = serializeMask(layer.mask, `${layer.id}-mask`, ctx);
|
|
4537
4500
|
if (layer.locks && Object.values(layer.locks).some(Boolean)) out.locks = { ...layer.locks };
|
|
4501
|
+
if (layer.effects) out.effects = serializeEffects(layer.effects);
|
|
4538
4502
|
return out;
|
|
4539
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
|
+
}
|
|
4540
4524
|
function serializeMask(mask, hint, ctx) {
|
|
4541
4525
|
const out = { defaultValue: mask.defaultValue };
|
|
4542
4526
|
if (!mask.source) {
|
|
@@ -4569,7 +4553,7 @@ function serializeLayer(layer, ctx) {
|
|
|
4569
4553
|
}
|
|
4570
4554
|
}
|
|
4571
4555
|
if (layer.fillOpacity !== void 0 && layer.fillOpacity !== 1) out.fillOpacity = layer.fillOpacity;
|
|
4572
|
-
if (_optionalChain([layer, 'access',
|
|
4556
|
+
if (_optionalChain([layer, 'access', _73 => _73.filters, 'optionalAccess', _74 => _74.length])) out.filters = JSON.parse(JSON.stringify(layer.filters));
|
|
4573
4557
|
return out;
|
|
4574
4558
|
}
|
|
4575
4559
|
case "adjustment":
|
|
@@ -4607,7 +4591,7 @@ async function serializeLayersExternal(layers, store) {
|
|
|
4607
4591
|
for (const [id, url] of Object.entries(inline.assets)) {
|
|
4608
4592
|
let ref = refs.get(url);
|
|
4609
4593
|
if (!ref) {
|
|
4610
|
-
const parsed =
|
|
4594
|
+
const parsed = _chunk73L6TROJcjs.parseDataUrl.call(void 0, url);
|
|
4611
4595
|
const png = decodePngHeader(parsed.bytes);
|
|
4612
4596
|
ref = await store.put(new Blob([parsed.bytes], { type: "image/png" }), { id, width: png.width, height: png.height });
|
|
4613
4597
|
if (typeof ref !== "string" || !ref) throw new Error(`The asset store returned no reference for "${id}".`);
|
|
@@ -4635,7 +4619,7 @@ async function resolveExternalAssets(assets, store, problems) {
|
|
|
4635
4619
|
try {
|
|
4636
4620
|
const blob = await store.get(ref);
|
|
4637
4621
|
const bytes = new Uint8Array(await blob.arrayBuffer());
|
|
4638
|
-
out[id] = `data:image/png;base64,${
|
|
4622
|
+
out[id] = `data:image/png;base64,${_chunk73L6TROJcjs.bytesToBase64.call(void 0, bytes)}`;
|
|
4639
4623
|
} catch (err) {
|
|
4640
4624
|
problems.push(`Asset "${id}" (${ref}) could not be fetched: ${err.message}`);
|
|
4641
4625
|
}
|
|
@@ -4643,9 +4627,9 @@ async function resolveExternalAssets(assets, store, problems) {
|
|
|
4643
4627
|
return out;
|
|
4644
4628
|
}
|
|
4645
4629
|
function decodePngDataUrl(url, channels) {
|
|
4646
|
-
const parsed =
|
|
4630
|
+
const parsed = _chunk73L6TROJcjs.parseDataUrl.call(void 0, url);
|
|
4647
4631
|
if (!parsed) throw new Error("Asset is not a data URL.");
|
|
4648
|
-
const png =
|
|
4632
|
+
const png = _chunk73L6TROJcjs.decodePng.call(void 0, parsed.bytes, { keepGray: channels === 1 });
|
|
4649
4633
|
if (png.channels === channels) return png;
|
|
4650
4634
|
if (channels === 1) {
|
|
4651
4635
|
const out2 = new Uint8ClampedArray(png.width * png.height);
|
|
@@ -4739,13 +4723,15 @@ function deserializeLayer(raw, ctx) {
|
|
|
4739
4723
|
for (const k of ["pixels", "transparency", "position", "all"]) if (r.locks[k] === true) locks[k] = true;
|
|
4740
4724
|
if (Object.keys(locks).length) base.locks = locks;
|
|
4741
4725
|
}
|
|
4726
|
+
const effects = deserializeEffects(r.effects);
|
|
4727
|
+
if (effects && r.type !== "adjustment") base.effects = effects;
|
|
4742
4728
|
switch (r.type) {
|
|
4743
4729
|
case "pixel": {
|
|
4744
4730
|
const layer = {
|
|
4745
4731
|
...base,
|
|
4746
4732
|
type: "pixel",
|
|
4747
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}"`),
|
|
4748
|
-
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)) }
|
|
4749
4735
|
};
|
|
4750
4736
|
if (r.source === "document") layer.source = "document";
|
|
4751
4737
|
if (typeof r.fillOpacity === "number" && r.fillOpacity !== 1) layer.fillOpacity = num(r.fillOpacity, 0, 1, 1);
|
|
@@ -4805,47 +4791,47 @@ var fail = (message) => {
|
|
|
4805
4791
|
throw new LayerOperationError(message);
|
|
4806
4792
|
};
|
|
4807
4793
|
function requireLayer(layers, id) {
|
|
4808
|
-
const loc =
|
|
4794
|
+
const loc = _chunk73L6TROJcjs.findLayer.call(void 0, layers, id);
|
|
4809
4795
|
if (!loc) {
|
|
4810
|
-
const ids =
|
|
4796
|
+
const ids = _chunk73L6TROJcjs.flattenLayers.call(void 0, layers).map((l) => l.id);
|
|
4811
4797
|
fail(`Unknown layer "${id}". ${ids.length ? `Layers: ${ids.join(", ")}.` : "The document has no layers."} Call list_layers for ids.`);
|
|
4812
4798
|
}
|
|
4813
4799
|
return loc;
|
|
4814
4800
|
}
|
|
4815
4801
|
function requireUnlocked(layer, what, action) {
|
|
4816
|
-
if (
|
|
4817
|
-
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}.`);
|
|
4818
4804
|
}
|
|
4819
4805
|
function placeLayer(layers, layer, placement = {}, defaultIndex) {
|
|
4820
4806
|
const given = [placement.aboveId, placement.belowId, placement.parentId].filter((v) => v !== void 0).length;
|
|
4821
4807
|
if (given > 1) fail("Give only one of aboveId, belowId and parentId.");
|
|
4822
4808
|
if (placement.aboveId || placement.belowId) {
|
|
4823
4809
|
const ref = requireLayer(layers, _nullishCoalesce(placement.aboveId, () => ( placement.belowId)));
|
|
4824
|
-
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));
|
|
4825
4811
|
}
|
|
4826
4812
|
if (placement.parentId) {
|
|
4827
4813
|
const ref = requireLayer(layers, placement.parentId);
|
|
4828
4814
|
if (ref.layer.type !== "group") fail(`Layer "${placement.parentId}" is not a group; parentId must be a group id.`);
|
|
4829
|
-
return
|
|
4815
|
+
return _chunk73L6TROJcjs.insertLayer.call(void 0, layers, layer, ref.layer.id, placement.index);
|
|
4830
4816
|
}
|
|
4831
|
-
return
|
|
4817
|
+
return _chunk73L6TROJcjs.insertLayer.call(void 0, layers, layer, null, _nullishCoalesce(placement.index, () => ( defaultIndex)));
|
|
4832
4818
|
}
|
|
4833
4819
|
function removeLayer(layers, id) {
|
|
4834
4820
|
const loc = requireLayer(layers, id);
|
|
4835
4821
|
requireUnlocked(loc.layer, "all", "delete it");
|
|
4836
|
-
return
|
|
4822
|
+
return _chunk73L6TROJcjs.mapLayer.call(void 0, layers, id, () => null);
|
|
4837
4823
|
}
|
|
4838
4824
|
function moveLayer(layers, id, placement) {
|
|
4839
4825
|
const loc = requireLayer(layers, id);
|
|
4840
4826
|
requireUnlocked(loc.layer, "all", "move it");
|
|
4841
4827
|
const target = _nullishCoalesce(_nullishCoalesce(placement.aboveId, () => ( placement.belowId)), () => ( placement.parentId));
|
|
4842
4828
|
if (target === id) fail("A layer cannot be placed relative to itself.");
|
|
4843
|
-
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)) {
|
|
4844
4830
|
fail(`Group "${id}" cannot be moved into its own child "${target}".`);
|
|
4845
4831
|
}
|
|
4846
4832
|
if (target) requireLayer(layers, target);
|
|
4847
4833
|
if (!target && placement.index === void 0) fail("Give aboveId, belowId, parentId or index.");
|
|
4848
|
-
const without =
|
|
4834
|
+
const without = _chunk73L6TROJcjs.mapLayer.call(void 0, layers, id, () => null);
|
|
4849
4835
|
return placeLayer(without, loc.layer, placement);
|
|
4850
4836
|
}
|
|
4851
4837
|
function withNewIds(layer) {
|
|
@@ -4859,7 +4845,7 @@ function duplicateLayer(layers, id, name) {
|
|
|
4859
4845
|
const copy = withNewIds(loc.layer);
|
|
4860
4846
|
copy.name = _nullishCoalesce(name, () => ( `${loc.layer.name || "Layer"} copy`));
|
|
4861
4847
|
delete copy.locks;
|
|
4862
|
-
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 };
|
|
4863
4849
|
}
|
|
4864
4850
|
function setLayerProperties(layers, id, props) {
|
|
4865
4851
|
const loc = requireLayer(layers, id);
|
|
@@ -4906,13 +4892,13 @@ function setLayerProperties(layers, id, props) {
|
|
|
4906
4892
|
if (props.collapsed) g.collapsed = true;
|
|
4907
4893
|
else delete g.collapsed;
|
|
4908
4894
|
}
|
|
4909
|
-
return
|
|
4895
|
+
return _chunk73L6TROJcjs.mapLayer.call(void 0, layers, id, () => next);
|
|
4910
4896
|
}
|
|
4911
4897
|
function groupLayers(layers, ids, name = "Group") {
|
|
4912
4898
|
if (!ids.length) fail("Give at least one layer id to group.");
|
|
4913
4899
|
const locs = ids.map((id) => requireLayer(layers, id));
|
|
4914
|
-
const parent = _nullishCoalesce(_optionalChain([locs, 'access',
|
|
4915
|
-
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.");
|
|
4916
4902
|
for (const l of locs) requireUnlocked(l.layer, "all", "group it");
|
|
4917
4903
|
const ordered = [...new Set(locs)].sort((a, b) => a.index - b.index);
|
|
4918
4904
|
const top = ordered[ordered.length - 1].index;
|
|
@@ -4929,23 +4915,23 @@ function groupLayers(layers, ids, name = "Group") {
|
|
|
4929
4915
|
return c;
|
|
4930
4916
|
})
|
|
4931
4917
|
};
|
|
4932
|
-
if (_optionalChain([group, 'access',
|
|
4918
|
+
if (_optionalChain([group, 'access', _88 => _88.children, 'access', _89 => _89[0], 'optionalAccess', _90 => _90.clipped])) {
|
|
4933
4919
|
const c = { ...group.children[0] };
|
|
4934
4920
|
delete c.clipped;
|
|
4935
4921
|
group.children[0] = c;
|
|
4936
4922
|
}
|
|
4937
4923
|
let out = layers;
|
|
4938
|
-
for (const l of ordered) out =
|
|
4939
|
-
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 };
|
|
4940
4926
|
}
|
|
4941
4927
|
function ungroupLayer(layers, id) {
|
|
4942
4928
|
const loc = requireLayer(layers, id);
|
|
4943
4929
|
if (loc.layer.type !== "group") fail(`Layer "${id}" is not a group.`);
|
|
4944
4930
|
requireUnlocked(loc.layer, "all", "ungroup it");
|
|
4945
4931
|
const group = loc.layer;
|
|
4946
|
-
let out =
|
|
4932
|
+
let out = _chunk73L6TROJcjs.mapLayer.call(void 0, layers, id, () => null);
|
|
4947
4933
|
group.children.forEach((c, i) => {
|
|
4948
|
-
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);
|
|
4949
4935
|
});
|
|
4950
4936
|
return { layers: out, ids: group.children.map((c) => c.id) };
|
|
4951
4937
|
}
|
|
@@ -4955,12 +4941,12 @@ function offsetLayer(layers, id, offset) {
|
|
|
4955
4941
|
requireUnlocked(loc.layer, "position", "move it");
|
|
4956
4942
|
if (!Number.isFinite(offset.x) || !Number.isFinite(offset.y)) fail("x and y must be numbers.");
|
|
4957
4943
|
const layer = loc.layer;
|
|
4958
|
-
return
|
|
4944
|
+
return _chunk73L6TROJcjs.mapLayer.call(void 0, layers, id, () => ({ ...layer, offset: { x: Math.round(offset.x), y: Math.round(offset.y) } }));
|
|
4959
4945
|
}
|
|
4960
4946
|
function setLayerMask(layers, id, mask) {
|
|
4961
4947
|
const loc = requireLayer(layers, id);
|
|
4962
4948
|
requireUnlocked(loc.layer, "all", "change its mask");
|
|
4963
|
-
return
|
|
4949
|
+
return _chunk73L6TROJcjs.mapLayer.call(void 0, layers, id, (l) => {
|
|
4964
4950
|
const next = { ...l };
|
|
4965
4951
|
if (mask) next.mask = mask;
|
|
4966
4952
|
else delete next.mask;
|
|
@@ -4998,8 +4984,8 @@ function requirePixelLayer(layers, id) {
|
|
|
4998
4984
|
}
|
|
4999
4985
|
function addLayerFilter(layers, id, filter) {
|
|
5000
4986
|
const layer = requirePixelLayer(layers, id);
|
|
5001
|
-
if (_optionalChain([layer, 'access',
|
|
5002
|
-
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] }));
|
|
5003
4989
|
}
|
|
5004
4990
|
function updateLayerFilter(layers, id, filterId, changes) {
|
|
5005
4991
|
const layer = requirePixelLayer(layers, id);
|
|
@@ -5010,7 +4996,7 @@ function updateLayerFilter(layers, id, filterId, changes) {
|
|
|
5010
4996
|
const merged = normalizeFilter({ ...current, ...changes, kind: current.kind }, current.id);
|
|
5011
4997
|
const filters = [...layer.filters];
|
|
5012
4998
|
filters[i] = merged;
|
|
5013
|
-
return
|
|
4999
|
+
return _chunk73L6TROJcjs.mapLayer.call(void 0, layers, id, () => ({ ...layer, filters }));
|
|
5014
5000
|
}
|
|
5015
5001
|
function removeLayerFilter(layers, id, filterId) {
|
|
5016
5002
|
const layer = requirePixelLayer(layers, id);
|
|
@@ -5019,7 +5005,78 @@ function removeLayerFilter(layers, id, filterId) {
|
|
|
5019
5005
|
const next = { ...layer };
|
|
5020
5006
|
if (filters.length) next.filters = filters;
|
|
5021
5007
|
else delete next.filters;
|
|
5022
|
-
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);
|
|
5023
5080
|
}
|
|
5024
5081
|
function parseBlend(value, allowPassThrough = false) {
|
|
5025
5082
|
if (value === void 0) return void 0;
|
|
@@ -5258,7 +5315,7 @@ var PsdWriter = (_class4 = class {constructor() { _class4.prototype.__init24.cal
|
|
|
5258
5315
|
function decodeLegacyName(b) {
|
|
5259
5316
|
try {
|
|
5260
5317
|
return new TextDecoder("utf-8", { fatal: true }).decode(b);
|
|
5261
|
-
} catch (
|
|
5318
|
+
} catch (e13) {
|
|
5262
5319
|
return String.fromCharCode(...b);
|
|
5263
5320
|
}
|
|
5264
5321
|
}
|
|
@@ -5279,7 +5336,7 @@ function descriptor(classId, items = []) {
|
|
|
5279
5336
|
return { name: "", classId, items };
|
|
5280
5337
|
}
|
|
5281
5338
|
function descGet(d, key) {
|
|
5282
|
-
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]]);
|
|
5283
5340
|
}
|
|
5284
5341
|
function descNumber(d, key) {
|
|
5285
5342
|
const v = descGet(d, key);
|
|
@@ -5289,7 +5346,7 @@ function descNumber(d, key) {
|
|
|
5289
5346
|
}
|
|
5290
5347
|
function descBool(d, key) {
|
|
5291
5348
|
const v = descGet(d, key);
|
|
5292
|
-
return _optionalChain([v, 'optionalAccess',
|
|
5349
|
+
return _optionalChain([v, 'optionalAccess', _102 => _102.type]) === "bool" ? v.value : void 0;
|
|
5293
5350
|
}
|
|
5294
5351
|
function descObject(d, key) {
|
|
5295
5352
|
const v = descGet(d, key);
|
|
@@ -5760,7 +5817,7 @@ function parseAdjustmentBlock(key, data) {
|
|
|
5760
5817
|
default:
|
|
5761
5818
|
return null;
|
|
5762
5819
|
}
|
|
5763
|
-
} catch (
|
|
5820
|
+
} catch (e14) {
|
|
5764
5821
|
return null;
|
|
5765
5822
|
}
|
|
5766
5823
|
}
|
|
@@ -5936,9 +5993,9 @@ function packbitsDecodeInto(src, expected, out, at) {
|
|
|
5936
5993
|
function inflateChecked(data, expected) {
|
|
5937
5994
|
let out;
|
|
5938
5995
|
try {
|
|
5939
|
-
out =
|
|
5996
|
+
out = _chunk73L6TROJcjs.inflate.call(void 0, data, { maxOutput: expected + (1 << 20), sizeHint: expected, verify: false });
|
|
5940
5997
|
} catch (e) {
|
|
5941
|
-
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)}`);
|
|
5942
5999
|
}
|
|
5943
6000
|
if (out.length < expected) throw new PsdError(`ZIP stream produced ${out.length} of ${expected} bytes.`);
|
|
5944
6001
|
return out.length === expected ? out : out.subarray(0, expected);
|
|
@@ -6177,7 +6234,7 @@ function parseMask(d) {
|
|
|
6177
6234
|
}
|
|
6178
6235
|
if (!realFirst) m.real = readReal();
|
|
6179
6236
|
return m;
|
|
6180
|
-
} catch (
|
|
6237
|
+
} catch (e15) {
|
|
6181
6238
|
return void 0;
|
|
6182
6239
|
}
|
|
6183
6240
|
}
|
|
@@ -6251,14 +6308,14 @@ function readPsd(bytes) {
|
|
|
6251
6308
|
return { header, colorModeData, resources, layers, mergedAlpha, globalBlocks, imageCompression, imageData: r.rest() };
|
|
6252
6309
|
}
|
|
6253
6310
|
function layerBlock(rec, key) {
|
|
6254
|
-
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]);
|
|
6255
6312
|
}
|
|
6256
6313
|
function layerName(rec) {
|
|
6257
6314
|
const luni = layerBlock(rec, "luni");
|
|
6258
6315
|
if (luni) {
|
|
6259
6316
|
try {
|
|
6260
6317
|
return new PsdReader(luni).unicode();
|
|
6261
|
-
} catch (
|
|
6318
|
+
} catch (e16) {
|
|
6262
6319
|
}
|
|
6263
6320
|
}
|
|
6264
6321
|
return rec.legacyName;
|
|
@@ -6282,7 +6339,7 @@ function u8Block(rec, key) {
|
|
|
6282
6339
|
function layerTree(file) {
|
|
6283
6340
|
const stack = [[]];
|
|
6284
6341
|
file.layers.forEach((rec, index) => {
|
|
6285
|
-
const kind = _nullishCoalesce(_optionalChain([sectionDivider, 'call',
|
|
6342
|
+
const kind = _nullishCoalesce(_optionalChain([sectionDivider, 'call', _107 => _107(rec), 'optionalAccess', _108 => _108.kind]), () => ( SECTION_OTHER));
|
|
6286
6343
|
if (kind === SECTION_DIVIDER) {
|
|
6287
6344
|
stack.push([]);
|
|
6288
6345
|
} else if (kind === SECTION_OPEN || kind === SECTION_CLOSED) {
|
|
@@ -6300,7 +6357,7 @@ function layerTree(file) {
|
|
|
6300
6357
|
}
|
|
6301
6358
|
function channelRect(rec, id) {
|
|
6302
6359
|
if (id === CHANNEL_USER_MASK && rec.mask) return rec.mask.rect;
|
|
6303
|
-
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));
|
|
6304
6361
|
return rec.rect;
|
|
6305
6362
|
}
|
|
6306
6363
|
function decodeLayerChannel(file, rec, id) {
|
|
@@ -6318,7 +6375,7 @@ function decodeMergedImage(file) {
|
|
|
6318
6375
|
return decodePlanes(file.imageCompression, file.imageData, { planes: channels, width, height, depth, psb });
|
|
6319
6376
|
}
|
|
6320
6377
|
function resource(file, id) {
|
|
6321
|
-
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]);
|
|
6322
6379
|
}
|
|
6323
6380
|
function resolution(file) {
|
|
6324
6381
|
const d = resource(file, 1005);
|
|
@@ -6767,7 +6824,7 @@ function importNode(ctx, node, depth) {
|
|
|
6767
6824
|
if (node.children) {
|
|
6768
6825
|
const props2 = baseProps(ctx, rec, name, notes);
|
|
6769
6826
|
const divider = sectionDivider(rec);
|
|
6770
|
-
const key = _nullishCoalesce(_optionalChain([divider, 'optionalAccess',
|
|
6827
|
+
const key = _nullishCoalesce(_optionalChain([divider, 'optionalAccess', _116 => _116.blendKey]), () => ( rec.blendKey));
|
|
6771
6828
|
const groupBlend = key === "pass" ? "pass-through" : _nullishCoalesce(PSD_BLEND_KEYS[key], () => ( "normal"));
|
|
6772
6829
|
const children = [];
|
|
6773
6830
|
for (const child of node.children) {
|
|
@@ -6775,7 +6832,7 @@ function importNode(ctx, node, depth) {
|
|
|
6775
6832
|
if (layer2) children.push(layer2);
|
|
6776
6833
|
}
|
|
6777
6834
|
const group = { type: "group", id: ctx.newId(name), ...props2, blend: groupBlend, children };
|
|
6778
|
-
if (_optionalChain([divider, 'optionalAccess',
|
|
6835
|
+
if (_optionalChain([divider, 'optionalAccess', _117 => _117.kind]) === SECTION_CLOSED) group.collapsed = true;
|
|
6779
6836
|
const mask2 = recordMask(ctx, rec, name);
|
|
6780
6837
|
if (mask2) group.mask = mask2;
|
|
6781
6838
|
entry.type = "group";
|
|
@@ -6968,7 +7025,7 @@ function exportPsd(input) {
|
|
|
6968
7025
|
return {
|
|
6969
7026
|
opacity: Math.round(Math.min(1, Math.max(0, layer.opacity)) * 255),
|
|
6970
7027
|
clipping: layer.clipped ? 1 : 0,
|
|
6971
|
-
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),
|
|
6972
7029
|
legacyName: name,
|
|
6973
7030
|
blocks
|
|
6974
7031
|
};
|
|
@@ -7025,7 +7082,7 @@ function exportPsd(input) {
|
|
|
7025
7082
|
}
|
|
7026
7083
|
case "pixel": {
|
|
7027
7084
|
if (layer.source === "document") throw new PsdError(`Layer "${layer.name}" reads the document image; resolve its pixels before export.`);
|
|
7028
|
-
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.`);
|
|
7029
7086
|
const extra = [];
|
|
7030
7087
|
if (layer.fillOpacity !== void 0 && layer.fillOpacity < 1) {
|
|
7031
7088
|
extra.push({ key: "iOpa", data: Uint8Array.from([Math.round(Math.max(0, layer.fillOpacity) * 255), 0, 0, 0]) });
|
|
@@ -7109,7 +7166,7 @@ function paintCoverageInto(base, coverage, apply, rects) {
|
|
|
7109
7166
|
const key = _chunkZOOEX3WTcjs.tileKey.call(void 0, t.tx, t.ty);
|
|
7110
7167
|
if (done.has(key)) continue;
|
|
7111
7168
|
done.add(key);
|
|
7112
|
-
const src = _nullishCoalesce(_optionalChain([base, 'access',
|
|
7169
|
+
const src = _nullishCoalesce(_optionalChain([base, 'access', _123 => _123.tiles, 'access', _124 => _124.get, 'call', _125 => _125(key), 'optionalAccess', _126 => _126.data]), () => ( defaultTile(base)));
|
|
7113
7170
|
const data = _chunk4F3YDIWWcjs.applyStrokeToTile.call(void 0, coverage, src, base.channels, t.tx, t.ty, apply);
|
|
7114
7171
|
const tile = _chunkZOOEX3WTcjs.finishTile.call(void 0, data, base.channels, base.defaultValue);
|
|
7115
7172
|
if (tile) tiles.set(key, tile);
|
|
@@ -7164,8 +7221,8 @@ var PaintStrokeSession = (_class6 = class {
|
|
|
7164
7221
|
}
|
|
7165
7222
|
}
|
|
7166
7223
|
for (const [key, { tx, ty, r }] of regions) {
|
|
7167
|
-
const src = _nullishCoalesce(_optionalChain([this, 'access',
|
|
7168
|
-
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;
|
|
7169
7226
|
this.touched.add(key);
|
|
7170
7227
|
const data = _chunk4F3YDIWWcjs.applyStrokeToTile.call(void 0, this.stroke.coverage, src, ch, tx, ty, this.apply, prev ? { into: prev, region: r } : {});
|
|
7171
7228
|
this.live.set(key, { data, uniform: null });
|
|
@@ -7236,14 +7293,14 @@ function migrateSerializedImageEditorState(data) {
|
|
|
7236
7293
|
const legacy = data;
|
|
7237
7294
|
const adjustments = normalizeStoredAdjustments(legacy.adjustments);
|
|
7238
7295
|
return {
|
|
7239
|
-
version: _optionalChain([adjustments, 'access',
|
|
7296
|
+
version: _optionalChain([adjustments, 'access', _136 => _136.layers, 'optionalAccess', _137 => _137.length]) ? 2 : 1,
|
|
7240
7297
|
crop: legacy.crop ? { ...legacy.crop } : null,
|
|
7241
7298
|
transform: { ...DEFAULT_TRANSFORM, ...legacy.transform },
|
|
7242
7299
|
adjustments: serializeAdjustments(adjustments),
|
|
7243
7300
|
depthMask: {
|
|
7244
7301
|
...DEFAULT_DEPTH_MASK,
|
|
7245
7302
|
...legacy.depthMask,
|
|
7246
|
-
depthRange: [..._nullishCoalesce(_optionalChain([legacy, 'access',
|
|
7303
|
+
depthRange: [..._nullishCoalesce(_optionalChain([legacy, 'access', _138 => _138.depthMask, 'optionalAccess', _139 => _139.depthRange]), () => ( DEFAULT_DEPTH_MASK.depthRange))]
|
|
7247
7304
|
},
|
|
7248
7305
|
annotations: JSON.parse(JSON.stringify(_nullishCoalesce(legacy.annotations, () => ( [])))),
|
|
7249
7306
|
...legacy.selection ? { selection: { ...legacy.selection } } : {}
|
|
@@ -7305,7 +7362,8 @@ var ImageEditorController = (_class7 = class {
|
|
|
7305
7362
|
this.renderer.layerSources = {
|
|
7306
7363
|
surfaceOf: (layer) => this.surfaceOf(layer),
|
|
7307
7364
|
sourceIsOpaque: () => this.sourceIsOpaque(),
|
|
7308
|
-
version: () => this.sourceVersion()
|
|
7365
|
+
version: () => this.sourceVersion(),
|
|
7366
|
+
globalLight: () => this.state.globalLight
|
|
7309
7367
|
};
|
|
7310
7368
|
this.state = {
|
|
7311
7369
|
sourceUrl: typeof options.image === "string" ? options.image : null,
|
|
@@ -7338,10 +7396,10 @@ var ImageEditorController = (_class7 = class {
|
|
|
7338
7396
|
};
|
|
7339
7397
|
}
|
|
7340
7398
|
this.applyStored(_nullishCoalesce(options.initialState, () => ( {})));
|
|
7341
|
-
if (_optionalChain([options, 'access',
|
|
7399
|
+
if (_optionalChain([options, 'access', _140 => _140.initialState, 'optionalAccess', _141 => _141.selection])) {
|
|
7342
7400
|
try {
|
|
7343
7401
|
this.state.selection = normalizeSelection(deserializeSelection(options.initialState.selection));
|
|
7344
|
-
} catch (
|
|
7402
|
+
} catch (e17) {
|
|
7345
7403
|
}
|
|
7346
7404
|
}
|
|
7347
7405
|
this.initialSnapshot = this.captureHistoryEntry();
|
|
@@ -7382,7 +7440,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7382
7440
|
height: img.naturalHeight || img.height || 600
|
|
7383
7441
|
}
|
|
7384
7442
|
};
|
|
7385
|
-
} catch (
|
|
7443
|
+
} catch (e18) {
|
|
7386
7444
|
return { sourceUrl: src, element: null, dimensions: { ...this.state.imageDimensions } };
|
|
7387
7445
|
}
|
|
7388
7446
|
}
|
|
@@ -7421,7 +7479,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7421
7479
|
else if (!strokeRects) this.pendingDirty = "all";
|
|
7422
7480
|
this.syncViews();
|
|
7423
7481
|
const currentState = { ...this.state };
|
|
7424
|
-
_optionalChain([this, 'access',
|
|
7482
|
+
_optionalChain([this, 'access', _142 => _142.onStateChange, 'optionalCall', _143 => _143(currentState)]);
|
|
7425
7483
|
this.listeners.forEach((l) => l(currentState));
|
|
7426
7484
|
}
|
|
7427
7485
|
/** Recomputes the compatibility views (`adjustments`, `depthMask`, `annotations`) when the stack changed. */
|
|
@@ -7459,6 +7517,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7459
7517
|
}
|
|
7460
7518
|
};
|
|
7461
7519
|
if (s.legacyOutputBlur !== void 0) entry.legacyOutputBlur = s.legacyOutputBlur;
|
|
7520
|
+
if (s.globalLight) entry.globalLight = { ...s.globalLight };
|
|
7462
7521
|
return entry;
|
|
7463
7522
|
}
|
|
7464
7523
|
restoreHistoryEntry(entry) {
|
|
@@ -7471,6 +7530,8 @@ var ImageEditorController = (_class7 = class {
|
|
|
7471
7530
|
s.outputOpacity = entry.outputOpacity;
|
|
7472
7531
|
if (entry.legacyOutputBlur !== void 0) s.legacyOutputBlur = entry.legacyOutputBlur;
|
|
7473
7532
|
else delete s.legacyOutputBlur;
|
|
7533
|
+
if (entry.globalLight) s.globalLight = { ...entry.globalLight };
|
|
7534
|
+
else delete s.globalLight;
|
|
7474
7535
|
s.selection = entry.selection;
|
|
7475
7536
|
if (this.imageElement !== entry.source.element && !this.samplePixelsOverride) this.samplePixels = null;
|
|
7476
7537
|
this.imageElement = entry.source.element;
|
|
@@ -7626,7 +7687,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7626
7687
|
return this.state.layers;
|
|
7627
7688
|
}
|
|
7628
7689
|
getLayer(id) {
|
|
7629
|
-
return _optionalChain([
|
|
7690
|
+
return _optionalChain([_chunk73L6TROJcjs.findLayer.call(void 0, this.state.layers, id), 'optionalAccess', _144 => _144.layer]);
|
|
7630
7691
|
}
|
|
7631
7692
|
/** The active layer, or `undefined`. */
|
|
7632
7693
|
getActiveLayer() {
|
|
@@ -7639,7 +7700,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7639
7700
|
setActiveLayer(id, target = "pixels") {
|
|
7640
7701
|
if (id !== null && !this.getLayer(id)) return false;
|
|
7641
7702
|
const layer = id ? this.getLayer(id) : void 0;
|
|
7642
|
-
const t = target === "mask" && _optionalChain([layer, 'optionalAccess',
|
|
7703
|
+
const t = target === "mask" && _optionalChain([layer, 'optionalAccess', _145 => _145.mask]) ? "mask" : "pixels";
|
|
7643
7704
|
if (this.state.activeLayerId === id && this.state.activeTarget === t) return true;
|
|
7644
7705
|
this.state.activeLayerId = id;
|
|
7645
7706
|
this.state.activeTarget = t;
|
|
@@ -7685,14 +7746,14 @@ var ImageEditorController = (_class7 = class {
|
|
|
7685
7746
|
let layers = this.state.layers;
|
|
7686
7747
|
if (options.layerIds) {
|
|
7687
7748
|
const keep = new Set(options.layerIds);
|
|
7688
|
-
layers =
|
|
7749
|
+
layers = _chunk73L6TROJcjs.flattenLayers.call(void 0, layers).filter((l) => keep.has(l.id) && l.type !== "group");
|
|
7689
7750
|
}
|
|
7690
7751
|
const data = this.compositor.composite(layers, r, this.compositorSources());
|
|
7691
7752
|
return { width: r.width, height: r.height, data };
|
|
7692
7753
|
}
|
|
7693
7754
|
compositorSources() {
|
|
7694
7755
|
const { width, height } = this.naturalSize;
|
|
7695
|
-
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 };
|
|
7696
7757
|
}
|
|
7697
7758
|
__init44() {this.sourceIds = /* @__PURE__ */ new WeakMap()}
|
|
7698
7759
|
__init45() {this.nextSourceId = 1}
|
|
@@ -7768,9 +7829,9 @@ var ImageEditorController = (_class7 = class {
|
|
|
7768
7829
|
if (!ctx || typeof ctx.getImageData !== "function") return null;
|
|
7769
7830
|
ctx.drawImage(el, 0, 0, width, height);
|
|
7770
7831
|
const data = ctx.getImageData(0, 0, width, height);
|
|
7771
|
-
if (!_optionalChain([data, 'optionalAccess',
|
|
7832
|
+
if (!_optionalChain([data, 'optionalAccess', _146 => _146.data]) || data.data.length < width * height * 4) return null;
|
|
7772
7833
|
return { width, height, data: data.data };
|
|
7773
|
-
} catch (
|
|
7834
|
+
} catch (e19) {
|
|
7774
7835
|
return null;
|
|
7775
7836
|
}
|
|
7776
7837
|
}
|
|
@@ -7779,8 +7840,8 @@ var ImageEditorController = (_class7 = class {
|
|
|
7779
7840
|
commitLayers(next, extra, commitToHistory = true) {
|
|
7780
7841
|
if (commitToHistory) this.recordHistory();
|
|
7781
7842
|
this.state.layers = next;
|
|
7782
|
-
_optionalChain([extra, 'optionalCall',
|
|
7783
|
-
if (this.state.activeLayerId && !
|
|
7843
|
+
_optionalChain([extra, 'optionalCall', _147 => _147()]);
|
|
7844
|
+
if (this.state.activeLayerId && !_chunk73L6TROJcjs.findLayer.call(void 0, next, this.state.activeLayerId)) {
|
|
7784
7845
|
this.state.activeLayerId = null;
|
|
7785
7846
|
this.state.activeTarget = "pixels";
|
|
7786
7847
|
}
|
|
@@ -7789,7 +7850,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7789
7850
|
/** The default position of a new layer: above the active layer, else the top of the stack. */
|
|
7790
7851
|
newLayerPlacement(placement) {
|
|
7791
7852
|
if (placement.aboveId || placement.belowId || placement.parentId || placement.index !== void 0) return placement;
|
|
7792
|
-
const active = this.state.activeLayerId ?
|
|
7853
|
+
const active = this.state.activeLayerId ? _chunk73L6TROJcjs.findLayer.call(void 0, this.state.layers, this.state.activeLayerId) : null;
|
|
7793
7854
|
return active ? { aboveId: active.layer.id } : {};
|
|
7794
7855
|
}
|
|
7795
7856
|
/**
|
|
@@ -7812,11 +7873,11 @@ var ImageEditorController = (_class7 = class {
|
|
|
7812
7873
|
}
|
|
7813
7874
|
const blend = parseBlend(init.blend);
|
|
7814
7875
|
if (init.opacity !== void 0 && !(init.opacity >= 0 && init.opacity <= 1)) throw new LayerOperationError("opacity must be from 0 to 1.");
|
|
7815
|
-
const ids = new Set(
|
|
7876
|
+
const ids = new Set(_chunk73L6TROJcjs.flattenLayers.call(void 0, this.state.layers).map((l) => l.id));
|
|
7816
7877
|
const layer = {
|
|
7817
7878
|
type: "pixel",
|
|
7818
7879
|
id: init.id && !ids.has(init.id) ? init.id : newLayerId(),
|
|
7819
|
-
name: _optionalChain([init, 'access',
|
|
7880
|
+
name: _optionalChain([init, 'access', _148 => _148.name, 'optionalAccess', _149 => _149.trim, 'call', _150 => _150()]) || this.nextLayerName(),
|
|
7820
7881
|
visible: _nullishCoalesce(init.visible, () => ( true)),
|
|
7821
7882
|
opacity: _nullishCoalesce(init.opacity, () => ( 1)),
|
|
7822
7883
|
blend: _nullishCoalesce(blend, () => ( "normal")),
|
|
@@ -7843,27 +7904,27 @@ var ImageEditorController = (_class7 = class {
|
|
|
7843
7904
|
async decodeImage(image) {
|
|
7844
7905
|
const trimmed = image.trim();
|
|
7845
7906
|
let png = null;
|
|
7846
|
-
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));
|
|
7847
7908
|
else if (/^[A-Za-z0-9+/=\s]+$/.test(trimmed) && trimmed.length > 16) {
|
|
7848
7909
|
try {
|
|
7849
|
-
const bytes =
|
|
7850
|
-
if (
|
|
7851
|
-
} catch (
|
|
7910
|
+
const bytes = _chunk73L6TROJcjs.base64ToBytes.call(void 0, trimmed);
|
|
7911
|
+
if (_chunk73L6TROJcjs.isPng.call(void 0, bytes)) png = bytes;
|
|
7912
|
+
} catch (e20) {
|
|
7852
7913
|
png = null;
|
|
7853
7914
|
}
|
|
7854
7915
|
}
|
|
7855
7916
|
if (png) {
|
|
7856
7917
|
try {
|
|
7857
|
-
const d =
|
|
7918
|
+
const d = _chunk73L6TROJcjs.decodePng.call(void 0, png);
|
|
7858
7919
|
return { width: d.width, height: d.height, data: d.data };
|
|
7859
|
-
} catch (
|
|
7920
|
+
} catch (e21) {
|
|
7860
7921
|
}
|
|
7861
7922
|
}
|
|
7862
|
-
const src = png ? `data:image/png;base64,${
|
|
7923
|
+
const src = png ? `data:image/png;base64,${_chunk73L6TROJcjs.bytesToBase64.call(void 0, png)}` : trimmed;
|
|
7863
7924
|
let img;
|
|
7864
7925
|
try {
|
|
7865
7926
|
img = await this.renderer.imageCache.get(src);
|
|
7866
|
-
} catch (
|
|
7927
|
+
} catch (e22) {
|
|
7867
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.");
|
|
7868
7929
|
}
|
|
7869
7930
|
const w = img.naturalWidth || img.width;
|
|
@@ -7875,7 +7936,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7875
7936
|
return { width: w, height: h, data: data.data };
|
|
7876
7937
|
}
|
|
7877
7938
|
nextLayerName() {
|
|
7878
|
-
const names = new Set(
|
|
7939
|
+
const names = new Set(_chunk73L6TROJcjs.flattenLayers.call(void 0, this.state.layers).map((l) => l.name));
|
|
7879
7940
|
let n = 1;
|
|
7880
7941
|
while (names.has(`Layer ${n}`)) n++;
|
|
7881
7942
|
return `Layer ${n}`;
|
|
@@ -7892,7 +7953,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7892
7953
|
removeLayer(id) {
|
|
7893
7954
|
const next = removeLayer(this.state.layers, id);
|
|
7894
7955
|
this.commitLayers(next, () => {
|
|
7895
|
-
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)) {
|
|
7896
7957
|
this.state.selectedAnnotationId = null;
|
|
7897
7958
|
}
|
|
7898
7959
|
});
|
|
@@ -7900,10 +7961,10 @@ var ImageEditorController = (_class7 = class {
|
|
|
7900
7961
|
/** Moves a layer above / below another, or into a group, as one undo step. Returns its new parent and index. */
|
|
7901
7962
|
moveLayer(id, placement) {
|
|
7902
7963
|
const next = moveLayer(this.state.layers, id, placement);
|
|
7903
|
-
const loc =
|
|
7904
|
-
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 };
|
|
7905
7966
|
this.commitLayers(next);
|
|
7906
|
-
return { parentId: _nullishCoalesce(_optionalChain([loc, 'access',
|
|
7967
|
+
return { parentId: _nullishCoalesce(_optionalChain([loc, 'access', _154 => _154.parent, 'optionalAccess', _155 => _155.id]), () => ( null)), index: loc.index };
|
|
7907
7968
|
}
|
|
7908
7969
|
/**
|
|
7909
7970
|
* Changes name, visibility, opacity, fill, blend, clipping, locks or (groups) collapsed state, as
|
|
@@ -7912,7 +7973,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7912
7973
|
setLayerProperties(id, props, commitToHistory = true) {
|
|
7913
7974
|
const next = setLayerProperties(this.state.layers, id, props);
|
|
7914
7975
|
this.commitLayers(next, void 0, commitToHistory);
|
|
7915
|
-
return
|
|
7976
|
+
return _chunk73L6TROJcjs.findLayer.call(void 0, next, id).layer;
|
|
7916
7977
|
}
|
|
7917
7978
|
/** Adds an empty pass-through group above the active layer (or at `placement`) and makes it active. Returns its id. */
|
|
7918
7979
|
addGroup(init = {}) {
|
|
@@ -7920,7 +7981,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7920
7981
|
const group = {
|
|
7921
7982
|
type: "group",
|
|
7922
7983
|
id: newLayerId("group"),
|
|
7923
|
-
name: _optionalChain([init, 'access',
|
|
7984
|
+
name: _optionalChain([init, 'access', _156 => _156.name, 'optionalAccess', _157 => _157.trim, 'call', _158 => _158()]) || "Group",
|
|
7924
7985
|
visible: true,
|
|
7925
7986
|
opacity: 1,
|
|
7926
7987
|
blend,
|
|
@@ -7970,7 +8031,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7970
8031
|
let mask;
|
|
7971
8032
|
if (from === "selection") {
|
|
7972
8033
|
const sel = this.state.selection;
|
|
7973
|
-
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.");
|
|
7974
8035
|
mask = this.maskFromSelection(sel, props);
|
|
7975
8036
|
if (layer.type === "pixel" && (layer.offset.x || layer.offset.y)) {
|
|
7976
8037
|
mask = { ...mask, surface: _chunkZOOEX3WTcjs.translateSurface.call(void 0, mask.surface, -layer.offset.x, -layer.offset.y) };
|
|
@@ -8033,7 +8094,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8033
8094
|
const next = { ...layer, surface: out };
|
|
8034
8095
|
delete next.mask;
|
|
8035
8096
|
delete next.source;
|
|
8036
|
-
this.commitLayers(
|
|
8097
|
+
this.commitLayers(_chunk73L6TROJcjs.mapLayer.call(void 0, this.state.layers, id, () => next), () => {
|
|
8037
8098
|
if (this.state.activeLayerId === id) this.state.activeTarget = "pixels";
|
|
8038
8099
|
});
|
|
8039
8100
|
}
|
|
@@ -8048,7 +8109,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8048
8109
|
const layer = loc.layer;
|
|
8049
8110
|
if (layer.type !== "pixel") throw new LayerOperationError(`Layer via copy needs a pixel layer; "${id}" is a ${layer.type} layer.`);
|
|
8050
8111
|
const sel = this.state.selection;
|
|
8051
|
-
if (!_optionalChain([sel, 'optionalAccess',
|
|
8112
|
+
if (!_optionalChain([sel, 'optionalAccess', _160 => _160.bounds])) throw new LayerOperationError("Nothing is selected; select the pixels to copy first.");
|
|
8052
8113
|
if (options.cut) requireUnlocked(layer, "pixels", "cut from it");
|
|
8053
8114
|
const surface = this.surfaceOf(layer);
|
|
8054
8115
|
const sb = sel.bounds;
|
|
@@ -8066,18 +8127,18 @@ var ImageEditorController = (_class7 = class {
|
|
|
8066
8127
|
const copy = {
|
|
8067
8128
|
type: "pixel",
|
|
8068
8129
|
id: newLayerId(),
|
|
8069
|
-
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"}`,
|
|
8070
8131
|
visible: true,
|
|
8071
8132
|
opacity: 1,
|
|
8072
8133
|
blend: "normal",
|
|
8073
8134
|
surface: _chunkZOOEX3WTcjs.surfaceFromPixels.call(void 0, { width: src.width, height: src.height, data: px }, 4, src.x, src.y),
|
|
8074
8135
|
offset: { ...layer.offset }
|
|
8075
8136
|
};
|
|
8076
|
-
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);
|
|
8077
8138
|
if (kept) {
|
|
8078
8139
|
const cutLayer = { ...layer, surface: _chunkZOOEX3WTcjs.writeRegion.call(void 0, surface, src, kept) };
|
|
8079
8140
|
delete cutLayer.source;
|
|
8080
|
-
next =
|
|
8141
|
+
next = _chunk73L6TROJcjs.mapLayer.call(void 0, next, id, () => cutLayer);
|
|
8081
8142
|
}
|
|
8082
8143
|
this.commitLayers(next, () => {
|
|
8083
8144
|
this.state.activeLayerId = copy.id;
|
|
@@ -8090,24 +8151,73 @@ var ImageEditorController = (_class7 = class {
|
|
|
8090
8151
|
const f = normalizeFilter(filter);
|
|
8091
8152
|
const next = addLayerFilter(this.state.layers, id, f);
|
|
8092
8153
|
this.commitLayers(next);
|
|
8093
|
-
return _nullishCoalesce(
|
|
8154
|
+
return _nullishCoalesce(_chunk73L6TROJcjs.findLayer.call(void 0, next, id).layer.filters, () => ( []));
|
|
8094
8155
|
}
|
|
8095
8156
|
/** Changes one filter (one undo step, or none with `commitToHistory = false` during a drag). Returns the filters. */
|
|
8096
8157
|
updateLayerFilter(id, filterId, changes, commitToHistory = true) {
|
|
8097
8158
|
const next = updateLayerFilter(this.state.layers, id, filterId, changes);
|
|
8098
8159
|
this.commitLayers(next, void 0, commitToHistory);
|
|
8099
|
-
return _nullishCoalesce(
|
|
8160
|
+
return _nullishCoalesce(_chunk73L6TROJcjs.findLayer.call(void 0, next, id).layer.filters, () => ( []));
|
|
8100
8161
|
}
|
|
8101
8162
|
/** Removes one filter (one undo step). Returns the remaining filters. */
|
|
8102
8163
|
removeLayerFilter(id, filterId) {
|
|
8103
8164
|
const next = removeLayerFilter(this.state.layers, id, filterId);
|
|
8104
8165
|
this.commitLayers(next);
|
|
8105
|
-
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();
|
|
8106
8216
|
}
|
|
8107
8217
|
/** Composites `layers` (in isolation) over `rect` into a surface, loading depth maps first. */
|
|
8108
8218
|
async compositeToSurface(layers, rect) {
|
|
8109
8219
|
const { width, height } = this.naturalSize;
|
|
8110
|
-
if (
|
|
8220
|
+
if (_chunk73L6TROJcjs.flattenLayers.call(void 0, layers).some((l) => l.type === "annotation" && l.visible) && !this.renderer.canRasterize()) {
|
|
8111
8221
|
throw new LayerOperationError("Merging annotation layers needs a canvas (a browser); hide or delete them first, or merge in the browser.");
|
|
8112
8222
|
}
|
|
8113
8223
|
await this.renderer.prepareLayerAssets(layers, width, height);
|
|
@@ -8133,7 +8243,8 @@ var ImageEditorController = (_class7 = class {
|
|
|
8133
8243
|
}
|
|
8134
8244
|
/**
|
|
8135
8245
|
* Merge Down: composites a layer onto the pixel layer directly below it (which keeps its name,
|
|
8136
|
-
* 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.
|
|
8137
8248
|
*/
|
|
8138
8249
|
async mergeDown(id) {
|
|
8139
8250
|
const loc = requireLayer(this.state.layers, id);
|
|
@@ -8145,7 +8256,9 @@ var ImageEditorController = (_class7 = class {
|
|
|
8145
8256
|
if (!upper.visible) throw new LayerOperationError(`Layer "${upper.name || id}" is hidden; show it or delete it instead of merging.`);
|
|
8146
8257
|
requireUnlocked(upper, "all", "merge it");
|
|
8147
8258
|
requireUnlocked(lower, "pixels", "merge into it");
|
|
8148
|
-
|
|
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 };
|
|
8149
8262
|
const base = { ...lower, blend: "normal", opacity: 1 };
|
|
8150
8263
|
delete base.clipped;
|
|
8151
8264
|
const surface = await this.compositeToSurface([base, upper], rect);
|
|
@@ -8154,8 +8267,9 @@ var ImageEditorController = (_class7 = class {
|
|
|
8154
8267
|
delete merged.fillOpacity;
|
|
8155
8268
|
delete merged.filters;
|
|
8156
8269
|
delete merged.source;
|
|
8157
|
-
|
|
8158
|
-
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);
|
|
8159
8273
|
this.commitLayers(next, () => {
|
|
8160
8274
|
this.state.activeLayerId = merged.id;
|
|
8161
8275
|
this.state.activeTarget = "pixels";
|
|
@@ -8231,7 +8345,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8231
8345
|
const oy = layer.type === "pixel" ? layer.offset.y : 0;
|
|
8232
8346
|
const key = `${tw}x${th}:${ox},${oy}`;
|
|
8233
8347
|
let byKey = this.thumbCache.get(surface);
|
|
8234
|
-
const hit = _optionalChain([byKey, 'optionalAccess',
|
|
8348
|
+
const hit = _optionalChain([byKey, 'optionalAccess', _166 => _166.get, 'call', _167 => _167(key)]);
|
|
8235
8349
|
if (hit) return hit;
|
|
8236
8350
|
const out = new Uint8ClampedArray(tw * th * 4);
|
|
8237
8351
|
for (let y = 0; y < th; y++) {
|
|
@@ -8293,7 +8407,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8293
8407
|
if (!layer.visible) throw new LayerOperationError(`Layer "${layer.name || id}" is hidden; show it before you ${action}.`);
|
|
8294
8408
|
const offset = layer.type === "pixel" ? layer.offset : { x: 0, y: 0 };
|
|
8295
8409
|
const surface = ch === "mask" ? layer.mask.surface : this.surfaceOf(layer);
|
|
8296
|
-
const lockTransparency = ch === "pixels" && Boolean(_optionalChain([layer, 'access',
|
|
8410
|
+
const lockTransparency = ch === "pixels" && Boolean(_optionalChain([layer, 'access', _168 => _168.locks, 'optionalAccess', _169 => _169.transparency]));
|
|
8297
8411
|
return { id, layer, channel: ch, offset, surface, lockTransparency };
|
|
8298
8412
|
}
|
|
8299
8413
|
/** The layer with its pixels (or mask) replaced by `surface`. */
|
|
@@ -8326,19 +8440,19 @@ var ImageEditorController = (_class7 = class {
|
|
|
8326
8440
|
opacity: brush.opacity,
|
|
8327
8441
|
blend: target.channel === "mask" ? "normal" : brush.blend,
|
|
8328
8442
|
lockTransparency: target.lockTransparency,
|
|
8329
|
-
selection: _optionalChain([this, 'access',
|
|
8443
|
+
selection: _optionalChain([this, 'access', _170 => _170.state, 'access', _171 => _171.selection, 'optionalAccess', _172 => _172.bounds]) ? this.state.selection : null,
|
|
8330
8444
|
offset: target.offset
|
|
8331
8445
|
};
|
|
8332
8446
|
return new PaintStrokeSession(this, target, new (0, _chunk4F3YDIWWcjs.StrokeCoverage)(brush), apply);
|
|
8333
8447
|
}
|
|
8334
8448
|
/** @internal Shows a stroke's live surface (no history). */
|
|
8335
8449
|
_strokeUpdate(layerId, channel, surface, rects) {
|
|
8336
|
-
this.state.layers =
|
|
8450
|
+
this.state.layers = _chunk73L6TROJcjs.mapLayer.call(void 0, this.state.layers, layerId, (l) => this.withSurface(l, channel, surface));
|
|
8337
8451
|
this.notify(rects);
|
|
8338
8452
|
}
|
|
8339
8453
|
/** @internal Commits a finished stroke as one undo step (`before` is the pre-stroke state). */
|
|
8340
8454
|
_strokeCommit(before, layerId, channel, surface) {
|
|
8341
|
-
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));
|
|
8342
8456
|
else this.state.layers = before.layers;
|
|
8343
8457
|
if (surface && !this.isApplyingHistory) {
|
|
8344
8458
|
this.undoStack.push(before);
|
|
@@ -8360,7 +8474,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8360
8474
|
paintStroke(init) {
|
|
8361
8475
|
if (!Array.isArray(init.points) || !init.points.length) throw new LayerOperationError("points must hold at least one { x, y } point.");
|
|
8362
8476
|
for (const p of init.points) {
|
|
8363
|
-
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).");
|
|
8364
8478
|
}
|
|
8365
8479
|
const session = this.beginStroke(init);
|
|
8366
8480
|
session.push(init.points);
|
|
@@ -8388,8 +8502,8 @@ var ImageEditorController = (_class7 = class {
|
|
|
8388
8502
|
const opacity = _nullishCoalesce(options.opacity, () => ( 1));
|
|
8389
8503
|
if (!(opacity >= 0 && opacity <= 1)) throw new LayerOperationError("opacity must be from 0 to 1.");
|
|
8390
8504
|
const blend = _nullishCoalesce(parseBlend(options.blend), () => ( "normal"));
|
|
8391
|
-
const sel = options.useSelection !== false && _optionalChain([this, 'access',
|
|
8392
|
-
const region = _nullishCoalesce(_optionalChain([sel, 'optionalAccess',
|
|
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 }));
|
|
8393
8507
|
const coverage = new (0, _chunk4F3YDIWWcjs.CoverageMap)();
|
|
8394
8508
|
const ones = new Float32Array(region.width * region.height);
|
|
8395
8509
|
if (sel) {
|
|
@@ -8415,7 +8529,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8415
8529
|
offset: target.offset
|
|
8416
8530
|
};
|
|
8417
8531
|
const surface = paintCoverageInto(target.surface, coverage, apply, [region]);
|
|
8418
|
-
const next =
|
|
8532
|
+
const next = _chunk73L6TROJcjs.mapLayer.call(void 0, this.state.layers, target.id, (l) => this.withSurface(l, target.channel, surface));
|
|
8419
8533
|
this.commitLayers(next);
|
|
8420
8534
|
return { layerId: target.id, channel: target.channel, bounds: region, dabs: 0 };
|
|
8421
8535
|
}
|
|
@@ -8437,12 +8551,12 @@ var ImageEditorController = (_class7 = class {
|
|
|
8437
8551
|
const target = this.developLayer();
|
|
8438
8552
|
let layers = this.state.layers;
|
|
8439
8553
|
if (target && (DEVELOP_KEYS.some((k) => k in partial) || "process" in partial)) {
|
|
8440
|
-
layers =
|
|
8554
|
+
layers = _chunk73L6TROJcjs.mapLayer.call(void 0, layers, target.id, (l) => withDevelop(l, partial));
|
|
8441
8555
|
}
|
|
8442
8556
|
if ("blur" in partial && typeof partial.blur === "number") {
|
|
8443
8557
|
const blur = Math.max(0, partial.blur);
|
|
8444
8558
|
if (this.state.legacyOutputBlur !== void 0) this.state.legacyOutputBlur = blur;
|
|
8445
|
-
else if (target) layers =
|
|
8559
|
+
else if (target) layers = _chunk73L6TROJcjs.mapLayer.call(void 0, layers, target.id, (l) => withBlur(l, blur));
|
|
8446
8560
|
}
|
|
8447
8561
|
if ("opacity" in partial && typeof partial.opacity === "number") {
|
|
8448
8562
|
this.state.outputOpacity = Math.min(1, Math.max(0, partial.opacity));
|
|
@@ -8472,7 +8586,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8472
8586
|
this.recordHistory();
|
|
8473
8587
|
const target = this.developLayer();
|
|
8474
8588
|
if (target) {
|
|
8475
|
-
this.state.layers =
|
|
8589
|
+
this.state.layers = _chunk73L6TROJcjs.mapLayer.call(void 0,
|
|
8476
8590
|
this.state.layers,
|
|
8477
8591
|
target.id,
|
|
8478
8592
|
(l) => withBlur(withDevelop(l, { ...DEFAULT_ADJUSTMENTS, process: LATEST_PROCESS_VERSION }), 0)
|
|
@@ -8492,7 +8606,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8492
8606
|
return this.getAdjustmentLayers().find((l) => l.id === id);
|
|
8493
8607
|
}
|
|
8494
8608
|
adjustmentNodes(layers = this.state.layers) {
|
|
8495
|
-
return
|
|
8609
|
+
return _chunk73L6TROJcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "adjustment");
|
|
8496
8610
|
}
|
|
8497
8611
|
/**
|
|
8498
8612
|
* Where a new layer goes when no position is given: directly above the topmost layer that is
|
|
@@ -8506,26 +8620,26 @@ var ImageEditorController = (_class7 = class {
|
|
|
8506
8620
|
/** Inserts `node` by `aboveId` / `parentId` / adjustment index / default position. */
|
|
8507
8621
|
placeLayer(layers, node, where) {
|
|
8508
8622
|
if (where.aboveId) {
|
|
8509
|
-
const loc =
|
|
8510
|
-
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);
|
|
8511
8625
|
}
|
|
8512
8626
|
if (where.parentId) {
|
|
8513
|
-
const loc =
|
|
8514
|
-
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);
|
|
8515
8629
|
}
|
|
8516
8630
|
if (where.adjustmentIndex !== void 0) {
|
|
8517
8631
|
const nodes = this.adjustmentNodes(layers);
|
|
8518
8632
|
const at = Math.max(0, Math.min(nodes.length, Math.round(where.adjustmentIndex)));
|
|
8519
8633
|
if (at < nodes.length) {
|
|
8520
|
-
const loc =
|
|
8521
|
-
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);
|
|
8522
8636
|
}
|
|
8523
8637
|
if (nodes.length) {
|
|
8524
|
-
const loc =
|
|
8525
|
-
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);
|
|
8526
8640
|
}
|
|
8527
8641
|
}
|
|
8528
|
-
return
|
|
8642
|
+
return _chunk73L6TROJcjs.insertLayer.call(void 0, layers, node, null, this.defaultInsertIndex(layers));
|
|
8529
8643
|
}
|
|
8530
8644
|
/** `setAdjustments({ layers })`: updates nodes by id in place, removes missing ones, adds new ones. */
|
|
8531
8645
|
replaceAdjustmentNodes(layers, next) {
|
|
@@ -8534,7 +8648,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8534
8648
|
let out = layers;
|
|
8535
8649
|
for (const node of this.adjustmentNodes(layers)) {
|
|
8536
8650
|
const update = byId.get(node.id);
|
|
8537
|
-
out =
|
|
8651
|
+
out = _chunk73L6TROJcjs.mapLayer.call(void 0, out, node.id, () => update ? mergeAdjustmentNode(node, update, width, height) : null);
|
|
8538
8652
|
}
|
|
8539
8653
|
const existing = new Set(this.adjustmentNodes(out).map((n) => n.id));
|
|
8540
8654
|
for (const l of next) {
|
|
@@ -8553,7 +8667,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8553
8667
|
*/
|
|
8554
8668
|
addAdjustmentLayer(init, index) {
|
|
8555
8669
|
const spec = typeof init === "string" ? { kind: init } : init;
|
|
8556
|
-
const ids = new Set(
|
|
8670
|
+
const ids = new Set(_chunk73L6TROJcjs.flattenLayers.call(void 0, this.state.layers).map((l) => l.id));
|
|
8557
8671
|
const layer = createAdjustmentLayer(spec.kind, {
|
|
8558
8672
|
id: spec.id && !ids.has(spec.id) ? spec.id : void 0,
|
|
8559
8673
|
name: spec.name,
|
|
@@ -8582,7 +8696,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8582
8696
|
* Returns false for an unknown id.
|
|
8583
8697
|
*/
|
|
8584
8698
|
updateAdjustmentLayer(id, update, commitToHistory = true) {
|
|
8585
|
-
const loc =
|
|
8699
|
+
const loc = _chunk73L6TROJcjs.findLayer.call(void 0, this.state.layers, id);
|
|
8586
8700
|
if (!loc || loc.layer.type !== "adjustment") return false;
|
|
8587
8701
|
const { width, height } = this.naturalSize;
|
|
8588
8702
|
const node = loc.layer;
|
|
@@ -8610,16 +8724,16 @@ var ImageEditorController = (_class7 = class {
|
|
|
8610
8724
|
if (mask) next.mask = mask;
|
|
8611
8725
|
else delete next.mask;
|
|
8612
8726
|
}
|
|
8613
|
-
this.state.layers =
|
|
8727
|
+
this.state.layers = _chunk73L6TROJcjs.mapLayer.call(void 0, this.state.layers, id, () => next);
|
|
8614
8728
|
this.notify();
|
|
8615
8729
|
return true;
|
|
8616
8730
|
}
|
|
8617
8731
|
/** Removes a layer as one undo step. Returns false for an unknown id. */
|
|
8618
8732
|
removeAdjustmentLayer(id) {
|
|
8619
|
-
const loc =
|
|
8733
|
+
const loc = _chunk73L6TROJcjs.findLayer.call(void 0, this.state.layers, id);
|
|
8620
8734
|
if (!loc || loc.layer.type !== "adjustment") return false;
|
|
8621
8735
|
this.recordHistory();
|
|
8622
|
-
this.state.layers =
|
|
8736
|
+
this.state.layers = _chunk73L6TROJcjs.mapLayer.call(void 0, this.state.layers, id, () => null);
|
|
8623
8737
|
if (this.state.activeLayerId === id) this.state.activeLayerId = null;
|
|
8624
8738
|
this.notify();
|
|
8625
8739
|
return true;
|
|
@@ -8632,9 +8746,9 @@ var ImageEditorController = (_class7 = class {
|
|
|
8632
8746
|
if (to === from) return layers;
|
|
8633
8747
|
const node = nodes[from];
|
|
8634
8748
|
const anchor = nodes[to];
|
|
8635
|
-
const without =
|
|
8636
|
-
const loc =
|
|
8637
|
-
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);
|
|
8638
8752
|
}
|
|
8639
8753
|
/** Moves a layer to `toIndex` among the adjustment layers (0 = bottom) as one undo step. Returns false if nothing moved. */
|
|
8640
8754
|
moveAdjustmentLayer(id, toIndex) {
|
|
@@ -8659,7 +8773,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8659
8773
|
if (!nodes.length) return;
|
|
8660
8774
|
this.recordHistory();
|
|
8661
8775
|
let layers = this.state.layers;
|
|
8662
|
-
for (const n of nodes) layers =
|
|
8776
|
+
for (const n of nodes) layers = _chunk73L6TROJcjs.mapLayer.call(void 0, layers, n.id, () => null);
|
|
8663
8777
|
this.state.layers = layers;
|
|
8664
8778
|
if (nodes.some((n) => n.id === this.state.activeLayerId)) this.state.activeLayerId = null;
|
|
8665
8779
|
this.notify();
|
|
@@ -8670,7 +8784,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8670
8784
|
return _nullishCoalesce(this.state.selection, () => ( null));
|
|
8671
8785
|
}
|
|
8672
8786
|
get hasSelection() {
|
|
8673
|
-
return Boolean(_optionalChain([this, 'access',
|
|
8787
|
+
return Boolean(_optionalChain([this, 'access', _187 => _187.state, 'access', _188 => _188.selection, 'optionalAccess', _189 => _189.bounds]));
|
|
8674
8788
|
}
|
|
8675
8789
|
get naturalSize() {
|
|
8676
8790
|
return {
|
|
@@ -8760,13 +8874,13 @@ var ImageEditorController = (_class7 = class {
|
|
|
8760
8874
|
try {
|
|
8761
8875
|
const canvas = await this.renderSource();
|
|
8762
8876
|
const ctx = canvas.getContext("2d");
|
|
8763
|
-
const data2 = _optionalChain([ctx, 'optionalAccess',
|
|
8877
|
+
const data2 = _optionalChain([ctx, 'optionalAccess', _190 => _190.getImageData, 'optionalCall', _191 => _191(0, 0, width, height)]);
|
|
8764
8878
|
if (data2 && data2.data && data2.data.length >= width * height * 4) {
|
|
8765
8879
|
base = { width, height, data: data2.data };
|
|
8766
8880
|
this.samplePixels = base;
|
|
8767
8881
|
this.samplePixelsOverride = false;
|
|
8768
8882
|
}
|
|
8769
|
-
} catch (
|
|
8883
|
+
} catch (e23) {
|
|
8770
8884
|
base = null;
|
|
8771
8885
|
}
|
|
8772
8886
|
}
|
|
@@ -8826,7 +8940,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8826
8940
|
/** Select › Modify: grow, shrink, feather, border or smooth by `radius` pixels (one undo step). */
|
|
8827
8941
|
modifySelection(op, radius) {
|
|
8828
8942
|
const sel = this.state.selection;
|
|
8829
|
-
if (!_optionalChain([sel, 'optionalAccess',
|
|
8943
|
+
if (!_optionalChain([sel, 'optionalAccess', _192 => _192.bounds])) return false;
|
|
8830
8944
|
return this.setSelection(modifySelection(sel, op, radius));
|
|
8831
8945
|
}
|
|
8832
8946
|
/**
|
|
@@ -8835,7 +8949,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8835
8949
|
*/
|
|
8836
8950
|
async refineSelection(params, options = {}) {
|
|
8837
8951
|
const sel = this.state.selection;
|
|
8838
|
-
if (!_optionalChain([sel, 'optionalAccess',
|
|
8952
|
+
if (!_optionalChain([sel, 'optionalAccess', _193 => _193.bounds])) return false;
|
|
8839
8953
|
const pixels = (_nullishCoalesce(params.radius, () => ( 0))) > 0 ? await this.requirePixels(options) : null;
|
|
8840
8954
|
return this.setSelection(refineSelection(pixels, sel, params));
|
|
8841
8955
|
}
|
|
@@ -8852,7 +8966,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8852
8966
|
const canvas = this.renderer.createCanvas(w, h);
|
|
8853
8967
|
const ctx = canvas.getContext("2d");
|
|
8854
8968
|
if (ctx) ctx.drawImage(img, 0, 0, w, h);
|
|
8855
|
-
const data = _optionalChain([ctx, 'optionalAccess',
|
|
8969
|
+
const data = _optionalChain([ctx, 'optionalAccess', _194 => _194.getImageData, 'optionalCall', _195 => _195(0, 0, w, h)]);
|
|
8856
8970
|
if (!data) throw new Error("The mask image pixels are not available (no canvas access); pass pixels.");
|
|
8857
8971
|
pixels = { width: w, height: h, data: data.data };
|
|
8858
8972
|
} else {
|
|
@@ -8880,14 +8994,14 @@ var ImageEditorController = (_class7 = class {
|
|
|
8880
8994
|
*/
|
|
8881
8995
|
applySelectionAsLayerMask(layerId, props = {}) {
|
|
8882
8996
|
const sel = this.state.selection;
|
|
8883
|
-
if (!_optionalChain([sel, 'optionalAccess',
|
|
8997
|
+
if (!_optionalChain([sel, 'optionalAccess', _196 => _196.bounds]) || !this.getAdjustmentLayer(layerId)) return false;
|
|
8884
8998
|
return this.setLayerMask(layerId, this.maskFromSelection(sel, props));
|
|
8885
8999
|
}
|
|
8886
9000
|
setLayerMask(layerId, mask, commitToHistory = true) {
|
|
8887
|
-
const loc =
|
|
9001
|
+
const loc = _chunk73L6TROJcjs.findLayer.call(void 0, this.state.layers, layerId);
|
|
8888
9002
|
if (!loc) return false;
|
|
8889
9003
|
if (commitToHistory) this.recordHistory();
|
|
8890
|
-
this.state.layers =
|
|
9004
|
+
this.state.layers = _chunk73L6TROJcjs.mapLayer.call(void 0, this.state.layers, layerId, (l) => {
|
|
8891
9005
|
const next = { ...l };
|
|
8892
9006
|
if (mask) next.mask = mask;
|
|
8893
9007
|
else delete next.mask;
|
|
@@ -8911,7 +9025,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8911
9025
|
/** Load Selection from a layer mask (its pixels; density and feather are not applied). */
|
|
8912
9026
|
selectionFromLayerMask(layerId, mode = "replace") {
|
|
8913
9027
|
const layer = this.getLayer(layerId);
|
|
8914
|
-
if (!_optionalChain([layer, 'optionalAccess',
|
|
9028
|
+
if (!_optionalChain([layer, 'optionalAccess', _197 => _197.mask]) || layer.mask.source) return false;
|
|
8915
9029
|
const { width, height } = this.naturalSize;
|
|
8916
9030
|
const ox = layer.type === "pixel" ? layer.offset.x : 0;
|
|
8917
9031
|
const oy = layer.type === "pixel" ? layer.offset.y : 0;
|
|
@@ -8944,10 +9058,10 @@ var ImageEditorController = (_class7 = class {
|
|
|
8944
9058
|
if (target) {
|
|
8945
9059
|
const merged = { ...this.state.depthMask, ...partial };
|
|
8946
9060
|
merged.depthRange = [...merged.depthRange];
|
|
8947
|
-
this.state.layers =
|
|
9061
|
+
this.state.layers = _chunk73L6TROJcjs.mapLayer.call(void 0, this.state.layers, target.id, (l) => {
|
|
8948
9062
|
const next = { ...l };
|
|
8949
9063
|
if (isDefaultDepthMask(merged)) {
|
|
8950
|
-
if (_optionalChain([next, 'access',
|
|
9064
|
+
if (_optionalChain([next, 'access', _198 => _198.mask, 'optionalAccess', _199 => _199.source])) delete next.mask;
|
|
8951
9065
|
} else next.mask = depthRasterMask(merged);
|
|
8952
9066
|
return next;
|
|
8953
9067
|
});
|
|
@@ -8957,8 +9071,8 @@ var ImageEditorController = (_class7 = class {
|
|
|
8957
9071
|
resetDepthMask() {
|
|
8958
9072
|
this.recordHistory();
|
|
8959
9073
|
const target = this.developLayer();
|
|
8960
|
-
if (_optionalChain([target, 'optionalAccess',
|
|
8961
|
-
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) => {
|
|
8962
9076
|
const next = { ...l };
|
|
8963
9077
|
delete next.mask;
|
|
8964
9078
|
return next;
|
|
@@ -8968,7 +9082,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8968
9082
|
}
|
|
8969
9083
|
// --- Annotations & Layers ---
|
|
8970
9084
|
annotationLayer(id) {
|
|
8971
|
-
return
|
|
9085
|
+
return _chunk73L6TROJcjs.flattenLayers.call(void 0, this.state.layers).find(
|
|
8972
9086
|
(l) => l.type === "annotation" && l.annotation.id === id
|
|
8973
9087
|
);
|
|
8974
9088
|
}
|
|
@@ -8978,8 +9092,8 @@ var ImageEditorController = (_class7 = class {
|
|
|
8978
9092
|
const id = `ann_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`;
|
|
8979
9093
|
const fullAnnotation = { ...annotation, id };
|
|
8980
9094
|
const layer = annotationLayerFor(fullAnnotation);
|
|
8981
|
-
const loc = placement.aboveId ?
|
|
8982
|
-
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);
|
|
8983
9097
|
this.state.selectedAnnotationId = id;
|
|
8984
9098
|
this.notify();
|
|
8985
9099
|
return id;
|
|
@@ -8992,14 +9106,14 @@ var ImageEditorController = (_class7 = class {
|
|
|
8992
9106
|
if (layer) {
|
|
8993
9107
|
const annotation = { ...layer.annotation, ...partial, id };
|
|
8994
9108
|
const name = layer.name === annotationLayerName(layer.annotation) ? annotationLayerName(annotation) : layer.name;
|
|
8995
|
-
this.state.layers =
|
|
9109
|
+
this.state.layers = _chunk73L6TROJcjs.mapLayer.call(void 0, this.state.layers, layer.id, () => ({ ...layer, annotation, name }));
|
|
8996
9110
|
}
|
|
8997
9111
|
this.notify();
|
|
8998
9112
|
}
|
|
8999
9113
|
removeAnnotation(id) {
|
|
9000
9114
|
this.recordHistory();
|
|
9001
9115
|
const layer = this.annotationLayer(id);
|
|
9002
|
-
if (layer) this.state.layers =
|
|
9116
|
+
if (layer) this.state.layers = _chunk73L6TROJcjs.mapLayer.call(void 0, this.state.layers, layer.id, () => null);
|
|
9003
9117
|
if (this.state.selectedAnnotationId === id) {
|
|
9004
9118
|
this.state.selectedAnnotationId = null;
|
|
9005
9119
|
}
|
|
@@ -9008,7 +9122,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9008
9122
|
clearAnnotations() {
|
|
9009
9123
|
this.recordHistory();
|
|
9010
9124
|
let layers = this.state.layers;
|
|
9011
|
-
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);
|
|
9012
9126
|
this.state.layers = layers;
|
|
9013
9127
|
this.state.selectedAnnotationId = null;
|
|
9014
9128
|
this.notify();
|
|
@@ -9076,7 +9190,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9076
9190
|
dirty: dirty === "all" ? void 0 : dirty,
|
|
9077
9191
|
checkpointLayerId: this.state.activeLayerId
|
|
9078
9192
|
});
|
|
9079
|
-
} catch (
|
|
9193
|
+
} catch (e24) {
|
|
9080
9194
|
}
|
|
9081
9195
|
}
|
|
9082
9196
|
async renderExport(options) {
|
|
@@ -9085,9 +9199,9 @@ var ImageEditorController = (_class7 = class {
|
|
|
9085
9199
|
return this.renderer.createCanvas(1, 1);
|
|
9086
9200
|
}
|
|
9087
9201
|
this.syncViews();
|
|
9088
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
9202
|
+
if (_optionalChain([options, 'optionalAccess', _204 => _204.layerIds])) {
|
|
9089
9203
|
const keep = new Set(options.layerIds);
|
|
9090
|
-
const layers =
|
|
9204
|
+
const layers = _chunk73L6TROJcjs.flattenLayers.call(void 0, this.state.layers).filter((l) => keep.has(l.id));
|
|
9091
9205
|
return this.renderer.renderExport(source, { ...this.state, layers }, options);
|
|
9092
9206
|
}
|
|
9093
9207
|
return this.renderer.renderExport(source, this.state, options);
|
|
@@ -9197,10 +9311,10 @@ var ImageEditorController = (_class7 = class {
|
|
|
9197
9311
|
/** No source image, and no layer reading one (an opened PSD): the layers are the whole document. */
|
|
9198
9312
|
isSourceless() {
|
|
9199
9313
|
if (this.imageElement || this.state.sourceUrl || !this.state.layers.length) return false;
|
|
9200
|
-
return !
|
|
9314
|
+
return !_chunk73L6TROJcjs.flattenLayers.call(void 0, this.state.layers).some((l) => l.type === "pixel" && l.source === "document");
|
|
9201
9315
|
}
|
|
9202
9316
|
get isMultiLayer() {
|
|
9203
|
-
return
|
|
9317
|
+
return _chunk73L6TROJcjs.flattenLayers.call(void 0, this.state.layers).filter((l) => l.type === "pixel" || l.type === "group").length > 1;
|
|
9204
9318
|
}
|
|
9205
9319
|
/**
|
|
9206
9320
|
* Applies an inpainted result (natural image space, see `toSourceDataURL`) as ONE undoable step.
|
|
@@ -9218,7 +9332,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9218
9332
|
let px = await this.decodeImage(newDataUrl);
|
|
9219
9333
|
if (px.width !== width || px.height !== height) px = resizePixels(px, width, height);
|
|
9220
9334
|
const data = new Uint8ClampedArray(px.data);
|
|
9221
|
-
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;
|
|
9222
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);
|
|
9223
9337
|
return this.addPixelLayer({ name: "Inpaint", pixels: { width, height, data } });
|
|
9224
9338
|
}
|
|
@@ -9270,7 +9384,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9270
9384
|
if (layer.locks) next.locks = layer.locks;
|
|
9271
9385
|
if (this.state.selectedAnnotationId === layer.annotation.id) this.state.selectedAnnotationId = null;
|
|
9272
9386
|
} else if (layer.type === "pixel") {
|
|
9273
|
-
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.`);
|
|
9274
9388
|
requireUnlocked(layer, "pixels", "rasterize it");
|
|
9275
9389
|
const spatial = layer.filters.some((f) => f.enabled && f.kind === "blur");
|
|
9276
9390
|
const content = { ...layer, visible: true, opacity: 1, blend: "normal" };
|
|
@@ -9288,7 +9402,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9288
9402
|
} else {
|
|
9289
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.`);
|
|
9290
9404
|
}
|
|
9291
|
-
this.commitLayers(
|
|
9405
|
+
this.commitLayers(_chunk73L6TROJcjs.mapLayer.call(void 0, this.state.layers, id, () => next));
|
|
9292
9406
|
return id;
|
|
9293
9407
|
}
|
|
9294
9408
|
// --- PSD ---
|
|
@@ -9315,14 +9429,14 @@ var ImageEditorController = (_class7 = class {
|
|
|
9315
9429
|
delete s.legacyOutputBlur;
|
|
9316
9430
|
s.selection = null;
|
|
9317
9431
|
s.selectedAnnotationId = null;
|
|
9318
|
-
const pixels =
|
|
9432
|
+
const pixels = _chunk73L6TROJcjs.flattenLayers.call(void 0, result.layers).filter((l) => l.type === "pixel");
|
|
9319
9433
|
s.activeLayerId = pixels.length ? pixels[pixels.length - 1].id : null;
|
|
9320
9434
|
s.activeTarget = "pixels";
|
|
9321
9435
|
this.psdResolution = result.resolution;
|
|
9322
9436
|
this.lastLoadProblems = result.warnings;
|
|
9323
9437
|
this.notify();
|
|
9324
9438
|
return {
|
|
9325
|
-
layerIds:
|
|
9439
|
+
layerIds: _chunk73L6TROJcjs.flattenLayers.call(void 0, result.layers).map((l) => l.id),
|
|
9326
9440
|
warnings: result.warnings,
|
|
9327
9441
|
width: result.width,
|
|
9328
9442
|
height: result.height,
|
|
@@ -9347,7 +9461,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9347
9461
|
const compositor = new LayerCompositor();
|
|
9348
9462
|
const bakeMask = (layer) => {
|
|
9349
9463
|
const mask = layer.mask;
|
|
9350
|
-
if (!_optionalChain([mask, 'optionalAccess',
|
|
9464
|
+
if (!_optionalChain([mask, 'optionalAccess', _210 => _210.source])) return mask;
|
|
9351
9465
|
add("Parametric (depth) masks were baked into pixel masks", layer.name);
|
|
9352
9466
|
const plain3 = { ...layer, mask: { ...mask, density: 1, feather: 0, enabled: true } };
|
|
9353
9467
|
const ox = layer.type === "pixel" ? layer.offset.x : 0;
|
|
@@ -9404,7 +9518,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9404
9518
|
out.surface = this.surfaceOf(layer);
|
|
9405
9519
|
delete out.source;
|
|
9406
9520
|
}
|
|
9407
|
-
const active = _nullishCoalesce(_optionalChain([layer, 'access',
|
|
9521
|
+
const active = _nullishCoalesce(_optionalChain([layer, 'access', _211 => _211.filters, 'optionalAccess', _212 => _212.filter, 'call', _213 => _213(isActiveFilter)]), () => ( []));
|
|
9408
9522
|
if (active.length) {
|
|
9409
9523
|
add("Layer filters (develop, blur) were baked into the pixels", layer.name);
|
|
9410
9524
|
const content = { ...out, visible: true, opacity: 1, blend: "normal" };
|
|
@@ -9414,7 +9528,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9414
9528
|
const data = compositor.composite([content], canvas, sources);
|
|
9415
9529
|
out = { ...out, surface: _chunkZOOEX3WTcjs.surfaceFromPixels.call(void 0, { width, height, data }, 4, -layer.offset.x, -layer.offset.y) };
|
|
9416
9530
|
}
|
|
9417
|
-
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);
|
|
9418
9532
|
delete out.filters;
|
|
9419
9533
|
const mask = bakeMask(layer);
|
|
9420
9534
|
if (mask) out.mask = mask;
|
|
@@ -9466,16 +9580,16 @@ var ImageEditorController = (_class7 = class {
|
|
|
9466
9580
|
);
|
|
9467
9581
|
}
|
|
9468
9582
|
layers = resizeLegacyMasks(layers, prev, next.dimensions);
|
|
9469
|
-
for (const l of
|
|
9583
|
+
for (const l of _chunk73L6TROJcjs.flattenLayers.call(void 0, layers)) {
|
|
9470
9584
|
if (l.type === "annotation") {
|
|
9471
|
-
layers =
|
|
9585
|
+
layers = _chunk73L6TROJcjs.mapLayer.call(void 0, layers, l.id, () => ({ ...l, annotation: scaleAnnotation(l.annotation, sx, sy) }));
|
|
9472
9586
|
}
|
|
9473
9587
|
}
|
|
9474
9588
|
}
|
|
9475
9589
|
const bg = developTarget(layers, null);
|
|
9476
|
-
if (bg && bg.source !== "document") layers =
|
|
9590
|
+
if (bg && bg.source !== "document") layers = _chunk73L6TROJcjs.mapLayer.call(void 0, layers, bg.id, () => ({ ...bg, source: "document" }));
|
|
9477
9591
|
if (clearAnnotations) {
|
|
9478
|
-
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);
|
|
9479
9593
|
this.state.selectedAnnotationId = null;
|
|
9480
9594
|
}
|
|
9481
9595
|
this.state.layers = layers;
|
|
@@ -9483,7 +9597,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9483
9597
|
}
|
|
9484
9598
|
toJSON(options) {
|
|
9485
9599
|
const out = this.serializeState();
|
|
9486
|
-
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);
|
|
9487
9601
|
if (!options || out.version !== LAYERED_SCHEMA_VERSION) return options ? Promise.resolve(out) : out;
|
|
9488
9602
|
return serializeLayersExternal(this.state.layers, options.store).then(({ layers, assets }) => ({ ...out, layers, assets }));
|
|
9489
9603
|
}
|
|
@@ -9510,7 +9624,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9510
9624
|
if (data.selection) {
|
|
9511
9625
|
try {
|
|
9512
9626
|
selection = normalizeSelection(deserializeSelection(data.selection));
|
|
9513
|
-
} catch (
|
|
9627
|
+
} catch (e25) {
|
|
9514
9628
|
selection = null;
|
|
9515
9629
|
}
|
|
9516
9630
|
}
|
|
@@ -9533,7 +9647,10 @@ var ImageEditorController = (_class7 = class {
|
|
|
9533
9647
|
s.outputOpacity = data.opacity;
|
|
9534
9648
|
if (typeof data.legacyOutputBlur === "number" && data.legacyOutputBlur >= 0) s.legacyOutputBlur = data.legacyOutputBlur;
|
|
9535
9649
|
else delete s.legacyOutputBlur;
|
|
9536
|
-
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;
|
|
9537
9654
|
if (!this.imageElement && typeof data.width === "number" && typeof data.height === "number" && data.width > 0 && data.height > 0) {
|
|
9538
9655
|
s.imageDimensions = { width: data.width, height: data.height };
|
|
9539
9656
|
}
|
|
@@ -9547,6 +9664,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9547
9664
|
s.crop = data.crop ? { ...data.crop } : null;
|
|
9548
9665
|
s.transform = { ...data.transform };
|
|
9549
9666
|
s.activeLayerId = null;
|
|
9667
|
+
delete s.globalLight;
|
|
9550
9668
|
}
|
|
9551
9669
|
s.activeTarget = "pixels";
|
|
9552
9670
|
this.viewKey = [];
|
|
@@ -9556,10 +9674,10 @@ var ImageEditorController = (_class7 = class {
|
|
|
9556
9674
|
serializeState() {
|
|
9557
9675
|
const { width, height } = this.naturalSize;
|
|
9558
9676
|
const view = legacyView(this.stack(), width, height, null);
|
|
9559
|
-
if (view.exact) {
|
|
9677
|
+
if (view.exact && !this.state.globalLight) {
|
|
9560
9678
|
return {
|
|
9561
9679
|
// States without adjustment layers keep schema 1, so they round-trip unchanged.
|
|
9562
|
-
version: _optionalChain([view, 'access',
|
|
9680
|
+
version: _optionalChain([view, 'access', _220 => _220.adjustments, 'access', _221 => _221.layers, 'optionalAccess', _222 => _222.length]) ? 2 : 1,
|
|
9563
9681
|
crop: this.state.crop ? { ...this.state.crop } : null,
|
|
9564
9682
|
transform: { ...this.state.transform },
|
|
9565
9683
|
adjustments: serializeAdjustments(view.adjustments),
|
|
@@ -9583,12 +9701,13 @@ var ImageEditorController = (_class7 = class {
|
|
|
9583
9701
|
opacity: this.state.outputOpacity
|
|
9584
9702
|
};
|
|
9585
9703
|
if (this.state.legacyOutputBlur !== void 0) out.legacyOutputBlur = this.state.legacyOutputBlur;
|
|
9704
|
+
if (this.state.globalLight) out.globalLight = { ...this.state.globalLight };
|
|
9586
9705
|
return out;
|
|
9587
9706
|
}
|
|
9588
9707
|
}, _class7);
|
|
9589
9708
|
function serializeAdjustments(adjustments) {
|
|
9590
9709
|
const out = { ...adjustments };
|
|
9591
|
-
if (_optionalChain([out, 'access',
|
|
9710
|
+
if (_optionalChain([out, 'access', _223 => _223.layers, 'optionalAccess', _224 => _224.length])) out.layers = JSON.parse(JSON.stringify(out.layers));
|
|
9592
9711
|
else delete out.layers;
|
|
9593
9712
|
if (normalizeProcessVersion(out.process) === LEGACY_PROCESS_VERSION) {
|
|
9594
9713
|
delete out.process;
|
|
@@ -9624,11 +9743,11 @@ function withDevelop(layer, partial) {
|
|
|
9624
9743
|
return { ...layer, filters };
|
|
9625
9744
|
}
|
|
9626
9745
|
function withBlur(layer, radius) {
|
|
9627
|
-
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")]);
|
|
9628
9747
|
const filters = (_nullishCoalesce(layer.filters, () => ( []))).filter((f) => f.kind !== "blur");
|
|
9629
9748
|
if (radius > 0) {
|
|
9630
9749
|
filters.push({
|
|
9631
|
-
id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess',
|
|
9750
|
+
id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _228 => _228.id]), () => ( (layer.source === "document" ? BLUR_FILTER_ID : newLayerId("flt")))),
|
|
9632
9751
|
kind: "blur",
|
|
9633
9752
|
enabled: true,
|
|
9634
9753
|
radius
|
|
@@ -9692,12 +9811,12 @@ function resizeLegacyMasks(layers, from, to) {
|
|
|
9692
9811
|
const th = Math.max(1, Math.round(to.height));
|
|
9693
9812
|
if (fw === tw && fh === th) return layers;
|
|
9694
9813
|
let out = layers;
|
|
9695
|
-
for (const l of
|
|
9814
|
+
for (const l of _chunk73L6TROJcjs.flattenLayers.call(void 0, layers)) {
|
|
9696
9815
|
if (l.type !== "adjustment" || !l.mask || l.mask.source) continue;
|
|
9697
9816
|
const old = l.mask;
|
|
9698
9817
|
const mask = rasterMaskFromLegacy(legacyMaskOf(old, fw, fh), tw, th);
|
|
9699
9818
|
if (!mask) continue;
|
|
9700
|
-
out =
|
|
9819
|
+
out = _chunk73L6TROJcjs.mapLayer.call(void 0, out, l.id, (n) => ({ ...n, mask: { ...mask, density: old.density, feather: old.feather, enabled: old.enabled } }));
|
|
9701
9820
|
}
|
|
9702
9821
|
return out;
|
|
9703
9822
|
}
|
|
@@ -9710,7 +9829,7 @@ function isOpaqueInside(surface, width, height) {
|
|
|
9710
9829
|
return true;
|
|
9711
9830
|
}
|
|
9712
9831
|
function collectStateTiles(layers, into) {
|
|
9713
|
-
for (const l of
|
|
9832
|
+
for (const l of _chunk73L6TROJcjs.flattenLayers.call(void 0, layers)) {
|
|
9714
9833
|
if (l.type === "pixel" && l.source !== "document") _chunkZOOEX3WTcjs.collectTiles.call(void 0, l.surface, into);
|
|
9715
9834
|
if (l.mask && !l.mask.source) _chunkZOOEX3WTcjs.collectTiles.call(void 0, l.mask.surface, into);
|
|
9716
9835
|
}
|
|
@@ -9720,7 +9839,7 @@ function pixelsOnly(layers) {
|
|
|
9720
9839
|
for (const l of layers) {
|
|
9721
9840
|
if (l.type === "adjustment") continue;
|
|
9722
9841
|
if (l.type === "group") out.push({ ...l, children: pixelsOnly(l.children) });
|
|
9723
|
-
else if (l.type === "pixel" && _optionalChain([l, 'access',
|
|
9842
|
+
else if (l.type === "pixel" && _optionalChain([l, 'access', _229 => _229.filters, 'optionalAccess', _230 => _230.length])) {
|
|
9724
9843
|
const p = { ...l };
|
|
9725
9844
|
delete p.filters;
|
|
9726
9845
|
out.push(p);
|
|
@@ -9778,7 +9897,7 @@ function toHex2(c) {
|
|
|
9778
9897
|
return "#" + [c[0], c[1], c[2]].map((v) => Math.round(v).toString(16).padStart(2, "0")).join("");
|
|
9779
9898
|
}
|
|
9780
9899
|
function normalizeSelection(mask) {
|
|
9781
|
-
return _optionalChain([mask, 'optionalAccess',
|
|
9900
|
+
return _optionalChain([mask, 'optionalAccess', _231 => _231.bounds]) ? mask : null;
|
|
9782
9901
|
}
|
|
9783
9902
|
function sameSelection(a, b) {
|
|
9784
9903
|
if (a.width !== b.width || a.height !== b.height) return false;
|
|
@@ -9883,7 +10002,7 @@ function loadImageEditorDocument(input) {
|
|
|
9883
10002
|
if (typeof input === "string") {
|
|
9884
10003
|
try {
|
|
9885
10004
|
parsed = JSON.parse(input);
|
|
9886
|
-
} catch (
|
|
10005
|
+
} catch (e26) {
|
|
9887
10006
|
parsed = input;
|
|
9888
10007
|
}
|
|
9889
10008
|
}
|
|
@@ -9939,7 +10058,7 @@ function loadImageEditorDocument(input) {
|
|
|
9939
10058
|
}
|
|
9940
10059
|
const state = { version: 1, ...result.value };
|
|
9941
10060
|
if (isV2) {
|
|
9942
|
-
if (_optionalChain([state, 'access',
|
|
10061
|
+
if (_optionalChain([state, 'access', _232 => _232.adjustments, 'access', _233 => _233.layers, 'optionalAccess', _234 => _234.length])) state.version = 2;
|
|
9943
10062
|
result.report.version = 2;
|
|
9944
10063
|
}
|
|
9945
10064
|
if (state.selection === void 0) delete state.selection;
|
|
@@ -10139,7 +10258,7 @@ function findAdjustmentControl(id) {
|
|
|
10139
10258
|
}
|
|
10140
10259
|
function findLayerControl(kind, id) {
|
|
10141
10260
|
if (id === "opacity") return ADJUSTMENT_LAYER_OPACITY_CONTROL;
|
|
10142
|
-
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)]);
|
|
10143
10262
|
}
|
|
10144
10263
|
function clampControlValue(spec, v) {
|
|
10145
10264
|
if (typeof v !== "number" || !Number.isFinite(v)) return spec.default;
|
|
@@ -10258,7 +10377,7 @@ function summary(controller) {
|
|
|
10258
10377
|
const area = selectionArea(sel);
|
|
10259
10378
|
return {
|
|
10260
10379
|
empty: !sel,
|
|
10261
|
-
bounds: _nullishCoalesce(_optionalChain([sel, 'optionalAccess',
|
|
10380
|
+
bounds: _nullishCoalesce(_optionalChain([sel, 'optionalAccess', _238 => _238.bounds]), () => ( null)),
|
|
10262
10381
|
/** Σ coverage in pixels. */
|
|
10263
10382
|
area: Math.round(area),
|
|
10264
10383
|
percent: Math.round(area / Math.max(1, width * height) * 1e4) / 100,
|
|
@@ -10502,7 +10621,7 @@ async function renderImageRegion(controller, request) {
|
|
|
10502
10621
|
if (request.includeOverlays) {
|
|
10503
10622
|
const s = request.scale;
|
|
10504
10623
|
const selection = state.selection;
|
|
10505
|
-
if (_optionalChain([selection, 'optionalAccess',
|
|
10624
|
+
if (_optionalChain([selection, 'optionalAccess', _239 => _239.bounds]) && selection.width === state.imageDimensions.width && selection.height === state.imageDimensions.height) {
|
|
10506
10625
|
const shade = selectionShade(selection, document);
|
|
10507
10626
|
if (shade) context.drawImage(shade, rect.x, rect.y, rect.width, rect.height, 0, 0, out.width, out.height);
|
|
10508
10627
|
}
|
|
@@ -10527,7 +10646,7 @@ function createImageCaptureSurface(controller) {
|
|
|
10527
10646
|
return {
|
|
10528
10647
|
units: "image pixels",
|
|
10529
10648
|
content: whole,
|
|
10530
|
-
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)) }),
|
|
10531
10650
|
overlays: "a shade over unselected pixels and the crop box outline",
|
|
10532
10651
|
maxScale: 8,
|
|
10533
10652
|
render: (request) => renderImageRegion(controller, request)
|
|
@@ -10820,6 +10939,7 @@ function describeLayer(layer, activeId, boundsOf) {
|
|
|
10820
10939
|
clipped: Boolean(layer.clipped),
|
|
10821
10940
|
locks: layer.locks ? { ...layer.locks } : {},
|
|
10822
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,
|
|
10823
10943
|
active: layer.id === activeId
|
|
10824
10944
|
};
|
|
10825
10945
|
switch (layer.type) {
|
|
@@ -10863,11 +10983,11 @@ function placementFrom(args) {
|
|
|
10863
10983
|
function createImageLayerTools(controller) {
|
|
10864
10984
|
const describe = (id) => {
|
|
10865
10985
|
const s = controller.getState();
|
|
10866
|
-
const loc =
|
|
10986
|
+
const loc = _chunk73L6TROJcjs.findLayer.call(void 0, s.layers, id);
|
|
10867
10987
|
if (!loc) return null;
|
|
10868
10988
|
return {
|
|
10869
10989
|
...describeLayer(loc.layer, s.activeLayerId, (x) => controller.getLayerBounds(x.id)),
|
|
10870
|
-
parentId: _nullishCoalesce(_optionalChain([loc, 'access',
|
|
10990
|
+
parentId: _nullishCoalesce(_optionalChain([loc, 'access', _244 => _244.parent, 'optionalAccess', _245 => _245.id]), () => ( null)),
|
|
10871
10991
|
index: loc.index
|
|
10872
10992
|
};
|
|
10873
10993
|
};
|
|
@@ -10879,7 +10999,7 @@ function createImageLayerTools(controller) {
|
|
|
10879
10999
|
const listLayers = {
|
|
10880
11000
|
name: "list_layers",
|
|
10881
11001
|
title: "List image layers",
|
|
10882
|
-
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.",
|
|
10883
11003
|
inputSchema: { type: "object", properties: {}, additionalProperties: false },
|
|
10884
11004
|
annotations: { title: "List image layers", ...READ2 },
|
|
10885
11005
|
handler: () => {
|
|
@@ -11315,9 +11435,338 @@ function createImageLayerTools(controller) {
|
|
|
11315
11435
|
];
|
|
11316
11436
|
}
|
|
11317
11437
|
|
|
11318
|
-
// src/image-editor/
|
|
11438
|
+
// src/image-editor/effect-tools.ts
|
|
11439
|
+
var READ3 = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
11319
11440
|
var WRITE3 = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false };
|
|
11441
|
+
var WRITE_IDEMPOTENT3 = { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
11320
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 };
|
|
11321
11770
|
var TARGET = {
|
|
11322
11771
|
layerId: { type: "string", description: "Layer to paint (default the active layer; see list_layers)." },
|
|
11323
11772
|
channel: { type: "string", enum: ["pixels", "mask"], description: "pixels (default for a pixel layer) or the layer's mask: black hides, white reveals." }
|
|
@@ -11375,7 +11824,7 @@ function createImagePaintTools(controller) {
|
|
|
11375
11824
|
required: ["points"],
|
|
11376
11825
|
additionalProperties: false
|
|
11377
11826
|
},
|
|
11378
|
-
annotations: { title: "Paint a brush stroke", ...
|
|
11827
|
+
annotations: { title: "Paint a brush stroke", ...WRITE4 },
|
|
11379
11828
|
handler: (args) => controller.paintStroke({
|
|
11380
11829
|
tool: args.tool,
|
|
11381
11830
|
points: args.points,
|
|
@@ -11399,7 +11848,7 @@ function createImagePaintTools(controller) {
|
|
|
11399
11848
|
},
|
|
11400
11849
|
additionalProperties: false
|
|
11401
11850
|
},
|
|
11402
|
-
annotations: { title: "Fill pixels", ...
|
|
11851
|
+
annotations: { title: "Fill pixels", ...WRITE4 },
|
|
11403
11852
|
handler: (args) => controller.fillPixels({
|
|
11404
11853
|
color: args.color,
|
|
11405
11854
|
opacity: args.opacity,
|
|
@@ -11421,15 +11870,15 @@ function createImagePaintTools(controller) {
|
|
|
11421
11870
|
},
|
|
11422
11871
|
additionalProperties: false
|
|
11423
11872
|
},
|
|
11424
|
-
annotations: { title: "Clear pixels", ...
|
|
11873
|
+
annotations: { title: "Clear pixels", ...DESTRUCTIVE3 },
|
|
11425
11874
|
handler: (args) => controller.clearPixels({ opacity: args.opacity, useSelection: args.useSelection, ...readTarget(args) })
|
|
11426
11875
|
};
|
|
11427
11876
|
return [paintStroke, fill, clear];
|
|
11428
11877
|
}
|
|
11429
11878
|
|
|
11430
11879
|
// src/image-editor/psd-tools.ts
|
|
11431
|
-
var
|
|
11432
|
-
var
|
|
11880
|
+
var READ4 = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
11881
|
+
var DESTRUCTIVE4 = { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false };
|
|
11433
11882
|
var DATA = {
|
|
11434
11883
|
type: "string",
|
|
11435
11884
|
minLength: 1,
|
|
@@ -11439,7 +11888,7 @@ function psdBytesFromBase64(data) {
|
|
|
11439
11888
|
if (typeof data !== "string" || !data.trim()) throw new PsdError("data is required: the PSD file as base64.");
|
|
11440
11889
|
const body = data.trim().replace(/^data:[^,]*;base64,/i, "");
|
|
11441
11890
|
if (!/^[A-Za-z0-9+/=_\s-]+$/.test(body)) throw new PsdError("data is not base64; send the PSD file bytes base64-encoded.");
|
|
11442
|
-
const bytes =
|
|
11891
|
+
const bytes = _chunk73L6TROJcjs.base64ToBytes.call(void 0, body);
|
|
11443
11892
|
if (bytes.length < 26) throw new PsdError(`data decodes to ${bytes.length} bytes, too short for a PSD (at least 26).`);
|
|
11444
11893
|
return bytes;
|
|
11445
11894
|
}
|
|
@@ -11449,7 +11898,7 @@ function createImagePsdTools(controller) {
|
|
|
11449
11898
|
title: "Inspect a PSD",
|
|
11450
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.",
|
|
11451
11900
|
inputSchema: { type: "object", properties: { data: DATA }, required: ["data"], additionalProperties: false },
|
|
11452
|
-
annotations: { title: "Inspect a PSD", ...
|
|
11901
|
+
annotations: { title: "Inspect a PSD", ...READ4 },
|
|
11453
11902
|
handler: ({ data }) => {
|
|
11454
11903
|
const res = importPsd(psdBytesFromBase64(data), { skipPixels: true });
|
|
11455
11904
|
return {
|
|
@@ -11467,7 +11916,7 @@ function createImagePsdTools(controller) {
|
|
|
11467
11916
|
title: "Open a PSD as the document",
|
|
11468
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).",
|
|
11469
11918
|
inputSchema: { type: "object", properties: { data: DATA }, required: ["data"], additionalProperties: false },
|
|
11470
|
-
annotations: { title: "Open a PSD as the document", ...
|
|
11919
|
+
annotations: { title: "Open a PSD as the document", ...DESTRUCTIVE4 },
|
|
11471
11920
|
handler: ({ data }) => {
|
|
11472
11921
|
const res = controller.loadPsd(psdBytesFromBase64(data));
|
|
11473
11922
|
const s = controller.getState();
|
|
@@ -11486,11 +11935,11 @@ function createImagePsdTools(controller) {
|
|
|
11486
11935
|
title: "Export the document as a PSD",
|
|
11487
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.",
|
|
11488
11937
|
inputSchema: { type: "object", properties: {}, additionalProperties: false },
|
|
11489
|
-
annotations: { title: "Export the document as a PSD", ...
|
|
11938
|
+
annotations: { title: "Export the document as a PSD", ...READ4 },
|
|
11490
11939
|
handler: async () => {
|
|
11491
11940
|
const res = await controller.toPsd();
|
|
11492
11941
|
return {
|
|
11493
|
-
data:
|
|
11942
|
+
data: _chunk73L6TROJcjs.bytesToBase64.call(void 0, res.bytes),
|
|
11494
11943
|
mimeType: "image/vnd.adobe.photoshop",
|
|
11495
11944
|
size: res.bytes.length,
|
|
11496
11945
|
psb: res.psb,
|
|
@@ -11675,7 +12124,7 @@ function createImageEditorToolProvider(controller, options = {}) {
|
|
|
11675
12124
|
for (const ref of [aboveId, parentId]) {
|
|
11676
12125
|
if (ref !== void 0 && !controller.getLayer(ref)) throw new Error(`Unknown layer "${ref}". Call list_layers for ids.`);
|
|
11677
12126
|
}
|
|
11678
|
-
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.`);
|
|
11679
12128
|
const id = controller.addAdjustmentLayer({ kind, params, opacity, blend, name, aboveId, parentId });
|
|
11680
12129
|
const layer = controller.getAdjustmentLayer(id);
|
|
11681
12130
|
return { layer: JSON.parse(JSON.stringify(layer)), index: controller.getAdjustmentLayers().findIndex((l) => l.id === id) };
|
|
@@ -11740,6 +12189,7 @@ function createImageEditorToolProvider(controller, options = {}) {
|
|
|
11740
12189
|
...createImageSelectionTools(controller),
|
|
11741
12190
|
...createImageEditTools(controller),
|
|
11742
12191
|
...createImageLayerTools(controller),
|
|
12192
|
+
...createImageEffectTools(controller),
|
|
11743
12193
|
...createImagePaintTools(controller),
|
|
11744
12194
|
..._chunk4F3YDIWWcjs.createPigmentTools.call(void 0, ),
|
|
11745
12195
|
...createImagePsdTools(controller)
|
|
@@ -12085,7 +12535,7 @@ function dropZone(fraction, isGroup) {
|
|
|
12085
12535
|
}
|
|
12086
12536
|
function dropPlacement(layers, dragId, targetId, zone) {
|
|
12087
12537
|
if (dragId === targetId) return null;
|
|
12088
|
-
const target =
|
|
12538
|
+
const target = _chunk73L6TROJcjs.findLayer.call(void 0, layers, targetId);
|
|
12089
12539
|
if (!target) return null;
|
|
12090
12540
|
if (zone === "inside" && target.layer.type === "group") return { parentId: targetId };
|
|
12091
12541
|
return zone === "above" ? { aboveId: targetId } : { belowId: targetId };
|
|
@@ -12093,35 +12543,35 @@ function dropPlacement(layers, dragId, targetId, zone) {
|
|
|
12093
12543
|
function layerMenu(controller) {
|
|
12094
12544
|
const s = controller.getState();
|
|
12095
12545
|
const active = controller.getActiveLayer();
|
|
12096
|
-
const loc = active ?
|
|
12546
|
+
const loc = active ? _chunk73L6TROJcjs.findLayer.call(void 0, s.layers, active.id) : null;
|
|
12097
12547
|
const siblings = loc ? loc.parent ? loc.parent.children : s.layers : [];
|
|
12098
12548
|
const below = loc ? siblings[loc.index - 1] : void 0;
|
|
12099
12549
|
const hasSel = controller.hasSelection;
|
|
12100
|
-
const isPixel = _optionalChain([active, 'optionalAccess',
|
|
12550
|
+
const isPixel = _optionalChain([active, 'optionalAccess', _249 => _249.type]) === "pixel";
|
|
12101
12551
|
return [
|
|
12102
12552
|
{ action: "new-layer", label: "New Layer", enabled: true },
|
|
12103
12553
|
{ action: "new-group", label: "New Group", enabled: true },
|
|
12104
12554
|
{ action: "duplicate", label: "Duplicate Layer", enabled: Boolean(active) },
|
|
12105
12555
|
{ action: "delete", label: "Delete Layer", enabled: Boolean(active) },
|
|
12106
12556
|
{ action: "group-selected", label: "Group Layer", enabled: Boolean(active) },
|
|
12107
|
-
{ action: "ungroup", label: "Ungroup", enabled: _optionalChain([active, 'optionalAccess',
|
|
12108
|
-
{ 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") },
|
|
12109
12559
|
{ action: "merge-visible", label: "Merge Visible", enabled: s.layers.some((l) => l.visible) },
|
|
12110
12560
|
{ action: "flatten", label: "Flatten Image", enabled: s.layers.length > 0 },
|
|
12111
12561
|
{ action: "via-copy", label: "Layer via Copy", enabled: isPixel && hasSel },
|
|
12112
12562
|
{ action: "via-cut", label: "Layer via Cut", enabled: isPixel && hasSel },
|
|
12113
12563
|
{ action: "add-mask", label: "Add Layer Mask", enabled: Boolean(active) },
|
|
12114
12564
|
{ action: "add-mask-selection", label: "Add Mask from Selection", enabled: Boolean(active) && hasSel },
|
|
12115
|
-
{ action: "apply-mask", label: "Apply Layer Mask", enabled: isPixel && Boolean(_optionalChain([active, 'optionalAccess',
|
|
12116
|
-
{ action: "delete-mask", label: "Delete Layer Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess',
|
|
12117
|
-
{ action: "toggle-mask", label: _optionalChain([active, 'optionalAccess',
|
|
12118
|
-
{ action: "rasterize", label: "Rasterize Layer", enabled: _optionalChain([active, 'optionalAccess',
|
|
12119
|
-
{ 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) }
|
|
12120
12570
|
];
|
|
12121
12571
|
}
|
|
12122
12572
|
async function runLayerMenuAction(controller, action) {
|
|
12123
12573
|
const active = controller.getActiveLayer();
|
|
12124
|
-
const id = _optionalChain([active, 'optionalAccess',
|
|
12574
|
+
const id = _optionalChain([active, 'optionalAccess', _263 => _263.id]);
|
|
12125
12575
|
try {
|
|
12126
12576
|
switch (action) {
|
|
12127
12577
|
case "new-layer":
|
|
@@ -12168,13 +12618,13 @@ async function runLayerMenuAction(controller, action) {
|
|
|
12168
12618
|
if (id) controller.removeLayerMask(id);
|
|
12169
12619
|
break;
|
|
12170
12620
|
case "toggle-mask":
|
|
12171
|
-
if (id && _optionalChain([active, 'optionalAccess',
|
|
12621
|
+
if (id && _optionalChain([active, 'optionalAccess', _264 => _264.mask])) controller.setLayerMaskProps(id, { enabled: active.mask.enabled === false });
|
|
12172
12622
|
break;
|
|
12173
12623
|
case "rasterize":
|
|
12174
12624
|
if (id) await controller.rasterizeLayer(id);
|
|
12175
12625
|
break;
|
|
12176
12626
|
case "toggle-clip":
|
|
12177
|
-
if (id) controller.setLayerProperties(id, { clipped: !_optionalChain([active, 'optionalAccess',
|
|
12627
|
+
if (id) controller.setLayerProperties(id, { clipped: !_optionalChain([active, 'optionalAccess', _265 => _265.clipped]) });
|
|
12178
12628
|
break;
|
|
12179
12629
|
}
|
|
12180
12630
|
return null;
|
|
@@ -12267,7 +12717,7 @@ var PaintGesture = (_class9 = class {
|
|
|
12267
12717
|
const layer = this.controller.getActiveLayer();
|
|
12268
12718
|
if (!layer) throw new Error("Select a layer to move in the Layers panel.");
|
|
12269
12719
|
if (layer.type !== "pixel") throw new Error(`Only pixel layers move; "${layer.name}" is a ${layer.type} layer.`);
|
|
12270
|
-
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.`);
|
|
12271
12721
|
this.move = { id: layer.id, start: { x: sample.x, y: sample.y }, origin: { ...layer.offset }, moved: false };
|
|
12272
12722
|
return null;
|
|
12273
12723
|
}
|
|
@@ -12316,7 +12766,7 @@ var PaintGesture = (_class9 = class {
|
|
|
12316
12766
|
this.move = null;
|
|
12317
12767
|
}
|
|
12318
12768
|
cancel() {
|
|
12319
|
-
_optionalChain([this, 'access',
|
|
12769
|
+
_optionalChain([this, 'access', _270 => _270.stroke, 'optionalAccess', _271 => _271.cancel, 'call', _272 => _272()]);
|
|
12320
12770
|
this.stroke = null;
|
|
12321
12771
|
this.move = null;
|
|
12322
12772
|
}
|
|
@@ -12762,5 +13212,15 @@ async function downloadPsd(controller, name = "image") {
|
|
|
12762
13212
|
|
|
12763
13213
|
|
|
12764
13214
|
|
|
12765
|
-
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 = _chunkH543GD6Tcjs.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 = _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 = _chunk4F3YDIWWcjs.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 = _chunk4F3YDIWWcjs.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.createPigment = _chunk4F3YDIWWcjs.createPigment; exports.createPigmentTools = _chunk4F3YDIWWcjs.createPigmentTools; exports.createSelectionMask = createSelectionMask; exports.curveLut = 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 = _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.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 = _chunkH543GD6Tcjs.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 = _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 = _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.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.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.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.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;
|
|
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;
|
|
12766
13226
|
//# sourceMappingURL=index.cjs.map
|