@pixerate/editor 0.149.0 → 0.150.1
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/dist/agent/index.cjs +7 -5
- package/dist/agent/index.js +5 -3
- package/dist/animation/index.cjs +4 -2
- package/dist/animation/index.js +3 -1
- package/dist/chart/index.cjs +7 -7
- package/dist/chart/index.js +1 -1
- package/dist/{chunk-3EVMUYF4.js → chunk-6DXDUVSL.js} +1 -1
- package/dist/{chunk-ZCFHPORF.cjs → chunk-ERAGQL2N.cjs} +2 -2
- package/dist/{chunk-FR7GHH2K.cjs → chunk-GMWNBSBS.cjs} +3 -3
- package/dist/{chunk-OOV64UEB.js → chunk-KMU6QJB7.js} +1 -1
- package/dist/{chunk-PEEP2YR7.js → chunk-O2ANJFUF.js} +23 -1
- package/dist/{chunk-QCEQIRJQ.cjs → chunk-PI45JMP7.cjs} +163 -136
- package/dist/{chunk-UJGAA6AK.cjs → chunk-SWTUM32H.cjs} +23 -1
- package/dist/{chunk-ZQUANEK4.js → chunk-Y64YPIFT.js} +28 -1
- package/dist/commands/index.cjs +3 -3
- package/dist/commands/index.js +2 -2
- package/dist/diagram/index.cjs +7 -7
- package/dist/diagram/index.js +1 -1
- package/dist/image-editor/canvas-viewport.d.cts +52 -0
- package/dist/image-editor/canvas-viewport.d.ts +52 -0
- package/dist/image-editor/index.cjs +687 -596
- package/dist/image-editor/index.d.cts +1 -0
- package/dist/image-editor/index.d.ts +1 -0
- package/dist/image-editor/index.js +120 -29
- package/dist/image-editor/layers/ops.d.cts +21 -3
- package/dist/image-editor/layers/ops.d.ts +21 -3
- package/dist/image-editor/playback.d.cts +20 -1
- package/dist/image-editor/playback.d.ts +20 -1
- package/dist/image-editor/renderer.d.cts +7 -0
- package/dist/image-editor/renderer.d.ts +7 -0
- package/dist/paint-editor/index.cjs +12 -12
- package/dist/paint-editor/index.js +2 -2
- package/dist/tools/index.cjs +6 -4
- package/dist/tools/index.js +5 -3
- package/dist/tools/presence.d.cts +17 -0
- package/dist/tools/presence.d.ts +17 -0
- package/package.json +2 -2
- package/skills/pixerate-image-editor/SKILL.md +6 -6
|
@@ -2901,11 +2901,34 @@ function combineCoverage(a, b, op, n) {
|
|
|
2901
2901
|
|
|
2902
2902
|
// src/image-editor/layers/ops.ts
|
|
2903
2903
|
var LayerOperationError = class extends Error {
|
|
2904
|
-
|
|
2904
|
+
|
|
2905
|
+
constructor(message, userMessage) {
|
|
2905
2906
|
super(message);
|
|
2906
2907
|
this.name = "LayerOperationError";
|
|
2908
|
+
if (userMessage) this.userMessage = userMessage;
|
|
2907
2909
|
}
|
|
2908
2910
|
};
|
|
2911
|
+
function userErrorMessage(err) {
|
|
2912
|
+
if (err instanceof LayerOperationError && err.userMessage) return err.userMessage;
|
|
2913
|
+
return err instanceof Error ? err.message : String(err);
|
|
2914
|
+
}
|
|
2915
|
+
function isPaintableLayer(layer) {
|
|
2916
|
+
return layer.type === "pixel" && layer.visible && !_chunkHGTDMKNEcjs.isLayerLocked.call(void 0, layer, "pixels");
|
|
2917
|
+
}
|
|
2918
|
+
function defaultActiveLayerId(layers) {
|
|
2919
|
+
const pixels = _chunkHGTDMKNEcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "pixel");
|
|
2920
|
+
for (let i = pixels.length - 1; i >= 0; i--) if (isPaintableLayer(pixels[i])) return pixels[i].id;
|
|
2921
|
+
return _nullishCoalesce(_optionalChain([pixels, 'access', _21 => _21[pixels.length - 1], 'optionalAccess', _22 => _22.id]), () => ( null));
|
|
2922
|
+
}
|
|
2923
|
+
function activeLayerAfterRemoval(prev, next, removedId) {
|
|
2924
|
+
const before = _chunkHGTDMKNEcjs.flattenLayers.call(void 0, prev);
|
|
2925
|
+
const at = before.findIndex((l) => l.id === removedId);
|
|
2926
|
+
for (let i = at - 1; i >= 0; i--) {
|
|
2927
|
+
const loc = _chunkHGTDMKNEcjs.findLayer.call(void 0, next, before[i].id);
|
|
2928
|
+
if (loc && isPaintableLayer(loc.layer)) return loc.layer.id;
|
|
2929
|
+
}
|
|
2930
|
+
return defaultActiveLayerId(next);
|
|
2931
|
+
}
|
|
2909
2932
|
var fail = (message) => {
|
|
2910
2933
|
throw new LayerOperationError(message);
|
|
2911
2934
|
};
|
|
@@ -2926,7 +2949,7 @@ function placeLayer(layers, layer, placement = {}, defaultIndex) {
|
|
|
2926
2949
|
if (given > 1) fail("Give only one of aboveId, belowId and parentId.");
|
|
2927
2950
|
if (placement.aboveId || placement.belowId) {
|
|
2928
2951
|
const ref = requireLayer(layers, _nullishCoalesce(placement.aboveId, () => ( placement.belowId)));
|
|
2929
|
-
return _chunkHGTDMKNEcjs.insertLayer.call(void 0, layers, layer, _nullishCoalesce(_optionalChain([ref, 'access',
|
|
2952
|
+
return _chunkHGTDMKNEcjs.insertLayer.call(void 0, layers, layer, _nullishCoalesce(_optionalChain([ref, 'access', _23 => _23.parent, 'optionalAccess', _24 => _24.id]), () => ( null)), ref.index + (placement.aboveId ? 1 : 0));
|
|
2930
2953
|
}
|
|
2931
2954
|
if (placement.parentId) {
|
|
2932
2955
|
const ref = requireLayer(layers, placement.parentId);
|
|
@@ -2958,7 +2981,7 @@ function withNewIds(layer) {
|
|
|
2958
2981
|
if (next.type === "group") next.children = next.children.map(withNewIds);
|
|
2959
2982
|
if (next.type === "annotation") next.annotation = { ...next.annotation, id: next.id };
|
|
2960
2983
|
if (next.type === "shape" || next.type === "type") delete next.annotation;
|
|
2961
|
-
if (next.type === "smart" && _optionalChain([next, 'access',
|
|
2984
|
+
if (next.type === "smart" && _optionalChain([next, 'access', _25 => _25.psd, 'optionalAccess', _26 => _26.placed])) {
|
|
2962
2985
|
next.psd = { ...next.psd };
|
|
2963
2986
|
delete next.psd.placed;
|
|
2964
2987
|
}
|
|
@@ -2969,7 +2992,7 @@ function duplicateLayer(layers, id, name) {
|
|
|
2969
2992
|
const copy = withNewIds(loc.layer);
|
|
2970
2993
|
copy.name = _nullishCoalesce(name, () => ( `${loc.layer.name || "Layer"} copy`));
|
|
2971
2994
|
delete copy.locks;
|
|
2972
|
-
return { layers: _chunkHGTDMKNEcjs.insertLayer.call(void 0, layers, copy, _nullishCoalesce(_optionalChain([loc, 'access',
|
|
2995
|
+
return { layers: _chunkHGTDMKNEcjs.insertLayer.call(void 0, layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _27 => _27.parent, 'optionalAccess', _28 => _28.id]), () => ( null)), loc.index + 1), id: copy.id };
|
|
2973
2996
|
}
|
|
2974
2997
|
function setLayerProperties(layers, id, props) {
|
|
2975
2998
|
const loc = requireLayer(layers, id);
|
|
@@ -3021,8 +3044,8 @@ function setLayerProperties(layers, id, props) {
|
|
|
3021
3044
|
function groupLayers(layers, ids, name = "Group") {
|
|
3022
3045
|
if (!ids.length) fail("Give at least one layer id to group.");
|
|
3023
3046
|
const locs = ids.map((id) => requireLayer(layers, id));
|
|
3024
|
-
const parent = _nullishCoalesce(_optionalChain([locs, 'access',
|
|
3025
|
-
if (locs.some((l) => (_nullishCoalesce(_optionalChain([l, 'access',
|
|
3047
|
+
const parent = _nullishCoalesce(_optionalChain([locs, 'access', _29 => _29[0], 'access', _30 => _30.parent, 'optionalAccess', _31 => _31.id]), () => ( null));
|
|
3048
|
+
if (locs.some((l) => (_nullishCoalesce(_optionalChain([l, 'access', _32 => _32.parent, 'optionalAccess', _33 => _33.id]), () => ( null))) !== parent)) fail("Layers to group must share one parent; move them next to each other first.");
|
|
3026
3049
|
for (const l of locs) requireUnlocked(l.layer, "all", "group it");
|
|
3027
3050
|
const ordered = [...new Set(locs)].sort((a, b) => a.index - b.index);
|
|
3028
3051
|
const top = ordered[ordered.length - 1].index;
|
|
@@ -3039,7 +3062,7 @@ function groupLayers(layers, ids, name = "Group") {
|
|
|
3039
3062
|
return c;
|
|
3040
3063
|
})
|
|
3041
3064
|
};
|
|
3042
|
-
if (_optionalChain([group, 'access',
|
|
3065
|
+
if (_optionalChain([group, 'access', _34 => _34.children, 'access', _35 => _35[0], 'optionalAccess', _36 => _36.clipped])) {
|
|
3043
3066
|
const c = { ...group.children[0] };
|
|
3044
3067
|
delete c.clipped;
|
|
3045
3068
|
group.children[0] = c;
|
|
@@ -3055,7 +3078,7 @@ function ungroupLayer(layers, id) {
|
|
|
3055
3078
|
const group = loc.layer;
|
|
3056
3079
|
let out = _chunkHGTDMKNEcjs.mapLayer.call(void 0, layers, id, () => null);
|
|
3057
3080
|
group.children.forEach((c, i) => {
|
|
3058
|
-
out = _chunkHGTDMKNEcjs.insertLayer.call(void 0, out, c, _nullishCoalesce(_optionalChain([loc, 'access',
|
|
3081
|
+
out = _chunkHGTDMKNEcjs.insertLayer.call(void 0, out, c, _nullishCoalesce(_optionalChain([loc, 'access', _37 => _37.parent, 'optionalAccess', _38 => _38.id]), () => ( null)), loc.index + i);
|
|
3059
3082
|
});
|
|
3060
3083
|
return { layers: out, ids: group.children.map((c) => c.id) };
|
|
3061
3084
|
}
|
|
@@ -3113,7 +3136,7 @@ function requirePixelLayer(layers, id) {
|
|
|
3113
3136
|
}
|
|
3114
3137
|
function addLayerFilter(layers, id, filter) {
|
|
3115
3138
|
const layer = requirePixelLayer(layers, id);
|
|
3116
|
-
if (_optionalChain([layer, 'access',
|
|
3139
|
+
if (_optionalChain([layer, 'access', _39 => _39.filters, 'optionalAccess', _40 => _40.some, 'call', _41 => _41((f) => f.kind === filter.kind)])) fail(`Layer "${id}" already has a ${filter.kind} filter; change it with update_layer_filter.`);
|
|
3117
3140
|
return _chunkHGTDMKNEcjs.mapLayer.call(void 0, layers, id, () => ({ ...layer, filters: [..._nullishCoalesce(layer.filters, () => ( [])), filter] }));
|
|
3118
3141
|
}
|
|
3119
3142
|
function updateLayerFilter(layers, id, filterId, changes) {
|
|
@@ -3177,7 +3200,7 @@ function addLayerEffect(layers, id, kind, params = {}, index) {
|
|
|
3177
3200
|
return { layers: setLayerEffects(layers, id, { ...current, items }), effect };
|
|
3178
3201
|
}
|
|
3179
3202
|
function requireEffect(layer, effectId) {
|
|
3180
|
-
const items = _nullishCoalesce(_optionalChain([layer, 'access',
|
|
3203
|
+
const items = _nullishCoalesce(_optionalChain([layer, 'access', _42 => _42.effects, 'optionalAccess', _43 => _43.items]), () => ( []));
|
|
3181
3204
|
const i = items.findIndex((e) => e.id === effectId);
|
|
3182
3205
|
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.`);
|
|
3183
3206
|
return i;
|
|
@@ -3365,7 +3388,7 @@ function closedOutline(path) {
|
|
|
3365
3388
|
function strokeArea(path, stroke, double) {
|
|
3366
3389
|
const w = stroke.width * (double ? 2 : 1);
|
|
3367
3390
|
if (!(w > 0) || !path.length) return [];
|
|
3368
|
-
const dashes = _optionalChain([stroke, 'access',
|
|
3391
|
+
const dashes = _optionalChain([stroke, 'access', _44 => _44.dashes, 'optionalAccess', _45 => _45.length]) && stroke.dashes.some((d) => d > 0) ? stroke.dashes.map((d) => d * stroke.width) : void 0;
|
|
3369
3392
|
const options = {
|
|
3370
3393
|
width: w,
|
|
3371
3394
|
cap: _nullishCoalesce(stroke.cap, () => ( "butt")),
|
|
@@ -3441,7 +3464,7 @@ function paintContext(env) {
|
|
|
3441
3464
|
light: _chunkHGTDMKNEcjs.DEFAULT_GLOBAL_LIGHT,
|
|
3442
3465
|
pattern: (id) => {
|
|
3443
3466
|
if (tiles.has(id)) return tiles.get(id);
|
|
3444
|
-
const p = _nullishCoalesce(_optionalChain([env, 'access',
|
|
3467
|
+
const p = _nullishCoalesce(_optionalChain([env, 'access', _46 => _46.pattern, 'optionalCall', _47 => _47(id)]), () => ( _chunkHGTDMKNEcjs.builtinPattern.call(void 0, id)));
|
|
3445
3468
|
const t = p && p.width > 0 && p.height > 0 && p.data.length >= p.width * p.height * 4 ? new (0, _chunkHGTDMKNEcjs.PatternTile)(p) : null;
|
|
3446
3469
|
tiles.set(id, t);
|
|
3447
3470
|
return t;
|
|
@@ -3474,9 +3497,9 @@ function renderShapeRect(layer, rect, env, ctx = paintContext(env)) {
|
|
|
3474
3497
|
const canvas = { x: 0, y: 0, width: env.width, height: env.height };
|
|
3475
3498
|
const anchor = { x: geo.frame.x, y: geo.frame.y };
|
|
3476
3499
|
const fc = fCov ? _chunkHGTDMKNEcjs.effectFillColors.call(void 0, layer.fill, rect, geo.frame, canvas, anchor, ctx) : null;
|
|
3477
|
-
const fo = _nullishCoalesce(_optionalChain([layer, 'access',
|
|
3500
|
+
const fo = _nullishCoalesce(_optionalChain([layer, 'access', _48 => _48.fill, 'optionalAccess', _49 => _49.opacity]), () => ( 1));
|
|
3478
3501
|
const sc = sCov ? _chunkHGTDMKNEcjs.effectFillColors.call(void 0, layer.stroke.paint, rect, geo.frame, canvas, anchor, ctx) : null;
|
|
3479
|
-
const so = _nullishCoalesce(_optionalChain([layer, 'access',
|
|
3502
|
+
const so = _nullishCoalesce(_optionalChain([layer, 'access', _50 => _50.stroke, 'optionalAccess', _51 => _51.paint, 'access', _52 => _52.opacity]), () => ( 1));
|
|
3480
3503
|
const out = new Uint8ClampedArray(n * 4);
|
|
3481
3504
|
let any = false;
|
|
3482
3505
|
for (let i = 0; i < n; i++) {
|
|
@@ -3558,7 +3581,7 @@ function normalizeShapePaint(v, path = "paint") {
|
|
|
3558
3581
|
const g = o.gradient;
|
|
3559
3582
|
if (!g || typeof g !== "object") return fail2(`${path}.gradient is required: { stops: [{ position, color }], style, angle, \u2026 }.`);
|
|
3560
3583
|
const gradient = {
|
|
3561
|
-
stops: Array.isArray(g.stops) ? g.stops.map((s) => ({ position: s.position, color: _nullishCoalesce(_optionalChain([_chunkA2IS7EHEcjs.parseCssColor.call(void 0, s.color), 'optionalAccess',
|
|
3584
|
+
stops: Array.isArray(g.stops) ? g.stops.map((s) => ({ position: s.position, color: _nullishCoalesce(_optionalChain([_chunkA2IS7EHEcjs.parseCssColor.call(void 0, s.color), 'optionalAccess', _53 => _53.hex]), () => ( s.color)) })) : [],
|
|
3562
3585
|
...g.opacityStops ? { opacityStops: g.opacityStops } : {},
|
|
3563
3586
|
style: _nullishCoalesce(g.style, () => ( "linear")),
|
|
3564
3587
|
angle: _nullishCoalesce(g.angle, () => ( 90)),
|
|
@@ -3584,7 +3607,7 @@ function normalizeShapePaint(v, path = "paint") {
|
|
|
3584
3607
|
if (o.link !== void 0) p.link = Boolean(o.link);
|
|
3585
3608
|
if (o.phase !== void 0) {
|
|
3586
3609
|
const ph = o.phase;
|
|
3587
|
-
p.phase = { x: requireNum(_optionalChain([ph, 'optionalAccess',
|
|
3610
|
+
p.phase = { x: requireNum(_optionalChain([ph, 'optionalAccess', _54 => _54.x]), `${path}.phase.x`), y: requireNum(_optionalChain([ph, 'optionalAccess', _55 => _55.y]), `${path}.phase.y`) };
|
|
3588
3611
|
}
|
|
3589
3612
|
return withOpacity(p);
|
|
3590
3613
|
}
|
|
@@ -3597,7 +3620,7 @@ function normalizeShapeStroke(v, path = "stroke", base) {
|
|
|
3597
3620
|
const paint = o.paint === void 0 && base ? base.paint : o.paint === void 0 && o.color !== void 0 ? normalizeShapePaint(o.color, `${path}.color`) : normalizeShapePaint(o.paint, `${path}.paint`);
|
|
3598
3621
|
const out = { width, paint };
|
|
3599
3622
|
const pick = (k, allowed) => {
|
|
3600
|
-
const value = o[k] === void 0 ? _optionalChain([base, 'optionalAccess',
|
|
3623
|
+
const value = o[k] === void 0 ? _optionalChain([base, 'optionalAccess', _56 => _56[k]]) : o[k];
|
|
3601
3624
|
if (value === void 0) return;
|
|
3602
3625
|
if (!allowed.includes(value)) fail2(`${path}.${k} must be one of ${allowed.join(", ")}, got ${JSON.stringify(value)}.`);
|
|
3603
3626
|
if (value !== (k === "align" ? "center" : k === "cap" ? "butt" : "miter")) out[k] = value;
|
|
@@ -3605,9 +3628,9 @@ function normalizeShapeStroke(v, path = "stroke", base) {
|
|
|
3605
3628
|
pick("align", ["inside", "center", "outside"]);
|
|
3606
3629
|
pick("cap", ["butt", "round", "square"]);
|
|
3607
3630
|
pick("join", ["miter", "round", "bevel"]);
|
|
3608
|
-
const miter = o.miterLimit === void 0 ? _optionalChain([base, 'optionalAccess',
|
|
3631
|
+
const miter = o.miterLimit === void 0 ? _optionalChain([base, 'optionalAccess', _57 => _57.miterLimit]) : requireNum(o.miterLimit, `${path}.miterLimit`, 1, 500);
|
|
3609
3632
|
if (miter !== void 0 && miter !== DEFAULT_MITER_LIMIT) out.miterLimit = miter;
|
|
3610
|
-
const dashes = o.dashes === void 0 ? _optionalChain([base, 'optionalAccess',
|
|
3633
|
+
const dashes = o.dashes === void 0 ? _optionalChain([base, 'optionalAccess', _58 => _58.dashes]) : o.dashes;
|
|
3611
3634
|
if (dashes !== void 0 && dashes !== null) {
|
|
3612
3635
|
if (!Array.isArray(dashes) || dashes.length > 32 || !dashes.every((d) => isNum(d) && d >= 0 && d <= 1e4)) fail2(`${path}.dashes must be at most 32 lengths 0..10000 (multiples of the width).`);
|
|
3613
3636
|
if (dashes.length) {
|
|
@@ -3615,7 +3638,7 @@ function normalizeShapeStroke(v, path = "stroke", base) {
|
|
|
3615
3638
|
out.dashes = [...dashes];
|
|
3616
3639
|
}
|
|
3617
3640
|
}
|
|
3618
|
-
const offset = o.dashOffset === void 0 ? _optionalChain([base, 'optionalAccess',
|
|
3641
|
+
const offset = o.dashOffset === void 0 ? _optionalChain([base, 'optionalAccess', _59 => _59.dashOffset]) : requireNum(o.dashOffset, `${path}.dashOffset`, -1e6, 1e6);
|
|
3619
3642
|
if (offset) out.dashOffset = offset;
|
|
3620
3643
|
return out;
|
|
3621
3644
|
}
|
|
@@ -3759,7 +3782,7 @@ function createShapeLayer(init, env, id = newLayerId()) {
|
|
|
3759
3782
|
return rerenderShape(layer, env);
|
|
3760
3783
|
}
|
|
3761
3784
|
function defaultShapeName(c) {
|
|
3762
|
-
switch (_optionalChain([c, 'optionalAccess',
|
|
3785
|
+
switch (_optionalChain([c, 'optionalAccess', _60 => _60.live, 'optionalAccess', _61 => _61.kind])) {
|
|
3763
3786
|
case "rect":
|
|
3764
3787
|
return "Rectangle";
|
|
3765
3788
|
case "ellipse":
|
|
@@ -3954,7 +3977,7 @@ function textOutlines(layer, shaper) {
|
|
|
3954
3977
|
}
|
|
3955
3978
|
var rgbOf = (hex) => {
|
|
3956
3979
|
const c = _chunkA2IS7EHEcjs.parseCssColor.call(void 0, hex);
|
|
3957
|
-
const h = (_nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
3980
|
+
const h = (_nullishCoalesce(_optionalChain([c, 'optionalAccess', _62 => _62.hex]), () => ( "#000000"))).slice(1);
|
|
3958
3981
|
return [parseInt(h.slice(0, 2), 16), parseInt(h.slice(2, 4), 16), parseInt(h.slice(4, 6), 16)];
|
|
3959
3982
|
};
|
|
3960
3983
|
function renderOutlines(layer, shaper, region) {
|
|
@@ -4170,7 +4193,7 @@ function createTypeLayer(init, env, id = newLayerId(), lenient = false) {
|
|
|
4170
4193
|
surface: _chunkCWM3CUUXcjs.emptySurface.call(void 0, 4),
|
|
4171
4194
|
offset: { x: 0, y: 0 }
|
|
4172
4195
|
};
|
|
4173
|
-
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([init, 'access',
|
|
4196
|
+
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([init, 'access', _63 => _63.runs, 'access', _64 => _64[0], 'optionalAccess', _65 => _65.style]), () => ( _chunkRHXW4TA5cjs.DEFAULT_TEXT_STYLE)) }];
|
|
4174
4197
|
if (init.transform && !_chunkRHXW4TA5cjs.isIdentityMatrix.call(void 0, init.transform)) layer.transform = init.transform;
|
|
4175
4198
|
if (lenient && !renderText(layer, env)) return { ...layer, rendering: "stored" };
|
|
4176
4199
|
return rerenderText(layer, env);
|
|
@@ -4181,7 +4204,7 @@ function updateTypeLayer(layers, id, change, env, action = "edit it") {
|
|
|
4181
4204
|
const patch = change(current);
|
|
4182
4205
|
const next = { ...current, ...patch };
|
|
4183
4206
|
if (!("annotation" in patch)) delete next.annotation;
|
|
4184
|
-
if ("text" in patch || "runs" in patch) next.runs = _chunkRHXW4TA5cjs.fitRuns.call(void 0, next.runs, next.text.length, _nullishCoalesce(_optionalChain([current, 'access',
|
|
4207
|
+
if ("text" in patch || "runs" in patch) next.runs = _chunkRHXW4TA5cjs.fitRuns.call(void 0, next.runs, next.text.length, _nullishCoalesce(_optionalChain([current, 'access', _66 => _66.runs, 'access', _67 => _67[0], 'optionalAccess', _68 => _68.style]), () => ( _chunkRHXW4TA5cjs.DEFAULT_TEXT_STYLE)));
|
|
4185
4208
|
if (!next.runs.length) next.runs = [{ length: 0, style: _chunkRHXW4TA5cjs.styleAt.call(void 0, current.runs, 0, _chunkRHXW4TA5cjs.DEFAULT_TEXT_STYLE) }];
|
|
4186
4209
|
if ("text" in patch || "paragraphs" in patch) next.paragraphs = _chunkRHXW4TA5cjs.fitParagraphRuns.call(void 0, next.paragraphs, next.text);
|
|
4187
4210
|
const rendered = rerenderText(next, env);
|
|
@@ -4468,7 +4491,7 @@ function legacyView(stack, width, height, activeLayerId = null) {
|
|
|
4468
4491
|
const { layers } = stack;
|
|
4469
4492
|
const target = developTarget(layers, activeLayerId);
|
|
4470
4493
|
const develop = target ? developFilter(target) : void 0;
|
|
4471
|
-
const blur = _nullishCoalesce(_nullishCoalesce(stack.legacyOutputBlur, () => ( (target ? _optionalChain([blurFilter, 'call',
|
|
4494
|
+
const blur = _nullishCoalesce(_nullishCoalesce(stack.legacyOutputBlur, () => ( (target ? _optionalChain([blurFilter, 'call', _69 => _69(target), 'optionalAccess', _70 => _70.radius]) : void 0))), () => ( 0));
|
|
4472
4495
|
const adjustments = {
|
|
4473
4496
|
...DEFAULT_ADJUSTMENTS_VALUES,
|
|
4474
4497
|
...develop ? {
|
|
@@ -4497,7 +4520,7 @@ function legacyView(stack, width, height, activeLayerId = null) {
|
|
|
4497
4520
|
};
|
|
4498
4521
|
walk(layers);
|
|
4499
4522
|
if (adjNodes.length) adjustments.layers = adjNodes.map((n) => legacyAdjustmentLayer(n, width, height));
|
|
4500
|
-
const depthSource = _optionalChain([target, 'optionalAccess',
|
|
4523
|
+
const depthSource = _optionalChain([target, 'optionalAccess', _71 => _71.mask, 'optionalAccess', _72 => _72.source]);
|
|
4501
4524
|
const depthMask = depthSource ? { ...depthSource, depthRange: [...depthSource.depthRange] } : { ...DEFAULT_DEPTH_MASK_VALUES, depthRange: [...DEFAULT_DEPTH_MASK_VALUES.depthRange] };
|
|
4502
4525
|
return { adjustments, depthMask, annotations, exact: isLegacyShape(stack) };
|
|
4503
4526
|
}
|
|
@@ -4522,7 +4545,7 @@ function isLegacyShape(stack) {
|
|
|
4522
4545
|
let adjustments = 0;
|
|
4523
4546
|
for (; i < layers.length && layers[i].type === "adjustment"; i++) {
|
|
4524
4547
|
const l = layers[i];
|
|
4525
|
-
if (l.clipped || l.locks || _optionalChain([l, 'access',
|
|
4548
|
+
if (l.clipped || l.locks || _optionalChain([l, 'access', _73 => _73.mask, 'optionalAccess', _74 => _74.source]) || l.effects) return false;
|
|
4526
4549
|
adjustments++;
|
|
4527
4550
|
}
|
|
4528
4551
|
for (; i < layers.length; i++) {
|
|
@@ -4729,7 +4752,7 @@ function isContentsDecoded(contents) {
|
|
|
4729
4752
|
}
|
|
4730
4753
|
function requireDecoded(layer, action) {
|
|
4731
4754
|
if (isContentsDecoded(layer.contents)) return;
|
|
4732
|
-
const what = _optionalChain([layer, 'access',
|
|
4755
|
+
const what = _optionalChain([layer, 'access', _75 => _75.contents, 'access', _76 => _76.file, 'optionalAccess', _77 => _77.type]) ? `a ${layer.contents.file.type.toUpperCase()} file` : "a file";
|
|
4733
4756
|
fail4(
|
|
4734
4757
|
`The contents of smart object "${layer.name || layer.id}" are ${what} that could not be decoded here, so it cannot ${action}. Run prepareSmartObjects() in a browser first, or rasterize it.`
|
|
4735
4758
|
);
|
|
@@ -4754,7 +4777,7 @@ function contentsSurface(contents) {
|
|
|
4754
4777
|
width: W,
|
|
4755
4778
|
height: H,
|
|
4756
4779
|
globalLight: doc.globalLight,
|
|
4757
|
-
pattern: (id) => _nullishCoalesce(_optionalChain([doc, 'access',
|
|
4780
|
+
pattern: (id) => _nullishCoalesce(_optionalChain([doc, 'access', _78 => _78.patterns, 'optionalAccess', _79 => _79.find, 'call', _80 => _80((p) => p.id === id)]), () => ( null))
|
|
4758
4781
|
});
|
|
4759
4782
|
s = _chunkCWM3CUUXcjs.surfaceFromPixels.call(void 0, { width: W, height: H, data }, 4, 0, 0);
|
|
4760
4783
|
}
|
|
@@ -4789,7 +4812,7 @@ function placeContents(layer, canvas, options = {}) {
|
|
|
4789
4812
|
const preview = Boolean(options.step && options.step > 1) || Boolean(options.clip);
|
|
4790
4813
|
const key = placementKey(placement, canvas);
|
|
4791
4814
|
if (!preview) {
|
|
4792
|
-
const hit = _optionalChain([placedCache, 'access',
|
|
4815
|
+
const hit = _optionalChain([placedCache, 'access', _81 => _81.get, 'call', _82 => _82(contents), 'optionalAccess', _83 => _83.get, 'call', _84 => _84(key)]);
|
|
4793
4816
|
if (hit) return hit;
|
|
4794
4817
|
}
|
|
4795
4818
|
const src = contentsSurface(contents);
|
|
@@ -4816,10 +4839,10 @@ function placeContents(layer, canvas, options = {}) {
|
|
|
4816
4839
|
let k = 1;
|
|
4817
4840
|
if (step > 1) {
|
|
4818
4841
|
k = step;
|
|
4819
|
-
let r = _optionalChain([options, 'access',
|
|
4842
|
+
let r = _optionalChain([options, 'access', _85 => _85.reduced, 'optionalAccess', _86 => _86.get, 'call', _87 => _87(k)]);
|
|
4820
4843
|
if (!r) {
|
|
4821
4844
|
r = _chunkHGTDMKNEcjs.reduceSurface.call(void 0, src, k);
|
|
4822
|
-
_optionalChain([options, 'access',
|
|
4845
|
+
_optionalChain([options, 'access', _88 => _88.reduced, 'optionalAccess', _89 => _89.set, 'call', _90 => _90(k, r)]);
|
|
4823
4846
|
}
|
|
4824
4847
|
source = r;
|
|
4825
4848
|
}
|
|
@@ -4852,15 +4875,15 @@ function placeContents(layer, canvas, options = {}) {
|
|
|
4852
4875
|
return out;
|
|
4853
4876
|
}
|
|
4854
4877
|
function activeSmartFilters(stack) {
|
|
4855
|
-
if (!_optionalChain([stack, 'optionalAccess',
|
|
4878
|
+
if (!_optionalChain([stack, 'optionalAccess', _91 => _91.enabled])) return [];
|
|
4856
4879
|
return stack.filters.filter((f) => f.kind !== "psd" && f.kind !== "effect" && isActiveFilter(f) && f.opacity > 0);
|
|
4857
4880
|
}
|
|
4858
4881
|
function activeEffectSmartFilters(stack) {
|
|
4859
|
-
if (!_optionalChain([stack, 'optionalAccess',
|
|
4882
|
+
if (!_optionalChain([stack, 'optionalAccess', _92 => _92.enabled])) return [];
|
|
4860
4883
|
return stack.filters.filter((f) => f.kind === "effect" && f.enabled && f.opacity > 0);
|
|
4861
4884
|
}
|
|
4862
4885
|
function runnableSmartFilters(stack) {
|
|
4863
|
-
if (!_optionalChain([stack, 'optionalAccess',
|
|
4886
|
+
if (!_optionalChain([stack, 'optionalAccess', _93 => _93.enabled])) return [];
|
|
4864
4887
|
return stack.filters.filter((f) => f.opacity > 0 && (f.kind === "effect" ? f.enabled : f.kind !== "psd" && isActiveFilter(f)));
|
|
4865
4888
|
}
|
|
4866
4889
|
function filterMaskCoverage(mask, canvas) {
|
|
@@ -4886,7 +4909,7 @@ function applySmartFilters(placed, stack, canvas) {
|
|
|
4886
4909
|
if (!active.length || !(canvas.width > 0 && canvas.height > 0)) return placed;
|
|
4887
4910
|
const W = canvas.width;
|
|
4888
4911
|
const H = canvas.height;
|
|
4889
|
-
const token = active.some((f) => f.kind === "effect") ? _nullishCoalesce(_optionalChain([canvas, 'access',
|
|
4912
|
+
const token = active.some((f) => f.kind === "effect") ? _nullishCoalesce(_optionalChain([canvas, 'access', _94 => _94.effects, 'optionalAccess', _95 => _95.token]), () => ( -1)) : 0;
|
|
4890
4913
|
const key = JSON.stringify([W, H, token, active.map((f) => ({ ...f, id: void 0 }))]);
|
|
4891
4914
|
let entry = filteredCache.get(placed);
|
|
4892
4915
|
let incomplete = false;
|
|
@@ -4898,9 +4921,9 @@ function applySmartFilters(placed, stack, canvas) {
|
|
|
4898
4921
|
if (f.kind === "effect") {
|
|
4899
4922
|
if (incomplete) continue;
|
|
4900
4923
|
const inputKey = JSON.stringify([surfaceId(placed), W, H, active.slice(0, i + 1).map((x) => ({ ...x, id: void 0, blend: x === f ? void 0 : x.blend, opacity: x === f ? void 0 : x.opacity }))]);
|
|
4901
|
-
const r = _optionalChain([canvas, 'access',
|
|
4902
|
-
if (!_optionalChain([r, 'optionalAccess',
|
|
4903
|
-
if (_optionalChain([r, 'optionalAccess',
|
|
4924
|
+
const r = _optionalChain([canvas, 'access', _96 => _96.effects, 'optionalAccess', _97 => _97.resolve, 'call', _98 => _98(f, acc, W, H, inputKey)]);
|
|
4925
|
+
if (!_optionalChain([r, 'optionalAccess', _99 => _99.result])) {
|
|
4926
|
+
if (_optionalChain([r, 'optionalAccess', _100 => _100.pending])) incomplete = true;
|
|
4904
4927
|
continue;
|
|
4905
4928
|
}
|
|
4906
4929
|
out2 = new Uint8ClampedArray(r.result);
|
|
@@ -4951,7 +4974,7 @@ function rerender(layer, canvas, action = "change") {
|
|
|
4951
4974
|
return { ...layer, surface: renderSmartObject(layer, canvas) };
|
|
4952
4975
|
}
|
|
4953
4976
|
function normalizePlacement(raw, contents) {
|
|
4954
|
-
const c = _optionalChain([raw, 'optionalAccess',
|
|
4977
|
+
const c = _optionalChain([raw, 'optionalAccess', _101 => _101.corners]);
|
|
4955
4978
|
if (!Array.isArray(c) || c.length !== 4 || !c.every((p) => p && Number.isFinite(p.x) && Number.isFinite(p.y))) {
|
|
4956
4979
|
fail4("corners must be four finite points [top-left, top-right, bottom-right, bottom-left] in document pixels.");
|
|
4957
4980
|
}
|
|
@@ -4996,7 +5019,7 @@ function setSmartPlacement(layers, id, placement, canvas) {
|
|
|
4996
5019
|
masksMoved ||= m !== layer.mask;
|
|
4997
5020
|
next.mask = m;
|
|
4998
5021
|
}
|
|
4999
|
-
if (_optionalChain([next, 'access',
|
|
5022
|
+
if (_optionalChain([next, 'access', _102 => _102.smartFilters, 'optionalAccess', _103 => _103.mask])) {
|
|
5000
5023
|
const m = followMask(next.smartFilters.mask, layer, next);
|
|
5001
5024
|
masksMoved ||= m !== next.smartFilters.mask;
|
|
5002
5025
|
next.smartFilters = { ...next.smartFilters, mask: m };
|
|
@@ -5014,12 +5037,12 @@ function offsetSmartObject(layers, id, dx, dy, canvas) {
|
|
|
5014
5037
|
let next = { ...layer, placement: { ...layer.placement, corners } };
|
|
5015
5038
|
const moveMask = (m2) => m2 && m2.linked !== false && !m2.source ? { ...m2, surface: _chunkCWM3CUUXcjs.translateSurface.call(void 0, m2.surface, mx, my) } : m2;
|
|
5016
5039
|
if (layer.mask) next.mask = moveMask(layer.mask);
|
|
5017
|
-
if (_optionalChain([layer, 'access',
|
|
5040
|
+
if (_optionalChain([layer, 'access', _104 => _104.smartFilters, 'optionalAccess', _105 => _105.mask])) next.smartFilters = { ...layer.smartFilters, mask: moveMask(layer.smartFilters.mask) };
|
|
5018
5041
|
const spatial = activeSmartFilters(layer.smartFilters).some((f) => f.kind === "blur") || activeEffectSmartFilters(layer.smartFilters).length > 0;
|
|
5019
5042
|
const b = _chunkCWM3CUUXcjs.contentBounds.call(void 0, layer.surface);
|
|
5020
5043
|
const m = SMART_RENDER_MARGIN;
|
|
5021
5044
|
const cut = b && (b.x <= -m || b.y <= -m || b.x + b.width >= canvas.width + m || b.y + b.height >= canvas.height + m);
|
|
5022
|
-
if (!spatial && !cut && !(_optionalChain([next, 'access',
|
|
5045
|
+
if (!spatial && !cut && !(_optionalChain([next, 'access', _106 => _106.smartFilters, 'optionalAccess', _107 => _107.mask]) && activeSmartFilters(next.smartFilters).length && next.smartFilters.mask.linked === false)) {
|
|
5023
5046
|
next = { ...next, surface: _chunkCWM3CUUXcjs.translateSurface.call(void 0, layer.surface, mx, my) };
|
|
5024
5047
|
} else {
|
|
5025
5048
|
next = rerender(next, canvas, "move");
|
|
@@ -5044,7 +5067,7 @@ function translateLayer(layer, dx, dy) {
|
|
|
5044
5067
|
mask: moveMask(layer.mask)
|
|
5045
5068
|
};
|
|
5046
5069
|
if (!next.mask) delete next.mask;
|
|
5047
|
-
if (_optionalChain([layer, 'access',
|
|
5070
|
+
if (_optionalChain([layer, 'access', _108 => _108.smartFilters, 'optionalAccess', _109 => _109.mask])) next.smartFilters = { ...layer.smartFilters, mask: moveMask(layer.smartFilters.mask) };
|
|
5048
5071
|
return next;
|
|
5049
5072
|
}
|
|
5050
5073
|
case "group": {
|
|
@@ -5104,14 +5127,14 @@ function union(a, b) {
|
|
|
5104
5127
|
return { x, y, width: Math.max(a.x + a.width, b.x + b.width) - x, height: Math.max(a.y + a.height, b.y + b.height) - y };
|
|
5105
5128
|
}
|
|
5106
5129
|
function asSmartFilters(filters) {
|
|
5107
|
-
if (!_optionalChain([filters, 'optionalAccess',
|
|
5130
|
+
if (!_optionalChain([filters, 'optionalAccess', _110 => _110.length])) return void 0;
|
|
5108
5131
|
return { enabled: true, filters: filters.map((f) => ({ ...f, blend: "normal", opacity: 1 })) };
|
|
5109
5132
|
}
|
|
5110
5133
|
function convertToSmartObject(layers, ids, canvas, options) {
|
|
5111
5134
|
if (!ids.length) fail4("Give at least one layer id to convert.");
|
|
5112
5135
|
const locs = [...new Set(ids)].map((id) => requireLayer(layers, id));
|
|
5113
|
-
const parent = _nullishCoalesce(_optionalChain([locs, 'access',
|
|
5114
|
-
if (locs.some((l) => (_nullishCoalesce(_optionalChain([l, 'access',
|
|
5136
|
+
const parent = _nullishCoalesce(_optionalChain([locs, 'access', _111 => _111[0], 'access', _112 => _112.parent, 'optionalAccess', _113 => _113.id]), () => ( null));
|
|
5137
|
+
if (locs.some((l) => (_nullishCoalesce(_optionalChain([l, 'access', _114 => _114.parent, 'optionalAccess', _115 => _115.id]), () => ( null))) !== parent)) fail4("Layers to convert must share one parent; move them next to each other first.");
|
|
5115
5138
|
for (const l of locs) requireUnlocked(l.layer, "all", "convert it");
|
|
5116
5139
|
const ordered = locs.sort((a, b) => a.index - b.index);
|
|
5117
5140
|
const top = ordered[ordered.length - 1];
|
|
@@ -5169,7 +5192,7 @@ function convertToSmartObject(layers, ids, canvas, options) {
|
|
|
5169
5192
|
delete first.clipped;
|
|
5170
5193
|
nested[0] = first;
|
|
5171
5194
|
}
|
|
5172
|
-
const name = _optionalChain([options, 'access',
|
|
5195
|
+
const name = _optionalChain([options, 'access', _116 => _116.name, 'optionalAccess', _117 => _117.trim, 'call', _118 => _118()]) || top.layer.name || "Smart Object";
|
|
5173
5196
|
const contents = documentContents({ layers: nested }, b.width, b.height, `${name}.psb`);
|
|
5174
5197
|
smart = {
|
|
5175
5198
|
type: "smart",
|
|
@@ -5184,7 +5207,7 @@ function convertToSmartObject(layers, ids, canvas, options) {
|
|
|
5184
5207
|
offset: { x: 0, y: 0 }
|
|
5185
5208
|
};
|
|
5186
5209
|
}
|
|
5187
|
-
if (_optionalChain([options, 'access',
|
|
5210
|
+
if (_optionalChain([options, 'access', _119 => _119.name, 'optionalAccess', _120 => _120.trim, 'call', _121 => _121()])) smart.name = options.name.trim();
|
|
5188
5211
|
smart = { ...smart, surface: renderSmartObject(smart, canvas) };
|
|
5189
5212
|
const below = ordered.filter((l) => l.index < top.index).length;
|
|
5190
5213
|
let out = layers;
|
|
@@ -5214,12 +5237,12 @@ function rasterizeSmartObject(layers, id) {
|
|
|
5214
5237
|
function copySmartObject(layers, id, linked, name) {
|
|
5215
5238
|
const loc = requireLayer(layers, id);
|
|
5216
5239
|
const layer = requireSmartObject(layers, id);
|
|
5217
|
-
const copy = { ...layer, id: newLayerId("smart"), name: _optionalChain([name, 'optionalAccess',
|
|
5240
|
+
const copy = { ...layer, id: newLayerId("smart"), name: _optionalChain([name, 'optionalAccess', _122 => _122.trim, 'call', _123 => _123()]) || `${layer.name || "Smart Object"} copy` };
|
|
5218
5241
|
delete copy.locks;
|
|
5219
5242
|
delete copy.psd;
|
|
5220
5243
|
if (!linked) copy.contents = { ...layer.contents, id: newContentsId() };
|
|
5221
5244
|
if (copy.smartFilters) copy.smartFilters = { ...copy.smartFilters, filters: copy.smartFilters.filters.map((f) => ({ ...f, id: newLayerId("flt") })) };
|
|
5222
|
-
return { layers: _chunkHGTDMKNEcjs.insertLayer.call(void 0, layers, copy, _nullishCoalesce(_optionalChain([loc, 'access',
|
|
5245
|
+
return { layers: _chunkHGTDMKNEcjs.insertLayer.call(void 0, layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _124 => _124.parent, 'optionalAccess', _125 => _125.id]), () => ( null)), loc.index + 1), layer: copy };
|
|
5223
5246
|
}
|
|
5224
5247
|
function instancesOf(layers, contentsId) {
|
|
5225
5248
|
return _chunkHGTDMKNEcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "smart" && l.contents.id === contentsId).map((l) => l.id);
|
|
@@ -5291,7 +5314,7 @@ function stackOf(layer) {
|
|
|
5291
5314
|
return _nullishCoalesce(layer.smartFilters, () => ( { enabled: true, filters: [] }));
|
|
5292
5315
|
}
|
|
5293
5316
|
function requireFilter(layer, filterId) {
|
|
5294
|
-
const list2 = _nullishCoalesce(_optionalChain([layer, 'access',
|
|
5317
|
+
const list2 = _nullishCoalesce(_optionalChain([layer, 'access', _126 => _126.smartFilters, 'optionalAccess', _127 => _127.filters]), () => ( []));
|
|
5295
5318
|
const i = list2.findIndex((f) => f.id === filterId);
|
|
5296
5319
|
if (i === -1) fail4(`Smart object "${layer.name || layer.id}" has no smart filter "${filterId}". Filters: ${list2.map((f) => `${f.id} (${f.kind})`).join(", ") || "none"}; call get_smart_object.`);
|
|
5297
5320
|
return i;
|
|
@@ -5358,7 +5381,7 @@ function setSmartFiltersEnabled(layers, id, enabled, canvas) {
|
|
|
5358
5381
|
}
|
|
5359
5382
|
function setSmartFilterMask(layers, id, mask, canvas) {
|
|
5360
5383
|
const layer = editableSmart(layers, id);
|
|
5361
|
-
if (_optionalChain([mask, 'optionalAccess',
|
|
5384
|
+
if (_optionalChain([mask, 'optionalAccess', _128 => _128.source])) fail4("A smart filter mask is painted, not generated; use a raster mask.");
|
|
5362
5385
|
const stack = { ...stackOf(layer) };
|
|
5363
5386
|
if (mask) stack.mask = mask;
|
|
5364
5387
|
else delete stack.mask;
|
|
@@ -5510,7 +5533,7 @@ function serializeLayer(layer, ctx) {
|
|
|
5510
5533
|
}
|
|
5511
5534
|
}
|
|
5512
5535
|
if (layer.fillOpacity !== void 0 && layer.fillOpacity !== 1) out.fillOpacity = layer.fillOpacity;
|
|
5513
|
-
if (_optionalChain([layer, 'access',
|
|
5536
|
+
if (_optionalChain([layer, 'access', _129 => _129.filters, 'optionalAccess', _130 => _130.length])) out.filters = JSON.parse(JSON.stringify(layer.filters));
|
|
5514
5537
|
if (layer.generator) out.generator = JSON.parse(JSON.stringify(layer.generator));
|
|
5515
5538
|
if (layer.source !== "document") {
|
|
5516
5539
|
const deep = encodeDeepSurface(layer.surface);
|
|
@@ -5553,12 +5576,12 @@ function serializeType(layer, base, ctx) {
|
|
|
5553
5576
|
out.x = enc.x;
|
|
5554
5577
|
out.y = enc.y;
|
|
5555
5578
|
}
|
|
5556
|
-
if (_optionalChain([layer, 'access',
|
|
5579
|
+
if (_optionalChain([layer, 'access', _131 => _131.missingFonts, 'optionalAccess', _132 => _132.length])) out.missingFonts = [...layer.missingFonts];
|
|
5557
5580
|
if (layer.annotation) out.annotation = JSON.parse(JSON.stringify(layer.annotation));
|
|
5558
|
-
if (_optionalChain([layer, 'access',
|
|
5581
|
+
if (_optionalChain([layer, 'access', _133 => _133.psd, 'optionalAccess', _134 => _134.tySh]) || _optionalChain([layer, 'access', _135 => _135.psd, 'optionalAccess', _136 => _136.blocks, 'optionalAccess', _137 => _137.length])) {
|
|
5559
5582
|
out.psd = {};
|
|
5560
5583
|
if (layer.psd.tySh) out.psd.tySh = _chunkCWM3CUUXcjs.bytesToBase64.call(void 0, layer.psd.tySh);
|
|
5561
|
-
if (_optionalChain([layer, 'access',
|
|
5584
|
+
if (_optionalChain([layer, 'access', _138 => _138.psd, 'access', _139 => _139.blocks, 'optionalAccess', _140 => _140.length])) out.psd.blocks = layer.psd.blocks.map((b) => ({ key: b.key, data: _chunkCWM3CUUXcjs.bytesToBase64.call(void 0, b.data) }));
|
|
5562
5585
|
if (layer.psd.signature) out.psd.signature = layer.psd.signature;
|
|
5563
5586
|
}
|
|
5564
5587
|
return out;
|
|
@@ -5568,15 +5591,15 @@ function readType(r, base, ctx) {
|
|
|
5568
5591
|
try {
|
|
5569
5592
|
const text3 = normalizeText(_nullishCoalesce(r.text, () => ( "")));
|
|
5570
5593
|
const runs = (Array.isArray(r.runs) ? r.runs : []).map((run, i) => ({
|
|
5571
|
-
length: Math.max(0, Math.floor(num2(_optionalChain([run, 'optionalAccess',
|
|
5572
|
-
style: patchTextStyle(_chunkRHXW4TA5cjs.DEFAULT_TEXT_STYLE, _optionalChain([run, 'optionalAccess',
|
|
5594
|
+
length: Math.max(0, Math.floor(num2(_optionalChain([run, 'optionalAccess', _141 => _141.length]), 0, 1e9, 0))),
|
|
5595
|
+
style: patchTextStyle(_chunkRHXW4TA5cjs.DEFAULT_TEXT_STYLE, _optionalChain([run, 'optionalAccess', _142 => _142.style]) && typeof run.style === "object" ? run.style : {}, `runs[${i}].style`)
|
|
5573
5596
|
}));
|
|
5574
5597
|
const paragraphs = (Array.isArray(r.paragraphs) ? r.paragraphs : []).map((p, i) => ({
|
|
5575
|
-
length: Math.max(0, Math.floor(num2(_optionalChain([p, 'optionalAccess',
|
|
5576
|
-
style: patchParagraphStyle({}, _optionalChain([p, 'optionalAccess',
|
|
5598
|
+
length: Math.max(0, Math.floor(num2(_optionalChain([p, 'optionalAccess', _143 => _143.length]), 0, 1e9, 0))),
|
|
5599
|
+
style: patchParagraphStyle({}, _optionalChain([p, 'optionalAccess', _144 => _144.style]) && typeof p.style === "object" ? p.style : {}, `paragraphs[${i}].style`)
|
|
5577
5600
|
}));
|
|
5578
5601
|
const f = r.frame;
|
|
5579
|
-
const frame = _optionalChain([f, 'optionalAccess',
|
|
5602
|
+
const frame = _optionalChain([f, 'optionalAccess', _145 => _145.kind]) === "box" ? { kind: "box", width: num2(f.width, 1, 1e6, 100), height: num2(f.height, 1, 1e6, 100) } : _optionalChain([f, 'optionalAccess', _146 => _146.origin]) === "top" ? { kind: "point", origin: "top" } : { kind: "point" };
|
|
5580
5603
|
const m = Array.isArray(r.transform) && r.transform.length === 6 && r.transform.every((v) => typeof v === "number" && Number.isFinite(v)) ? r.transform : void 0;
|
|
5581
5604
|
const layer = {
|
|
5582
5605
|
...base,
|
|
@@ -5588,7 +5611,7 @@ function readType(r, base, ctx) {
|
|
|
5588
5611
|
surface: _chunkCWM3CUUXcjs.emptySurface.call(void 0, 4),
|
|
5589
5612
|
offset: { x: 0, y: 0 }
|
|
5590
5613
|
};
|
|
5591
|
-
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([runs, 'access',
|
|
5614
|
+
if (!layer.runs.length) layer.runs = [{ length: 0, style: _nullishCoalesce(_optionalChain([runs, 'access', _147 => _147[0], 'optionalAccess', _148 => _148.style]), () => ( _chunkRHXW4TA5cjs.DEFAULT_TEXT_STYLE)) }];
|
|
5592
5615
|
if (m) layer.transform = m;
|
|
5593
5616
|
if (r.antiAlias === false) layer.antiAlias = false;
|
|
5594
5617
|
if (typeof r.fillOpacity === "number" && r.fillOpacity !== 1) layer.fillOpacity = num2(r.fillOpacity, 0, 1, 1);
|
|
@@ -5599,10 +5622,10 @@ function readType(r, base, ctx) {
|
|
|
5599
5622
|
if (typeof r.psd.tySh === "string") psd.tySh = _chunkCWM3CUUXcjs.base64ToBytes.call(void 0, r.psd.tySh);
|
|
5600
5623
|
if (Array.isArray(r.psd.blocks)) psd.blocks = r.psd.blocks.filter((b) => b && typeof b.key === "string" && typeof b.data === "string").map((b) => ({ key: b.key, data: _chunkCWM3CUUXcjs.base64ToBytes.call(void 0, b.data) }));
|
|
5601
5624
|
if (typeof r.psd.signature === "string") psd.signature = r.psd.signature;
|
|
5602
|
-
if (psd.tySh || _optionalChain([psd, 'access',
|
|
5625
|
+
if (psd.tySh || _optionalChain([psd, 'access', _149 => _149.blocks, 'optionalAccess', _150 => _150.length])) layer.psd = psd;
|
|
5603
5626
|
}
|
|
5604
5627
|
if (typeof r.asset === "string") return { ...layer, surface: readSurface(r.asset, r.x, r.y, 4, 0, ctx, label), rendering: "stored" };
|
|
5605
|
-
const env = { ..._nullishCoalesce(ctx.canvas, () => ( { width: 1, height: 1 })), shaper: _nullishCoalesce(_optionalChain([ctx, 'access',
|
|
5628
|
+
const env = { ..._nullishCoalesce(ctx.canvas, () => ( { width: 1, height: 1 })), shaper: _nullishCoalesce(_optionalChain([ctx, 'access', _151 => _151.text, 'optionalAccess', _152 => _152.shaper]), () => ( null)), createCanvas: _optionalChain([ctx, 'access', _153 => _153.text, 'optionalAccess', _154 => _154.createCanvas]) };
|
|
5606
5629
|
try {
|
|
5607
5630
|
return rerenderText(layer, env);
|
|
5608
5631
|
} catch (e8) {
|
|
@@ -5625,7 +5648,7 @@ function serializeShape(layer, base) {
|
|
|
5625
5648
|
if (layer.inverted) out.inverted = true;
|
|
5626
5649
|
if (layer.fillOpacity !== void 0 && layer.fillOpacity !== 1) out.fillOpacity = layer.fillOpacity;
|
|
5627
5650
|
if (layer.annotation) out.annotation = JSON.parse(JSON.stringify(layer.annotation));
|
|
5628
|
-
if (_optionalChain([layer, 'access',
|
|
5651
|
+
if (_optionalChain([layer, 'access', _155 => _155.psd, 'optionalAccess', _156 => _156.blocks, 'optionalAccess', _157 => _157.length])) out.psd = { blocks: layer.psd.blocks.map((b) => ({ key: b.key, data: _chunkCWM3CUUXcjs.bytesToBase64.call(void 0, b.data) })), ...layer.psd.signature ? { signature: layer.psd.signature } : {} };
|
|
5629
5652
|
return out;
|
|
5630
5653
|
}
|
|
5631
5654
|
function readShape(r, base, ctx) {
|
|
@@ -5639,12 +5662,12 @@ function readShape(r, base, ctx) {
|
|
|
5639
5662
|
if (!data) {
|
|
5640
5663
|
if (!Array.isArray(r.components) || !r.components.length) throw new Error("it has no components");
|
|
5641
5664
|
const components = r.components.map((c, i) => {
|
|
5642
|
-
const op = requireOperation(_optionalChain([c, 'optionalAccess',
|
|
5643
|
-
if (_optionalChain([c, 'optionalAccess',
|
|
5665
|
+
const op = requireOperation(_optionalChain([c, 'optionalAccess', _158 => _158.op]), `components[${i}].op`);
|
|
5666
|
+
if (_optionalChain([c, 'optionalAccess', _159 => _159.live])) {
|
|
5644
5667
|
const live = normalizeLiveShape(c.live, `components[${i}].live`);
|
|
5645
5668
|
return { op, subpaths: liveShapeSubpaths(live), live };
|
|
5646
5669
|
}
|
|
5647
|
-
return { op, subpaths: Array.isArray(_optionalChain([c, 'optionalAccess',
|
|
5670
|
+
return { op, subpaths: Array.isArray(_optionalChain([c, 'optionalAccess', _160 => _160.subpaths])) && !c.subpaths.length ? [] : normalizeSubpaths(_optionalChain([c, 'optionalAccess', _161 => _161.subpaths]), `components[${i}].subpaths`) };
|
|
5648
5671
|
});
|
|
5649
5672
|
data = {
|
|
5650
5673
|
components,
|
|
@@ -5715,7 +5738,7 @@ function serializeContents(c, ctx) {
|
|
|
5715
5738
|
if (c.kind === "document" && c.document) {
|
|
5716
5739
|
out.layers = c.document.layers.map((l) => serializeLayer(l, ctx));
|
|
5717
5740
|
if (c.document.globalLight) out.globalLight = { ...c.document.globalLight };
|
|
5718
|
-
if (_optionalChain([c, 'access',
|
|
5741
|
+
if (_optionalChain([c, 'access', _162 => _162.document, 'access', _163 => _163.patterns, 'optionalAccess', _164 => _164.length])) out.patterns = serializePatterns(c.document.patterns);
|
|
5719
5742
|
}
|
|
5720
5743
|
if (c.file) out.file = { type: c.file.type, data: _chunkCWM3CUUXcjs.bytesToBase64.call(void 0, c.file.bytes) };
|
|
5721
5744
|
if (c.linked) out.linked = { path: c.linked.path };
|
|
@@ -5895,7 +5918,7 @@ function deserializeLayer(raw, ctx) {
|
|
|
5895
5918
|
...base,
|
|
5896
5919
|
type: "pixel",
|
|
5897
5920
|
surface: r.source === "document" ? _chunkCWM3CUUXcjs.emptySurface.call(void 0, 4) : readSurface(r.asset, r.x, r.y, 4, 0, ctx, `Layer "${base.name || id}"`),
|
|
5898
|
-
offset: { x: Math.round(num2(_optionalChain([r, 'access',
|
|
5921
|
+
offset: { x: Math.round(num2(_optionalChain([r, 'access', _165 => _165.offset, 'optionalAccess', _166 => _166.x]), -1e7, 1e7, 0)), y: Math.round(num2(_optionalChain([r, 'access', _167 => _167.offset, 'optionalAccess', _168 => _168.y]), -1e7, 1e7, 0)) }
|
|
5899
5922
|
};
|
|
5900
5923
|
if (r.source === "document") layer.source = "document";
|
|
5901
5924
|
else if (r.deep) layer.surface = decodeDeepSurface(layer.surface, r.deep, ctx.problems, `Layer "${base.name || id}"`);
|
|
@@ -5928,7 +5951,7 @@ function deserializeLayer(raw, ctx) {
|
|
|
5928
5951
|
return null;
|
|
5929
5952
|
}
|
|
5930
5953
|
const annotation = JSON.parse(JSON.stringify({ ...a, id: typeof a.id === "string" ? a.id : id }));
|
|
5931
|
-
const migrated = annotationLayerFor(annotation, { ..._nullishCoalesce(ctx.canvas, () => ( { width: 1, height: 1 })), shaper: _nullishCoalesce(_optionalChain([ctx, 'access',
|
|
5954
|
+
const migrated = annotationLayerFor(annotation, { ..._nullishCoalesce(ctx.canvas, () => ( { width: 1, height: 1 })), shaper: _nullishCoalesce(_optionalChain([ctx, 'access', _169 => _169.text, 'optionalAccess', _170 => _170.shaper]), () => ( null)), createCanvas: _optionalChain([ctx, 'access', _171 => _171.text, 'optionalAccess', _172 => _172.createCanvas]) });
|
|
5932
5955
|
if (migrated.type === "shape" || migrated.type === "type") {
|
|
5933
5956
|
const blend = base.blend === "normal" ? migrated.blend : base.blend;
|
|
5934
5957
|
return { ...migrated, ...base, blend, id, name: base.name };
|
|
@@ -6320,7 +6343,7 @@ function descriptor(classId, items = []) {
|
|
|
6320
6343
|
return { name: "", classId, items };
|
|
6321
6344
|
}
|
|
6322
6345
|
function descGet(d, key) {
|
|
6323
|
-
return _optionalChain([d, 'access',
|
|
6346
|
+
return _optionalChain([d, 'access', _173 => _173.items, 'access', _174 => _174.find, 'call', _175 => _175(([k]) => k === key), 'optionalAccess', _176 => _176[1]]);
|
|
6324
6347
|
}
|
|
6325
6348
|
function descNumber(d, key) {
|
|
6326
6349
|
const v = descGet(d, key);
|
|
@@ -6330,7 +6353,7 @@ function descNumber(d, key) {
|
|
|
6330
6353
|
}
|
|
6331
6354
|
function descBool(d, key) {
|
|
6332
6355
|
const v = descGet(d, key);
|
|
6333
|
-
return _optionalChain([v, 'optionalAccess',
|
|
6356
|
+
return _optionalChain([v, 'optionalAccess', _177 => _177.type]) === "bool" ? v.value : void 0;
|
|
6334
6357
|
}
|
|
6335
6358
|
function descObject(d, key) {
|
|
6336
6359
|
const v = descGet(d, key);
|
|
@@ -7051,7 +7074,7 @@ var enumV = (typeId, value) => ({ type: "enum", typeId, value });
|
|
|
7051
7074
|
var obj = (d) => ({ type: "Objc", value: d });
|
|
7052
7075
|
var enumOf = (d, key) => {
|
|
7053
7076
|
const v = descGet(d, key);
|
|
7054
|
-
return _optionalChain([v, 'optionalAccess',
|
|
7077
|
+
return _optionalChain([v, 'optionalAccess', _178 => _178.type]) === "enum" ? v.value : void 0;
|
|
7055
7078
|
};
|
|
7056
7079
|
function read(data) {
|
|
7057
7080
|
try {
|
|
@@ -7133,7 +7156,7 @@ function strokeFromVstk(data, dpi, notes) {
|
|
|
7133
7156
|
const miter = descNumber(d, "strokeStyleMiterLimit");
|
|
7134
7157
|
if (miter !== void 0 && miter !== 100) stroke.miterLimit = Math.max(1, Math.min(500, miter));
|
|
7135
7158
|
const dashes = descGet(d, "strokeStyleLineDashSet");
|
|
7136
|
-
if (_optionalChain([dashes, 'optionalAccess',
|
|
7159
|
+
if (_optionalChain([dashes, 'optionalAccess', _179 => _179.type]) === "VlLs") {
|
|
7137
7160
|
const list2 = dashes.items.map((v) => v.type === "UntF" || v.type === "doub" || v.type === "long" ? v.value : NaN).filter((v) => Number.isFinite(v) && v >= 0);
|
|
7138
7161
|
if (list2.length && list2.some((v) => v > 0)) stroke.dashes = list2;
|
|
7139
7162
|
}
|
|
@@ -7285,7 +7308,7 @@ function vogkBytes(components, dpi) {
|
|
|
7285
7308
|
["keyOriginLineArrowEnd", boolV(Boolean(live.endArrow))],
|
|
7286
7309
|
["keyOriginLineArrWdth", dbl(head ? head.width / w * 100 : 0)],
|
|
7287
7310
|
["keyOriginLineArrLngth", dbl(head ? head.length / w * 100 : 0)],
|
|
7288
|
-
["keyOriginLineArrConc", long2(_optionalChain([head, 'optionalAccess',
|
|
7311
|
+
["keyOriginLineArrConc", long2(_optionalChain([head, 'optionalAccess', _180 => _180.concavity]) ? head.concavity * 100 : 0)]
|
|
7289
7312
|
];
|
|
7290
7313
|
}
|
|
7291
7314
|
const m = live.transform;
|
|
@@ -7318,7 +7341,7 @@ function shapeSignature(layer) {
|
|
|
7318
7341
|
return JSON.stringify([layer.components, layer.fill, layer.stroke, _nullishCoalesce(layer.fillRule, () => ( "nonzero")), Boolean(layer.inverted)]);
|
|
7319
7342
|
}
|
|
7320
7343
|
function shapeFromBlocks(blocks, width, height, dpi, notes) {
|
|
7321
|
-
const block = (k) => _optionalChain([blocks, 'access',
|
|
7344
|
+
const block = (k) => _optionalChain([blocks, 'access', _181 => _181.find, 'call', _182 => _182((b) => b.key === k), 'optionalAccess', _183 => _183.data]);
|
|
7322
7345
|
const vector = _nullishCoalesce(block("vsms"), () => ( block("vmsk")));
|
|
7323
7346
|
const path = vector ? componentsFromVectorBlock(vector, width, height) : null;
|
|
7324
7347
|
if (!path) return null;
|
|
@@ -7373,18 +7396,18 @@ function sameExtent(sub, c) {
|
|
|
7373
7396
|
return a.every((v, i) => Math.abs(v - b[i]) < 1);
|
|
7374
7397
|
}
|
|
7375
7398
|
function shapeBlocks(layer, width, height, dpi, notes) {
|
|
7376
|
-
const kept = _optionalChain([layer, 'access',
|
|
7377
|
-
if (_optionalChain([kept, 'optionalAccess',
|
|
7399
|
+
const kept = _optionalChain([layer, 'access', _184 => _184.psd, 'optionalAccess', _185 => _185.blocks]);
|
|
7400
|
+
if (_optionalChain([kept, 'optionalAccess', _186 => _186.length]) && _optionalChain([layer, 'access', _187 => _187.psd, 'optionalAccess', _188 => _188.signature]) === shapeSignature(layer)) return kept.map((b) => ({ key: b.key, data: b.data }));
|
|
7378
7401
|
const out = [];
|
|
7379
7402
|
out.push({ key: "vsms", data: vectorBlockForComponents(layer.components, Boolean(layer.inverted), width, height) });
|
|
7380
7403
|
if (layer.fillRule === "evenodd" && layer.components.some((c) => c.subpaths.length > 1)) notes.add("Even-odd fill rules were written as nonzero (Photoshop fills shapes nonzero)");
|
|
7381
7404
|
const fill = _nullishCoalesce(layer.fill, () => ( { type: "color", color: "#000000" }));
|
|
7382
|
-
if (_optionalChain([layer, 'access',
|
|
7405
|
+
if (_optionalChain([layer, 'access', _189 => _189.fill, 'optionalAccess', _190 => _190.opacity]) !== void 0 && layer.fill.opacity < 1) notes.add("Shape fill opacity has no PSD equivalent and was written as 100 % (use the layer fill opacity)");
|
|
7383
7406
|
out.push({ key: "vscg", data: vscgBytes(fill) });
|
|
7384
7407
|
if (layer.stroke || !layer.fill) out.push({ key: "vstk", data: vstkBytes(layer.stroke, Boolean(layer.fill), dpi) });
|
|
7385
7408
|
const vogk = vogkBytes(layer.components, dpi);
|
|
7386
7409
|
if (vogk) out.push({ key: "vogk", data: vogk });
|
|
7387
|
-
if (layer.components.some((c) => _optionalChain([c, 'access',
|
|
7410
|
+
if (layer.components.some((c) => _optionalChain([c, 'access', _191 => _191.live, 'optionalAccess', _192 => _192.kind]) === "line" && (c.live.startArrow && c.live.endArrow && JSON.stringify(c.live.startArrow) !== JSON.stringify(c.live.endArrow) || false))) {
|
|
7388
7411
|
notes.add("Lines with different start and end arrowheads were written with one arrowhead size (Photoshop has one)");
|
|
7389
7412
|
}
|
|
7390
7413
|
return out;
|
|
@@ -7593,7 +7616,7 @@ var E = {
|
|
|
7593
7616
|
bool: (value) => ({ t: "bool", value })
|
|
7594
7617
|
};
|
|
7595
7618
|
function eGet(v, key) {
|
|
7596
|
-
return _optionalChain([v, 'optionalAccess',
|
|
7619
|
+
return _optionalChain([v, 'optionalAccess', _193 => _193.t]) === "dict" ? _optionalChain([v, 'access', _194 => _194.items, 'access', _195 => _195.find, 'call', _196 => _196(([k]) => k === key), 'optionalAccess', _197 => _197[1]]) : void 0;
|
|
7597
7620
|
}
|
|
7598
7621
|
function ePath(v, keys) {
|
|
7599
7622
|
return keys.reduce((at, k) => eGet(at, k), v);
|
|
@@ -7611,7 +7634,7 @@ function eStr(v) {
|
|
|
7611
7634
|
return v && (v.t === "string" || v.t === "name") ? v.value : void 0;
|
|
7612
7635
|
}
|
|
7613
7636
|
function eArray(v) {
|
|
7614
|
-
return _optionalChain([v, 'optionalAccess',
|
|
7637
|
+
return _optionalChain([v, 'optionalAccess', _198 => _198.t]) === "array" ? v.items : [];
|
|
7615
7638
|
}
|
|
7616
7639
|
function eSet(d, key, value) {
|
|
7617
7640
|
if (d.t !== "dict") return;
|
|
@@ -7713,7 +7736,7 @@ function fontFromPostScript(ps) {
|
|
|
7713
7736
|
}
|
|
7714
7737
|
family += suffix;
|
|
7715
7738
|
const s = style.toLowerCase();
|
|
7716
|
-
const weight = _nullishCoalesce(_optionalChain([WEIGHTS, 'access',
|
|
7739
|
+
const weight = _nullishCoalesce(_optionalChain([WEIGHTS, 'access', _199 => _199.find, 'call', _200 => _200(([re]) => re.test(s)), 'optionalAccess', _201 => _201[1]]), () => ( 400));
|
|
7717
7740
|
return { family: family || ps, weight, italic: /italic|oblique|it$/.test(s) };
|
|
7718
7741
|
}
|
|
7719
7742
|
var STYLE_NAMES = [
|
|
@@ -7738,7 +7761,7 @@ var hex2 = (v) => Math.round(Math.max(0, Math.min(1, v)) * 255).toString(16).pad
|
|
|
7738
7761
|
function merged(levels) {
|
|
7739
7762
|
const items = [];
|
|
7740
7763
|
for (const l of levels) {
|
|
7741
|
-
if (_optionalChain([l, 'optionalAccess',
|
|
7764
|
+
if (_optionalChain([l, 'optionalAccess', _202 => _202.t]) !== "dict") continue;
|
|
7742
7765
|
for (const [k, v] of l.items) if (!items.some(([o]) => o === k)) items.push([k, v]);
|
|
7743
7766
|
}
|
|
7744
7767
|
return E.dict(items);
|
|
@@ -7809,10 +7832,10 @@ function typeFromTySh(data, notes) {
|
|
|
7809
7832
|
const t = parseTySh(data);
|
|
7810
7833
|
if (!t) return null;
|
|
7811
7834
|
const txtV = descGet(t.text, "Txt ");
|
|
7812
|
-
const txt = _optionalChain([txtV, 'optionalAccess',
|
|
7835
|
+
const txt = _optionalChain([txtV, 'optionalAccess', _203 => _203.type]) === "TEXT" ? txtV.value.replace(/\0+$/, "") : void 0;
|
|
7813
7836
|
const ed = descGet(t.text, "EngineData");
|
|
7814
7837
|
let engine = null;
|
|
7815
|
-
if (_optionalChain([ed, 'optionalAccess',
|
|
7838
|
+
if (_optionalChain([ed, 'optionalAccess', _204 => _204.type]) === "tdta") {
|
|
7816
7839
|
try {
|
|
7817
7840
|
engine = parseEngineData(ed.data);
|
|
7818
7841
|
} catch (e18) {
|
|
@@ -7820,12 +7843,12 @@ function typeFromTySh(data, notes) {
|
|
|
7820
7843
|
}
|
|
7821
7844
|
}
|
|
7822
7845
|
const anti = descGet(t.text, "AntA");
|
|
7823
|
-
const antiAlias = !(_optionalChain([anti, 'optionalAccess',
|
|
7846
|
+
const antiAlias = !(_optionalChain([anti, 'optionalAccess', _205 => _205.type]) === "enum" && (anti.value === "Anno" || anti.value === "antiAliasNone"));
|
|
7824
7847
|
const ornt = descGet(t.text, "Ornt");
|
|
7825
|
-
if (_optionalChain([ornt, 'optionalAccess',
|
|
7848
|
+
if (_optionalChain([ornt, 'optionalAccess', _206 => _206.type]) === "enum" && ornt.value === "Vrtc") notes.add("vertical type is laid out horizontally");
|
|
7826
7849
|
if (t.warp) {
|
|
7827
7850
|
const style = descGet(t.warp, "warpStyle");
|
|
7828
|
-
if (_optionalChain([style, 'optionalAccess',
|
|
7851
|
+
if (_optionalChain([style, 'optionalAccess', _207 => _207.type]) === "enum" && style.value !== "warpNone") notes.add("warped text is drawn without its warp when edited");
|
|
7829
7852
|
}
|
|
7830
7853
|
const edText = _nullishCoalesce(eStr(ePath(_nullishCoalesce(engine, () => ( void 0)), ["EngineDict", "Editor", "Text"])), () => ( ""));
|
|
7831
7854
|
const text3 = (_nullishCoalesce(txt, () => ( edText.replace(/\r$/, "")))).replace(/\r\n?/g, "\n");
|
|
@@ -7874,7 +7897,7 @@ function typeFromTySh(data, notes) {
|
|
|
7874
7897
|
let at = 0;
|
|
7875
7898
|
runs = ssheets.map((sheet, i) => {
|
|
7876
7899
|
const own = named(styleSet, sheet);
|
|
7877
|
-
const paraDefault = _optionalChain([paraBases, 'access',
|
|
7900
|
+
const paraDefault = _optionalChain([paraBases, 'access', _208 => _208[paraAt(at)], 'optionalAccess', _209 => _209.charDefault]);
|
|
7878
7901
|
at += _nullishCoalesce(slens[i], () => ( 0));
|
|
7879
7902
|
const d = merged([eGet(sheet, "StyleSheetData"), eGet(own, "StyleSheetData"), eGet(paraDefault, "StyleSheetData"), eGet(normalStyle, "StyleSheetData")]);
|
|
7880
7903
|
return { length: _nullishCoalesce(slens[i], () => ( 0)), style: charStyle(d, fonts, notes) };
|
|
@@ -7953,8 +7976,8 @@ var fontEntry = (name) => E.dict([
|
|
|
7953
7976
|
["Synthetic", E.int(0)]
|
|
7954
7977
|
]);
|
|
7955
7978
|
function buildEngineData(layer, template) {
|
|
7956
|
-
const e = _optionalChain([template, 'optionalAccess',
|
|
7957
|
-
if (_optionalChain([eGet, 'call',
|
|
7979
|
+
const e = _optionalChain([template, 'optionalAccess', _210 => _210.t]) === "dict" ? eClone(template) : E.dict([["EngineDict", E.dict()], ["ResourceDict", E.dict()]]);
|
|
7980
|
+
if (_optionalChain([eGet, 'call', _211 => _211(e, "EngineDict"), 'optionalAccess', _212 => _212.t]) !== "dict") eSet(e, "EngineDict", E.dict());
|
|
7958
7981
|
const dict = eGet(e, "EngineDict");
|
|
7959
7982
|
const text3 = layer.text.replace(/\n/g, "\r");
|
|
7960
7983
|
const edText = `${text3}\r`;
|
|
@@ -8033,7 +8056,7 @@ function buildEngineData(layer, template) {
|
|
|
8033
8056
|
eSet(e, key, rd);
|
|
8034
8057
|
}
|
|
8035
8058
|
eSet(rd, "FontSet", fontSet);
|
|
8036
|
-
if (!eGet(rd, "StyleSheetSet")) eSet(rd, "StyleSheetSet", E.array([E.dict([["Name", E.str("Normal RGB")], ["StyleSheetData", styleSheetData(_nullishCoalesce(_optionalChain([runs, 'access',
|
|
8059
|
+
if (!eGet(rd, "StyleSheetSet")) eSet(rd, "StyleSheetSet", E.array([E.dict([["Name", E.str("Normal RGB")], ["StyleSheetData", styleSheetData(_nullishCoalesce(_optionalChain([runs, 'access', _213 => _213[0], 'optionalAccess', _214 => _214.style]), () => ( _chunkRHXW4TA5cjs.DEFAULT_TEXT_STYLE)), 0)]])]));
|
|
8037
8060
|
if (!eGet(rd, "ParagraphSheetSet")) eSet(rd, "ParagraphSheetSet", E.array([E.dict([["Name", E.str("Normal RGB")], ["DefaultStyleSheet", E.int(0)], ["Properties", paragraphProperties({})]])]));
|
|
8038
8061
|
if (!eGet(rd, "TheNormalStyleSheet")) eSet(rd, "TheNormalStyleSheet", E.int(0));
|
|
8039
8062
|
if (!eGet(rd, "TheNormalParagraphSheet")) eSet(rd, "TheNormalParagraphSheet", E.int(0));
|
|
@@ -8054,12 +8077,12 @@ function inkBounds2(layer) {
|
|
|
8054
8077
|
return [Math.min(...pts.map((p) => p.x)), Math.min(...pts.map((p) => p.y)), Math.max(...pts.map((p) => p.x)), Math.max(...pts.map((p) => p.y))];
|
|
8055
8078
|
}
|
|
8056
8079
|
function tyShForLayer(layer) {
|
|
8057
|
-
const raw = _optionalChain([layer, 'access',
|
|
8058
|
-
if (raw && _optionalChain([layer, 'access',
|
|
8080
|
+
const raw = _optionalChain([layer, 'access', _215 => _215.psd, 'optionalAccess', _216 => _216.tySh]);
|
|
8081
|
+
if (raw && _optionalChain([layer, 'access', _217 => _217.psd, 'optionalAccess', _218 => _218.signature]) === typeSignature(layer)) return raw;
|
|
8059
8082
|
const old = raw ? parseTySh(raw) : null;
|
|
8060
8083
|
const oldEd = old ? descGet(old.text, "EngineData") : void 0;
|
|
8061
8084
|
let template = null;
|
|
8062
|
-
if (_optionalChain([oldEd, 'optionalAccess',
|
|
8085
|
+
if (_optionalChain([oldEd, 'optionalAccess', _219 => _219.type]) === "tdta") {
|
|
8063
8086
|
try {
|
|
8064
8087
|
template = parseEngineData(oldEd.data);
|
|
8065
8088
|
} catch (e19) {
|
|
@@ -8091,8 +8114,8 @@ function tyShForLayer(layer) {
|
|
|
8091
8114
|
set("boundingBox", rect("boundingBox"));
|
|
8092
8115
|
if (!descGet(text3, "TextIndex")) set("TextIndex", { type: "long", value: 0 });
|
|
8093
8116
|
set("EngineData", { type: "tdta", data: writeEngineData(engine) });
|
|
8094
|
-
const warpStyle = _optionalChain([old, 'optionalAccess',
|
|
8095
|
-
const warp = _optionalChain([old, 'optionalAccess',
|
|
8117
|
+
const warpStyle = _optionalChain([old, 'optionalAccess', _220 => _220.warp]) ? descGet(old.warp, "warpStyle") : void 0;
|
|
8118
|
+
const warp = _optionalChain([old, 'optionalAccess', _221 => _221.warp]) && _optionalChain([warpStyle, 'optionalAccess', _222 => _222.type]) === "enum" && warpStyle.value === "warpNone" ? old.warp : null;
|
|
8096
8119
|
return writeTySh({ transform: textMatrix(layer), text: text3, warp, tail: new Uint8Array(16) });
|
|
8097
8120
|
}
|
|
8098
8121
|
|
|
@@ -8292,15 +8315,15 @@ var textV = (value) => ({ type: "TEXT", value });
|
|
|
8292
8315
|
var obj2 = (d) => ({ type: "Objc", value: d });
|
|
8293
8316
|
var text = (d, key) => {
|
|
8294
8317
|
const v = descGet(d, key);
|
|
8295
|
-
return _optionalChain([v, 'optionalAccess',
|
|
8318
|
+
return _optionalChain([v, 'optionalAccess', _223 => _223.type]) === "TEXT" ? v.value : void 0;
|
|
8296
8319
|
};
|
|
8297
8320
|
var enumOf2 = (d, key) => {
|
|
8298
8321
|
const v = descGet(d, key);
|
|
8299
|
-
return _optionalChain([v, 'optionalAccess',
|
|
8322
|
+
return _optionalChain([v, 'optionalAccess', _224 => _224.type]) === "enum" ? v.value : void 0;
|
|
8300
8323
|
};
|
|
8301
8324
|
var numbers = (d, key) => {
|
|
8302
8325
|
const v = descGet(d, key);
|
|
8303
|
-
if (_optionalChain([v, 'optionalAccess',
|
|
8326
|
+
if (_optionalChain([v, 'optionalAccess', _225 => _225.type]) !== "VlLs") return null;
|
|
8304
8327
|
const out = [];
|
|
8305
8328
|
for (const it of v.items) {
|
|
8306
8329
|
if (it.type === "doub" || it.type === "UntF" || it.type === "long") out.push(it.value);
|
|
@@ -8495,8 +8518,8 @@ function filterMaskItem(placed, mask, area) {
|
|
|
8495
8518
|
const painted = _chunkCWM3CUUXcjs.contentBounds.call(void 0, mask.surface);
|
|
8496
8519
|
let b = _nullishCoalesce(painted, () => ( { x: 0, y: 0, width: 1, height: 1 }));
|
|
8497
8520
|
if (mask.defaultValue !== 255 && area) {
|
|
8498
|
-
const x0 = Math.min(area.x, _nullishCoalesce(_optionalChain([painted, 'optionalAccess',
|
|
8499
|
-
const y0 = Math.min(area.y, _nullishCoalesce(_optionalChain([painted, 'optionalAccess',
|
|
8521
|
+
const x0 = Math.min(area.x, _nullishCoalesce(_optionalChain([painted, 'optionalAccess', _226 => _226.x]), () => ( area.x)));
|
|
8522
|
+
const y0 = Math.min(area.y, _nullishCoalesce(_optionalChain([painted, 'optionalAccess', _227 => _227.y]), () => ( area.y)));
|
|
8500
8523
|
const x1 = Math.max(area.x + area.width, painted ? painted.x + painted.width : 0);
|
|
8501
8524
|
const y1 = Math.max(area.y + area.height, painted ? painted.y + painted.height : 0);
|
|
8502
8525
|
b = { x: x0, y: y0, width: x1 - x0, height: y1 - y0 };
|
|
@@ -8516,7 +8539,7 @@ function filterMaskItem(placed, mask, area) {
|
|
|
8516
8539
|
}
|
|
8517
8540
|
var warpStyleOf = (name) => {
|
|
8518
8541
|
if (!name.startsWith("warp")) return null;
|
|
8519
|
-
const s = _optionalChain([name, 'access',
|
|
8542
|
+
const s = _optionalChain([name, 'access', _228 => _228[4], 'optionalAccess', _229 => _229.toLowerCase, 'call', _230 => _230()]) + name.slice(5);
|
|
8520
8543
|
return _chunkRHXW4TA5cjs.WARP_STYLES.includes(s) ? s : null;
|
|
8521
8544
|
};
|
|
8522
8545
|
function warpFromDescriptor(w, contents) {
|
|
@@ -8538,7 +8561,7 @@ function warpFromDescriptor(w, contents) {
|
|
|
8538
8561
|
if (!arr || arr.type !== "ObAr") return void 0;
|
|
8539
8562
|
const xs = descGet(arr.body, "Hrzn");
|
|
8540
8563
|
const ys = descGet(arr.body, "Vrtc");
|
|
8541
|
-
if (_optionalChain([xs, 'optionalAccess',
|
|
8564
|
+
if (_optionalChain([xs, 'optionalAccess', _231 => _231.type]) !== "UnFl" || _optionalChain([ys, 'optionalAccess', _232 => _232.type]) !== "UnFl" || xs.values.length !== 16 || ys.values.length !== 16) return void 0;
|
|
8542
8565
|
mesh = { us: [0, 1], vs: [0, 1], points: xs.values.map((x, i) => ({ x, y: ys.values[i] })) };
|
|
8543
8566
|
const px2 = mesh.points.map((p) => p.x);
|
|
8544
8567
|
const py = mesh.points.map((p) => p.y);
|
|
@@ -8705,13 +8728,13 @@ function blendOptions(f) {
|
|
|
8705
8728
|
function smartFiltersFromPsd(fx, newId, notes) {
|
|
8706
8729
|
const filters = [];
|
|
8707
8730
|
const list2 = descGet(fx, "filterFXList");
|
|
8708
|
-
for (const v of _optionalChain([list2, 'optionalAccess',
|
|
8731
|
+
for (const v of _optionalChain([list2, 'optionalAccess', _233 => _233.type]) === "VlLs" ? list2.items : []) {
|
|
8709
8732
|
if (v.type !== "Objc" && v.type !== "GlbO") continue;
|
|
8710
8733
|
const item = v.value;
|
|
8711
8734
|
const { blend, opacity } = blendOptionsOf(item);
|
|
8712
8735
|
const enabled = descBool(item, "enab") !== false;
|
|
8713
8736
|
const fltr = descObject(item, "Fltr");
|
|
8714
|
-
const radius = _optionalChain([fltr, 'optionalAccess',
|
|
8737
|
+
const radius = _optionalChain([fltr, 'optionalAccess', _234 => _234.classId]) === BOX_BLUR.classId ? descNumber(fltr, "Rds ") : void 0;
|
|
8715
8738
|
if (radius !== void 0 && radius >= 0 && radius <= 50) {
|
|
8716
8739
|
filters.push({ id: newId(), kind: "blur", enabled, radius, blend, opacity });
|
|
8717
8740
|
continue;
|
|
@@ -9064,7 +9087,7 @@ function readPsd(bytes) {
|
|
|
9064
9087
|
return { header, colorModeData, resources, layers, mergedAlpha, globalBlocks, imageCompression, imageData: r.rest() };
|
|
9065
9088
|
}
|
|
9066
9089
|
function layerBlock(rec, key) {
|
|
9067
|
-
return _optionalChain([rec, 'access',
|
|
9090
|
+
return _optionalChain([rec, 'access', _235 => _235.blocks, 'access', _236 => _236.find, 'call', _237 => _237((b) => b.key === key), 'optionalAccess', _238 => _238.data]);
|
|
9068
9091
|
}
|
|
9069
9092
|
function layerName(rec) {
|
|
9070
9093
|
const luni = layerBlock(rec, "luni");
|
|
@@ -9095,7 +9118,7 @@ function u8Block(rec, key) {
|
|
|
9095
9118
|
function layerTree(file) {
|
|
9096
9119
|
const stack = [[]];
|
|
9097
9120
|
file.layers.forEach((rec, index) => {
|
|
9098
|
-
const kind = _nullishCoalesce(_optionalChain([sectionDivider, 'call',
|
|
9121
|
+
const kind = _nullishCoalesce(_optionalChain([sectionDivider, 'call', _239 => _239(rec), 'optionalAccess', _240 => _240.kind]), () => ( SECTION_OTHER));
|
|
9099
9122
|
if (kind === SECTION_DIVIDER) {
|
|
9100
9123
|
stack.push([]);
|
|
9101
9124
|
} else if (kind === SECTION_OPEN || kind === SECTION_CLOSED) {
|
|
@@ -9113,7 +9136,7 @@ function layerTree(file) {
|
|
|
9113
9136
|
}
|
|
9114
9137
|
function channelRect(rec, id) {
|
|
9115
9138
|
if (id === CHANNEL_USER_MASK && rec.mask) return rec.mask.rect;
|
|
9116
|
-
if (id === CHANNEL_REAL_USER_MASK && rec.mask) return _nullishCoalesce(_optionalChain([rec, 'access',
|
|
9139
|
+
if (id === CHANNEL_REAL_USER_MASK && rec.mask) return _nullishCoalesce(_optionalChain([rec, 'access', _241 => _241.mask, 'access', _242 => _242.real, 'optionalAccess', _243 => _243.rect]), () => ( rec.mask.rect));
|
|
9117
9140
|
return rec.rect;
|
|
9118
9141
|
}
|
|
9119
9142
|
function decodeLayerChannel(file, rec, id) {
|
|
@@ -9131,7 +9154,7 @@ function decodeMergedImage(file) {
|
|
|
9131
9154
|
return decodePlanes(file.imageCompression, file.imageData, { planes: channels, width, height, depth, psb });
|
|
9132
9155
|
}
|
|
9133
9156
|
function resource(file, id) {
|
|
9134
|
-
return _optionalChain([file, 'access',
|
|
9157
|
+
return _optionalChain([file, 'access', _244 => _244.resources, 'access', _245 => _245.find, 'call', _246 => _246((r) => r.id === id), 'optionalAccess', _247 => _247.data]);
|
|
9135
9158
|
}
|
|
9136
9159
|
function resolution(file) {
|
|
9137
9160
|
const d = resource(file, 1005);
|
|
@@ -9915,7 +9938,7 @@ function importNode(ctx, node, depth) {
|
|
|
9915
9938
|
if (node.children) {
|
|
9916
9939
|
const props2 = baseProps(ctx, rec, name, notes);
|
|
9917
9940
|
const divider = sectionDivider(rec);
|
|
9918
|
-
const key = _nullishCoalesce(_optionalChain([divider, 'optionalAccess',
|
|
9941
|
+
const key = _nullishCoalesce(_optionalChain([divider, 'optionalAccess', _248 => _248.blendKey]), () => ( rec.blendKey));
|
|
9919
9942
|
const groupBlend = key === "pass" ? "pass-through" : _nullishCoalesce(PSD_BLEND_KEYS[key], () => ( "normal"));
|
|
9920
9943
|
const children = [];
|
|
9921
9944
|
for (const child of node.children) {
|
|
@@ -9925,7 +9948,7 @@ function importNode(ctx, node, depth) {
|
|
|
9925
9948
|
const group = { type: "group", id: ctx.newId(name), ...props2, blend: groupBlend, children };
|
|
9926
9949
|
const effects2 = recordEffects(ctx, rec, name, notes, true);
|
|
9927
9950
|
if (effects2) group.effects = effects2;
|
|
9928
|
-
if (_optionalChain([divider, 'optionalAccess',
|
|
9951
|
+
if (_optionalChain([divider, 'optionalAccess', _249 => _249.kind]) === SECTION_CLOSED) group.collapsed = true;
|
|
9929
9952
|
const mask2 = recordMask(ctx, rec, name);
|
|
9930
9953
|
if (mask2) group.mask = mask2;
|
|
9931
9954
|
entry.type = "group";
|
|
@@ -10148,7 +10171,7 @@ function importSmart(ctx, rec, name, notes, props) {
|
|
|
10148
10171
|
const file = ctx.linked.get(placed.idnt);
|
|
10149
10172
|
contents = {
|
|
10150
10173
|
id: placed.idnt || ctx.newId(`${name}-contents`),
|
|
10151
|
-
name: _optionalChain([file, 'optionalAccess',
|
|
10174
|
+
name: _optionalChain([file, 'optionalAccess', _250 => _250.name]) || `${name}.png`,
|
|
10152
10175
|
width,
|
|
10153
10176
|
height,
|
|
10154
10177
|
kind: "raster",
|
|
@@ -10305,7 +10328,7 @@ function psdToLayers(file, options = {}) {
|
|
|
10305
10328
|
if (mode !== "rgb" && header.depth > 8 && header.colorMode !== MODE_INDEXED && header.colorMode !== MODE_BITMAP) {
|
|
10306
10329
|
warn.extra.push(`The file is ${header.depth}-bit ${mode}; it was converted to ${header.depth}-bit RGB.`);
|
|
10307
10330
|
} else if (mode !== "rgb" || header.depth !== 8 && header.depth !== 16 && header.depth !== 32) {
|
|
10308
|
-
const how = header.colorMode === MODE_CMYK ? ` through ${_nullishCoalesce(_optionalChain([cmykProfile, 'optionalAccess',
|
|
10331
|
+
const how = header.colorMode === MODE_CMYK ? ` through ${_nullishCoalesce(_optionalChain([cmykProfile, 'optionalAccess', _251 => _251.name]), () => ( "its profile"))}` : "";
|
|
10309
10332
|
warn.extra.push(`The file is ${header.depth}-bit ${mode}; it was converted to 8-bit RGB${how}.`);
|
|
10310
10333
|
}
|
|
10311
10334
|
let layers = [];
|
|
@@ -10411,15 +10434,15 @@ var pct = (d, key, fallback) => num3(d, key, fallback * 100) / 100;
|
|
|
10411
10434
|
var bool = (d, key) => descBool(d, key) === true;
|
|
10412
10435
|
var enumOf3 = (d, key) => {
|
|
10413
10436
|
const v = descGet(d, key);
|
|
10414
|
-
return _optionalChain([v, 'optionalAccess',
|
|
10437
|
+
return _optionalChain([v, 'optionalAccess', _252 => _252.type]) === "enum" ? v.value : void 0;
|
|
10415
10438
|
};
|
|
10416
10439
|
var text2 = (d, key) => {
|
|
10417
10440
|
const v = d ? descGet(d, key) : void 0;
|
|
10418
|
-
return _optionalChain([v, 'optionalAccess',
|
|
10441
|
+
return _optionalChain([v, 'optionalAccess', _253 => _253.type]) === "TEXT" ? v.value : "";
|
|
10419
10442
|
};
|
|
10420
10443
|
var list = (d, key) => {
|
|
10421
10444
|
const v = descGet(d, key);
|
|
10422
|
-
if (_optionalChain([v, 'optionalAccess',
|
|
10445
|
+
if (_optionalChain([v, 'optionalAccess', _254 => _254.type]) !== "VlLs") return [];
|
|
10423
10446
|
return v.items.flatMap((it) => it.type === "Objc" || it.type === "GlbO" ? [it.value] : []);
|
|
10424
10447
|
};
|
|
10425
10448
|
var clamp3 = (v, lo, hi) => Number.isFinite(v) ? Math.min(hi, Math.max(lo, v)) : lo;
|
|
@@ -10489,8 +10512,8 @@ function contourOf(d, key) {
|
|
|
10489
10512
|
return { name, points };
|
|
10490
10513
|
}
|
|
10491
10514
|
function contourDesc(c) {
|
|
10492
|
-
const name = _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
10493
|
-
const points = _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
10515
|
+
const name = _nullishCoalesce(_optionalChain([c, 'optionalAccess', _255 => _255.name]), () => ( "Linear"));
|
|
10516
|
+
const points = _nullishCoalesce(_optionalChain([c, 'optionalAccess', _256 => _256.points]), () => ( [
|
|
10494
10517
|
{ input: 0, output: 0 },
|
|
10495
10518
|
{ input: 1, output: 1 }
|
|
10496
10519
|
]));
|
|
@@ -10525,7 +10548,7 @@ function gradientOf(d, notes) {
|
|
|
10525
10548
|
{ position: 0, color: "#000000" },
|
|
10526
10549
|
{ position: 1, color: "#ffffff" }
|
|
10527
10550
|
],
|
|
10528
|
-
style: _nullishCoalesce(_optionalChain([GRADIENT_STYLES, 'access',
|
|
10551
|
+
style: _nullishCoalesce(_optionalChain([GRADIENT_STYLES, 'access', _257 => _257.find, 'call', _258 => _258(([, id]) => id === enumOf3(d, "Type")), 'optionalAccess', _259 => _259[0]]), () => ( "linear")),
|
|
10529
10552
|
angle: clamp3(num3(d, "Angl", 90), -360, 360),
|
|
10530
10553
|
scale: clamp3(pct(d, "Scl ", 1), 0.1, 1.5),
|
|
10531
10554
|
reverse: bool(d, "Rvrs"),
|
|
@@ -10579,7 +10602,7 @@ function gradientItems(g) {
|
|
|
10579
10602
|
)
|
|
10580
10603
|
)
|
|
10581
10604
|
};
|
|
10582
|
-
const op = _optionalChain([g, 'access',
|
|
10605
|
+
const op = _optionalChain([g, 'access', _260 => _260.opacityStops, 'optionalAccess', _261 => _261.length]) ? g.opacityStops : g.stops.map((s) => ({ position: s.position, opacity: 1 }));
|
|
10583
10606
|
const trns = {
|
|
10584
10607
|
type: "VlLs",
|
|
10585
10608
|
items: op.map(
|
|
@@ -11076,9 +11099,9 @@ function prepareNestedLayers(layers) {
|
|
|
11076
11099
|
if (l.type === "annotation") continue;
|
|
11077
11100
|
let next = l;
|
|
11078
11101
|
if (l.type === "group") next = { ...l, children: prepareNestedLayers(l.children) };
|
|
11079
|
-
else if (l.type === "pixel" && (_optionalChain([l, 'access',
|
|
11102
|
+
else if (l.type === "pixel" && (_optionalChain([l, 'access', _262 => _262.filters, 'optionalAccess', _263 => _263.length]) || l.source === "document")) {
|
|
11080
11103
|
const p = { ...l };
|
|
11081
|
-
if (_optionalChain([l, 'access',
|
|
11104
|
+
if (_optionalChain([l, 'access', _264 => _264.filters, 'optionalAccess', _265 => _265.some, 'call', _266 => _266(isActiveFilter)])) {
|
|
11082
11105
|
const b = l.surface.bounds;
|
|
11083
11106
|
if (b) {
|
|
11084
11107
|
const r = { x: b.x + l.offset.x - 64, y: b.y + l.offset.y - 64, width: b.width + 128, height: b.height + 128 };
|
|
@@ -11095,7 +11118,7 @@ function prepareNestedLayers(layers) {
|
|
|
11095
11118
|
delete p.source;
|
|
11096
11119
|
next = p;
|
|
11097
11120
|
}
|
|
11098
|
-
if (_optionalChain([next, 'access',
|
|
11121
|
+
if (_optionalChain([next, 'access', _267 => _267.mask, 'optionalAccess', _268 => _268.source])) {
|
|
11099
11122
|
next = { ...next };
|
|
11100
11123
|
delete next.mask;
|
|
11101
11124
|
}
|
|
@@ -11201,7 +11224,7 @@ function exportPsd(input) {
|
|
|
11201
11224
|
return {
|
|
11202
11225
|
opacity: Math.round(Math.min(1, Math.max(0, layer.opacity)) * 255),
|
|
11203
11226
|
clipping: layer.clipped ? 1 : 0,
|
|
11204
|
-
flags: (layer.visible ? 0 : LAYER_FLAG_HIDDEN) | (_optionalChain([layer, 'access',
|
|
11227
|
+
flags: (layer.visible ? 0 : LAYER_FLAG_HIDDEN) | (_optionalChain([layer, 'access', _269 => _269.locks, 'optionalAccess', _270 => _270.transparency]) ? LAYER_FLAG_TRANSPARENCY_PROTECTED : 0),
|
|
11205
11228
|
legacyName: name,
|
|
11206
11229
|
blocks
|
|
11207
11230
|
};
|
|
@@ -11258,7 +11281,7 @@ function exportPsd(input) {
|
|
|
11258
11281
|
}
|
|
11259
11282
|
case "pixel": {
|
|
11260
11283
|
if (layer.source === "document") throw new PsdError(`Layer "${layer.name}" reads the document image; resolve its pixels before export.`);
|
|
11261
|
-
if (_optionalChain([layer, 'access',
|
|
11284
|
+
if (_optionalChain([layer, 'access', _271 => _271.filters, 'optionalAccess', _272 => _272.some, 'call', _273 => _273(isActiveFilter)])) throw new PsdError(`Layer "${layer.name}" has live filters; bake them before export.`);
|
|
11262
11285
|
const extra = [];
|
|
11263
11286
|
if (layer.fillOpacity !== void 0 && layer.fillOpacity < 1) {
|
|
11264
11287
|
extra.push({ key: "iOpa", data: Uint8Array.from([Math.round(Math.max(0, layer.fillOpacity) * 255), 0, 0, 0]) });
|
|
@@ -11290,7 +11313,7 @@ function exportPsd(input) {
|
|
|
11290
11313
|
if (c.linked) note("Linked smart objects were embedded (their preview is written as the contents)", layer.name);
|
|
11291
11314
|
linkedFiles.set(idnt, smartContentsFile(c));
|
|
11292
11315
|
}
|
|
11293
|
-
let placedId = _nullishCoalesce(_optionalChain([layer, 'access',
|
|
11316
|
+
let placedId = _nullishCoalesce(_optionalChain([layer, 'access', _274 => _274.psd, 'optionalAccess', _275 => _275.placed]), () => ( psdUuid(`${layer.id}:placed`)));
|
|
11294
11317
|
if (placedIds.has(placedId)) placedId = psdUuid(`${layer.id}:placed:${placedIds.size}`);
|
|
11295
11318
|
placedIds.add(placedId);
|
|
11296
11319
|
if (placedUnchanged(layer, idnt, placedId)) {
|
|
@@ -11300,12 +11323,12 @@ function exportPsd(input) {
|
|
|
11300
11323
|
const filterFX = layer.smartFilters ? filterFXDescriptor(layer.smartFilters, dropped) : void 0;
|
|
11301
11324
|
if (dropped.length) note("Develop smart filters have no Photoshop filter and were left out of the filter list (the layer\u2019s pixels still show them)", layer.name);
|
|
11302
11325
|
const raw = layer.psd && layer.psd.key !== "PlLd" ? parsePlaced(layer.psd.key, layer.psd.data) : null;
|
|
11303
|
-
const spec = { idnt, placed: placedId, placement: layer.placement, size: { width: c.width, height: c.height }, filterFX, template: _optionalChain([raw, 'optionalAccess',
|
|
11326
|
+
const spec = { idnt, placed: placedId, placement: layer.placement, size: { width: c.width, height: c.height }, filterFX, template: _optionalChain([raw, 'optionalAccess', _276 => _276.descriptor]) };
|
|
11304
11327
|
const wnotes = [];
|
|
11305
11328
|
extra.push({ key: "PlLd", data: plldBytes(spec) }, { key: "SoLd", data: soldBytes(spec, wnotes) });
|
|
11306
11329
|
for (const n2 of wnotes) note(`A smart object: ${n2}`, layer.name);
|
|
11307
11330
|
}
|
|
11308
|
-
const fm = _optionalChain([layer, 'access',
|
|
11331
|
+
const fm = _optionalChain([layer, 'access', _277 => _277.smartFilters, 'optionalAccess', _278 => _278.mask]);
|
|
11309
11332
|
if (fm && !fm.source) filterItems.push(filterMaskItem(placedId, fm, { x: 0, y: 0, width, height }));
|
|
11310
11333
|
const rec = { ...common2(layer, extra), rect: EMPTY_RECT, channels: [], blendKey: _nullishCoalesce(BLEND_TO_PSD[layer.blend], () => ( "norm")) };
|
|
11311
11334
|
const bounds = _chunkCWM3CUUXcjs.contentBounds.call(void 0, layer.surface);
|
|
@@ -11333,8 +11356,8 @@ function exportPsd(input) {
|
|
|
11333
11356
|
const losses = /* @__PURE__ */ new Set();
|
|
11334
11357
|
for (const b of shapeBlocks(layer, width, height, _nullishCoalesce(input.resolution, () => ( 72)), losses)) extra.push({ key: b.key, data: padEven(b.data) });
|
|
11335
11358
|
for (const n2 of losses) note(n2, layer.name);
|
|
11336
|
-
if (_optionalChain([layer, 'access',
|
|
11337
|
-
if (_optionalChain([layer, 'access',
|
|
11359
|
+
if (_optionalChain([layer, 'access', _279 => _279.fill, 'optionalAccess', _280 => _280.type]) === "pattern") patternIds2.add(layer.fill.patternId);
|
|
11360
|
+
if (_optionalChain([layer, 'access', _281 => _281.stroke, 'optionalAccess', _282 => _282.paint, 'access', _283 => _283.type]) === "pattern") patternIds2.add(layer.stroke.paint.patternId);
|
|
11338
11361
|
} else {
|
|
11339
11362
|
extra.push({ key: "TySh", data: padEven(tyShForLayer(layer)) });
|
|
11340
11363
|
}
|
|
@@ -11398,7 +11421,7 @@ function exportPsd(input) {
|
|
|
11398
11421
|
{ id: 1005, name: "", data: rw.result() },
|
|
11399
11422
|
{ id: 1057, name: "", data: version.result() }
|
|
11400
11423
|
];
|
|
11401
|
-
if (_optionalChain([input, 'access',
|
|
11424
|
+
if (_optionalChain([input, 'access', _284 => _284.iccProfile, 'optionalAccess', _285 => _285.length])) resources.push({ id: 1039, name: "", data: input.iccProfile });
|
|
11402
11425
|
if (input.globalLight) {
|
|
11403
11426
|
const i32 = (v) => {
|
|
11404
11427
|
const w = new PsdWriter();
|
|
@@ -11807,4 +11830,8 @@ function exportPsd(input) {
|
|
|
11807
11830
|
|
|
11808
11831
|
|
|
11809
11832
|
|
|
11810
|
-
exports.LEGACY_PROCESS_VERSION = LEGACY_PROCESS_VERSION; exports.LATEST_PROCESS_VERSION = LATEST_PROCESS_VERSION; exports.normalizeProcessVersion = normalizeProcessVersion; exports.srgbToLinear = srgbToLinear; exports.linearToSrgb = linearToSrgb; exports.LUMA_709 = LUMA_709; exports.IDENTITY_MATRIX3 = IDENTITY_MATRIX3; exports.mulMatrix3 = mulMatrix3; exports.applyMatrix3 = applyMatrix3; exports.invertMatrix3 = invertMatrix3; exports.D65 = D65; exports.bradfordAdaptation = bradfordAdaptation; exports.wbMatrix = wbMatrix; exports.linearSrgbToXy = linearSrgbToXy; exports.TINT_SCALE = TINT_SCALE; exports.MIN_KELVIN = MIN_KELVIN; exports.MAX_KELVIN = MAX_KELVIN; exports.xyToUv = xyToUv; exports.uvToXy = uvToXy; exports.tempTintToXy = tempTintToXy; exports.xyToTempTint = xyToTempTint; exports.AS_SHOT_KELVIN = AS_SHOT_KELVIN; exports.MIRED_PER_TEMPERATURE_UNIT = MIRED_PER_TEMPERATURE_UNIT; exports.temperatureToKelvin = temperatureToKelvin; exports.kelvinToTemperature = kelvinToTemperature; exports.whiteBalanceMatrix = whiteBalanceMatrix; exports.whiteBalanceFromSample = whiteBalanceFromSample; exports.TONE_LUT_SIZE = TONE_LUT_SIZE; exports.toneCurve = toneCurve; exports.buildToneLut = buildToneLut; exports.sampleToneLut = sampleToneLut; exports.normalizeAngle = normalizeAngle; exports.isQuarterTurnSwapped = isQuarterTurnSwapped; exports.getRotatedSize = getRotatedSize; exports.projectImagePoint = projectImagePoint; exports.unprojectCanvasPoint = unprojectCanvasPoint; exports.applyImageProjectionToContext = applyImageProjectionToContext; exports.projectImageRect = projectImageRect; exports.clampCropToImage = clampCropToImage; exports.getViewportProjection = getViewportProjection; exports.getViewportMetrics = getViewportMetrics; exports.canvasToImagePoint = canvasToImagePoint; exports.imageToCanvasPoint = imageToCanvasPoint; exports.mapCropHandle = mapCropHandle; exports.hitTestCrop = hitTestCrop; exports.getCropCursor = getCropCursor; exports.calculateCropDrag = calculateCropDrag; exports.getAnnotationBounds = getAnnotationBounds; exports.hitTestAnnotation = hitTestAnnotation; exports.SELECTION_MODES = SELECTION_MODES; exports.isSelectionMode = isSelectionMode; exports.parseSelectionMode = parseSelectionMode; exports.computeSelectionBounds = computeSelectionBounds; exports.createSelectionMask = createSelectionMask; exports.fullSelection = fullSelection; exports.isSelectionEmpty = isSelectionEmpty; exports.selectionValueAt = selectionValueAt; exports.coverageToByte = coverageToByte; exports.selectionFromCoverage = selectionFromCoverage; exports.selectionToCoverage = selectionToCoverage; exports.selectionArea = selectionArea; exports.combineSelections = combineSelections; exports.invertSelection = invertSelection; exports.resizeSelection = resizeSelection; exports.selectionFromPixels = selectionFromPixels; exports.selectionToPixels = selectionToPixels; exports.encodeSelectionRle = encodeSelectionRle; exports.decodeSelectionRle = decodeSelectionRle; exports.serializeSelection = serializeSelection; exports.deserializeSelection = deserializeSelection; exports.hashMaskContent = hashMaskContent; exports.EMPTY_DISTANCE = EMPTY_DISTANCE; exports.distanceTransform = distanceTransform; exports.expandCoverage = expandCoverage; exports.contractCoverage = contractCoverage; exports.borderCoverage = borderCoverage; exports.smoothCoverage = smoothCoverage; exports.featherCoverage = featherCoverage; exports.greyMorphology = greyMorphology; exports.shiftCoverage = shiftCoverage; exports.SELECTION_MODIFY_OPS = SELECTION_MODIFY_OPS; exports.modifySelection = modifySelection; exports.normalizeLayerMask = normalizeLayerMask; exports.layerMaskFromSelection = layerMaskFromSelection; exports.updateLayerMaskProps = updateLayerMaskProps; exports.decodeLayerMask = decodeLayerMask; exports.layerMaskKey = layerMaskKey; exports.layerMaskCoverage = layerMaskCoverage; exports.projectMaskCoverage = projectMaskCoverage; exports.buildLayerMaskPlanes = buildLayerMaskPlanes; exports.ADJUSTMENT_LUT_SIZE = ADJUSTMENT_LUT_SIZE; exports.sampleLut = sampleLut; exports.ADJUSTMENT_KINDS = ADJUSTMENT_KINDS; exports.isAdjustmentKind = isAdjustmentKind; exports.adjustmentKindLabel = adjustmentKindLabel; exports.HUE_RANGE_LABELS = HUE_RANGE_LABELS; exports.neutralHueRange = neutralHueRange; exports.identityCurve = identityCurve; exports.identityLevels = identityLevels; exports.defaultAdjustmentParams = defaultAdjustmentParams; exports.createAdjustmentLayer = createAdjustmentLayer; exports.normalizeAdjustmentLayer = normalizeAdjustmentLayer; exports.normalizeAdjustmentLayers = normalizeAdjustmentLayers; exports.curveLutFromLevels = curveLutFromLevels; exports.levelsValue = levelsValue; exports.rgbToHsl = rgbToHsl; exports.hslToRgb = hslToRgb; exports.hueRangeWeight = hueRangeWeight; exports.hueRangeTables = hueRangeTables; exports.hueSaturation = hueSaturation; exports.rangeLightness = rangeLightness; exports.VIBRANCE_GREY = VIBRANCE_GREY; exports.vibranceLinear = vibranceLinear; exports.vibrancePixel = vibrancePixel; exports.colorBalanceChannel = colorBalanceChannel; exports.blackWhiteGray = blackWhiteGray; exports.D50 = D50; exports.XYZ_D50_TO_SRGB = XYZ_D50_TO_SRGB; exports.photoFilterMatrix = photoFilterMatrix; exports.posterizeValue = posterizeValue; exports.rgbToGray = rgbToGray; exports.hexToRgb = hexToRgb; exports.toneLuts = toneLuts; exports.compileAdjustmentLayer = compileAdjustmentLayer; exports.activeAdjustmentLayers = activeAdjustmentLayers; exports.evaluateAdjustmentLayers = evaluateAdjustmentLayers; exports.applyAdjustmentLayers = applyAdjustmentLayers; exports.applyAdjustmentLayersFloat = applyAdjustmentLayersFloat; exports.adjustmentLayersKey = adjustmentLayersKey; exports.applyAdjustments = applyAdjustments; exports.applyLegacyAdjustments = applyLegacyAdjustments; exports.applyLegacyFloat = applyLegacyFloat; exports.applyProcess2Adjustments = applyProcess2Adjustments; exports.applyProcess2Float = applyProcess2Float; exports.applyBoxBlurFloat = applyBoxBlurFloat; exports.applyBoxBlur = applyBoxBlur; exports.applyDepthMask = applyDepthMask; exports.removeAlpha = removeAlpha; exports.TEXT_ALIGNS = TEXT_ALIGNS; exports.SHAPE_OPERATIONS = SHAPE_OPERATIONS; exports.LIVE_SHAPE_KINDS = LIVE_SHAPE_KINDS; exports.newLayerId = newLayerId; exports.pixelLayers = pixelLayers; exports.developFilter = developFilter; exports.blurFilter = blurFilter; exports.isActiveFilter = isActiveFilter; exports.isSpatialFilter = isSpatialFilter; exports.pixelLayerBounds = pixelLayerBounds; exports.layerTypeLabel = layerTypeLabel; exports.hasSurface = hasSurface; exports.isRenderedLayer = isRenderedLayer; exports.shapeLayers = shapeLayers; exports.smartObjectLayers = smartObjectLayers; exports.adjustmentNodeAsLayer = adjustmentNodeAsLayer; exports.depthMaskAlpha = depthMaskAlpha; exports.runLayerFilters = runLayerFilters; exports.runLayerFiltersFloat = runLayerFiltersFloat; exports.LayerCompositor = LayerCompositor; exports.compositeDeep = compositeDeep; exports.DEFAULT_ADJUSTMENTS_VALUES = DEFAULT_ADJUSTMENTS_VALUES; exports.DEFAULT_TRANSFORM_VALUES = DEFAULT_TRANSFORM_VALUES; exports.DEFAULT_DEPTH_MASK_VALUES = DEFAULT_DEPTH_MASK_VALUES; exports.flattenPath = flattenPath; exports.rasterizeCoverage = rasterizeCoverage; exports.LayerOperationError = LayerOperationError; exports.requireLayer = requireLayer; exports.requireUnlocked = requireUnlocked; exports.placeLayer = placeLayer; exports.removeLayer = removeLayer; exports.moveLayer = moveLayer; exports.withNewIds = withNewIds; exports.duplicateLayer = duplicateLayer; exports.setLayerProperties = setLayerProperties; exports.groupLayers = groupLayers; exports.ungroupLayer = ungroupLayer; exports.offsetLayer = offsetLayer; exports.setLayerMask = setLayerMask; exports.normalizeFilter = normalizeFilter; exports.addLayerFilter = addLayerFilter; exports.updateLayerFilter = updateLayerFilter; exports.removeLayerFilter = removeLayerFilter; exports.layerEffectsOf = layerEffectsOf; exports.setLayerEffects = setLayerEffects; exports.addLayerEffect = addLayerEffect; exports.updateLayerEffect = updateLayerEffect; exports.removeLayerEffect = removeLayerEffect; exports.setLayerEffectsEnabled = setLayerEffectsEnabled; exports.parseBlend = parseBlend; exports.unionRect = unionRect; exports.SHAPE_RENDER_MARGIN = SHAPE_RENDER_MARGIN; exports.DEFAULT_MITER_LIMIT = DEFAULT_MITER_LIMIT; exports.mapSubpaths = mapSubpaths; exports.liveShapeSubpaths = liveShapeSubpaths; exports.liveComponent = liveComponent; exports.componentPath = componentPath; exports.shapeOutline = shapeOutline; exports.shapeGeometryBounds = shapeGeometryBounds; exports.shapeRenderClip = shapeRenderClip; exports.renderShapeRect = renderShapeRect; exports.renderShape = renderShape; exports.rerenderShape = rerenderShape; exports.normalizeShapePaint = normalizeShapePaint; exports.normalizeShapeStroke = normalizeShapeStroke; exports.normalizeLiveShape = normalizeLiveShape; exports.normalizeSubpaths = normalizeSubpaths; exports.requireOperation = requireOperation; exports.requireShapeLayer = requireShapeLayer; exports.createShapeLayer = createShapeLayer; exports.defaultShapeName = defaultShapeName; exports.updateShapeLayer = updateShapeLayer; exports.transformShapeComponents = transformShapeComponents; exports.offsetShape = offsetShape; exports.mergeShapeComponents = mergeShapeComponents; exports.shapeAsPixelLayer = shapeAsPixelLayer; exports.shapeFromAnnotation = shapeFromAnnotation; exports.annotationBlend = annotationBlend; exports.annotationOfShape = annotationOfShape; exports.TEXT_RENDER_MARGIN = TEXT_RENDER_MARGIN; exports.textMatrix = textMatrix; exports.textOutlines = textOutlines; exports.renderText = renderText; exports.rerenderText = rerenderText; exports.TEXT_STYLE_FIELDS = TEXT_STYLE_FIELDS; exports.patchTextStyle = patchTextStyle; exports.PARAGRAPH_STYLE_FIELDS = PARAGRAPH_STYLE_FIELDS; exports.patchParagraphStyle = patchParagraphStyle; exports.textRange = textRange; exports.requireTypeLayer = requireTypeLayer; exports.normalizeText = normalizeText; exports.typeLayerName = typeLayerName; exports.createTypeLayer = createTypeLayer; exports.updateTypeLayer = updateTypeLayer; exports.replaceTextRange = replaceTextRange; exports.transformTypeLayer = transformTypeLayer; exports.typeFrame = typeFrame; exports.typeAsPixelLayer = typeAsPixelLayer; exports.toTextSpace = toTextSpace; exports.typeFromAnnotation = typeFromAnnotation; exports.annotationOfType = annotationOfType; exports.BACKGROUND_LAYER_ID = BACKGROUND_LAYER_ID; exports.BACKGROUND_LAYER_NAME = BACKGROUND_LAYER_NAME; exports.DEVELOP_FILTER_ID = DEVELOP_FILTER_ID; exports.BLUR_FILTER_ID = BLUR_FILTER_ID; exports.rasterMaskFromLegacy = rasterMaskFromLegacy; exports.hasResampledLegacyMask = hasResampledLegacyMask; exports.legacyMaskOf = legacyMaskOf; exports.isDefaultDepthMask = isDefaultDepthMask; exports.developFromAdjustments = developFromAdjustments; exports.annotationLayerName = annotationLayerName; exports.annotationLayerFor = annotationLayerFor; exports.annotationOfLayer = annotationOfLayer; exports.adjustmentNodeFromLegacy = adjustmentNodeFromLegacy; exports.backgroundLayer = backgroundLayer; exports.depthRasterMask = depthRasterMask; exports.layersFromLegacy = layersFromLegacy; exports.legacyAdjustmentLayer = legacyAdjustmentLayer; exports.developTarget = developTarget; exports.legacyView = legacyView; exports.isLegacyShape = isLegacyShape; exports.FREE_TRANSFORM_MODES = FREE_TRANSFORM_MODES; exports.TRANSFORM_ANCHORS = TRANSFORM_ANCHORS; exports.isTransformAnchor = isTransformAnchor; exports.identityTransform = identityTransform; exports.cornersFromMatrix = cornersFromMatrix; exports.matrixFromCorners = matrixFromCorners; exports.transformHomography = transformHomography; exports.hasWarp = hasWarp; exports.isIdentityTransform = isIdentityTransform; exports.transformMap = transformMap; exports.transformedPoint = transformedPoint; exports.anchorPoint = anchorPoint; exports.transformedBox = transformedBox; exports.referencePoint = referencePoint; exports.matrixFromParams = matrixFromParams; exports.describeTransform = describeTransform; exports.applyParams = applyParams; exports.flipCorners = flipCorners; exports.boxPointOf = boxPointOf; exports.presetWarp = presetWarp; exports.isValidWarp = isValidWarp; exports.geometryHomography = geometryHomography; exports.SMART_RENDER_MARGIN = SMART_RENDER_MARGIN; exports.isSmartSurfaceIncomplete = isSmartSurfaceIncomplete; exports.newContentsId = newContentsId; exports.contentsBox = contentsBox; exports.placementGeometry = placementGeometry; exports.placementAt = placementAt; exports.isContentsDecoded = isContentsDecoded; exports.requireSmartObject = requireSmartObject; exports.contentsSurface = contentsSurface; exports.rasterContents = rasterContents; exports.documentContents = documentContents; exports.placeContents = placeContents; exports.activeSmartFilters = activeSmartFilters; exports.activeEffectSmartFilters = activeEffectSmartFilters; exports.filterMaskCoverage = filterMaskCoverage; exports.applySmartFilters = applySmartFilters; exports.renderSmartObject = renderSmartObject; exports.rerender = rerender; exports.normalizePlacement = normalizePlacement; exports.setSmartPlacement = setSmartPlacement; exports.offsetSmartObject = offsetSmartObject; exports.convertToSmartObject = convertToSmartObject; exports.rasterizeSmartObject = rasterizeSmartObject; exports.copySmartObject = copySmartObject; exports.instancesOf = instancesOf; exports.replaceContents = replaceContents; exports.normalizeSmartFilter = normalizeSmartFilter; exports.addSmartFilter = addSmartFilter; exports.updateSmartFilter = updateSmartFilter; exports.removeSmartFilter = removeSmartFilter; exports.moveSmartFilter = moveSmartFilter; exports.setSmartFiltersEnabled = setSmartFiltersEnabled; exports.setSmartFilterMask = setSmartFilterMask; exports.withFilterMaskSurface = withFilterMaskSurface; exports.placementBounds = placementBounds; exports.LAYERED_SCHEMA_VERSION = LAYERED_SCHEMA_VERSION; exports.serializePatterns = serializePatterns; exports.deserializePatterns = deserializePatterns; exports.encodeSurface = encodeSurface; exports.encodeDeepSurface = encodeDeepSurface; exports.decodeDeepSurface = decodeDeepSurface; exports.serializeEffects = serializeEffects; exports.deserializeEffects = deserializeEffects; exports.serializeLayer = serializeLayer; exports.serializeContents = serializeContents; exports.serializeLayers = serializeLayers; exports.serializeLayersExternal = serializeLayersExternal; exports.resolveExternalAssets = resolveExternalAssets; exports.decodePngDataUrl = decodePngDataUrl; exports.deserializeLayer = deserializeLayer; exports.deserializeLayers = deserializeLayers; exports.PsdError = PsdError; exports.parseVersionedDescriptor = parseVersionedDescriptor; exports.versionedDescriptorBytes = versionedDescriptorBytes; exports.ADJUSTMENT_KEYS = ADJUSTMENT_KEYS; exports.SUPPORTED_ADJUSTMENT_KEYS = SUPPORTED_ADJUSTMENT_KEYS; exports.parseAdjustmentBlock = parseAdjustmentBlock; exports.writeAdjustmentBlock = writeAdjustmentBlock; exports.parseLfx2 = parseLfx2; exports.writeLfx2 = writeLfx2; exports.parseLrfx = parseLrfx; exports.decodePlanes = decodePlanes; exports.encodeRle = encodeRle; exports.BROWSER_IMAGE_TYPES = BROWSER_IMAGE_TYPES; exports.readPsd = readPsd; exports.layerName = layerName; exports.layerTree = layerTree; exports.decodeLayerChannel = decodeLayerChannel; exports.decodeMergedImage = decodeMergedImage; exports.writePsd = writePsd; exports.PATTERN_BLOCK_KEYS = PATTERN_BLOCK_KEYS; exports.parsePatternBlock = parsePatternBlock; exports.psdPatternToEffectPattern = psdPatternToEffectPattern; exports.writePatternBlock = writePatternBlock; exports.PSD_BLEND_KEYS = PSD_BLEND_KEYS; exports.psdToLayers = psdToLayers; exports.importPsd = importPsd; exports.smartContentsFile = smartContentsFile; exports.exportPsd = exportPsd;
|
|
11833
|
+
|
|
11834
|
+
|
|
11835
|
+
|
|
11836
|
+
|
|
11837
|
+
exports.LEGACY_PROCESS_VERSION = LEGACY_PROCESS_VERSION; exports.LATEST_PROCESS_VERSION = LATEST_PROCESS_VERSION; exports.normalizeProcessVersion = normalizeProcessVersion; exports.srgbToLinear = srgbToLinear; exports.linearToSrgb = linearToSrgb; exports.LUMA_709 = LUMA_709; exports.IDENTITY_MATRIX3 = IDENTITY_MATRIX3; exports.mulMatrix3 = mulMatrix3; exports.applyMatrix3 = applyMatrix3; exports.invertMatrix3 = invertMatrix3; exports.D65 = D65; exports.bradfordAdaptation = bradfordAdaptation; exports.wbMatrix = wbMatrix; exports.linearSrgbToXy = linearSrgbToXy; exports.TINT_SCALE = TINT_SCALE; exports.MIN_KELVIN = MIN_KELVIN; exports.MAX_KELVIN = MAX_KELVIN; exports.xyToUv = xyToUv; exports.uvToXy = uvToXy; exports.tempTintToXy = tempTintToXy; exports.xyToTempTint = xyToTempTint; exports.AS_SHOT_KELVIN = AS_SHOT_KELVIN; exports.MIRED_PER_TEMPERATURE_UNIT = MIRED_PER_TEMPERATURE_UNIT; exports.temperatureToKelvin = temperatureToKelvin; exports.kelvinToTemperature = kelvinToTemperature; exports.whiteBalanceMatrix = whiteBalanceMatrix; exports.whiteBalanceFromSample = whiteBalanceFromSample; exports.TONE_LUT_SIZE = TONE_LUT_SIZE; exports.toneCurve = toneCurve; exports.buildToneLut = buildToneLut; exports.sampleToneLut = sampleToneLut; exports.normalizeAngle = normalizeAngle; exports.isQuarterTurnSwapped = isQuarterTurnSwapped; exports.getRotatedSize = getRotatedSize; exports.projectImagePoint = projectImagePoint; exports.unprojectCanvasPoint = unprojectCanvasPoint; exports.applyImageProjectionToContext = applyImageProjectionToContext; exports.projectImageRect = projectImageRect; exports.clampCropToImage = clampCropToImage; exports.getViewportProjection = getViewportProjection; exports.getViewportMetrics = getViewportMetrics; exports.canvasToImagePoint = canvasToImagePoint; exports.imageToCanvasPoint = imageToCanvasPoint; exports.mapCropHandle = mapCropHandle; exports.hitTestCrop = hitTestCrop; exports.getCropCursor = getCropCursor; exports.calculateCropDrag = calculateCropDrag; exports.getAnnotationBounds = getAnnotationBounds; exports.hitTestAnnotation = hitTestAnnotation; exports.SELECTION_MODES = SELECTION_MODES; exports.isSelectionMode = isSelectionMode; exports.parseSelectionMode = parseSelectionMode; exports.computeSelectionBounds = computeSelectionBounds; exports.createSelectionMask = createSelectionMask; exports.fullSelection = fullSelection; exports.isSelectionEmpty = isSelectionEmpty; exports.selectionValueAt = selectionValueAt; exports.coverageToByte = coverageToByte; exports.selectionFromCoverage = selectionFromCoverage; exports.selectionToCoverage = selectionToCoverage; exports.selectionArea = selectionArea; exports.combineSelections = combineSelections; exports.invertSelection = invertSelection; exports.resizeSelection = resizeSelection; exports.selectionFromPixels = selectionFromPixels; exports.selectionToPixels = selectionToPixels; exports.encodeSelectionRle = encodeSelectionRle; exports.decodeSelectionRle = decodeSelectionRle; exports.serializeSelection = serializeSelection; exports.deserializeSelection = deserializeSelection; exports.hashMaskContent = hashMaskContent; exports.EMPTY_DISTANCE = EMPTY_DISTANCE; exports.distanceTransform = distanceTransform; exports.expandCoverage = expandCoverage; exports.contractCoverage = contractCoverage; exports.borderCoverage = borderCoverage; exports.smoothCoverage = smoothCoverage; exports.featherCoverage = featherCoverage; exports.greyMorphology = greyMorphology; exports.shiftCoverage = shiftCoverage; exports.SELECTION_MODIFY_OPS = SELECTION_MODIFY_OPS; exports.modifySelection = modifySelection; exports.normalizeLayerMask = normalizeLayerMask; exports.layerMaskFromSelection = layerMaskFromSelection; exports.updateLayerMaskProps = updateLayerMaskProps; exports.decodeLayerMask = decodeLayerMask; exports.layerMaskKey = layerMaskKey; exports.layerMaskCoverage = layerMaskCoverage; exports.projectMaskCoverage = projectMaskCoverage; exports.buildLayerMaskPlanes = buildLayerMaskPlanes; exports.ADJUSTMENT_LUT_SIZE = ADJUSTMENT_LUT_SIZE; exports.sampleLut = sampleLut; exports.ADJUSTMENT_KINDS = ADJUSTMENT_KINDS; exports.isAdjustmentKind = isAdjustmentKind; exports.adjustmentKindLabel = adjustmentKindLabel; exports.HUE_RANGE_LABELS = HUE_RANGE_LABELS; exports.neutralHueRange = neutralHueRange; exports.identityCurve = identityCurve; exports.identityLevels = identityLevels; exports.defaultAdjustmentParams = defaultAdjustmentParams; exports.createAdjustmentLayer = createAdjustmentLayer; exports.normalizeAdjustmentLayer = normalizeAdjustmentLayer; exports.normalizeAdjustmentLayers = normalizeAdjustmentLayers; exports.curveLutFromLevels = curveLutFromLevels; exports.levelsValue = levelsValue; exports.rgbToHsl = rgbToHsl; exports.hslToRgb = hslToRgb; exports.hueRangeWeight = hueRangeWeight; exports.hueRangeTables = hueRangeTables; exports.hueSaturation = hueSaturation; exports.rangeLightness = rangeLightness; exports.VIBRANCE_GREY = VIBRANCE_GREY; exports.vibranceLinear = vibranceLinear; exports.vibrancePixel = vibrancePixel; exports.colorBalanceChannel = colorBalanceChannel; exports.blackWhiteGray = blackWhiteGray; exports.D50 = D50; exports.XYZ_D50_TO_SRGB = XYZ_D50_TO_SRGB; exports.photoFilterMatrix = photoFilterMatrix; exports.posterizeValue = posterizeValue; exports.rgbToGray = rgbToGray; exports.hexToRgb = hexToRgb; exports.toneLuts = toneLuts; exports.compileAdjustmentLayer = compileAdjustmentLayer; exports.activeAdjustmentLayers = activeAdjustmentLayers; exports.evaluateAdjustmentLayers = evaluateAdjustmentLayers; exports.applyAdjustmentLayers = applyAdjustmentLayers; exports.applyAdjustmentLayersFloat = applyAdjustmentLayersFloat; exports.adjustmentLayersKey = adjustmentLayersKey; exports.applyAdjustments = applyAdjustments; exports.applyLegacyAdjustments = applyLegacyAdjustments; exports.applyLegacyFloat = applyLegacyFloat; exports.applyProcess2Adjustments = applyProcess2Adjustments; exports.applyProcess2Float = applyProcess2Float; exports.applyBoxBlurFloat = applyBoxBlurFloat; exports.applyBoxBlur = applyBoxBlur; exports.applyDepthMask = applyDepthMask; exports.removeAlpha = removeAlpha; exports.TEXT_ALIGNS = TEXT_ALIGNS; exports.SHAPE_OPERATIONS = SHAPE_OPERATIONS; exports.LIVE_SHAPE_KINDS = LIVE_SHAPE_KINDS; exports.newLayerId = newLayerId; exports.pixelLayers = pixelLayers; exports.developFilter = developFilter; exports.blurFilter = blurFilter; exports.isActiveFilter = isActiveFilter; exports.isSpatialFilter = isSpatialFilter; exports.pixelLayerBounds = pixelLayerBounds; exports.layerTypeLabel = layerTypeLabel; exports.hasSurface = hasSurface; exports.isRenderedLayer = isRenderedLayer; exports.shapeLayers = shapeLayers; exports.smartObjectLayers = smartObjectLayers; exports.adjustmentNodeAsLayer = adjustmentNodeAsLayer; exports.depthMaskAlpha = depthMaskAlpha; exports.runLayerFilters = runLayerFilters; exports.runLayerFiltersFloat = runLayerFiltersFloat; exports.LayerCompositor = LayerCompositor; exports.compositeDeep = compositeDeep; exports.DEFAULT_ADJUSTMENTS_VALUES = DEFAULT_ADJUSTMENTS_VALUES; exports.DEFAULT_TRANSFORM_VALUES = DEFAULT_TRANSFORM_VALUES; exports.DEFAULT_DEPTH_MASK_VALUES = DEFAULT_DEPTH_MASK_VALUES; exports.flattenPath = flattenPath; exports.rasterizeCoverage = rasterizeCoverage; exports.LayerOperationError = LayerOperationError; exports.userErrorMessage = userErrorMessage; exports.isPaintableLayer = isPaintableLayer; exports.defaultActiveLayerId = defaultActiveLayerId; exports.activeLayerAfterRemoval = activeLayerAfterRemoval; exports.requireLayer = requireLayer; exports.requireUnlocked = requireUnlocked; exports.placeLayer = placeLayer; exports.removeLayer = removeLayer; exports.moveLayer = moveLayer; exports.withNewIds = withNewIds; exports.duplicateLayer = duplicateLayer; exports.setLayerProperties = setLayerProperties; exports.groupLayers = groupLayers; exports.ungroupLayer = ungroupLayer; exports.offsetLayer = offsetLayer; exports.setLayerMask = setLayerMask; exports.normalizeFilter = normalizeFilter; exports.addLayerFilter = addLayerFilter; exports.updateLayerFilter = updateLayerFilter; exports.removeLayerFilter = removeLayerFilter; exports.layerEffectsOf = layerEffectsOf; exports.setLayerEffects = setLayerEffects; exports.addLayerEffect = addLayerEffect; exports.updateLayerEffect = updateLayerEffect; exports.removeLayerEffect = removeLayerEffect; exports.setLayerEffectsEnabled = setLayerEffectsEnabled; exports.parseBlend = parseBlend; exports.unionRect = unionRect; exports.SHAPE_RENDER_MARGIN = SHAPE_RENDER_MARGIN; exports.DEFAULT_MITER_LIMIT = DEFAULT_MITER_LIMIT; exports.mapSubpaths = mapSubpaths; exports.liveShapeSubpaths = liveShapeSubpaths; exports.liveComponent = liveComponent; exports.componentPath = componentPath; exports.shapeOutline = shapeOutline; exports.shapeGeometryBounds = shapeGeometryBounds; exports.shapeRenderClip = shapeRenderClip; exports.renderShapeRect = renderShapeRect; exports.renderShape = renderShape; exports.rerenderShape = rerenderShape; exports.normalizeShapePaint = normalizeShapePaint; exports.normalizeShapeStroke = normalizeShapeStroke; exports.normalizeLiveShape = normalizeLiveShape; exports.normalizeSubpaths = normalizeSubpaths; exports.requireOperation = requireOperation; exports.requireShapeLayer = requireShapeLayer; exports.createShapeLayer = createShapeLayer; exports.defaultShapeName = defaultShapeName; exports.updateShapeLayer = updateShapeLayer; exports.transformShapeComponents = transformShapeComponents; exports.offsetShape = offsetShape; exports.mergeShapeComponents = mergeShapeComponents; exports.shapeAsPixelLayer = shapeAsPixelLayer; exports.shapeFromAnnotation = shapeFromAnnotation; exports.annotationBlend = annotationBlend; exports.annotationOfShape = annotationOfShape; exports.TEXT_RENDER_MARGIN = TEXT_RENDER_MARGIN; exports.textMatrix = textMatrix; exports.textOutlines = textOutlines; exports.renderText = renderText; exports.rerenderText = rerenderText; exports.TEXT_STYLE_FIELDS = TEXT_STYLE_FIELDS; exports.patchTextStyle = patchTextStyle; exports.PARAGRAPH_STYLE_FIELDS = PARAGRAPH_STYLE_FIELDS; exports.patchParagraphStyle = patchParagraphStyle; exports.textRange = textRange; exports.requireTypeLayer = requireTypeLayer; exports.normalizeText = normalizeText; exports.typeLayerName = typeLayerName; exports.createTypeLayer = createTypeLayer; exports.updateTypeLayer = updateTypeLayer; exports.replaceTextRange = replaceTextRange; exports.transformTypeLayer = transformTypeLayer; exports.typeFrame = typeFrame; exports.typeAsPixelLayer = typeAsPixelLayer; exports.toTextSpace = toTextSpace; exports.typeFromAnnotation = typeFromAnnotation; exports.annotationOfType = annotationOfType; exports.BACKGROUND_LAYER_ID = BACKGROUND_LAYER_ID; exports.BACKGROUND_LAYER_NAME = BACKGROUND_LAYER_NAME; exports.DEVELOP_FILTER_ID = DEVELOP_FILTER_ID; exports.BLUR_FILTER_ID = BLUR_FILTER_ID; exports.rasterMaskFromLegacy = rasterMaskFromLegacy; exports.hasResampledLegacyMask = hasResampledLegacyMask; exports.legacyMaskOf = legacyMaskOf; exports.isDefaultDepthMask = isDefaultDepthMask; exports.developFromAdjustments = developFromAdjustments; exports.annotationLayerName = annotationLayerName; exports.annotationLayerFor = annotationLayerFor; exports.annotationOfLayer = annotationOfLayer; exports.adjustmentNodeFromLegacy = adjustmentNodeFromLegacy; exports.backgroundLayer = backgroundLayer; exports.depthRasterMask = depthRasterMask; exports.layersFromLegacy = layersFromLegacy; exports.legacyAdjustmentLayer = legacyAdjustmentLayer; exports.developTarget = developTarget; exports.legacyView = legacyView; exports.isLegacyShape = isLegacyShape; exports.FREE_TRANSFORM_MODES = FREE_TRANSFORM_MODES; exports.TRANSFORM_ANCHORS = TRANSFORM_ANCHORS; exports.isTransformAnchor = isTransformAnchor; exports.identityTransform = identityTransform; exports.cornersFromMatrix = cornersFromMatrix; exports.matrixFromCorners = matrixFromCorners; exports.transformHomography = transformHomography; exports.hasWarp = hasWarp; exports.isIdentityTransform = isIdentityTransform; exports.transformMap = transformMap; exports.transformedPoint = transformedPoint; exports.anchorPoint = anchorPoint; exports.transformedBox = transformedBox; exports.referencePoint = referencePoint; exports.matrixFromParams = matrixFromParams; exports.describeTransform = describeTransform; exports.applyParams = applyParams; exports.flipCorners = flipCorners; exports.boxPointOf = boxPointOf; exports.presetWarp = presetWarp; exports.isValidWarp = isValidWarp; exports.geometryHomography = geometryHomography; exports.SMART_RENDER_MARGIN = SMART_RENDER_MARGIN; exports.isSmartSurfaceIncomplete = isSmartSurfaceIncomplete; exports.newContentsId = newContentsId; exports.contentsBox = contentsBox; exports.placementGeometry = placementGeometry; exports.placementAt = placementAt; exports.isContentsDecoded = isContentsDecoded; exports.requireSmartObject = requireSmartObject; exports.contentsSurface = contentsSurface; exports.rasterContents = rasterContents; exports.documentContents = documentContents; exports.placeContents = placeContents; exports.activeSmartFilters = activeSmartFilters; exports.activeEffectSmartFilters = activeEffectSmartFilters; exports.filterMaskCoverage = filterMaskCoverage; exports.applySmartFilters = applySmartFilters; exports.renderSmartObject = renderSmartObject; exports.rerender = rerender; exports.normalizePlacement = normalizePlacement; exports.setSmartPlacement = setSmartPlacement; exports.offsetSmartObject = offsetSmartObject; exports.convertToSmartObject = convertToSmartObject; exports.rasterizeSmartObject = rasterizeSmartObject; exports.copySmartObject = copySmartObject; exports.instancesOf = instancesOf; exports.replaceContents = replaceContents; exports.normalizeSmartFilter = normalizeSmartFilter; exports.addSmartFilter = addSmartFilter; exports.updateSmartFilter = updateSmartFilter; exports.removeSmartFilter = removeSmartFilter; exports.moveSmartFilter = moveSmartFilter; exports.setSmartFiltersEnabled = setSmartFiltersEnabled; exports.setSmartFilterMask = setSmartFilterMask; exports.withFilterMaskSurface = withFilterMaskSurface; exports.placementBounds = placementBounds; exports.LAYERED_SCHEMA_VERSION = LAYERED_SCHEMA_VERSION; exports.serializePatterns = serializePatterns; exports.deserializePatterns = deserializePatterns; exports.encodeSurface = encodeSurface; exports.encodeDeepSurface = encodeDeepSurface; exports.decodeDeepSurface = decodeDeepSurface; exports.serializeEffects = serializeEffects; exports.deserializeEffects = deserializeEffects; exports.serializeLayer = serializeLayer; exports.serializeContents = serializeContents; exports.serializeLayers = serializeLayers; exports.serializeLayersExternal = serializeLayersExternal; exports.resolveExternalAssets = resolveExternalAssets; exports.decodePngDataUrl = decodePngDataUrl; exports.deserializeLayer = deserializeLayer; exports.deserializeLayers = deserializeLayers; exports.PsdError = PsdError; exports.parseVersionedDescriptor = parseVersionedDescriptor; exports.versionedDescriptorBytes = versionedDescriptorBytes; exports.ADJUSTMENT_KEYS = ADJUSTMENT_KEYS; exports.SUPPORTED_ADJUSTMENT_KEYS = SUPPORTED_ADJUSTMENT_KEYS; exports.parseAdjustmentBlock = parseAdjustmentBlock; exports.writeAdjustmentBlock = writeAdjustmentBlock; exports.parseLfx2 = parseLfx2; exports.writeLfx2 = writeLfx2; exports.parseLrfx = parseLrfx; exports.decodePlanes = decodePlanes; exports.encodeRle = encodeRle; exports.BROWSER_IMAGE_TYPES = BROWSER_IMAGE_TYPES; exports.readPsd = readPsd; exports.layerName = layerName; exports.layerTree = layerTree; exports.decodeLayerChannel = decodeLayerChannel; exports.decodeMergedImage = decodeMergedImage; exports.writePsd = writePsd; exports.PATTERN_BLOCK_KEYS = PATTERN_BLOCK_KEYS; exports.parsePatternBlock = parsePatternBlock; exports.psdPatternToEffectPattern = psdPatternToEffectPattern; exports.writePatternBlock = writePatternBlock; exports.PSD_BLEND_KEYS = PSD_BLEND_KEYS; exports.psdToLayers = psdToLayers; exports.importPsd = importPsd; exports.smartContentsFile = smartContentsFile; exports.exportPsd = exportPsd;
|