ag-psd 15.1.0 → 15.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bundle.js CHANGED
@@ -346,13 +346,15 @@ addHandler('TySh', hasKey('text'), function (reader, target, leftBytes) {
346
346
  },
347
347
  };
348
348
  if (text.EngineData) {
349
- var engineData = (0, text_1.decodeEngineData)((0, engineData_1.parseEngineData)(text.EngineData));
349
+ var engineData = (0, engineData_1.parseEngineData)(text.EngineData);
350
+ var textData = (0, text_1.decodeEngineData)(engineData);
351
+ // require('fs').writeFileSync(`layer-${target.name}.txt`, require('util').inspect(engineData, false, 99, false), 'utf8');
350
352
  // const before = parseEngineData(text.EngineData);
351
353
  // const after = encodeEngineData(engineData);
352
354
  // require('fs').writeFileSync('before.txt', require('util').inspect(before, false, 99, false), 'utf8');
353
355
  // require('fs').writeFileSync('after.txt', require('util').inspect(after, false, 99, false), 'utf8');
354
356
  // console.log(require('util').inspect(parseEngineData(text.EngineData), false, 99, true));
355
- target.text = __assign(__assign({}, target.text), engineData);
357
+ target.text = __assign(__assign({}, target.text), textData);
356
358
  // console.log(require('util').inspect(target.text, false, 99, true));
357
359
  }
358
360
  (0, psdReader_1.skipBytes)(reader, leftBytes());
@@ -1134,6 +1136,173 @@ addHandler('PlLd', hasKey('placedLayer'), function (reader, target, left) {
1134
1136
  var type = isQuilt ? 'quiltWarp' : 'warp';
1135
1137
  (0, descriptor_1.writeVersionAndDescriptor)(writer, '', type, encodeWarp(placed.warp || {}), type);
1136
1138
  });
