mirror of
https://gitee.com/onvia/ccc-tnt-psd2ui
synced 2024-12-28 20:47:43 +00:00
789 lines
130 KiB
JavaScript
789 lines
130 KiB
JavaScript
|
"use strict";
|
||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||
|
exports.resourceHandlersMap = exports.resourceHandlers = void 0;
|
||
|
var base64_js_1 = require("base64-js");
|
||
|
var psdReader_1 = require("./psdReader");
|
||
|
var psdWriter_1 = require("./psdWriter");
|
||
|
var helpers_1 = require("./helpers");
|
||
|
var utf8_1 = require("./utf8");
|
||
|
var descriptor_1 = require("./descriptor");
|
||
|
exports.resourceHandlers = [];
|
||
|
exports.resourceHandlersMap = {};
|
||
|
function addHandler(key, has, read, write) {
|
||
|
var handler = { key: key, has: has, read: read, write: write };
|
||
|
exports.resourceHandlers.push(handler);
|
||
|
exports.resourceHandlersMap[handler.key] = handler;
|
||
|
}
|
||
|
var LOG_MOCK_HANDLERS = false;
|
||
|
var RESOLUTION_UNITS = [undefined, 'PPI', 'PPCM'];
|
||
|
var MEASUREMENT_UNITS = [undefined, 'Inches', 'Centimeters', 'Points', 'Picas', 'Columns'];
|
||
|
var hex = '0123456789abcdef';
|
||
|
function charToNibble(code) {
|
||
|
return code <= 57 ? code - 48 : code - 87;
|
||
|
}
|
||
|
function byteAt(value, index) {
|
||
|
return (charToNibble(value.charCodeAt(index)) << 4) | charToNibble(value.charCodeAt(index + 1));
|
||
|
}
|
||
|
function readUtf8String(reader, length) {
|
||
|
var buffer = (0, psdReader_1.readBytes)(reader, length);
|
||
|
return (0, utf8_1.decodeString)(buffer);
|
||
|
}
|
||
|
function writeUtf8String(writer, value) {
|
||
|
var buffer = (0, utf8_1.encodeString)(value);
|
||
|
(0, psdWriter_1.writeBytes)(writer, buffer);
|
||
|
}
|
||
|
helpers_1.MOCK_HANDLERS && addHandler(1028, // IPTC-NAA record
|
||
|
function (// IPTC-NAA record
|
||
|
target) { return target._ir1028 !== undefined; }, function (reader, target, left) {
|
||
|
LOG_MOCK_HANDLERS && console.log('image resource 1028', left());
|
||
|
target._ir1028 = (0, psdReader_1.readBytes)(reader, left());
|
||
|
}, function (writer, target) {
|
||
|
(0, psdWriter_1.writeBytes)(writer, target._ir1028);
|
||
|
});
|
||
|
addHandler(1061, function (target) { return target.captionDigest !== undefined; }, function (reader, target) {
|
||
|
var captionDigest = '';
|
||
|
for (var i = 0; i < 16; i++) {
|
||
|
var byte = (0, psdReader_1.readUint8)(reader);
|
||
|
captionDigest += hex[byte >> 4];
|
||
|
captionDigest += hex[byte & 0xf];
|
||
|
}
|
||
|
target.captionDigest = captionDigest;
|
||
|
}, function (writer, target) {
|
||
|
for (var i = 0; i < 16; i++) {
|
||
|
(0, psdWriter_1.writeUint8)(writer, byteAt(target.captionDigest, i * 2));
|
||
|
}
|
||
|
});
|
||
|
addHandler(1060, function (target) { return target.xmpMetadata !== undefined; }, function (reader, target, left) { return target.xmpMetadata = readUtf8String(reader, left()); }, function (writer, target) { return writeUtf8String(writer, target.xmpMetadata); });
|
||
|
var Inte = (0, helpers_1.createEnum)('Inte', 'perceptual', {
|
||
|
'perceptual': 'Img ',
|
||
|
'saturation': 'Grp ',
|
||
|
'relative colorimetric': 'Clrm',
|
||
|
'absolute colorimetric': 'AClr',
|
||
|
});
|
||
|
addHandler(1082, function (target) { return target.printInformation !== undefined; }, function (reader, target) {
|
||
|
var _a, _b;
|
||
|
var desc = (0, descriptor_1.readVersionAndDescriptor)(reader);
|
||
|
target.printInformation = {
|
||
|
printerName: desc.printerName || '',
|
||
|
renderingIntent: Inte.decode((_a = desc.Inte) !== null && _a !== void 0 ? _a : 'Inte.Img '),
|
||
|
};
|
||
|
var info = target.printInformation;
|
||
|
if (desc.PstS !== undefined)
|
||
|
info.printerManagesColors = desc.PstS;
|
||
|
if (desc['Nm '] !== undefined)
|
||
|
info.printerProfile = desc['Nm '];
|
||
|
if (desc.MpBl !== undefined)
|
||
|
info.blackPointCompensation = desc.MpBl;
|
||
|
if (desc.printSixteenBit !== undefined)
|
||
|
info.printSixteenBit = desc.printSixteenBit;
|
||
|
if (desc.hardProof !== undefined)
|
||
|
info.hardProof = desc.hardProof;
|
||
|
if (desc.printProofSetup) {
|
||
|
if ('Bltn' in desc.printProofSetup) {
|
||
|
info.proofSetup = { builtin: desc.printProofSetup.Bltn.split('.')[1] };
|
||
|
}
|
||
|
else {
|
||
|
info.proofSetup = {
|
||
|
profile: desc.printProofSetup.profile,
|
||
|
renderingIntent: Inte.decode((_b = desc.printProofSetup.Inte) !== null && _b !== void 0 ? _b : 'Inte.Img '),
|
||
|
blackPointCompensation: !!desc.printProofSetup.MpBl,
|
||
|
paperWhite: !!desc.printProofSetup.paperWhite,
|
||
|
};
|
||
|
}
|
||
|
}
|
||
|
}, function (writer, target) {
|
||
|
var _a, _b;
|
||
|
var info = target.printInformation;
|
||
|
var desc = {};
|
||
|
if (info.printerManagesColors) {
|
||
|
desc.PstS = true;
|
||
|
}
|
||
|
else {
|
||
|
if (info.hardProof !== undefined)
|
||
|
desc.hardProof = !!info.hardProof;
|
||
|
desc.ClrS = 'ClrS.RGBC'; // TODO: ???
|
||
|
desc['Nm '] = (_a = info.printerProfile) !== null && _a !== void 0 ? _a : 'CIE RGB';
|
||
|
}
|
||
|
desc.Inte = Inte.encode(info.renderingIntent);
|
||
|
if (!info.printerManagesColors)
|
||
|
desc.MpBl = !!info.blackPointCompensation;
|
||
|
desc.printSixteenBit = !!info.printSixteenBit;
|
||
|
desc.printerName = info.printerName || '';
|
||
|
if (info.proofSetup && 'profile' in info.proofSetup) {
|
||
|
desc.printProofSetup = {
|
||
|
profile: info.proofSetup.profile || '',
|
||
|
Inte: Inte.encode(info.proofSetup.renderingIntent),
|
||
|
MpBl: !!info.proofSetup.blackPointCompensation,
|
||
|
paperWhite: !!info.proofSetup.paperWhite,
|
||
|
};
|
||
|
}
|
||
|
else {
|
||
|
desc.printProofSetup = {
|
||
|
Bltn: ((_b = info.proofSetup) === null || _b === void 0 ? void 0 : _b.builtin) ? "builtinProof.".concat(info.proofSetup.builtin) : 'builtinProof.proofCMYK',
|
||
|
};
|
||
|
}
|
||
|
(0, descriptor_1.writeVersionAndDescriptor)(writer, '', 'printOutput', desc);
|
||
|
});
|
||
|
helpers_1.MOCK_HANDLERS && addHandler(1083, // Print style
|
||
|
function (// Print style
|
||
|
target) { return target._ir1083 !== undefined; }, function (reader, target, left) {
|
||
|
LOG_MOCK_HANDLERS && console.log('image resource 1083', left());
|
||
|
target._ir1083 = (0, psdReader_1.readBytes)(reader, left());
|
||
|
// TODO:
|
||
|
// const desc = readVersionAndDescriptor(reader);
|
||
|
// console.log('1083', require('util').inspect(desc, false, 99, true));
|
||
|
}, function (writer, target) {
|
||
|
(0, psdWriter_1.writeBytes)(writer, target._ir1083);
|
||
|
});
|
||
|
addHandler(1005, function (target) { return target.resolutionInfo !== undefined; }, function (reader, target) {
|
||
|
var horizontalResolution = (0, psdReader_1.readFixedPoint32)(reader);
|
||
|
var horizontalResolutionUnit = (0, psdReader_1.readUint16)(reader);
|
||
|
var widthUnit = (0, psdReader_1.readUint16)(reader);
|
||
|
var verticalResolution = (0, psdReader_1.readFixedPoint32)(reader);
|
||
|
var verticalResolutionUnit = (0, psdReader_1.readUint16)(reader);
|
||
|
var heightUnit = (0, psdReader_1.readUint16)(reader);
|
||
|
target.resolutionInfo = {
|
||
|
horizontalResolution: horizontalResolution,
|
||
|
horizontalResolutionUnit: RESOLUTION_UNITS[horizontalResolutionUnit] || 'PPI',
|
||
|
widthUnit: MEASUREMENT_UNITS[widthUnit] || 'Inches',
|
||
|
verticalResolution: verticalResolution,
|
||
|
verticalResolutionUnit: RESOLUTION_UNITS[verticalResolutionUnit] || 'PPI',
|
||
|
heightUnit: MEASUREMENT_UNITS[heightUnit] || 'Inches',
|
||
|
};
|
||
|
}, function (writer, target) {
|
||
|
var info = target.resolutionInfo;
|
||
|
(0, psdWriter_1.writeFixedPoint32)(writer, info.horizontalResolution || 0);
|
||
|
(0, psdWriter_1.writeUint16)(writer, Math.max(1, RESOLUTION_UNITS.indexOf(info.horizontalResolutionUnit)));
|
||
|
(0, psdWriter_1.writeUint16)(writer, Math.max(1, MEASUREMENT_UNITS.indexOf(info.widthUnit)));
|
||
|
(0, psdWriter_1.writeFixedPoint32)(writer, info.verticalResolution || 0);
|
||
|
(0, psdWriter_1.writeUint16)(writer, Math.max(1, RESOLUTION_UNITS.indexOf(info.verticalResolutionUnit)));
|
||
|
(0, psdWriter_1.writeUint16)(writer, Math.max(1, MEASUREMENT_UNITS.indexOf(info.heightUnit)));
|
||
|
});
|
||
|
var printScaleStyles = ['centered', 'size to fit', 'user defined'];
|
||
|
addHandler(1062, function (target) { return target.printScale !== undefined; }, function (reader, target) {
|
||
|
target.printScale = {
|
||
|
style: printScaleStyles[(0, psdReader_1.readInt16)(reader)],
|
||
|
x: (0, psdReader_1.readFloat32)(reader),
|
||
|
y: (0, psdReader_1.readFloat32)(reader),
|
||
|
scale: (0, psdReader_1.readFloat32)(reader),
|
||
|
};
|
||
|
}, function (writer, target) {
|
||
|
var _a = target.printScale, style = _a.style, x = _a.x, y = _a.y, scale = _a.scale;
|
||
|
(0, psdWriter_1.writeInt16)(writer, Math.max(0, printScaleStyles.indexOf(style)));
|
||
|
(0, psdWriter_1.writeFloat32)(writer, x || 0);
|
||
|
(0, psdWriter_1.writeFloat32)(writer, y || 0);
|
||
|
(0, psdWriter_1.writeFloat32)(writer, scale || 0);
|
||
|
});
|
||
|
addHandler(1006, function (target) { return target.alphaChannelNames !== undefined; }, function (reader, target, left) {
|
||
|
target.alphaChannelNames = [];
|
||
|
while (left()) {
|
||
|
var value = (0, psdReader_1.readPascalString)(reader, 1);
|
||
|
target.alphaChannelNames.push(value);
|
||
|
}
|
||
|
}, function (writer, target) {
|
||
|
for (var _i = 0, _a = target.alphaChannelNames; _i < _a.length; _i++) {
|
||
|
var name_1 = _a[_i];
|
||
|
(0, psdWriter_1.writePascalString)(writer, name_1, 1);
|
||
|
}
|
||
|
});
|
||
|
addHandler(1045, function (target) { return target.alphaChannelNames !== undefined; }, function (reader, target, left) {
|
||
|
target.alphaChannelNames = [];
|
||
|
while (left()) {
|
||
|
target.alphaChannelNames.push((0, psdReader_1.readUnicodeString)(reader));
|
||
|
}
|
||
|
}, function (writer, target) {
|
||
|
for (var _i = 0, _a = target.alphaChannelNames; _i < _a.length; _i++) {
|
||
|
var name_2 = _a[_i];
|
||
|
(0, psdWriter_1.writeUnicodeStringWithPadding)(writer, name_2);
|
||
|
}
|
||
|
});
|
||
|
helpers_1.MOCK_HANDLERS && addHandler(1077, function (target) { return target._ir1077 !== undefined; }, function (reader, target, left) {
|
||
|
LOG_MOCK_HANDLERS && console.log('image resource 1077', left());
|
||
|
target._ir1077 = (0, psdReader_1.readBytes)(reader, left());
|
||
|
}, function (writer, target) {
|
||
|
(0, psdWriter_1.writeBytes)(writer, target._ir1077);
|
||
|
});
|
||
|
addHandler(1053, function (target) { return target.alphaIdentifiers !== undefined; }, function (reader, target, left) {
|
||
|
target.alphaIdentifiers = [];
|
||
|
while (left() >= 4) {
|
||
|
target.alphaIdentifiers.push((0, psdReader_1.readUint32)(reader));
|
||
|
}
|
||
|
}, function (writer, target) {
|
||
|
for (var _i = 0, _a = target.alphaIdentifiers; _i < _a.length; _i++) {
|
||
|
var id = _a[_i];
|
||
|
(0, psdWriter_1.writeUint32)(writer, id);
|
||
|
}
|
||
|
});
|
||
|
addHandler(1010, function (target) { return target.backgroundColor !== undefined; }, function (reader, target) { return target.backgroundColor = (0, psdReader_1.readColor)(reader); }, function (writer, target) { return (0, psdWriter_1.writeColor)(writer, target.backgroundColor); });
|
||
|
addHandler(1037, function (target) { return target.globalAngle !== undefined; }, function (reader, target) { return target.globalAngle = (0, psdReader_1.readUint32)(reader); }, function (writer, target) { return (0, psdWriter_1.writeUint32)(writer, target.globalAngle); });
|
||
|
addHandler(1049, function (target) { return target.globalAltitude !== undefined; }, function (reader, target) { return target.globalAltitude = (0, psdReader_1.readUint32)(reader); }, function (writer, target) { return (0, psdWriter_1.writeUint32)(writer, target.globalAltitude); });
|
||
|
addHandler(1011, function (target) { return target.printFlags !== undefined; }, function (reader, target) {
|
||
|
target.printFlags = {
|
||
|
labels: !!(0, psdReader_1.readUint8)(reader),
|
||
|
cropMarks: !!(0, psdReader_1.readUint8)(reader),
|
||
|
colorBars: !!(0, psdReader_1.readUint8)(reader),
|
||
|
registrationMarks: !!(0, psdReader_1.readUint8)(reader),
|
||
|
negative: !!(0, psdReader_1.readUint8)(reader),
|
||
|
flip: !!(0, psdReader_1.readUint8)(reader),
|
||
|
interpolate: !!(0, psdReader_1.readUint8)(reader),
|
||
|
caption: !!(0, psdReader_1.readUint8)(reader),
|
||
|
printFlags: !!(0, psdReader_1.readUint8)(reader),
|
||
|
};
|
||
|
}, function (writer, target) {
|
||
|
var flags = target.printFlags;
|
||
|
(0, psdWriter_1.writeUint8)(writer, flags.labels ? 1 : 0);
|
||
|
(0, psdWriter_1.writeUint8)(writer, flags.cropMarks ? 1 : 0);
|
||
|
(0, psdWriter_1.writeUint8)(writer, flags.colorBars ? 1 : 0);
|
||
|
(0, psdWriter_1.writeUint8)(writer, flags.registrationMarks ? 1 : 0);
|
||
|
(0, psdWriter_1.writeUint8)(writer, flags.negative ? 1 : 0);
|
||
|
(0, psdWriter_1.writeUint8)(writer, flags.flip ? 1 : 0);
|
||
|
(0, psdWriter_1.writeUint8)(writer, flags.interpolate ? 1 : 0);
|
||
|
(0, psdWriter_1.writeUint8)(writer, flags.caption ? 1 : 0);
|
||
|
(0, psdWriter_1.writeUint8)(writer, flags.printFlags ? 1 : 0);
|
||
|
});
|
||
|
helpers_1.MOCK_HANDLERS && addHandler(10000, // Print flags
|
||
|
function (// Print flags
|
||
|
target) { return target._ir10000 !== undefined; }, function (reader, target, left) {
|
||
|
LOG_MOCK_HANDLERS && console.log('image resource 10000', left());
|
||
|
target._ir10000 = (0, psdReader_1.readBytes)(reader, left());
|
||
|
}, function (writer, target) {
|
||
|
(0, psdWriter_1.writeBytes)(writer, target._ir10000);
|
||
|
});
|
||
|
helpers_1.MOCK_HANDLERS && addHandler(1013, // Color halftoning
|
||
|
function (// Color halftoning
|
||
|
target) { return target._ir1013 !== undefined; }, function (reader, target, left) {
|
||
|
LOG_MOCK_HANDLERS && console.log('image resource 1013', left());
|
||
|
target._ir1013 = (0, psdReader_1.readBytes)(reader, left());
|
||
|
}, function (writer, target) {
|
||
|
(0, psdWriter_1.writeBytes)(writer, target._ir1013);
|
||
|
});
|
||
|
helpers_1.MOCK_HANDLERS && addHandler(1016, // Color transfer functions
|
||
|
function (// Color transfer functions
|
||
|
target) { return target._ir1016 !== undefined; }, function (reader, target, left) {
|
||
|
LOG_MOCK_HANDLERS && console.log('image resource 1016', left());
|
||
|
target._ir1016 = (0, psdReader_1.readBytes)(reader, left());
|
||
|
}, function (writer, target) {
|
||
|
(0, psdWriter_1.writeBytes)(writer, target._ir1016);
|
||
|
});
|
||
|
addHandler(1024, function (target) { return target.layerState !== undefined; }, function (reader, target) { return target.layerState = (0, psdReader_1.readUint16)(reader); }, function (writer, target) { return (0, psdWriter_1.writeUint16)(writer, target.layerState); });
|
||
|
addHandler(1026, function (target) { return target.layersGroup !== undefined; }, function (reader, target, left) {
|
||
|
target.layersGroup = [];
|
||
|
while (left()) {
|
||
|
target.layersGroup.push((0, psdReader_1.readUint16)(reader));
|
||
|
}
|
||
|
}, function (writer, target) {
|
||
|
for (var _i = 0, _a = target.layersGroup; _i < _a.length; _i++) {
|
||
|
var g = _a[_i];
|
||
|
(0, psdWriter_1.writeUint16)(writer, g);
|
||
|
}
|
||
|
});
|
||
|
addHandler(1072, function (target) { return target.layerGroupsEnabledId !== undefined; }, function (reader, target, left) {
|
||
|
target.layerGroupsEnabledId = [];
|
||
|
while (left()) {
|
||
|
target.layerGroupsEnabledId.push((0, psdReader_1.readUint8)(reader));
|
||
|
}
|
||
|
}, function (writer, target) {
|
||
|
for (var _i = 0, _a = target.layerGroupsEnabledId; _i < _a.length; _i++) {
|
||
|
var id = _a[_i];
|
||
|
(0, psdWriter_1.writeUint8)(writer, id);
|
||
|
}
|
||
|
});
|
||
|
addHandler(1069, function (target) { return target.layerSelectionIds !== undefined; }, function (reader, target) {
|
||
|
var count = (0, psdReader_1.readUint16)(reader);
|
||
|
target.layerSelectionIds = [];
|
||
|
while (count--) {
|
||
|
target.layerSelectionIds.push((0, psdReader_1.readUint32)(reader));
|
||
|
}
|
||
|
}, function (writer, target) {
|
||
|
(0, psdWriter_1.writeUint16)(writer, target.layerSelectionIds.length);
|
||
|
for (var _i = 0, _a = target.layerSelectionIds; _i < _a.length; _i++) {
|
||
|
var id = _a[_i];
|
||
|
(0, psdWriter_1.writeUint32)(writer, id);
|
||
|
}
|
||
|
});
|
||
|
addHandler(1032, function (target) { return target.gridAndGuidesInformation !== undefined; }, function (reader, target) {
|
||
|
var version = (0, psdReader_1.readUint32)(reader);
|
||
|
var horizontal = (0, psdReader_1.readUint32)(reader);
|
||
|
var vertical = (0, psdReader_1.readUint32)(reader);
|
||
|
var count = (0, psdReader_1.readUint32)(reader);
|
||
|
if (version !== 1)
|
||
|
throw new Error("Invalid 1032 resource version: ".concat(version));
|
||
|
target.gridAndGuidesInformation = {
|
||
|
grid: { horizontal: horizontal, vertical: vertical },
|
||
|
guides: [],
|
||
|
};
|
||
|
for (var i = 0; i < count; i++) {
|
||
|
target.gridAndGuidesInformation.guides.push({
|
||
|
location: (0, psdReader_1.readUint32)(reader) / 32,
|
||
|
direction: (0, psdReader_1.readUint8)(reader) ? 'horizontal' : 'vertical'
|
||
|
});
|
||
|
}
|
||
|
}, function (writer, target) {
|
||
|
var info = target.gridAndGuidesInformation;
|
||
|
var grid = info.grid || { horizontal: 18 * 32, vertical: 18 * 32 };
|
||
|
var guides = info.guides || [];
|
||
|
(0, psdWriter_1.writeUint32)(writer, 1);
|
||
|
(0, psdWriter_1.writeUint32)(writer, grid.horizontal);
|
||
|
(0, psdWriter_1.writeUint32)(writer, grid.vertical);
|
||
|
(0, psdWriter_1.writeUint32)(writer, guides.length);
|
||
|
for (var _i = 0, guides_1 = guides; _i < guides_1.length; _i++) {
|
||
|
var g = guides_1[_i];
|
||
|
(0, psdWriter_1.writeUint32)(writer, g.location * 32);
|
||
|
(0, psdWriter_1.writeUint8)(writer, g.direction === 'horizontal' ? 1 : 0);
|
||
|
}
|
||
|
});
|
||
|
// 0 - normal, 7 - multiply, 8 - screen, 23 - difference
|
||
|
var onionSkinsBlendModes = [
|
||
|
'normal', undefined, undefined, undefined, undefined, undefined, undefined, 'multiply',
|
||
|
'screen', undefined, undefined, undefined, undefined, undefined, undefined, undefined,
|
||
|
undefined, undefined, undefined, undefined, undefined, undefined, undefined, 'difference',
|
||
|
];
|
||
|
addHandler(1078, // Onion Skins
|
||
|
function (// Onion Skins
|
||
|
target) { return target.onionSkins !== undefined; }, function (reader, target) {
|
||
|
var desc = (0, descriptor_1.readVersionAndDescriptor)(reader);
|
||
|
// console.log('1078', require('util').inspect(desc, false, 99, true));
|
||
|
target.onionSkins = {
|
||
|
enabled: desc.enab,
|
||
|
framesBefore: desc.numBefore,
|
||
|
framesAfter: desc.numAfter,
|
||
|
frameSpacing: desc.Spcn,
|
||
|
minOpacity: desc.minOpacity / 100,
|
||
|
maxOpacity: desc.maxOpacity / 100,
|
||
|
blendMode: onionSkinsBlendModes[desc.BlnM] || 'normal',
|
||
|
};
|
||
|
}, function (writer, target) {
|
||
|
var onionSkins = target.onionSkins;
|
||
|
var desc = {
|
||
|
Vrsn: 1,
|
||
|
enab: onionSkins.enabled,
|
||
|
numBefore: onionSkins.framesBefore,
|
||
|
numAfter: onionSkins.framesAfter,
|
||
|
Spcn: onionSkins.frameSpacing,
|
||
|
minOpacity: (onionSkins.minOpacity * 100) | 0,
|
||
|
maxOpacity: (onionSkins.maxOpacity * 100) | 0,
|
||
|
BlnM: Math.max(0, onionSkinsBlendModes.indexOf(onionSkins.blendMode)),
|
||
|
};
|
||
|
(0, descriptor_1.writeVersionAndDescriptor)(writer, '', 'null', desc);
|
||
|
});
|
||
|
addHandler(1075, // Timeline Information
|
||
|
function (// Timeline Information
|
||
|
target) { return target.timelineInformation !== undefined; }, function (reader, target, _, options) {
|
||
|
var _a, _b;
|
||
|
var desc = (0, descriptor_1.readVersionAndDescriptor)(reader);
|
||
|
// console.log('1075', require('util').inspect(desc, false, 99, true));
|
||
|
target.timelineInformation = {
|
||
|
enabled: desc.enab,
|
||
|
frameStep: desc.frameStep,
|
||
|
frameRate: desc.frameRate,
|
||
|
time: desc.time,
|
||
|
duration: desc.duration,
|
||
|
workInTime: desc.workInTime,
|
||
|
workOutTime: desc.workOutTime,
|
||
|
repeats: desc.LCnt,
|
||
|
hasMotion: desc.hasMotion,
|
||
|
globalTracks: (0, descriptor_1.parseTrackList)(desc.globalTrackList, !!options.logMissingFeatures),
|
||
|
};
|
||
|
if ((_b = (_a = desc.audioClipGroupList) === null || _a === void 0 ? void 0 : _a.audioClipGroupList) === null || _b === void 0 ? void 0 : _b.length) {
|
||
|
target.timelineInformation.audioClipGroups = desc.audioClipGroupList.audioClipGroupList.map(function (g) { return ({
|
||
|
id: g.groupID,
|
||
|
muted: g.muted,
|
||
|
audioClips: g.audioClipList.map(function (_a) {
|
||
|
var clipID = _a.clipID, timeScope = _a.timeScope, muted = _a.muted, audioLevel = _a.audioLevel, frameReader = _a.frameReader;
|
||
|
return ({
|
||
|
id: clipID,
|
||
|
start: timeScope.Strt,
|
||
|
duration: timeScope.duration,
|
||
|
inTime: timeScope.inTime,
|
||
|
outTime: timeScope.outTime,
|
||
|
muted: muted,
|
||
|
audioLevel: audioLevel,
|
||
|
frameReader: {
|
||
|
type: frameReader.frameReaderType,
|
||
|
mediaDescriptor: frameReader.mediaDescriptor,
|
||
|
link: {
|
||
|
name: frameReader['Lnk ']['Nm '],
|
||
|
fullPath: frameReader['Lnk '].fullPath,
|
||
|
relativePath: frameReader['Lnk '].relPath,
|
||
|
},
|
||
|
},
|
||
|
});
|
||
|
}),
|
||
|
}); });
|
||
|
}
|
||
|
}, function (writer, target) {
|
||
|
var _a;
|
||
|
var timeline = target.timelineInformation;
|
||
|
var desc = {
|
||
|
Vrsn: 1,
|
||
|
enab: timeline.enabled,
|
||
|
frameStep: timeline.frameStep,
|
||
|
frameRate: timeline.frameRate,
|
||
|
time: timeline.time,
|
||
|
duration: timeline.duration,
|
||
|
workInTime: timeline.workInTime,
|
||
|
workOutTime: timeline.workOutTime,
|
||
|
LCnt: timeline.repeats,
|
||
|
globalTrackList: (0, descriptor_1.serializeTrackList)(timeline.globalTracks),
|
||
|
audioClipGroupList: {
|
||
|
audioClipGroupList: (_a = timeline.audioClipGroups) === null || _a === void 0 ? void 0 : _a.map(function (a) { return ({
|
||
|
groupID: a.id,
|
||
|
muted: a.muted,
|
||
|
audioClipList: a.audioClips.map(function (c) { return ({
|
||
|
clipID: c.id,
|
||
|
timeScope: {
|
||
|
Vrsn: 1,
|
||
|
Strt: c.start,
|
||
|
duration: c.duration,
|
||
|
inTime: c.inTime,
|
||
|
outTime: c.outTime,
|
||
|
},
|
||
|
frameReader: {
|
||
|
frameReaderType: c.frameReader.type,
|
||
|
descVersion: 1,
|
||
|
'Lnk ': {
|
||
|
descVersion: 1,
|
||
|
'Nm ': c.frameReader.link.name,
|
||
|
fullPath: c.frameReader.link.fullPath,
|
||
|
relPath: c.frameReader.link.relativePath,
|
||
|
},
|
||
|
mediaDescriptor: c.frameReader.mediaDescriptor,
|
||
|
},
|
||
|
muted: c.muted,
|
||
|
audioLevel: c.audioLevel,
|
||
|
}); }),
|
||
|
}); }),
|
||
|
},
|
||
|
hasMotion: timeline.hasMotion,
|
||
|
};
|
||
|
// console.log('WRITE:1075', require('util').inspect(desc, false, 99, true));
|
||
|
(0, descriptor_1.writeVersionAndDescriptor)(writer, '', 'null', desc, 'anim');
|
||
|
});
|
||
|
addHandler(1076, // Sheet Disclosure
|
||
|
function (// Sheet Disclosure
|
||
|
target) { return target.sheetDisclosure !== undefined; }, function (reader, target) {
|
||
|
var desc = (0, descriptor_1.readVersionAndDescriptor)(reader);
|
||
|
// console.log('1076', require('util').inspect(desc, false, 99, true));
|
||
|
target.sheetDisclosure = {};
|
||
|
if (desc.sheetTimelineOptions) {
|
||
|
target.sheetDisclosure.sheetTimelineOptions = desc.sheetTimelineOptions.map(function (o) { return ({
|
||
|
sheetID: o.sheetID,
|
||
|
sheetDisclosed: o.sheetDisclosed,
|
||
|
lightsDisclosed: o.lightsDisclosed,
|
||
|
meshesDisclosed: o.meshesDisclosed,
|
||
|
materialsDisclosed: o.materialsDisclosed,
|
||
|
}); });
|
||
|
}
|
||
|
}, function (writer, target) {
|
||
|
var disclosure = target.sheetDisclosure;
|
||
|
var desc = { Vrsn: 1 };
|
||
|
if (disclosure.sheetTimelineOptions) {
|
||
|
desc.sheetTimelineOptions = disclosure.sheetTimelineOptions.map(function (d) { return ({
|
||
|
Vrsn: 2,
|
||
|
sheetID: d.sheetID,
|
||
|
sheetDisclosed: d.sheetDisclosed,
|
||
|
lightsDisclosed: d.lightsDisclosed,
|
||
|
meshesDisclosed: d.meshesDisclosed,
|
||
|
materialsDisclosed: d.materialsDisclosed,
|
||
|
}); });
|
||
|
}
|
||
|
(0, descriptor_1.writeVersionAndDescriptor)(writer, '', 'null', desc);
|
||
|
});
|
||
|
addHandler(1054, function (target) { return target.urlsList !== undefined; }, function (reader, target, _, options) {
|
||
|
var count = (0, psdReader_1.readUint32)(reader);
|
||
|
if (count) {
|
||
|
if (!options.throwForMissingFeatures)
|
||
|
return;
|
||
|
throw new Error('Not implemented: URL List');
|
||
|
}
|
||
|
// TODO: read actual URL list
|
||
|
target.urlsList = [];
|
||
|
}, function (writer, target) {
|
||
|
(0, psdWriter_1.writeUint32)(writer, target.urlsList.length);
|
||
|
// TODO: write actual URL list
|
||
|
if (target.urlsList.length) {
|
||
|
throw new Error('Not implemented: URL List');
|
||
|
}
|
||
|
});
|
||
|
helpers_1.MOCK_HANDLERS && addHandler(1050, // Slices
|
||
|
function (// Slices
|
||
|
target) { return target._ir1050 !== undefined; }, function (reader, target, left) {
|
||
|
LOG_MOCK_HANDLERS && console.log('image resource 1050', left());
|
||
|
target._ir1050 = (0, psdReader_1.readBytes)(reader, left());
|
||
|
}, function (writer, target) {
|
||
|
(0, psdWriter_1.writeBytes)(writer, target._ir1050);
|
||
|
});
|
||
|
addHandler(1064, function (target) { return target.pixelAspectRatio !== undefined; }, function (reader, target) {
|
||
|
if ((0, psdReader_1.readUint32)(reader) > 2)
|
||
|
throw new Error('Invalid pixelAspectRatio version');
|
||
|
target.pixelAspectRatio = { aspect: (0, psdReader_1.readFloat64)(reader) };
|
||
|
}, function (writer, target) {
|
||
|
(0, psdWriter_1.writeUint32)(writer, 2); // version
|
||
|
(0, psdWriter_1.writeFloat64)(writer, target.pixelAspectRatio.aspect);
|
||
|
});
|
||
|
addHandler(1041, function (target) { return target.iccUntaggedProfile !== undefined; }, function (reader, target) {
|
||
|
target.iccUntaggedProfile = !!(0, psdReader_1.readUint8)(reader);
|
||
|
}, function (writer, target) {
|
||
|
(0, psdWriter_1.writeUint8)(writer, target.iccUntaggedProfile ? 1 : 0);
|
||
|
});
|
||
|
helpers_1.MOCK_HANDLERS && addHandler(1039, // ICC Profile
|
||
|
function (// ICC Profile
|
||
|
target) { return target._ir1039 !== undefined; }, function (reader, target, left) {
|
||
|
LOG_MOCK_HANDLERS && console.log('image resource 1039', left());
|
||
|
target._ir1039 = (0, psdReader_1.readBytes)(reader, left());
|
||
|
}, function (writer, target) {
|
||
|
(0, psdWriter_1.writeBytes)(writer, target._ir1039);
|
||
|
});
|
||
|
addHandler(1044, function (target) { return target.idsSeedNumber !== undefined; }, function (reader, target) { return target.idsSeedNumber = (0, psdReader_1.readUint32)(reader); }, function (writer, target) { return (0, psdWriter_1.writeUint32)(writer, target.idsSeedNumber); });
|
||
|
addHandler(1036, function (target) { return target.thumbnail !== undefined || target.thumbnailRaw !== undefined; }, function (reader, target, left, options) {
|
||
|
var format = (0, psdReader_1.readUint32)(reader); // 1 = kJpegRGB, 0 = kRawRGB
|
||
|
var width = (0, psdReader_1.readUint32)(reader);
|
||
|
var height = (0, psdReader_1.readUint32)(reader);
|
||
|
(0, psdReader_1.readUint32)(reader); // widthBytes = (width * bits_per_pixel + 31) / 32 * 4.
|
||
|
(0, psdReader_1.readUint32)(reader); // totalSize = widthBytes * height * planes
|
||
|
(0, psdReader_1.readUint32)(reader); // sizeAfterCompression
|
||
|
var bitsPerPixel = (0, psdReader_1.readUint16)(reader); // 24
|
||
|
var planes = (0, psdReader_1.readUint16)(reader); // 1
|
||
|
if (format !== 1 || bitsPerPixel !== 24 || planes !== 1) {
|
||
|
options.logMissingFeatures && console.log("Invalid thumbnail data (format: ".concat(format, ", bitsPerPixel: ").concat(bitsPerPixel, ", planes: ").concat(planes, ")"));
|
||
|
(0, psdReader_1.skipBytes)(reader, left());
|
||
|
return;
|
||
|
}
|
||
|
var size = left();
|
||
|
var data = (0, psdReader_1.readBytes)(reader, size);
|
||
|
if (options.useRawThumbnail) {
|
||
|
target.thumbnailRaw = { width: width, height: height, data: data };
|
||
|
}
|
||
|
else if (data.byteLength) {
|
||
|
target.thumbnail = (0, helpers_1.createCanvasFromData)(data);
|
||
|
}
|
||
|
}, function (writer, target) {
|
||
|
var _a;
|
||
|
var width = 0;
|
||
|
var height = 0;
|
||
|
var data;
|
||
|
if (target.thumbnailRaw) {
|
||
|
width = target.thumbnailRaw.width;
|
||
|
height = target.thumbnailRaw.height;
|
||
|
data = target.thumbnailRaw.data;
|
||
|
}
|
||
|
else {
|
||
|
var dataUrl = (_a = target.thumbnail.toDataURL('image/jpeg', 1)) === null || _a === void 0 ? void 0 : _a.substring('data:image/jpeg;base64,'.length);
|
||
|
if (dataUrl) {
|
||
|
width = target.thumbnail.width;
|
||
|
height = target.thumbnail.height;
|
||
|
data = (0, base64_js_1.toByteArray)(dataUrl);
|
||
|
}
|
||
|
else {
|
||
|
data = new Uint8Array(0);
|
||
|
}
|
||
|
}
|
||
|
var bitsPerPixel = 24;
|
||
|
var widthBytes = Math.floor((width * bitsPerPixel + 31) / 32) * 4;
|
||
|
var planes = 1;
|
||
|
var totalSize = widthBytes * height * planes;
|
||
|
var sizeAfterCompression = data.length;
|
||
|
(0, psdWriter_1.writeUint32)(writer, 1); // 1 = kJpegRGB
|
||
|
(0, psdWriter_1.writeUint32)(writer, width);
|
||
|
(0, psdWriter_1.writeUint32)(writer, height);
|
||
|
(0, psdWriter_1.writeUint32)(writer, widthBytes);
|
||
|
(0, psdWriter_1.writeUint32)(writer, totalSize);
|
||
|
(0, psdWriter_1.writeUint32)(writer, sizeAfterCompression);
|
||
|
(0, psdWriter_1.writeUint16)(writer, bitsPerPixel);
|
||
|
(0, psdWriter_1.writeUint16)(writer, planes);
|
||
|
(0, psdWriter_1.writeBytes)(writer, data);
|
||
|
});
|
||
|
addHandler(1057, function (target) { return target.versionInfo !== undefined; }, function (reader, target, left) {
|
||
|
var version = (0, psdReader_1.readUint32)(reader);
|
||
|
if (version !== 1)
|
||
|
throw new Error('Invalid versionInfo version');
|
||
|
target.versionInfo = {
|
||
|
hasRealMergedData: !!(0, psdReader_1.readUint8)(reader),
|
||
|
writerName: (0, psdReader_1.readUnicodeString)(reader),
|
||
|
readerName: (0, psdReader_1.readUnicodeString)(reader),
|
||
|
fileVersion: (0, psdReader_1.readUint32)(reader),
|
||
|
};
|
||
|
(0, psdReader_1.skipBytes)(reader, left());
|
||
|
}, function (writer, target) {
|
||
|
var versionInfo = target.versionInfo;
|
||
|
(0, psdWriter_1.writeUint32)(writer, 1); // version
|
||
|
(0, psdWriter_1.writeUint8)(writer, versionInfo.hasRealMergedData ? 1 : 0);
|
||
|
(0, psdWriter_1.writeUnicodeString)(writer, versionInfo.writerName);
|
||
|
(0, psdWriter_1.writeUnicodeString)(writer, versionInfo.readerName);
|
||
|
(0, psdWriter_1.writeUint32)(writer, versionInfo.fileVersion);
|
||
|
});
|
||
|
helpers_1.MOCK_HANDLERS && addHandler(1058, // EXIF data 1.
|
||
|
function (// EXIF data 1.
|
||
|
target) { return target._ir1058 !== undefined; }, function (reader, target, left) {
|
||
|
LOG_MOCK_HANDLERS && console.log('image resource 1058', left());
|
||
|
target._ir1058 = (0, psdReader_1.readBytes)(reader, left());
|
||
|
}, function (writer, target) {
|
||
|
(0, psdWriter_1.writeBytes)(writer, target._ir1058);
|
||
|
});
|
||
|
addHandler(7000, function (target) { return target.imageReadyVariables !== undefined; }, function (reader, target, left) {
|
||
|
target.imageReadyVariables = readUtf8String(reader, left());
|
||
|
}, function (writer, target) {
|
||
|
writeUtf8String(writer, target.imageReadyVariables);
|
||
|
});
|
||
|
addHandler(7001, function (target) { return target.imageReadyDataSets !== undefined; }, function (reader, target, left) {
|
||
|
target.imageReadyDataSets = readUtf8String(reader, left());
|
||
|
}, function (writer, target) {
|
||
|
writeUtf8String(writer, target.imageReadyDataSets);
|
||
|
});
|
||
|
addHandler(1088, function (target) { return target.pathSelectionState !== undefined; }, function (reader, target, _left) {
|
||
|
var desc = (0, descriptor_1.readVersionAndDescriptor)(reader);
|
||
|
// console.log(require('util').inspect(desc, false, 99, true));
|
||
|
target.pathSelectionState = desc['null'];
|
||
|
}, function (writer, target) {
|
||
|
var desc = { 'null': target.pathSelectionState };
|
||
|
(0, descriptor_1.writeVersionAndDescriptor)(writer, '', 'null', desc);
|
||
|
});
|
||
|
helpers_1.MOCK_HANDLERS && addHandler(1025, function (target) { return target._ir1025 !== undefined; }, function (reader, target, left) {
|
||
|
LOG_MOCK_HANDLERS && console.log('image resource 1025', left());
|
||
|
target._ir1025 = (0, psdReader_1.readBytes)(reader, left());
|
||
|
}, function (writer, target) {
|
||
|
(0, psdWriter_1.writeBytes)(writer, target._ir1025);
|
||
|
});
|
||
|
var FrmD = (0, helpers_1.createEnum)('FrmD', '', {
|
||
|
auto: 'Auto',
|
||
|
none: 'None',
|
||
|
dispose: 'Disp',
|
||
|
});
|
||
|
addHandler(4000, // Plug-In resource(s)
|
||
|
function (// Plug-In resource(s)
|
||
|
target) { return target.animations !== undefined; }, function (reader, target, left, _a) {
|
||
|
var logMissingFeatures = _a.logMissingFeatures, logDevFeatures = _a.logDevFeatures;
|
||
|
var key = (0, psdReader_1.readSignature)(reader);
|
||
|
if (key === 'mani') {
|
||
|
(0, psdReader_1.checkSignature)(reader, 'IRFR');
|
||
|
(0, psdReader_1.readSection)(reader, 1, function (left) {
|
||
|
var _loop_1 = function () {
|
||
|
(0, psdReader_1.checkSignature)(reader, '8BIM');
|
||
|
var key_1 = (0, psdReader_1.readSignature)(reader);
|
||
|
(0, psdReader_1.readSection)(reader, 1, function (left) {
|
||
|
if (key_1 === 'AnDs') {
|
||
|
var desc = (0, descriptor_1.readVersionAndDescriptor)(reader);
|
||
|
target.animations = {
|
||
|
// desc.AFSt ???
|
||
|
frames: desc.FrIn.map(function (x) { return ({
|
||
|
id: x.FrID,
|
||
|
delay: (x.FrDl || 0) / 100,
|
||
|
dispose: x.FrDs ? FrmD.decode(x.FrDs) : 'auto', // missing == auto
|
||
|
// x.FrGA ???
|
||
|
}); }),
|
||
|
animations: desc.FSts.map(function (x) { return ({
|
||
|
id: x.FsID,
|
||
|
frames: x.FsFr,
|
||
|
repeats: x.LCnt,
|
||
|
activeFrame: x.AFrm || 0,
|
||
|
}); }),
|
||
|
};
|
||
|
// console.log('#4000 AnDs', require('util').inspect(desc, false, 99, true));
|
||
|
// console.log('#4000 AnDs:result', require('util').inspect(target.animations, false, 99, true));
|
||
|
}
|
||
|
else if (key_1 === 'Roll') {
|
||
|
var bytes = (0, psdReader_1.readBytes)(reader, left());
|
||
|
logDevFeatures && console.log('#4000 Roll', bytes);
|
||
|
}
|
||
|
else {
|
||
|
logMissingFeatures && console.log('Unhandled subsection in #4000', key_1);
|
||
|
}
|
||
|
});
|
||
|
};
|
||
|
while (left()) {
|
||
|
_loop_1();
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
else if (key === 'mopt') {
|
||
|
var bytes = (0, psdReader_1.readBytes)(reader, left());
|
||
|
logDevFeatures && console.log('#4000 mopt', bytes);
|
||
|
}
|
||
|
else {
|
||
|
logMissingFeatures && console.log('Unhandled key in #4000:', key);
|
||
|
}
|
||
|
}, function (writer, target) {
|
||
|
if (target.animations) {
|
||
|
(0, psdWriter_1.writeSignature)(writer, 'mani');
|
||
|
(0, psdWriter_1.writeSignature)(writer, 'IRFR');
|
||
|
(0, psdWriter_1.writeSection)(writer, 1, function () {
|
||
|
(0, psdWriter_1.writeSignature)(writer, '8BIM');
|
||
|
(0, psdWriter_1.writeSignature)(writer, 'AnDs');
|
||
|
(0, psdWriter_1.writeSection)(writer, 1, function () {
|
||
|
var desc = {
|
||
|
// AFSt: 0, // ???
|
||
|
FrIn: [],
|
||
|
FSts: [],
|
||
|
};
|
||
|
for (var i = 0; i < target.animations.frames.length; i++) {
|
||
|
var f = target.animations.frames[i];
|
||
|
var frame = {
|
||
|
FrID: f.id,
|
||
|
};
|
||
|
if (f.delay)
|
||
|
frame.FrDl = (f.delay * 100) | 0;
|
||
|
frame.FrDs = FrmD.encode(f.dispose);
|
||
|
// if (i === 0) frame.FrGA = 30; // ???
|
||
|
desc.FrIn.push(frame);
|
||
|
}
|
||
|
for (var i = 0; i < target.animations.animations.length; i++) {
|
||
|
var a = target.animations.animations[i];
|
||
|
var anim = {
|
||
|
FsID: a.id,
|
||
|
AFrm: a.activeFrame | 0,
|
||
|
FsFr: a.frames,
|
||
|
LCnt: a.repeats | 0,
|
||
|
};
|
||
|
desc.FSts.push(anim);
|
||
|
}
|
||
|
(0, descriptor_1.writeVersionAndDescriptor)(writer, '', 'null', desc);
|
||
|
});
|
||
|
// writeSignature(writer, '8BIM');
|
||
|
// writeSignature(writer, 'Roll');
|
||
|
// writeSection(writer, 1, () => {
|
||
|
// writeZeros(writer, 8);
|
||
|
// });
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
// TODO: Unfinished
|
||
|
helpers_1.MOCK_HANDLERS && addHandler(4001, // Plug-In resource(s)
|
||
|
function (// Plug-In resource(s)
|
||
|
target) { return target._ir4001 !== undefined; }, function (reader, target, left, _a) {
|
||
|
var logMissingFeatures = _a.logMissingFeatures, logDevFeatures = _a.logDevFeatures;
|
||
|
if (helpers_1.MOCK_HANDLERS) {
|
||
|
LOG_MOCK_HANDLERS && console.log('image resource 4001', left());
|
||
|
target._ir4001 = (0, psdReader_1.readBytes)(reader, left());
|
||
|
return;
|
||
|
}
|
||
|
var key = (0, psdReader_1.readSignature)(reader);
|
||
|
if (key === 'mfri') {
|
||
|
var version = (0, psdReader_1.readUint32)(reader);
|
||
|
if (version !== 2)
|
||
|
throw new Error('Invalid mfri version');
|
||
|
var length_1 = (0, psdReader_1.readUint32)(reader);
|
||
|
var bytes = (0, psdReader_1.readBytes)(reader, length_1);
|
||
|
logDevFeatures && console.log('mfri', bytes);
|
||
|
}
|
||
|
else if (key === 'mset') {
|
||
|
var desc = (0, descriptor_1.readVersionAndDescriptor)(reader);
|
||
|
logDevFeatures && console.log('mset', desc);
|
||
|
}
|
||
|
else {
|
||
|
logMissingFeatures && console.log('Unhandled key in #4001', key);
|
||
|
}
|
||
|
}, function (writer, target) {
|
||
|
(0, psdWriter_1.writeBytes)(writer, target._ir4001);
|
||
|
});
|
||
|
// TODO: Unfinished
|
||
|
helpers_1.MOCK_HANDLERS && addHandler(4002, // Plug-In resource(s)
|
||
|
function (// Plug-In resource(s)
|
||
|
target) { return target._ir4002 !== undefined; }, function (reader, target, left) {
|
||
|
LOG_MOCK_HANDLERS && console.log('image resource 4002', left());
|
||
|
target._ir4002 = (0, psdReader_1.readBytes)(reader, left());
|
||
|
}, function (writer, target) {
|
||
|
(0, psdWriter_1.writeBytes)(writer, target._ir4002);
|
||
|
});
|
||
|
|
||
|
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImltYWdlUmVzb3VyY2VzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLHVDQUF3QztBQUV4Qyx5Q0FJcUI7QUFDckIseUNBSXFCO0FBQ3JCLHFDQUE0RTtBQUM1RSw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