1139
+ function uint8ToFloat32(array) {
1140
+ return new Float32Array(array.buffer.slice(array.byteOffset), 0, array.byteLength / 4);
1141
+ }
1142
+ function uint8ToUint32(array) {
1143
+ return new Uint32Array(array.buffer.slice(array.byteOffset), 0, array.byteLength / 4);
1144
+ }
1145
+ function toUint8(array) {
1146
+ return new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
1147
+ }
1148
+ function arrayToPoints(array) {
1149
+ var points = [];
1150
+ for (var i = 0; i < array.length; i += 2) {
1151
+ points.push({ x: array[i], y: array[i + 1] });
1152
+ }
1153
+ return points;
1154
+ }
1155
+ function pointsToArray(points) {
1156
+ var array = [];
1157
+ for (var i = 0; i < points.length; i++) {
1158
+ array.push(points[i].x, points[i].y);
1159
+ }
1160
+ return array;
1161
+ }
1162
+ function uin8ToPoints(array) {
1163
+ return arrayToPoints(uint8ToFloat32(array));
1164
+ }
1165
+ function hrznVrtcToPoint(desc) {
1166
+ return {
1167
+ x: (0, descriptor_1.parseUnits)(desc.Hrzn),
1168
+ y: (0, descriptor_1.parseUnits)(desc.Vrtc),
1169
+ };
1170
+ }
1171
+ function pointToHrznVrtc(point) {
1172
+ return {
1173
+ Hrzn: (0, descriptor_1.unitsValue)(point.x, 'x'),
1174
+ Vrtc: (0, descriptor_1.unitsValue)(point.y, 'y'),
1175
+ };
1176
+ }
1177
+ function parseFilterFX(desc) {
1178
+ return {
1179
+ enabled: desc.enab,
1180
+ validAtPosition: desc.validAtPosition,
1181
+ maskEnabled: desc.filterMaskEnable,
1182
+ maskLinked: desc.filterMaskLinked,
1183
+ maskExtendWithWhite: desc.filterMaskExtendWithWhite,
1184
+ list: desc.filterFXList.map(function (f) { return ({
1185
+ id: f.filterID,
1186
+ name: f['Nm '],
1187
+ opacity: (0, descriptor_1.parsePercent)(f.blendOptions.Opct),
1188
+ blendMode: descriptor_1.BlnM.decode(f.blendOptions['Md ']),
1189
+ enabled: f.enab,
1190
+ hasOptions: f.hasoptions,
1191
+ foregroundColor: (0, descriptor_1.parseColor)(f.FrgC),
1192
+ backgroundColor: (0, descriptor_1.parseColor)(f.BckC),
1193
+ filter: {
1194
+ rigidType: f.Fltr.rigidType,
1195
+ bounds: [
1196
+ { x: f.Fltr.PuX0, y: f.Fltr.PuY0, },
1197
+ { x: f.Fltr.PuX1, y: f.Fltr.PuY1, },
1198
+ { x: f.Fltr.PuX2, y: f.Fltr.PuY2, },
1199
+ { x: f.Fltr.PuX3, y: f.Fltr.PuY3, },
1200
+ ],
1201
+ puppetShapeList: f.Fltr.puppetShapeList.map(function (p) { return ({
1202
+ rigidType: p.rigidType,
1203
+ // TODO: VrsM
1204
+ // TODO: VrsN
1205
+ originalVertexArray: uin8ToPoints(p.originalVertexArray),
1206
+ deformedVertexArray: uin8ToPoints(p.deformedVertexArray),
1207
+ indexArray: Array.from(uint8ToUint32(p.indexArray)),
1208
+ pinOffsets: arrayToPoints(p.pinOffsets),
1209
+ posFinalPins: arrayToPoints(p.posFinalPins),
1210
+ pinVertexIndices: p.pinVertexIndices,
1211
+ selectedPin: p.selectedPin,
1212
+ pinPosition: arrayToPoints(p.PinP),
1213
+ pinRotation: p.PnRt,
1214
+ pinOverlay: p.PnOv,
1215
+ pinDepth: p.PnDp,
1216
+ meshQuality: p.meshQuality,
1217
+ meshExpansion: p.meshExpansion,
1218
+ meshRigidity: p.meshRigidity,
1219
+ imageResolution: p.imageResolution,
1220
+ meshBoundaryPath: {
1221
+ pathComponents: p.meshBoundaryPath.pathComponents.map(function (c) { return ({
1222
+ shapeOperation: c.shapeOperation.split('.')[1],
1223
+ paths: c.SbpL.map(function (t) { return ({
1224
+ closed: t.Clsp,
1225
+ points: t['Pts '].map(function (pt) { return ({
1226
+ anchor: hrznVrtcToPoint(pt.Anch),
1227
+ forward: hrznVrtcToPoint(pt['Fwd ']),
1228
+ backward: hrznVrtcToPoint(pt['Bwd ']),
1229
+ smooth: pt.Smoo,
1230
+ }); }),
1231
+ }); }),
1232
+ }); }),
1233
+ },
1234
+ }); }),
1235
+ },
1236
+ }); }),
1237
+ };
1238
+ }
1239
+ function serializeFilterFX(filter) {
1240
+ return {
1241
+ enab: filter.enabled,
1242
+ validAtPosition: filter.validAtPosition,
1243
+ filterMaskEnable: filter.maskEnabled,
1244
+ filterMaskLinked: filter.maskLinked,
1245
+ filterMaskExtendWithWhite: filter.maskExtendWithWhite,
1246
+ filterFXList: filter.list.map(function (f) { return ({
1247
+ 'Nm ': f.name,
1248
+ blendOptions: {
1249
+ Opct: (0, descriptor_1.unitsPercent)(f.opacity),
1250
+ 'Md ': descriptor_1.BlnM.encode(f.blendMode),
1251
+ },
1252
+ enab: f.enabled,
1253
+ hasoptions: f.hasOptions,
1254
+ FrgC: (0, descriptor_1.serializeColor)(f.foregroundColor),
1255
+ BckC: (0, descriptor_1.serializeColor)(f.backgroundColor),
1256
+ Fltr: {
1257
+ 'null': ['Ordn.Trgt'],
1258
+ rigidType: f.filter.rigidType,
1259
+ puppetShapeList: f.filter.puppetShapeList.map(function (p) { return ({
1260
+ rigidType: p.rigidType,
1261
+ VrsM: 1,
1262
+ VrsN: 0,
1263
+ originalVertexArray: toUint8(new Float32Array(pointsToArray(p.originalVertexArray))),
1264
+ deformedVertexArray: toUint8(new Float32Array(pointsToArray(p.deformedVertexArray))),
1265
+ indexArray: toUint8(new Uint32Array(p.indexArray)),
1266
+ pinOffsets: pointsToArray(p.pinOffsets),
1267
+ posFinalPins: pointsToArray(p.posFinalPins),
1268
+ selectedPin: p.selectedPin,
1269
+ pinVertexIndices: p.pinVertexIndices,
1270
+ PinP: pointsToArray(p.pinPosition),
1271
+ PnRt: p.pinRotation,
1272
+ PnOv: p.pinOverlay,
1273
+ PnDp: p.pinDepth,
1274
+ meshQuality: p.meshQuality,
1275
+ meshExpansion: p.meshExpansion,
1276
+ meshRigidity: p.meshRigidity,
1277
+ imageResolution: p.imageResolution,
1278
+ meshBoundaryPath: {
1279
+ pathComponents: p.meshBoundaryPath.pathComponents.map(function (c) { return ({
1280
+ shapeOperation: "shapeOperation.".concat(c.shapeOperation),
1281
+ SbpL: c.paths.map(function (path) { return ({
1282
+ Clsp: path.closed,
1283
+ 'Pts ': path.points.map(function (pt) { return ({
1284
+ Anch: pointToHrznVrtc(pt.anchor),
1285
+ 'Fwd ': pointToHrznVrtc(pt.forward),
1286
+ 'Bwd ': pointToHrznVrtc(pt.backward),
1287
+ Smoo: pt.smooth,
1288
+ }); }),
1289
+ }); }),
1290
+ }); }),
1291
+ },
1292
+ }); }),
1293
+ PuX0: f.filter.bounds[0].x,
1294
+ PuX1: f.filter.bounds[1].x,
1295
+ PuX2: f.filter.bounds[2].x,
1296
+ PuX3: f.filter.bounds[3].x,
1297
+ PuY0: f.filter.bounds[0].y,
1298
+ PuY1: f.filter.bounds[1].y,
1299
+ PuY2: f.filter.bounds[2].y,
1300
+ PuY3: f.filter.bounds[3].y,
1301
+ },
1302
+ filterID: f.id,
1303
+ }); }),
1304
+ };
1305
+ }
1137
1306
  addHandler('SoLd', hasKey('placedLayer'), function (reader, target, left) {
1138
1307
  if ((0, psdReader_1.readSignature)(reader) !== 'soLD')
1139
1308
  throw new Error("Invalid SoLd type");
@@ -1144,6 +1313,8 @@ addHandler('SoLd', hasKey('placedLayer'), function (reader, target, left) {
1144
1313
  // console.log('SoLd', require('util').inspect(desc, false, 99, true));
1145
1314
  // console.log('SoLd.warp', require('util').inspect(desc.warp, false, 99, true));
1146
1315
  // console.log('SoLd.quiltWarp', require('util').inspect(desc.quiltWarp, false, 99, true));
1316
+ // desc.filterFX!.filterFXList[0].Fltr.puppetShapeList[0].meshBoundaryPath.pathComponents[0].SbpL[0]['Pts '] = [];
1317
+ // console.log('filterFX', require('util').inspect(desc.filterFX, false, 99, true));
1147
1318
  target.placedLayer = {
1148
1319
  id: desc.Idnt,
1149
1320
  placed: desc.placed,
@@ -1168,6 +1339,8 @@ addHandler('SoLd', hasKey('placedLayer'), function (reader, target, left) {
1168
1339
  target.placedLayer.comp = desc.comp;
1169
1340
  if (desc.compInfo)
1170
1341
  target.placedLayer.compInfo = desc.compInfo;
1342
+ if (desc.filterFX)
1343
+ target.placedLayer.filter = parseFilterFX(desc.filterFX);
1171
1344
  (0, psdReader_1.skipBytes)(reader, left()); // HACK
1172
1345
  }, function (writer, target) {
1173
1346
  var _a, _b;
@@ -1178,6 +1351,8 @@ addHandler('SoLd', hasKey('placedLayer'), function (reader, target, left) {
1178
1351
  Wdth: placed.width || 0,
1179
1352
  Hght: placed.height || 0, // TODO: find size ?
1180
1353
  }, Rslt: placed.resolution ? (0, descriptor_1.unitsValue)(placed.resolution, 'resolution') : { units: 'Density', value: 72 } });
1354
+ if (placed.filter)
1355
+ desc.filterFX = serializeFilterFX(placed.filter);
1181
1356
  if (placed.warp && isQuiltWarp(placed.warp)) {
1182
1357
  var quiltWarp = encodeWarp(placed.warp);
1183
1358
  desc.quiltWarp = quiltWarp;
@@ -2289,6 +2464,87 @@ addHandler('tsly', hasKey('transparencyShapesLayer'), function (reader, target)
2289
2464
  (0, psdWriter_1.writeUint8)(writer, target.transparencyShapesLayer ? 1 : 0);
2290
2465
  (0, psdWriter_1.writeZeros)(writer, 3);
2291
2466
  });
2467
+ /*addHandler(
2468
+ 'FEid',
2469
+ hasKey('filterEffects'),
2470
+ (reader, _target) => {
2471
+ const version = readInt32(reader);
2472
+ if (version < 1 || version > 3) throw new Error(`Invalid filterEffects version ${version}`);
2473
+
2474
+ if (readUint32(reader)) throw new Error('filterEffects: 64 bit length is not supported');
2475
+ const length = readUint32(reader);
2476
+ const end = reader.offset + length;
2477
+
2478
+ while (reader.offset < end) {
2479
+ console.log('bytes to go', end - reader.offset, 'at', reader.offset.toString(16));
2480
+ //
2481
+ const id = readPascalString(reader, 1);
2482
+ const effectVersion = readInt32(reader);
2483
+ if (effectVersion !== 1) throw new Error(`Invalid filterEffect version ${effectVersion}`);
2484
+ if (readUint32(reader)) throw new Error('filterEffect: 64 bit length is not supported');
2485
+ const effectLength = readUint32(reader);
2486
+ const endOfEffect = reader.offset + effectLength;
2487
+ const top = readInt32(reader);
2488
+ const left = readInt32(reader);
2489
+ const bottom = readInt32(reader);
2490
+ const right = readInt32(reader);
2491
+ const depth = readInt32(reader);
2492
+ const maxChannels = readInt32(reader);
2493
+ const channels: any[] = [];
2494
+
2495
+ for (let i = 0; i < (maxChannels + 2); i++) {
2496
+ const exists = readInt32(reader);
2497
+ if (exists) {
2498
+ if (readUint32(reader)) throw new Error('filterEffect: 64 bit length is not supported');
2499
+ const channelLength = readUint32(reader);
2500
+ const compressionMode = readUint16(reader);
2501
+ const data = readBytes(reader, channelLength - 2);
2502
+ channels.push({ channelLength, compressionMode, data: data?.length + ' bytes' });
2503
+ // if (c < 3 || c == 25) e_ = _F.Cn(!0, rL, m, b.rect.F, b.rect.V, X, rp);
2504
+ // if (c == 0) _c.S = e_;
2505
+ // if (c == 1) _c.v = e_;
2506
+ // if (c == 2) _c.e = e_;
2507
+ // if (c == 25) _c.w = e_;
2508
+ } else {
2509
+ channels.push(undefined);
2510
+ }
2511
+ }
2512
+
2513
+ console.log('left at the end', endOfEffect - reader.offset);
2514
+ if (endOfEffect > reader.offset) {
2515
+ if (readUint8(reader)) {
2516
+ const compressionMode = readUint16(reader);
2517
+ const data = endOfEffect > reader.offset ? readBytes(reader, endOfEffect - reader.offset) : undefined;
2518
+ console.log('extra data', { compressionMode, data: data?.length + ' bytes' });
2519
+ } else {
2520
+ console.log('no extra');
2521
+ }
2522
+ }
2523
+
2524
+ console.log('effect', {
2525
+ id,
2526
+ effectVersion,
2527
+ effectLength,
2528
+ top,
2529
+ left,
2530
+ bottom,
2531
+ right,
2532
+ depth,
2533
+ maxChannels,
2534
+ channels,
2535
+ });
2536
+
2537
+ console.log('bytes left after effect', endOfEffect - reader.offset);
2538
+ // if (length % 4) skipBytes(reader, 4 - length % 4);
2539
+ }
2540
+
2541
+ console.log({ version, length });
2542
+ },
2543
+ (_writer, _target) => {
2544
+ },
2545
+ );
2546
+
2547
+ addHandlerAlias('FXid', 'FEid');*/
2292
2548
 
2293
2549
  },{"./descriptor":4,"./effectsHelpers":5,"./engineData":6,"./helpers":7,"./psdReader":11,"./psdWriter":12,"./text":13,"base64-js":15}],3:[function(require,module,exports){
2294
2550
  "use strict";
@@ -2451,6 +2707,15 @@ var fieldToExtType = {
2451
2707
  'Lnk ': makeType('', 'ExternalFileLink'),
2452
2708
  frameReader: makeType('', 'FrameReader'),
2453
2709
  effectParams: makeType('', 'motionTrackEffectParams'),
2710
+ Impr: makeType('None', 'none'),
2711
+ Anch: makeType('', 'Pnt '),
2712
+ 'Fwd ': makeType('', 'Pnt '),
2713
+ 'Bwd ': makeType('', 'Pnt '),
2714
+ meshBoundaryPath: makeType('', 'pathClass'),
2715
+ filterFX: makeType('', 'filterFXStyle'),
2716
+ Fltr: makeType('', 'rigidTransform'),
2717
+ FrgC: makeType('', 'RGBC'),
2718
+ BckC: makeType('', 'RGBC'),
2454
2719
  };
2455
2720
  var fieldToArrayExtType = {
2456
2721
  'Crv ': makeType('', 'CrPt'),
@@ -2474,6 +2739,11 @@ var fieldToArrayExtType = {
2474
2739
  countObjectList: makeType('', 'countObject'),
2475
2740
  countGroupList: makeType('', 'countGroup'),
2476
2741
  slices: makeType('', 'slice'),
2742
+ 'Pts ': makeType('', 'Pthp'),
2743
+ SbpL: makeType('', 'SbpL'),
2744
+ pathComponents: makeType('', 'PaCm'),
2745
+ filterFXList: makeType('', 'filterFX'),
2746
+ puppetShapeList: makeType('', 'puppetShape'),
2477
2747
  };
2478
2748
  var typeToField = {
2479
2749
  'TEXT': [
@@ -2482,7 +2752,7 @@ var typeToField = {
2482
2752
  'artboardPresetName', 'json', 'clipID', 'relPath', 'fullPath', 'mediaDescriptor', 'Msge',
2483
2753
  'altTag', 'url', 'cellText',
2484
2754
  ],
2485
- 'tdta': ['EngineData', 'LUT3DFileData'],
2755
+ 'tdta': ['EngineData', 'LUT3DFileData', 'indexArray', 'originalVertexArray', 'deformedVertexArray'],
2486
2756
  'long': [
2487
2757
  'TextIndex', 'RndS', 'Mdpn', 'Smth', 'Lctn', 'strokeStyleVersion', 'LaID', 'Vrsn', 'Cnt ',
2488
2758
  'Brgh', 'Cntr', 'means', 'vibrance', 'Strt', 'bwPresetKind', 'presetKind', 'comp', 'compID', 'originalCompID',
@@ -2492,7 +2762,8 @@ var typeToField = {
2492
2762
  'numModifyingFX', 'deformNumRows', 'deformNumCols', 'FrID', 'FrDl', 'FsID', 'LCnt', 'AFrm', 'AFSt',
2493
2763
  'numBefore', 'numAfter', 'Spcn', 'minOpacity', 'maxOpacity', 'BlnM', 'sheetID', 'gblA', 'globalAltitude',
2494
2764
  'descVersion', 'frameReaderType', 'LyrI', 'zoomOrigin', 'fontSize', 'Rds ', 'sliceID',
2495
- 'topOutset', 'leftOutset', 'bottomOutset', 'rightOutset',
2765
+ 'topOutset', 'leftOutset', 'bottomOutset', 'rightOutset', 'filterID', 'meshQuality',
2766
+ 'meshExpansion', 'meshRigidity', 'VrsM', 'VrsN',
2496
2767
  ],
2497
2768
  'enum': [
2498
2769
  'textGridding', 'Ornt', 'warpStyle', 'warpRotate', 'Inte', 'Bltn', 'ClrS',
@@ -2501,7 +2772,7 @@ var typeToField = {
2501
2772
  'strokeStyleBlendMode', 'PntT', 'Styl', 'lookupType', 'LUTFormat', 'dataOrder',
2502
2773
  'tableOrder', 'enableCompCore', 'enableCompCoreGPU', 'compCoreSupport', 'compCoreGPUSupport', 'Engn',
2503
2774
  'enableCompCoreThreads', 'gs99', 'FrDs', 'trackID', 'animInterpStyle', 'horzAlign',
2504
- 'vertAlign', 'bgColorType',
2775
+ 'vertAlign', 'bgColorType', 'shapeOperation',
2505
2776
  ],
2506
2777
  'bool': [
2507
2778
  'PstS', 'printSixteenBit', 'masterFXSwitch', 'enab', 'uglg', 'antialiasGloss',
@@ -2512,13 +2783,15 @@ var typeToField = {
2512
2783
  'autoExpandEnabled', 'autoNestEnabled', 'autoPositionEnabled', 'shrinkwrapOnSaveEnabled',
2513
2784
  'present', 'showInDialog', 'overprint', 'sheetDisclosed', 'lightsDisclosed', 'meshesDisclosed',
2514
2785
  'materialsDisclosed', 'hasMotion', 'muted', 'Effc', 'selected', 'autoScope', 'fillCanvas',
2515
- 'cellTextIsHTML',
2786
+ 'cellTextIsHTML', 'Smoo', 'Clsp', 'validAtPosition', 'rigidType', 'hasoptions', 'filterMaskEnable',
2787
+ 'filterMaskLinked', 'filterMaskExtendWithWhite',
2516
2788
  ],
2517
2789
  'doub': [
2518
2790
  'warpValue', 'warpPerspective', 'warpPerspectiveOther', 'Intr', 'Wdth', 'Hght',
2519
2791
  'strokeStyleMiterLimit', 'strokeStyleResolution', 'layerTime', 'keyOriginResolution',
2520
2792
  'xx', 'xy', 'yx', 'yy', 'tx', 'ty', 'FrGA', 'frameRate', 'audioLevel', 'rotation',
2521
- 'X ', 'Y ', 'redFloat', 'greenFloat', 'blueFloat',
2793
+ 'X ', 'Y ', 'redFloat', 'greenFloat', 'blueFloat', 'imageResolution',
2794
+ 'PuX0', 'PuX1', 'PuX2', 'PuX3', 'PuY0', 'PuY1', 'PuY2', 'PuY3'
2522
2795
  ],
2523
2796
  'UntF': [
2524
2797
  'Scl ', 'sdwO', 'hglO', 'lagl', 'Lald', 'srgR', 'blur', 'Sftn', 'Opct', 'Dstn', 'Angl',
@@ -2531,7 +2804,8 @@ var typeToField = {
2531
2804
  'LaSt', 'Trnf', 'nonAffineTransform', 'keyDescriptorList', 'guideIndeces', 'gradientFillMulti',
2532
2805
  'solidFillMulti', 'frameFXMulti', 'innerShadowMulti', 'dropShadowMulti', 'FrIn', 'FSts', 'FsFr',
2533
2806
  'sheetTimelineOptions', 'audioClipList', 'trackList', 'globalTrackList', 'keyList', 'audioClipList',
2534
- 'warpValues',
2807
+ 'warpValues', 'selectedPin', 'Pts ', 'SbpL', 'pathComponents', 'pinOffsets', 'posFinalPins',
2808
+ 'pinVertexIndices', 'PinP', 'PnRt', 'PnOv', 'PnDp', 'filterFXList', 'puppetShapeList',
2535
2809
  ],
2536
2810
  'ObAr': ['meshPoints', 'quiltSliceX', 'quiltSliceY'],
2537
2811
  'obj ': ['null'],
@@ -2542,24 +2816,37 @@ var channels = [
2542
2816
  var fieldToArrayType = {
2543
2817
  'Mnm ': 'long',
2544
2818
  'Mxm ': 'long',
2545
- 'FrLs': 'long',
2546
- 'strokeStyleLineDashSet': 'UntF',
2547
- 'Trnf': 'doub',
2548
- 'nonAffineTransform': 'doub',
2549
- 'keyDescriptorList': 'Objc',
2550
- 'gradientFillMulti': 'Objc',
2551
- 'solidFillMulti': 'Objc',
2552
- 'frameFXMulti': 'Objc',
2553
- 'innerShadowMulti': 'Objc',
2554
- 'dropShadowMulti': 'Objc',
2555
- 'LaSt': 'Objc',
2556
- 'FrIn': 'Objc',
2557
- 'FSts': 'Objc',
2558
- 'FsFr': 'long',
2559
- 'blendOptions': 'Objc',
2560
- 'sheetTimelineOptions': 'Objc',
2561
- 'keyList': 'Objc',
2562
- 'warpValues': 'doub',
2819
+ FrLs: 'long',
2820
+ strokeStyleLineDashSet: 'UntF',
2821
+ Trnf: 'doub',
2822
+ nonAffineTransform: 'doub',
2823
+ keyDescriptorList: 'Objc',
2824
+ gradientFillMulti: 'Objc',
2825
+ solidFillMulti: 'Objc',
2826
+ frameFXMulti: 'Objc',
2827
+ innerShadowMulti: 'Objc',
2828
+ dropShadowMulti: 'Objc',
2829
+ LaSt: 'Objc',
2830
+ FrIn: 'Objc',
2831
+ FSts: 'Objc',
2832
+ FsFr: 'long',
2833
+ blendOptions: 'Objc',
2834
+ sheetTimelineOptions: 'Objc',
2835
+ keyList: 'Objc',
2836
+ warpValues: 'doub',
2837
+ selectedPin: 'long',
2838
+ 'Pts ': 'Objc',
2839
+ SbpL: 'Objc',
2840
+ pathComponents: 'Objc',
2841
+ pinOffsets: 'doub',
2842
+ posFinalPins: 'doub',
2843
+ pinVertexIndices: 'long',
2844
+ PinP: 'doub',
2845
+ PnRt: 'long',
2846
+ PnOv: 'bool',
2847
+ PnDp: 'doub',
2848
+ filterFXList: 'Objc',
2849
+ puppetShapeList: 'Objc',
2563
2850
  };
2564
2851
  var fieldToType = {};
2565
2852
  for (var _i = 0, _a = Object.keys(typeToField); _i < _a.length; _i++) {
@@ -2832,7 +3119,7 @@ function writeOSType(writer, type, value, key, extType, root) {
2832
3119
  for (var i = 0; i < value.length; i++) {
2833
3120
  var type_3 = fieldToArrayType[key];
2834
3121
  (0, psdWriter_1.writeSignature)(writer, type_3 || 'long');
2835
- writeOSType(writer, type_3 || 'long', value[i], '', fieldToArrayExtType[key], root);
3122
+ writeOSType(writer, type_3 || 'long', value[i], "".concat(key, "[]"), fieldToArrayExtType[key], root);
2836
3123
  if (logErrors && !type_3)
2837
3124
  console.log("Missing descriptor array type for: '".concat(key, "' in"), value);
2838
3125
  }
@@ -8140,6 +8427,8 @@ function decodeEngineData(engineData) {
8140
8427
  for (var i = 0; i < styleRun.RunArray.length; i++) {
8141
8428
  var length_2 = styleRun.RunLengthArray[i];
8142
8429
  var style = decodeStyle(styleRun.RunArray[i].StyleSheet.StyleSheetData, fonts);
8430
+ if (!style.font)
8431
+ style.font = fonts[0];
8143
8432
  result.styleRuns.push({ length: length_2, style: style });
8144
8433
  }
8145
8434
  for (var counter = removedCharacters; result.styleRuns.length && counter > 0; counter--) {
@@ -109,6 +109,15 @@ var fieldToExtType = {
109
109
  'Lnk ': makeType('', 'ExternalFileLink'),
110
110
  frameReader: makeType('', 'FrameReader'),
111
111
  effectParams: makeType('', 'motionTrackEffectParams'),
112
+ Impr: makeType('None', 'none'),
113
+ Anch: makeType('', 'Pnt '),
114
+ 'Fwd ': makeType('', 'Pnt '),
115
+ 'Bwd ': makeType('', 'Pnt '),
116
+ meshBoundaryPath: makeType('', 'pathClass'),
117
+ filterFX: makeType('', 'filterFXStyle'),
118
+ Fltr: makeType('', 'rigidTransform'),
119
+ FrgC: makeType('', 'RGBC'),
120
+ BckC: makeType('', 'RGBC'),
112
121
  };
113
122
  var fieldToArrayExtType = {
114
123
  'Crv ': makeType('', 'CrPt'),
@@ -132,6 +141,11 @@ var fieldToArrayExtType = {
132
141
  countObjectList: makeType('', 'countObject'),
133
142
  countGroupList: makeType('', 'countGroup'),
134
143
  slices: makeType('', 'slice'),
144
+ 'Pts ': makeType('', 'Pthp'),
145
+ SbpL: makeType('', 'SbpL'),
146
+ pathComponents: makeType('', 'PaCm'),
147
+ filterFXList: makeType('', 'filterFX'),
148
+ puppetShapeList: makeType('', 'puppetShape'),
135
149
  };
136
150
  var typeToField = {
137
151
  'TEXT': [
@@ -140,7 +154,7 @@ var typeToField = {
140
154
  'artboardPresetName', 'json', 'clipID', 'relPath', 'fullPath', 'mediaDescriptor', 'Msge',
141
155
  'altTag', 'url', 'cellText',
142
156
  ],
143
- 'tdta': ['EngineData', 'LUT3DFileData'],
157
+ 'tdta': ['EngineData', 'LUT3DFileData', 'indexArray', 'originalVertexArray', 'deformedVertexArray'],
144
158
  'long': [
145
159
  'TextIndex', 'RndS', 'Mdpn', 'Smth', 'Lctn', 'strokeStyleVersion', 'LaID', 'Vrsn', 'Cnt ',
146
160
  'Brgh', 'Cntr', 'means', 'vibrance', 'Strt', 'bwPresetKind', 'presetKind', 'comp', 'compID', 'originalCompID',
@@ -150,7 +164,8 @@ var typeToField = {
150
164
  'numModifyingFX', 'deformNumRows', 'deformNumCols', 'FrID', 'FrDl', 'FsID', 'LCnt', 'AFrm', 'AFSt',
151
165
  'numBefore', 'numAfter', 'Spcn', 'minOpacity', 'maxOpacity', 'BlnM', 'sheetID', 'gblA', 'globalAltitude',
152
166
  'descVersion', 'frameReaderType', 'LyrI', 'zoomOrigin', 'fontSize', 'Rds ', 'sliceID',
153
- 'topOutset', 'leftOutset', 'bottomOutset', 'rightOutset',
167
+ 'topOutset', 'leftOutset', 'bottomOutset', 'rightOutset', 'filterID', 'meshQuality',
168
+ 'meshExpansion', 'meshRigidity', 'VrsM', 'VrsN',
154
169
  ],
155
170
  'enum': [
156
171
  'textGridding', 'Ornt', 'warpStyle', 'warpRotate', 'Inte', 'Bltn', 'ClrS',
@@ -159,7 +174,7 @@ var typeToField = {
159
174
  'strokeStyleBlendMode', 'PntT', 'Styl', 'lookupType', 'LUTFormat', 'dataOrder',
160
175
  'tableOrder', 'enableCompCore', 'enableCompCoreGPU', 'compCoreSupport', 'compCoreGPUSupport', 'Engn',
161
176
  'enableCompCoreThreads', 'gs99', 'FrDs', 'trackID', 'animInterpStyle', 'horzAlign',
162
- 'vertAlign', 'bgColorType',
177
+ 'vertAlign', 'bgColorType', 'shapeOperation',
163
178
  ],
164
179
  'bool': [
165
180
  'PstS', 'printSixteenBit', 'masterFXSwitch', 'enab', 'uglg', 'antialiasGloss',
@@ -170,13 +185,15 @@ var typeToField = {
170
185
  'autoExpandEnabled', 'autoNestEnabled', 'autoPositionEnabled', 'shrinkwrapOnSaveEnabled',
171
186
  'present', 'showInDialog', 'overprint', 'sheetDisclosed', 'lightsDisclosed', 'meshesDisclosed',
172
187
  'materialsDisclosed', 'hasMotion', 'muted', 'Effc', 'selected', 'autoScope', 'fillCanvas',
173
- 'cellTextIsHTML',
188
+ 'cellTextIsHTML', 'Smoo', 'Clsp', 'validAtPosition', 'rigidType', 'hasoptions', 'filterMaskEnable',
189
+ 'filterMaskLinked', 'filterMaskExtendWithWhite',
174
190
  ],
175
191
  'doub': [
176
192
  'warpValue', 'warpPerspective', 'warpPerspectiveOther', 'Intr', 'Wdth', 'Hght',
177
193
  'strokeStyleMiterLimit', 'strokeStyleResolution', 'layerTime', 'keyOriginResolution',
178
194
  'xx', 'xy', 'yx', 'yy', 'tx', 'ty', 'FrGA', 'frameRate', 'audioLevel', 'rotation',
179
- 'X ', 'Y ', 'redFloat', 'greenFloat', 'blueFloat',
195
+ 'X ', 'Y ', 'redFloat', 'greenFloat', 'blueFloat', 'imageResolution',
196
+ 'PuX0', 'PuX1', 'PuX2', 'PuX3', 'PuY0', 'PuY1', 'PuY2', 'PuY3'
180
197
  ],
181
198
  'UntF': [
182
199
  'Scl ', 'sdwO', 'hglO', 'lagl', 'Lald', 'srgR', 'blur', 'Sftn', 'Opct', 'Dstn', 'Angl',
@@ -189,7 +206,8 @@ var typeToField = {
189
206
  'LaSt', 'Trnf', 'nonAffineTransform', 'keyDescriptorList', 'guideIndeces', 'gradientFillMulti',
190
207
  'solidFillMulti', 'frameFXMulti', 'innerShadowMulti', 'dropShadowMulti', 'FrIn', 'FSts', 'FsFr',
191
208
  'sheetTimelineOptions', 'audioClipList', 'trackList', 'globalTrackList', 'keyList', 'audioClipList',
192
- 'warpValues',
209
+ 'warpValues', 'selectedPin', 'Pts ', 'SbpL', 'pathComponents', 'pinOffsets', 'posFinalPins',
210
+ 'pinVertexIndices', 'PinP', 'PnRt', 'PnOv', 'PnDp', 'filterFXList', 'puppetShapeList',
193
211
  ],
194
212
  'ObAr': ['meshPoints', 'quiltSliceX', 'quiltSliceY'],
195
213
  'obj ': ['null'],
@@ -200,24 +218,37 @@ var channels = [
200
218
  var fieldToArrayType = {
201
219
  'Mnm ': 'long',
202
220
  'Mxm ': 'long',
203
- 'FrLs': 'long',
204
- 'strokeStyleLineDashSet': 'UntF',
205
- 'Trnf': 'doub',
206
- 'nonAffineTransform': 'doub',
207
- 'keyDescriptorList': 'Objc',
208
- 'gradientFillMulti': 'Objc',
209
- 'solidFillMulti': 'Objc',
210
- 'frameFXMulti': 'Objc',
211
- 'innerShadowMulti': 'Objc',
212
- 'dropShadowMulti': 'Objc',
213
- 'LaSt': 'Objc',
214
- 'FrIn': 'Objc',
215
- 'FSts': 'Objc',
216
- 'FsFr': 'long',
217
- 'blendOptions': 'Objc',
218
- 'sheetTimelineOptions': 'Objc',
219
- 'keyList': 'Objc',
220
- 'warpValues': 'doub',
221
+ FrLs: 'long',
222
+ strokeStyleLineDashSet: 'UntF',
223
+ Trnf: 'doub',
224
+ nonAffineTransform: 'doub',
225
+ keyDescriptorList: 'Objc',
226
+ gradientFillMulti: 'Objc',
227
+ solidFillMulti: 'Objc',
228
+ frameFXMulti: 'Objc',
229
+ innerShadowMulti: 'Objc',
230
+ dropShadowMulti: 'Objc',
231
+ LaSt: 'Objc',
232
+ FrIn: 'Objc',
233
+ FSts: 'Objc',
234
+ FsFr: 'long',
235
+ blendOptions: 'Objc',
236
+ sheetTimelineOptions: 'Objc',
237
+ keyList: 'Objc',
238
+ warpValues: 'doub',
239
+ selectedPin: 'long',
240
+ 'Pts ': 'Objc',
241
+ SbpL: 'Objc',
242
+ pathComponents: 'Objc',
243
+ pinOffsets: 'doub',
244
+ posFinalPins: 'doub',
245
+ pinVertexIndices: 'long',
246
+ PinP: 'doub',
247
+ PnRt: 'long',
248
+ PnOv: 'bool',
249
+ PnDp: 'doub',
250
+ filterFXList: 'Objc',
251
+ puppetShapeList: 'Objc',
221
252
  };
222
253
  var fieldToType = {};
223
254
  for (var _i = 0, _a = Object.keys(typeToField); _i < _a.length; _i++) {
@@ -490,7 +521,7 @@ function writeOSType(writer, type, value, key, extType, root) {
490
521
  for (var i = 0; i < value.length; i++) {
491
522
  var type_3 = fieldToArrayType[key];
492
523
  (0, psdWriter_1.writeSignature)(writer, type_3 || 'long');
493
- writeOSType(writer, type_3 || 'long', value[i], '', fieldToArrayExtType[key], root);
524
+ writeOSType(writer, type_3 || 'long', value[i], "".concat(key, "[]"), fieldToArrayExtType[key], root);
494
525
  if (logErrors && !type_3)
495
526
  console.log("Missing descriptor array type for: '".concat(key, "' in"), value);
496
527
  }