ppt-codec 1.2.13 → 1.4.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.
@@ -0,0 +1,78 @@
1
+ import { PptFormatError } from "../errors.js";
2
+ import { RT_SlideAtom } from "../record/types.js";
3
+ import "../text/atoms.js";
4
+ //#region src/document/master.ts
5
+ /** Builds one MainMasterContainer's own MasterStyleTable from its direct-child TextMasterStyleAtoms, falling back to the document-wide default (the single OTHER-typed TextMasterStyleAtom [MS-PPT] states lives in the DocumentTextInfoContainer inside Environment) for any TextTypeEnum member the master itself carries no atom for. A real master this package's own writer produces always states TITLE/BODY/NOTES explicitly (master-write.ts's own comment), so the document default is realistically only ever consulted for OTHER-typed runs or a third-party master that omits one of the three -- but [MS-PPT] 2.9.35 makes it the genuine fallback of last resort for every type, not a special case for OTHER alone. */
6
+ function buildMasterStyleTable(masterAtoms, documentDefault) {
7
+ const byType = /* @__PURE__ */ new Map();
8
+ if (documentDefault !== void 0) byType.set(documentDefault.textType, documentDefault.levels);
9
+ for (const atom of masterAtoms) byType.set(atom.textType, atom.levels);
10
+ return { byType };
11
+ }
12
+ function typeFamilyFallback(textType) {
13
+ switch (textType) {
14
+ case 5:
15
+ case 7:
16
+ case 8: return 1;
17
+ case 6: return 0;
18
+ default: return;
19
+ }
20
+ }
21
+ function orderedMasterLevels(table, textType, indentLevel) {
22
+ const levelsFor = (type) => {
23
+ const levels = table.byType.get(type);
24
+ if (levels === void 0 || levels.length === 0) return [];
25
+ const clampedLevel = Math.min(indentLevel, levels.length - 1);
26
+ return levels.slice(0, clampedLevel + 1).reverse();
27
+ };
28
+ const fallbackType = typeFamilyFallback(textType);
29
+ return fallbackType === void 0 ? levelsFor(textType) : [...levelsFor(textType), ...levelsFor(fallbackType)];
30
+ }
31
+ function firstDefined(candidates, get) {
32
+ for (const candidate of candidates) {
33
+ if (candidate === void 0) continue;
34
+ const value = get(candidate);
35
+ if (value !== void 0) return value;
36
+ }
37
+ }
38
+ /** Resolves a run's own ParagraphProperties (possibly stating nothing at all, when the run's paragraph itself carries no TextPFException of its own) against the master cascade -- every field the run itself states wins outright; every field it doesn't falls through to the first master level that does. indentLevel is never itself resolved from the cascade: it is the run's own stated (or default-zero) outline depth, and is what selects which master levels apply in the first place. */
39
+ function resolveParagraphProperties(run, table, textType, indentLevel) {
40
+ const candidates = [run, ...orderedMasterLevels(table, textType, indentLevel).map((level) => level.paragraph)];
41
+ return {
42
+ indentLevel,
43
+ alignment: firstDefined(candidates, (c) => c.alignment),
44
+ lineSpacing: firstDefined(candidates, (c) => c.lineSpacing),
45
+ spaceBefore: firstDefined(candidates, (c) => c.spaceBefore),
46
+ spaceAfter: firstDefined(candidates, (c) => c.spaceAfter),
47
+ leftMargin: firstDefined(candidates, (c) => c.leftMargin),
48
+ indent: firstDefined(candidates, (c) => c.indent)
49
+ };
50
+ }
51
+ /** The character-property counterpart of resolveParagraphProperties -- see that function's own comment for the cascade this implements. `color` resolves to whichever RunColor (literal or still-unresolved scheme reference) the cascade finds first; converting a scheme reference to an actual RgbColor is document/color-scheme.ts's own concern, deliberately kept separate since it needs the slide's colour scheme rather than anything the text-formatting cascade itself touches. */
52
+ function resolveCharacterProperties(run, table, textType, indentLevel) {
53
+ const candidates = [run, ...orderedMasterLevels(table, textType, indentLevel).map((level) => level.character)];
54
+ return {
55
+ bold: firstDefined(candidates, (c) => c.bold),
56
+ italic: firstDefined(candidates, (c) => c.italic),
57
+ underline: firstDefined(candidates, (c) => c.underline),
58
+ shadow: firstDefined(candidates, (c) => c.shadow),
59
+ emboss: firstDefined(candidates, (c) => c.emboss),
60
+ fontRef: firstDefined(candidates, (c) => c.fontRef),
61
+ sizePt: firstDefined(candidates, (c) => c.sizePt),
62
+ color: firstDefined(candidates, (c) => c.color)
63
+ };
64
+ }
65
+ function readSlideAtom(record) {
66
+ if (record.header.recType !== 1007) throw new PptFormatError(`expected RT_SlideAtom (0x${RT_SlideAtom.toString(16)}) at offset ${record.offset}, found record type 0x${record.header.recType.toString(16)}`);
67
+ const MASTER_ID_REF_OFFSET = 12;
68
+ const NOTES_ID_REF_OFFSET = 16;
69
+ if (record.data.length < 20) throw new PptFormatError(`SlideAtom at offset ${record.offset} carries ${record.data.length} bytes, too few for its masterIdRef/notesIdRef fields`);
70
+ const { data } = record;
71
+ const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
72
+ return {
73
+ masterIdRef: view.getUint32(MASTER_ID_REF_OFFSET, true),
74
+ notesIdRef: view.getUint32(NOTES_ID_REF_OFFSET, true)
75
+ };
76
+ }
77
+ //#endregion
78
+ export { buildMasterStyleTable, readSlideAtom, resolveCharacterProperties, resolveParagraphProperties };
@@ -0,0 +1,82 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_errors = require("./errors.cjs");
3
+ require("./record/header.cjs");
4
+ const require_record_tree = require("./record/tree.cjs");
5
+ const require_record_types = require("./record/types.cjs");
6
+ let archive_codec = require("archive-codec");
7
+ //#region src/encryption.ts
8
+ const ALG_ID_RC4 = 26625;
9
+ const ALG_ID_HASH_SHA1 = 32772;
10
+ const CRYPTOAPI_VERSION_MINOR = 2;
11
+ const CRYPTOAPI_VERSION_MAJOR_MIN = 2;
12
+ const CRYPTOAPI_VERSION_MAJOR_MAX = 4;
13
+ const VERSION_MAJOR_OFFSET = 0;
14
+ const VERSION_MINOR_OFFSET = 2;
15
+ const HEADER_SIZE_FIELD_OFFSET = 8;
16
+ const HEADER_START = 12;
17
+ const DEFAULT_KEY_SIZE_BITS = 40;
18
+ const MIN_HEADER_FIELDS_LENGTH = 32;
19
+ /** Parses a DocumentEncryptionAtom's own fields -- never encrypted, since it is what a decryptor needs before it can decrypt anything else. */
20
+ function readDocumentEncryptionAtom(record) {
21
+ if (record.header.recType !== 12052) throw new require_errors.PptFormatError(`expected the DocumentEncryptionAtom's own record type (0x${require_record_types.RT_CryptSession10Container.toString(16)}) at offset ${record.offset}, found 0x${record.header.recType.toString(16)}`);
22
+ const { data } = record;
23
+ if (data.length < HEADER_START) throw new require_errors.PptFormatError(`DocumentEncryptionAtom at offset ${record.offset} carries ${data.length} bytes, fewer than the ${HEADER_START}-byte fixed portion (version, encryptionFlags, headerSize) it requires`);
24
+ const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
25
+ const versionMajor = view.getUint16(VERSION_MAJOR_OFFSET, true);
26
+ const versionMinor = view.getUint16(VERSION_MINOR_OFFSET, true);
27
+ if (versionMajor < CRYPTOAPI_VERSION_MAJOR_MIN || versionMajor > CRYPTOAPI_VERSION_MAJOR_MAX || versionMinor !== CRYPTOAPI_VERSION_MINOR) throw new require_errors.PptEncryptedError(`DocumentEncryptionAtom declares version ${versionMajor}.${versionMinor}, outside [MS-OFFCRYPTO] 2.3.5.1's RC4 CryptoAPI range (major 2-4, minor 2); this package only decrypts RC4 CryptoAPI-encrypted presentations`);
28
+ const headerSize = view.getUint32(HEADER_SIZE_FIELD_OFFSET, true);
29
+ const headerEnd = HEADER_START + headerSize;
30
+ if (headerSize < MIN_HEADER_FIELDS_LENGTH || headerEnd > data.length) throw new require_errors.PptFormatError(`DocumentEncryptionAtom at offset ${record.offset} declares a ${headerSize}-byte EncryptionHeader, which is either shorter than the ${MIN_HEADER_FIELDS_LENGTH} fixed fields require or runs past the atom's own ${data.length} bytes`);
31
+ const algId = view.getUint32(20, true);
32
+ if (algId !== ALG_ID_RC4) throw new require_errors.PptEncryptedError(`DocumentEncryptionAtom's EncryptionHeader names cipher algorithm 0x${algId.toString(16)}, not RC4 (0x${ALG_ID_RC4.toString(16)}); this package only decrypts RC4 CryptoAPI-encrypted presentations`);
33
+ const algIdHash = view.getUint32(24, true);
34
+ if (algIdHash !== ALG_ID_HASH_SHA1) throw new require_errors.PptEncryptedError(`DocumentEncryptionAtom's EncryptionHeader names hash algorithm 0x${algIdHash.toString(16)}, not SHA-1 (0x${ALG_ID_HASH_SHA1.toString(16)}) as [MS-OFFCRYPTO] 2.3.5.1 requires of RC4 CryptoAPI`);
35
+ const rawKeySize = view.getUint32(28, true);
36
+ const keySizeBits = rawKeySize === 0 ? DEFAULT_KEY_SIZE_BITS : rawKeySize;
37
+ if (headerEnd + 4 > data.length) throw new require_errors.PptFormatError(`DocumentEncryptionAtom at offset ${record.offset} has no room for its EncryptionVerifier's saltSize field after the ${headerSize}-byte header`);
38
+ const saltSize = view.getUint32(headerEnd, true);
39
+ if (saltSize !== archive_codec.RC4_CRYPTOAPI_SALT_LENGTH) throw new require_errors.PptFormatError(`DocumentEncryptionAtom's EncryptionVerifier declares saltSize ${saltSize}, not the mandated ${archive_codec.RC4_CRYPTOAPI_SALT_LENGTH}`);
40
+ const saltStart = headerEnd + 4;
41
+ const encryptedVerifierStart = saltStart + archive_codec.RC4_CRYPTOAPI_SALT_LENGTH;
42
+ const verifierHashSizeFieldStart = encryptedVerifierStart + archive_codec.RC4_CRYPTOAPI_VERIFIER_LENGTH;
43
+ const encryptedVerifierHashStart = verifierHashSizeFieldStart + 4;
44
+ const encryptedVerifierHashEnd = encryptedVerifierHashStart + archive_codec.RC4_CRYPTOAPI_VERIFIER_HASH_LENGTH;
45
+ if (encryptedVerifierHashEnd > data.length) throw new require_errors.PptFormatError(`DocumentEncryptionAtom at offset ${record.offset} carries ${data.length} bytes, too few for its EncryptionVerifier's salt/encryptedVerifier/encryptedVerifierHash fields`);
46
+ return {
47
+ keySizeBits,
48
+ salt: data.subarray(saltStart, encryptedVerifierStart),
49
+ encryptedVerifier: data.subarray(encryptedVerifierStart, verifierHashSizeFieldStart),
50
+ encryptedVerifierHash: data.subarray(encryptedVerifierHashStart, encryptedVerifierHashEnd)
51
+ };
52
+ }
53
+ /**
54
+ * Decrypts a PowerPoint Document stream protected by [MS-OFFCRYPTO] 2.3.5 RC4 CryptoAPI, given the password and the persist directory/`encryptSessionPersistIdRef` `buildPersistDirectory` already resolved -- both come from parsing the stream's own never-encrypted UserEditAtom/PersistDirectoryAtom chain, which is why this module needs them handed in rather than deriving them itself.
55
+ *
56
+ * Returns a new, fully decrypted copy of the stream: every persist object in `directory` except the DocumentEncryptionAtom itself gets its own key, derived from its own persist ID as the RC4 CryptoAPI "block number" (see this file's own top comment), and is decrypted as one continuous keystream covering its header and data together -- the header is encrypted too here, unlike the shared xls/doc RC4 scheme, so each object's own recLen has to be learned by decrypting its header first.
57
+ *
58
+ * Throws `PptEncryptedError` for a missing password, an incorrect one, or an encryption shape this module does not implement (anything other than RC4 CryptoAPI) -- there is no partial or best-effort result to return in any of those cases.
59
+ */
60
+ function decryptPptDocumentStream(streamBytes, directory, encryptSessionPersistIdRef, password) {
61
+ const encryptionAtomOffset = directory.get(encryptSessionPersistIdRef);
62
+ if (encryptionAtomOffset === void 0) throw new require_errors.PptFormatError(`UserEditAtom.encryptSessionPersistIdRef ${encryptSessionPersistIdRef} references persist object ${encryptSessionPersistIdRef}, which the persist directory does not contain`);
63
+ const info = readDocumentEncryptionAtom(require_record_tree.readRecordAt(streamBytes, encryptionAtomOffset));
64
+ if (!(0, archive_codec.verifyRc4CryptoApiPassword)(password, info.salt, info.keySizeBits, info.encryptedVerifier, info.encryptedVerifierHash)) throw new require_errors.PptEncryptedError("incorrect password for RC4 CryptoAPI-encrypted presentation");
65
+ const decrypted = new Uint8Array(streamBytes.length);
66
+ decrypted.set(streamBytes);
67
+ for (const [persistId, offset] of directory) {
68
+ if (persistId === encryptSessionPersistIdRef) continue;
69
+ if (offset + 8 > streamBytes.length) throw new require_errors.PptFormatError(`persist object ${persistId} at offset ${offset} needs 8 bytes for its own record header, but only ${streamBytes.length - offset} remain in the stream`);
70
+ const key = (0, archive_codec.deriveRc4CryptoApiBlockKey)(password, info.salt, persistId, info.keySizeBits);
71
+ const headerPlaintext = (0, archive_codec.rc4)(key, streamBytes.subarray(offset, offset + 8));
72
+ const recLen = new DataView(headerPlaintext.buffer, headerPlaintext.byteOffset, headerPlaintext.byteLength).getUint32(4, true);
73
+ const objectEnd = offset + 8 + recLen;
74
+ if (objectEnd > streamBytes.length) throw new require_errors.PptFormatError(`persist object ${persistId} at offset ${offset} decrypts to a ${recLen}-byte record, which runs past the stream's own ${streamBytes.length} bytes`);
75
+ const plaintext = (0, archive_codec.rc4)(key, streamBytes.subarray(offset, objectEnd));
76
+ decrypted.set(plaintext, offset);
77
+ }
78
+ return decrypted;
79
+ }
80
+ //#endregion
81
+ exports.decryptPptDocumentStream = decryptPptDocumentStream;
82
+ exports.readDocumentEncryptionAtom = readDocumentEncryptionAtom;
@@ -0,0 +1,20 @@
1
+ import { t as PptRecord } from "./tree-Du_LXAF0.cjs";
2
+ //#region src/encryption.d.ts
3
+ interface PptEncryptionInfo {
4
+ readonly keySizeBits: number;
5
+ readonly salt: Uint8Array<ArrayBuffer>;
6
+ readonly encryptedVerifier: Uint8Array<ArrayBuffer>;
7
+ readonly encryptedVerifierHash: Uint8Array<ArrayBuffer>;
8
+ }
9
+ /** Parses a DocumentEncryptionAtom's own fields -- never encrypted, since it is what a decryptor needs before it can decrypt anything else. */
10
+ declare function readDocumentEncryptionAtom(record: PptRecord): PptEncryptionInfo;
11
+ /**
12
+ * Decrypts a PowerPoint Document stream protected by [MS-OFFCRYPTO] 2.3.5 RC4 CryptoAPI, given the password and the persist directory/`encryptSessionPersistIdRef` `buildPersistDirectory` already resolved -- both come from parsing the stream's own never-encrypted UserEditAtom/PersistDirectoryAtom chain, which is why this module needs them handed in rather than deriving them itself.
13
+ *
14
+ * Returns a new, fully decrypted copy of the stream: every persist object in `directory` except the DocumentEncryptionAtom itself gets its own key, derived from its own persist ID as the RC4 CryptoAPI "block number" (see this file's own top comment), and is decrypted as one continuous keystream covering its header and data together -- the header is encrypted too here, unlike the shared xls/doc RC4 scheme, so each object's own recLen has to be learned by decrypting its header first.
15
+ *
16
+ * Throws `PptEncryptedError` for a missing password, an incorrect one, or an encryption shape this module does not implement (anything other than RC4 CryptoAPI) -- there is no partial or best-effort result to return in any of those cases.
17
+ */
18
+ declare function decryptPptDocumentStream(streamBytes: Uint8Array<ArrayBuffer>, directory: ReadonlyMap<number, number>, encryptSessionPersistIdRef: number, password: string): Uint8Array<ArrayBuffer>;
19
+ //#endregion
20
+ export { PptEncryptionInfo, decryptPptDocumentStream, readDocumentEncryptionAtom };
@@ -0,0 +1,20 @@
1
+ import { t as PptRecord } from "./tree-PMcPNgd-.js";
2
+ //#region src/encryption.d.ts
3
+ interface PptEncryptionInfo {
4
+ readonly keySizeBits: number;
5
+ readonly salt: Uint8Array<ArrayBuffer>;
6
+ readonly encryptedVerifier: Uint8Array<ArrayBuffer>;
7
+ readonly encryptedVerifierHash: Uint8Array<ArrayBuffer>;
8
+ }
9
+ /** Parses a DocumentEncryptionAtom's own fields -- never encrypted, since it is what a decryptor needs before it can decrypt anything else. */
10
+ declare function readDocumentEncryptionAtom(record: PptRecord): PptEncryptionInfo;
11
+ /**
12
+ * Decrypts a PowerPoint Document stream protected by [MS-OFFCRYPTO] 2.3.5 RC4 CryptoAPI, given the password and the persist directory/`encryptSessionPersistIdRef` `buildPersistDirectory` already resolved -- both come from parsing the stream's own never-encrypted UserEditAtom/PersistDirectoryAtom chain, which is why this module needs them handed in rather than deriving them itself.
13
+ *
14
+ * Returns a new, fully decrypted copy of the stream: every persist object in `directory` except the DocumentEncryptionAtom itself gets its own key, derived from its own persist ID as the RC4 CryptoAPI "block number" (see this file's own top comment), and is decrypted as one continuous keystream covering its header and data together -- the header is encrypted too here, unlike the shared xls/doc RC4 scheme, so each object's own recLen has to be learned by decrypting its header first.
15
+ *
16
+ * Throws `PptEncryptedError` for a missing password, an incorrect one, or an encryption shape this module does not implement (anything other than RC4 CryptoAPI) -- there is no partial or best-effort result to return in any of those cases.
17
+ */
18
+ declare function decryptPptDocumentStream(streamBytes: Uint8Array<ArrayBuffer>, directory: ReadonlyMap<number, number>, encryptSessionPersistIdRef: number, password: string): Uint8Array<ArrayBuffer>;
19
+ //#endregion
20
+ export { PptEncryptionInfo, decryptPptDocumentStream, readDocumentEncryptionAtom };
@@ -0,0 +1,80 @@
1
+ import { PptEncryptedError, PptFormatError } from "./errors.js";
2
+ import "./record/header.js";
3
+ import { readRecordAt } from "./record/tree.js";
4
+ import { RT_CryptSession10Container } from "./record/types.js";
5
+ import { RC4_CRYPTOAPI_SALT_LENGTH, RC4_CRYPTOAPI_VERIFIER_HASH_LENGTH, RC4_CRYPTOAPI_VERIFIER_LENGTH, deriveRc4CryptoApiBlockKey, rc4, verifyRc4CryptoApiPassword } from "archive-codec";
6
+ //#region src/encryption.ts
7
+ const ALG_ID_RC4 = 26625;
8
+ const ALG_ID_HASH_SHA1 = 32772;
9
+ const CRYPTOAPI_VERSION_MINOR = 2;
10
+ const CRYPTOAPI_VERSION_MAJOR_MIN = 2;
11
+ const CRYPTOAPI_VERSION_MAJOR_MAX = 4;
12
+ const VERSION_MAJOR_OFFSET = 0;
13
+ const VERSION_MINOR_OFFSET = 2;
14
+ const HEADER_SIZE_FIELD_OFFSET = 8;
15
+ const HEADER_START = 12;
16
+ const DEFAULT_KEY_SIZE_BITS = 40;
17
+ const MIN_HEADER_FIELDS_LENGTH = 32;
18
+ /** Parses a DocumentEncryptionAtom's own fields -- never encrypted, since it is what a decryptor needs before it can decrypt anything else. */
19
+ function readDocumentEncryptionAtom(record) {
20
+ if (record.header.recType !== 12052) throw new PptFormatError(`expected the DocumentEncryptionAtom's own record type (0x${RT_CryptSession10Container.toString(16)}) at offset ${record.offset}, found 0x${record.header.recType.toString(16)}`);
21
+ const { data } = record;
22
+ if (data.length < HEADER_START) throw new PptFormatError(`DocumentEncryptionAtom at offset ${record.offset} carries ${data.length} bytes, fewer than the ${HEADER_START}-byte fixed portion (version, encryptionFlags, headerSize) it requires`);
23
+ const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
24
+ const versionMajor = view.getUint16(VERSION_MAJOR_OFFSET, true);
25
+ const versionMinor = view.getUint16(VERSION_MINOR_OFFSET, true);
26
+ if (versionMajor < CRYPTOAPI_VERSION_MAJOR_MIN || versionMajor > CRYPTOAPI_VERSION_MAJOR_MAX || versionMinor !== CRYPTOAPI_VERSION_MINOR) throw new PptEncryptedError(`DocumentEncryptionAtom declares version ${versionMajor}.${versionMinor}, outside [MS-OFFCRYPTO] 2.3.5.1's RC4 CryptoAPI range (major 2-4, minor 2); this package only decrypts RC4 CryptoAPI-encrypted presentations`);
27
+ const headerSize = view.getUint32(HEADER_SIZE_FIELD_OFFSET, true);
28
+ const headerEnd = HEADER_START + headerSize;
29
+ if (headerSize < MIN_HEADER_FIELDS_LENGTH || headerEnd > data.length) throw new PptFormatError(`DocumentEncryptionAtom at offset ${record.offset} declares a ${headerSize}-byte EncryptionHeader, which is either shorter than the ${MIN_HEADER_FIELDS_LENGTH} fixed fields require or runs past the atom's own ${data.length} bytes`);
30
+ const algId = view.getUint32(20, true);
31
+ if (algId !== ALG_ID_RC4) throw new PptEncryptedError(`DocumentEncryptionAtom's EncryptionHeader names cipher algorithm 0x${algId.toString(16)}, not RC4 (0x${ALG_ID_RC4.toString(16)}); this package only decrypts RC4 CryptoAPI-encrypted presentations`);
32
+ const algIdHash = view.getUint32(24, true);
33
+ if (algIdHash !== ALG_ID_HASH_SHA1) throw new PptEncryptedError(`DocumentEncryptionAtom's EncryptionHeader names hash algorithm 0x${algIdHash.toString(16)}, not SHA-1 (0x${ALG_ID_HASH_SHA1.toString(16)}) as [MS-OFFCRYPTO] 2.3.5.1 requires of RC4 CryptoAPI`);
34
+ const rawKeySize = view.getUint32(28, true);
35
+ const keySizeBits = rawKeySize === 0 ? DEFAULT_KEY_SIZE_BITS : rawKeySize;
36
+ if (headerEnd + 4 > data.length) throw new PptFormatError(`DocumentEncryptionAtom at offset ${record.offset} has no room for its EncryptionVerifier's saltSize field after the ${headerSize}-byte header`);
37
+ const saltSize = view.getUint32(headerEnd, true);
38
+ if (saltSize !== RC4_CRYPTOAPI_SALT_LENGTH) throw new PptFormatError(`DocumentEncryptionAtom's EncryptionVerifier declares saltSize ${saltSize}, not the mandated ${RC4_CRYPTOAPI_SALT_LENGTH}`);
39
+ const saltStart = headerEnd + 4;
40
+ const encryptedVerifierStart = saltStart + RC4_CRYPTOAPI_SALT_LENGTH;
41
+ const verifierHashSizeFieldStart = encryptedVerifierStart + RC4_CRYPTOAPI_VERIFIER_LENGTH;
42
+ const encryptedVerifierHashStart = verifierHashSizeFieldStart + 4;
43
+ const encryptedVerifierHashEnd = encryptedVerifierHashStart + RC4_CRYPTOAPI_VERIFIER_HASH_LENGTH;
44
+ if (encryptedVerifierHashEnd > data.length) throw new PptFormatError(`DocumentEncryptionAtom at offset ${record.offset} carries ${data.length} bytes, too few for its EncryptionVerifier's salt/encryptedVerifier/encryptedVerifierHash fields`);
45
+ return {
46
+ keySizeBits,
47
+ salt: data.subarray(saltStart, encryptedVerifierStart),
48
+ encryptedVerifier: data.subarray(encryptedVerifierStart, verifierHashSizeFieldStart),
49
+ encryptedVerifierHash: data.subarray(encryptedVerifierHashStart, encryptedVerifierHashEnd)
50
+ };
51
+ }
52
+ /**
53
+ * Decrypts a PowerPoint Document stream protected by [MS-OFFCRYPTO] 2.3.5 RC4 CryptoAPI, given the password and the persist directory/`encryptSessionPersistIdRef` `buildPersistDirectory` already resolved -- both come from parsing the stream's own never-encrypted UserEditAtom/PersistDirectoryAtom chain, which is why this module needs them handed in rather than deriving them itself.
54
+ *
55
+ * Returns a new, fully decrypted copy of the stream: every persist object in `directory` except the DocumentEncryptionAtom itself gets its own key, derived from its own persist ID as the RC4 CryptoAPI "block number" (see this file's own top comment), and is decrypted as one continuous keystream covering its header and data together -- the header is encrypted too here, unlike the shared xls/doc RC4 scheme, so each object's own recLen has to be learned by decrypting its header first.
56
+ *
57
+ * Throws `PptEncryptedError` for a missing password, an incorrect one, or an encryption shape this module does not implement (anything other than RC4 CryptoAPI) -- there is no partial or best-effort result to return in any of those cases.
58
+ */
59
+ function decryptPptDocumentStream(streamBytes, directory, encryptSessionPersistIdRef, password) {
60
+ const encryptionAtomOffset = directory.get(encryptSessionPersistIdRef);
61
+ if (encryptionAtomOffset === void 0) throw new PptFormatError(`UserEditAtom.encryptSessionPersistIdRef ${encryptSessionPersistIdRef} references persist object ${encryptSessionPersistIdRef}, which the persist directory does not contain`);
62
+ const info = readDocumentEncryptionAtom(readRecordAt(streamBytes, encryptionAtomOffset));
63
+ if (!verifyRc4CryptoApiPassword(password, info.salt, info.keySizeBits, info.encryptedVerifier, info.encryptedVerifierHash)) throw new PptEncryptedError("incorrect password for RC4 CryptoAPI-encrypted presentation");
64
+ const decrypted = new Uint8Array(streamBytes.length);
65
+ decrypted.set(streamBytes);
66
+ for (const [persistId, offset] of directory) {
67
+ if (persistId === encryptSessionPersistIdRef) continue;
68
+ if (offset + 8 > streamBytes.length) throw new PptFormatError(`persist object ${persistId} at offset ${offset} needs 8 bytes for its own record header, but only ${streamBytes.length - offset} remain in the stream`);
69
+ const key = deriveRc4CryptoApiBlockKey(password, info.salt, persistId, info.keySizeBits);
70
+ const headerPlaintext = rc4(key, streamBytes.subarray(offset, offset + 8));
71
+ const recLen = new DataView(headerPlaintext.buffer, headerPlaintext.byteOffset, headerPlaintext.byteLength).getUint32(4, true);
72
+ const objectEnd = offset + 8 + recLen;
73
+ if (objectEnd > streamBytes.length) throw new PptFormatError(`persist object ${persistId} at offset ${offset} decrypts to a ${recLen}-byte record, which runs past the stream's own ${streamBytes.length} bytes`);
74
+ const plaintext = rc4(key, streamBytes.subarray(offset, objectEnd));
75
+ decrypted.set(plaintext, offset);
76
+ }
77
+ return decrypted;
78
+ }
79
+ //#endregion
80
+ export { decryptPptDocumentStream, readDocumentEncryptionAtom };
package/dist/index.cjs CHANGED
@@ -54,6 +54,8 @@ exports.CF_SYMBOL_TYPEFACE = require_text_style.CF_SYMBOL_TYPEFACE;
54
54
  exports.CF_TYPEFACE = require_text_style.CF_TYPEFACE;
55
55
  exports.CF_UNDERLINE = require_text_style.CF_UNDERLINE;
56
56
  exports.COLOR_INDEX_SRGB = require_text_style.COLOR_INDEX_SRGB;
57
+ exports.COLOR_INDEX_UNDEFINED = require_text_style.COLOR_INDEX_UNDEFINED;
58
+ exports.COLOR_SCHEME_SLOT_COUNT = require_text_style.COLOR_SCHEME_SLOT_COUNT;
57
59
  exports.CONTAINER_REC_VER = require_record_header.CONTAINER_REC_VER;
58
60
  exports.CURRENT_USER_DOC_FILE_VERSION = require_stream_current_user.CURRENT_USER_DOC_FILE_VERSION;
59
61
  exports.CURRENT_USER_FIXED_SIZE = require_stream_current_user.CURRENT_USER_FIXED_SIZE;
@@ -190,6 +192,7 @@ exports.readSlideListWithText = require_document_slide_list.readSlideListWithTex
190
192
  exports.readStyleTextPropAtom = require_text_style.readStyleTextPropAtom;
191
193
  exports.readTextBody = require_text_atoms.readTextBody;
192
194
  exports.readTextHeaderAtom = require_text_atoms.readTextHeaderAtom;
195
+ exports.readTextMasterStyleAtom = require_text_style.readTextMasterStyleAtom;
193
196
  exports.readUserEditAtom = require_stream_persist.readUserEditAtom;
194
197
  exports.resolvePersistObject = require_stream_persist.resolvePersistObject;
195
198
  exports.splitParagraphs = require_text_atoms.splitParagraphs;
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { a as readRecordHeader, i as isContainerRecord, n as RECORD_HEADER_SIZE, r as RecordHeader, t as CONTAINER_REC_VER } from "./header-C5eAd16_.cjs";
2
2
  import { a as findDescendants, i as findChildren, n as childRecords, o as readRecordAt, r as findChild, s as readRecordSequence, t as PptRecord } from "./tree-Du_LXAF0.cjs";
3
- import { ALIGN_CENTER, ALIGN_DISTRIBUTED, ALIGN_JUSTIFY, ALIGN_JUSTIFY_LOW, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_THAI_DISTRIBUTED, CF_ANSI_TYPEFACE, CF_BOLD, CF_COLOR, CF_EMBOSS, CF_FEHINT, CF_HAS_STYLE, CF_ITALIC, CF_KUMI, CF_OLD_EA_TYPEFACE, CF_POSITION, CF_SHADOW, CF_SIZE, CF_SYMBOL_TYPEFACE, CF_TYPEFACE, CF_UNDERLINE, COLOR_INDEX_SRGB, CharacterProperties, PF_ALIGN, PF_BULLET_CHAR, PF_BULLET_COLOR, PF_BULLET_FONT, PF_BULLET_HAS_COLOR, PF_BULLET_HAS_FONT, PF_BULLET_HAS_SIZE, PF_BULLET_SIZE, PF_CHAR_WRAP, PF_DEFAULT_TAB_SIZE, PF_FONT_ALIGN, PF_HAS_BULLET, PF_INDENT, PF_LEFT_MARGIN, PF_LINE_SPACING, PF_OVERFLOW, PF_SPACE_AFTER, PF_SPACE_BEFORE, PF_TAB_STOPS, PF_TEXT_DIRECTION, PF_WORD_WRAP, ParagraphProperties, RgbColor, STYLE_BOLD, STYLE_EMBOSS, STYLE_ITALIC, STYLE_SHADOW, STYLE_UNDERLINE, StyleRun, StyleTextProps, readStyleTextPropAtom } from "./text/style.cjs";
3
+ import { ALIGN_CENTER, ALIGN_DISTRIBUTED, ALIGN_JUSTIFY, ALIGN_JUSTIFY_LOW, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_THAI_DISTRIBUTED, CF_ANSI_TYPEFACE, CF_BOLD, CF_COLOR, CF_EMBOSS, CF_FEHINT, CF_HAS_STYLE, CF_ITALIC, CF_KUMI, CF_OLD_EA_TYPEFACE, CF_POSITION, CF_SHADOW, CF_SIZE, CF_SYMBOL_TYPEFACE, CF_TYPEFACE, CF_UNDERLINE, COLOR_INDEX_SRGB, COLOR_INDEX_UNDEFINED, COLOR_SCHEME_SLOT_COUNT, CharacterProperties, MasterStyleLevel, MasterTextStyleAtom, PF_ALIGN, PF_BULLET_CHAR, PF_BULLET_COLOR, PF_BULLET_FONT, PF_BULLET_HAS_COLOR, PF_BULLET_HAS_FONT, PF_BULLET_HAS_SIZE, PF_BULLET_SIZE, PF_CHAR_WRAP, PF_DEFAULT_TAB_SIZE, PF_FONT_ALIGN, PF_HAS_BULLET, PF_INDENT, PF_LEFT_MARGIN, PF_LINE_SPACING, PF_OVERFLOW, PF_SPACE_AFTER, PF_SPACE_BEFORE, PF_TAB_STOPS, PF_TEXT_DIRECTION, PF_WORD_WRAP, ParagraphProperties, RgbColor, RunColor, STYLE_BOLD, STYLE_EMBOSS, STYLE_ITALIC, STYLE_SHADOW, STYLE_UNDERLINE, StyleRun, StyleTextProps, readStyleTextPropAtom, readTextMasterStyleAtom } from "./text/style.cjs";
4
4
  import { TextBody, buildTextBody, collectFontFamilies } from "./content-write.cjs";
5
5
  import { buildParagraphs } from "./content.cjs";
6
6
  import { writeSlideSchemeColorSchemeAtom } from "./document/color-scheme-write.cjs";
@@ -30,4 +30,4 @@ import { LINE_BREAK, PARAGRAPH_SEPARATOR, TEXT_TYPE_BODY, TEXT_TYPE_CENTER_BODY,
30
30
  import { writeStyleTextPropAtom } from "./text/style-write.cjs";
31
31
  import { MASTER_UNITS_PER_POINT, POINTS_PER_INCH, masterUnitsToPoints, pointsToMasterUnits } from "./units.cjs";
32
32
  import { writePpt, writePptContent, writePptStreams } from "./write.cjs";
33
- export { ALIGN_CENTER, ALIGN_DISTRIBUTED, ALIGN_JUSTIFY, ALIGN_JUSTIFY_LOW, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_THAI_DISTRIBUTED, CF_ANSI_TYPEFACE, CF_BOLD, CF_COLOR, CF_EMBOSS, CF_FEHINT, CF_HAS_STYLE, CF_ITALIC, CF_KUMI, CF_OLD_EA_TYPEFACE, CF_POSITION, CF_SHADOW, CF_SIZE, CF_SYMBOL_TYPEFACE, CF_TYPEFACE, CF_UNDERLINE, COLOR_INDEX_SRGB, CONTAINER_REC_VER, CURRENT_USER_DOC_FILE_VERSION, CURRENT_USER_FIXED_SIZE, CURRENT_USER_HEADER_TOKEN_ENCRYPTED, CURRENT_USER_HEADER_TOKEN_PLAIN, CURRENT_USER_STREAM, CharacterProperties, CurrentUser, DEFAULT_INSET_LEFT_RIGHT_PT, DEFAULT_INSET_TOP_BOTTOM_PT, DocumentAtom, DrawingShape, LINE_BREAK, MASTER_SLIDE_ID, MASTER_UNITS_PER_POINT, NOTES_MASTER_SLIDE_ID_REF, NotesAtom, NotesPersist, OfficeArtChildAnchor, OfficeArtClientAnchor, OfficeArtClientData, OfficeArtClientTextbox, OfficeArtDgContainer, OfficeArtFOPT, OfficeArtFSP, OfficeArtFSPGR, OfficeArtSpContainer, OfficeArtSpgrContainer, OutlineText, PARAGRAPH_SEPARATOR, PF_ALIGN, PF_BULLET_CHAR, PF_BULLET_COLOR, PF_BULLET_FONT, PF_BULLET_HAS_COLOR, PF_BULLET_HAS_FONT, PF_BULLET_HAS_SIZE, PF_BULLET_SIZE, PF_CHAR_WRAP, PF_DEFAULT_TAB_SIZE, PF_FONT_ALIGN, PF_HAS_BULLET, PF_INDENT, PF_LEFT_MARGIN, PF_LINE_SPACING, PF_OVERFLOW, PF_SPACE_AFTER, PF_SPACE_BEFORE, PF_TAB_STOPS, PF_TEXT_DIRECTION, PF_WORD_WRAP, POINTS_PER_INCH, POWERPOINT_DOCUMENT_STREAM, ParagraphProperties, PersistDirectory, PersistDirectoryEntryToWrite, PointStruct, PptDocument, PptEncryptedError, PptFormatError, PptRecord, PptShape, PptUnsupportedContentError, RECORD_HEADER_SIZE, RT_CString, RT_ColorSchemeAtom, RT_CryptSession10Container, RT_CurrentUserAtom, RT_Document, RT_DocumentAtom, RT_Drawing, RT_DrawingGroup, RT_Environment, RT_ExternalObjectList, RT_FontCollection, RT_FontEntityAtom, RT_List, RT_MainMaster, RT_MasterTextPropAtom, RT_Notes, RT_NotesAtom, RT_OutlineTextRefAtom, RT_PersistDirectoryAtom, RT_PlaceholderAtom, RT_Slide, RT_SlideAtom, RT_SlideListWithText, RT_SlidePersistAtom, RT_StyleTextPropAtom, RT_TextBytesAtom, RT_TextCharsAtom, RT_TextHeaderAtom, RT_TextMasterStyleAtom, RT_TextRulerAtom, RT_TextSpecialInfoAtom, RT_TextSpecialInfoDefaultAtom, RT_UserEditAtom, RecordHeader, RecordWriteOptions, RgbColor, SLIDE_LIST_INSTANCE_MASTERS, SLIDE_LIST_INSTANCE_NOTES, SLIDE_LIST_INSTANCE_SLIDES, STYLE_BOLD, STYLE_EMBOSS, STYLE_ITALIC, STYLE_SHADOW, STYLE_UNDERLINE, SUMMARY_INFORMATION_STREAM, ShapeRect, SlidePersist, SlidePersistRef, StyleRun, StyleTextProps, TEXT_TYPE_BODY, TEXT_TYPE_CENTER_BODY, TEXT_TYPE_CENTER_TITLE, TEXT_TYPE_HALF_BODY, TEXT_TYPE_NOTES, TEXT_TYPE_OTHER, TEXT_TYPE_QUARTER_BODY, TEXT_TYPE_TITLE, TextBody, TextParagraph, UserEdit, UserEditFields, asciiBytes, buildParagraphs, buildPersistDirectory, buildTextBody, characterCountOf, childRecords, collectFontFamilies, concatBytes, findChild, findChildren, findDescendants, i16le, i32le, isContainerRecord, layoutMetadataToSummaryInformation, masterUnitsToPoints, pointsToMasterUnits, readCurrentUserAtom, readDocumentAtom, readDrawingShapes, readFontNames, readNotesAtom, readNotesContainerAtom, readNotesListWithText, readNotesText, readPersistDirectoryAtom, readPpt, readPptContent, readPptStreams, readRecordAt, readRecordHeader, readRecordSequence, readSlideListWithText, readStyleTextPropAtom, readTextBody, readTextHeaderAtom, readUserEditAtom, resolvePersistObject, splitParagraphs, u16le, u32le, u8, utf16le, writeAtom, writeContainer, writeCurrentUserAtom, writeDocumentAtom, writeDrawingWithClientData, writeEnvironment, writeMainMaster, writeMasterListWithText, writeNotesAtom, writeNotesContainer, writeNotesListWithText, writePersistDirectoryAtom, writePpt, writePptContent, writePptStreams, writeSlideAtom, writeSlideAtomForSlide, writeSlideDrawing, writeSlideListWithText, writeSlideSchemeColorSchemeAtom, writeStyleTextPropAtom, writeUserEditAtom };
33
+ export { ALIGN_CENTER, ALIGN_DISTRIBUTED, ALIGN_JUSTIFY, ALIGN_JUSTIFY_LOW, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_THAI_DISTRIBUTED, CF_ANSI_TYPEFACE, CF_BOLD, CF_COLOR, CF_EMBOSS, CF_FEHINT, CF_HAS_STYLE, CF_ITALIC, CF_KUMI, CF_OLD_EA_TYPEFACE, CF_POSITION, CF_SHADOW, CF_SIZE, CF_SYMBOL_TYPEFACE, CF_TYPEFACE, CF_UNDERLINE, COLOR_INDEX_SRGB, COLOR_INDEX_UNDEFINED, COLOR_SCHEME_SLOT_COUNT, CONTAINER_REC_VER, CURRENT_USER_DOC_FILE_VERSION, CURRENT_USER_FIXED_SIZE, CURRENT_USER_HEADER_TOKEN_ENCRYPTED, CURRENT_USER_HEADER_TOKEN_PLAIN, CURRENT_USER_STREAM, CharacterProperties, CurrentUser, DEFAULT_INSET_LEFT_RIGHT_PT, DEFAULT_INSET_TOP_BOTTOM_PT, DocumentAtom, DrawingShape, LINE_BREAK, MASTER_SLIDE_ID, MASTER_UNITS_PER_POINT, MasterStyleLevel, MasterTextStyleAtom, NOTES_MASTER_SLIDE_ID_REF, NotesAtom, NotesPersist, OfficeArtChildAnchor, OfficeArtClientAnchor, OfficeArtClientData, OfficeArtClientTextbox, OfficeArtDgContainer, OfficeArtFOPT, OfficeArtFSP, OfficeArtFSPGR, OfficeArtSpContainer, OfficeArtSpgrContainer, OutlineText, PARAGRAPH_SEPARATOR, PF_ALIGN, PF_BULLET_CHAR, PF_BULLET_COLOR, PF_BULLET_FONT, PF_BULLET_HAS_COLOR, PF_BULLET_HAS_FONT, PF_BULLET_HAS_SIZE, PF_BULLET_SIZE, PF_CHAR_WRAP, PF_DEFAULT_TAB_SIZE, PF_FONT_ALIGN, PF_HAS_BULLET, PF_INDENT, PF_LEFT_MARGIN, PF_LINE_SPACING, PF_OVERFLOW, PF_SPACE_AFTER, PF_SPACE_BEFORE, PF_TAB_STOPS, PF_TEXT_DIRECTION, PF_WORD_WRAP, POINTS_PER_INCH, POWERPOINT_DOCUMENT_STREAM, ParagraphProperties, PersistDirectory, PersistDirectoryEntryToWrite, PointStruct, PptDocument, PptEncryptedError, PptFormatError, PptRecord, PptShape, PptUnsupportedContentError, RECORD_HEADER_SIZE, RT_CString, RT_ColorSchemeAtom, RT_CryptSession10Container, RT_CurrentUserAtom, RT_Document, RT_DocumentAtom, RT_Drawing, RT_DrawingGroup, RT_Environment, RT_ExternalObjectList, RT_FontCollection, RT_FontEntityAtom, RT_List, RT_MainMaster, RT_MasterTextPropAtom, RT_Notes, RT_NotesAtom, RT_OutlineTextRefAtom, RT_PersistDirectoryAtom, RT_PlaceholderAtom, RT_Slide, RT_SlideAtom, RT_SlideListWithText, RT_SlidePersistAtom, RT_StyleTextPropAtom, RT_TextBytesAtom, RT_TextCharsAtom, RT_TextHeaderAtom, RT_TextMasterStyleAtom, RT_TextRulerAtom, RT_TextSpecialInfoAtom, RT_TextSpecialInfoDefaultAtom, RT_UserEditAtom, RecordHeader, RecordWriteOptions, RgbColor, RunColor, SLIDE_LIST_INSTANCE_MASTERS, SLIDE_LIST_INSTANCE_NOTES, SLIDE_LIST_INSTANCE_SLIDES, STYLE_BOLD, STYLE_EMBOSS, STYLE_ITALIC, STYLE_SHADOW, STYLE_UNDERLINE, SUMMARY_INFORMATION_STREAM, ShapeRect, SlidePersist, SlidePersistRef, StyleRun, StyleTextProps, TEXT_TYPE_BODY, TEXT_TYPE_CENTER_BODY, TEXT_TYPE_CENTER_TITLE, TEXT_TYPE_HALF_BODY, TEXT_TYPE_NOTES, TEXT_TYPE_OTHER, TEXT_TYPE_QUARTER_BODY, TEXT_TYPE_TITLE, TextBody, TextParagraph, UserEdit, UserEditFields, asciiBytes, buildParagraphs, buildPersistDirectory, buildTextBody, characterCountOf, childRecords, collectFontFamilies, concatBytes, findChild, findChildren, findDescendants, i16le, i32le, isContainerRecord, layoutMetadataToSummaryInformation, masterUnitsToPoints, pointsToMasterUnits, readCurrentUserAtom, readDocumentAtom, readDrawingShapes, readFontNames, readNotesAtom, readNotesContainerAtom, readNotesListWithText, readNotesText, readPersistDirectoryAtom, readPpt, readPptContent, readPptStreams, readRecordAt, readRecordHeader, readRecordSequence, readSlideListWithText, readStyleTextPropAtom, readTextBody, readTextHeaderAtom, readTextMasterStyleAtom, readUserEditAtom, resolvePersistObject, splitParagraphs, u16le, u32le, u8, utf16le, writeAtom, writeContainer, writeCurrentUserAtom, writeDocumentAtom, writeDrawingWithClientData, writeEnvironment, writeMainMaster, writeMasterListWithText, writeNotesAtom, writeNotesContainer, writeNotesListWithText, writePersistDirectoryAtom, writePpt, writePptContent, writePptStreams, writeSlideAtom, writeSlideAtomForSlide, writeSlideDrawing, writeSlideListWithText, writeSlideSchemeColorSchemeAtom, writeStyleTextPropAtom, writeUserEditAtom };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { a as readRecordHeader, i as isContainerRecord, n as RECORD_HEADER_SIZE, r as RecordHeader, t as CONTAINER_REC_VER } from "./header-C5eAd16_.js";
2
2
  import { a as findDescendants, i as findChildren, n as childRecords, o as readRecordAt, r as findChild, s as readRecordSequence, t as PptRecord } from "./tree-PMcPNgd-.js";
3
- import { ALIGN_CENTER, ALIGN_DISTRIBUTED, ALIGN_JUSTIFY, ALIGN_JUSTIFY_LOW, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_THAI_DISTRIBUTED, CF_ANSI_TYPEFACE, CF_BOLD, CF_COLOR, CF_EMBOSS, CF_FEHINT, CF_HAS_STYLE, CF_ITALIC, CF_KUMI, CF_OLD_EA_TYPEFACE, CF_POSITION, CF_SHADOW, CF_SIZE, CF_SYMBOL_TYPEFACE, CF_TYPEFACE, CF_UNDERLINE, COLOR_INDEX_SRGB, CharacterProperties, PF_ALIGN, PF_BULLET_CHAR, PF_BULLET_COLOR, PF_BULLET_FONT, PF_BULLET_HAS_COLOR, PF_BULLET_HAS_FONT, PF_BULLET_HAS_SIZE, PF_BULLET_SIZE, PF_CHAR_WRAP, PF_DEFAULT_TAB_SIZE, PF_FONT_ALIGN, PF_HAS_BULLET, PF_INDENT, PF_LEFT_MARGIN, PF_LINE_SPACING, PF_OVERFLOW, PF_SPACE_AFTER, PF_SPACE_BEFORE, PF_TAB_STOPS, PF_TEXT_DIRECTION, PF_WORD_WRAP, ParagraphProperties, RgbColor, STYLE_BOLD, STYLE_EMBOSS, STYLE_ITALIC, STYLE_SHADOW, STYLE_UNDERLINE, StyleRun, StyleTextProps, readStyleTextPropAtom } from "./text/style.js";
3
+ import { ALIGN_CENTER, ALIGN_DISTRIBUTED, ALIGN_JUSTIFY, ALIGN_JUSTIFY_LOW, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_THAI_DISTRIBUTED, CF_ANSI_TYPEFACE, CF_BOLD, CF_COLOR, CF_EMBOSS, CF_FEHINT, CF_HAS_STYLE, CF_ITALIC, CF_KUMI, CF_OLD_EA_TYPEFACE, CF_POSITION, CF_SHADOW, CF_SIZE, CF_SYMBOL_TYPEFACE, CF_TYPEFACE, CF_UNDERLINE, COLOR_INDEX_SRGB, COLOR_INDEX_UNDEFINED, COLOR_SCHEME_SLOT_COUNT, CharacterProperties, MasterStyleLevel, MasterTextStyleAtom, PF_ALIGN, PF_BULLET_CHAR, PF_BULLET_COLOR, PF_BULLET_FONT, PF_BULLET_HAS_COLOR, PF_BULLET_HAS_FONT, PF_BULLET_HAS_SIZE, PF_BULLET_SIZE, PF_CHAR_WRAP, PF_DEFAULT_TAB_SIZE, PF_FONT_ALIGN, PF_HAS_BULLET, PF_INDENT, PF_LEFT_MARGIN, PF_LINE_SPACING, PF_OVERFLOW, PF_SPACE_AFTER, PF_SPACE_BEFORE, PF_TAB_STOPS, PF_TEXT_DIRECTION, PF_WORD_WRAP, ParagraphProperties, RgbColor, RunColor, STYLE_BOLD, STYLE_EMBOSS, STYLE_ITALIC, STYLE_SHADOW, STYLE_UNDERLINE, StyleRun, StyleTextProps, readStyleTextPropAtom, readTextMasterStyleAtom } from "./text/style.js";
4
4
  import { TextBody, buildTextBody, collectFontFamilies } from "./content-write.js";
5
5
  import { buildParagraphs } from "./content.js";
6
6
  import { writeSlideSchemeColorSchemeAtom } from "./document/color-scheme-write.js";
@@ -30,4 +30,4 @@ import { LINE_BREAK, PARAGRAPH_SEPARATOR, TEXT_TYPE_BODY, TEXT_TYPE_CENTER_BODY,
30
30
  import { writeStyleTextPropAtom } from "./text/style-write.js";
31
31
  import { MASTER_UNITS_PER_POINT, POINTS_PER_INCH, masterUnitsToPoints, pointsToMasterUnits } from "./units.js";
32
32
  import { writePpt, writePptContent, writePptStreams } from "./write.js";
33
- export { ALIGN_CENTER, ALIGN_DISTRIBUTED, ALIGN_JUSTIFY, ALIGN_JUSTIFY_LOW, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_THAI_DISTRIBUTED, CF_ANSI_TYPEFACE, CF_BOLD, CF_COLOR, CF_EMBOSS, CF_FEHINT, CF_HAS_STYLE, CF_ITALIC, CF_KUMI, CF_OLD_EA_TYPEFACE, CF_POSITION, CF_SHADOW, CF_SIZE, CF_SYMBOL_TYPEFACE, CF_TYPEFACE, CF_UNDERLINE, COLOR_INDEX_SRGB, CONTAINER_REC_VER, CURRENT_USER_DOC_FILE_VERSION, CURRENT_USER_FIXED_SIZE, CURRENT_USER_HEADER_TOKEN_ENCRYPTED, CURRENT_USER_HEADER_TOKEN_PLAIN, CURRENT_USER_STREAM, CharacterProperties, CurrentUser, DEFAULT_INSET_LEFT_RIGHT_PT, DEFAULT_INSET_TOP_BOTTOM_PT, DocumentAtom, DrawingShape, LINE_BREAK, MASTER_SLIDE_ID, MASTER_UNITS_PER_POINT, NOTES_MASTER_SLIDE_ID_REF, NotesAtom, NotesPersist, OfficeArtChildAnchor, OfficeArtClientAnchor, OfficeArtClientData, OfficeArtClientTextbox, OfficeArtDgContainer, OfficeArtFOPT, OfficeArtFSP, OfficeArtFSPGR, OfficeArtSpContainer, OfficeArtSpgrContainer, OutlineText, PARAGRAPH_SEPARATOR, PF_ALIGN, PF_BULLET_CHAR, PF_BULLET_COLOR, PF_BULLET_FONT, PF_BULLET_HAS_COLOR, PF_BULLET_HAS_FONT, PF_BULLET_HAS_SIZE, PF_BULLET_SIZE, PF_CHAR_WRAP, PF_DEFAULT_TAB_SIZE, PF_FONT_ALIGN, PF_HAS_BULLET, PF_INDENT, PF_LEFT_MARGIN, PF_LINE_SPACING, PF_OVERFLOW, PF_SPACE_AFTER, PF_SPACE_BEFORE, PF_TAB_STOPS, PF_TEXT_DIRECTION, PF_WORD_WRAP, POINTS_PER_INCH, POWERPOINT_DOCUMENT_STREAM, ParagraphProperties, PersistDirectory, PersistDirectoryEntryToWrite, PointStruct, PptDocument, PptEncryptedError, PptFormatError, PptRecord, PptShape, PptUnsupportedContentError, RECORD_HEADER_SIZE, RT_CString, RT_ColorSchemeAtom, RT_CryptSession10Container, RT_CurrentUserAtom, RT_Document, RT_DocumentAtom, RT_Drawing, RT_DrawingGroup, RT_Environment, RT_ExternalObjectList, RT_FontCollection, RT_FontEntityAtom, RT_List, RT_MainMaster, RT_MasterTextPropAtom, RT_Notes, RT_NotesAtom, RT_OutlineTextRefAtom, RT_PersistDirectoryAtom, RT_PlaceholderAtom, RT_Slide, RT_SlideAtom, RT_SlideListWithText, RT_SlidePersistAtom, RT_StyleTextPropAtom, RT_TextBytesAtom, RT_TextCharsAtom, RT_TextHeaderAtom, RT_TextMasterStyleAtom, RT_TextRulerAtom, RT_TextSpecialInfoAtom, RT_TextSpecialInfoDefaultAtom, RT_UserEditAtom, RecordHeader, RecordWriteOptions, RgbColor, SLIDE_LIST_INSTANCE_MASTERS, SLIDE_LIST_INSTANCE_NOTES, SLIDE_LIST_INSTANCE_SLIDES, STYLE_BOLD, STYLE_EMBOSS, STYLE_ITALIC, STYLE_SHADOW, STYLE_UNDERLINE, SUMMARY_INFORMATION_STREAM, ShapeRect, SlidePersist, SlidePersistRef, StyleRun, StyleTextProps, TEXT_TYPE_BODY, TEXT_TYPE_CENTER_BODY, TEXT_TYPE_CENTER_TITLE, TEXT_TYPE_HALF_BODY, TEXT_TYPE_NOTES, TEXT_TYPE_OTHER, TEXT_TYPE_QUARTER_BODY, TEXT_TYPE_TITLE, TextBody, TextParagraph, UserEdit, UserEditFields, asciiBytes, buildParagraphs, buildPersistDirectory, buildTextBody, characterCountOf, childRecords, collectFontFamilies, concatBytes, findChild, findChildren, findDescendants, i16le, i32le, isContainerRecord, layoutMetadataToSummaryInformation, masterUnitsToPoints, pointsToMasterUnits, readCurrentUserAtom, readDocumentAtom, readDrawingShapes, readFontNames, readNotesAtom, readNotesContainerAtom, readNotesListWithText, readNotesText, readPersistDirectoryAtom, readPpt, readPptContent, readPptStreams, readRecordAt, readRecordHeader, readRecordSequence, readSlideListWithText, readStyleTextPropAtom, readTextBody, readTextHeaderAtom, readUserEditAtom, resolvePersistObject, splitParagraphs, u16le, u32le, u8, utf16le, writeAtom, writeContainer, writeCurrentUserAtom, writeDocumentAtom, writeDrawingWithClientData, writeEnvironment, writeMainMaster, writeMasterListWithText, writeNotesAtom, writeNotesContainer, writeNotesListWithText, writePersistDirectoryAtom, writePpt, writePptContent, writePptStreams, writeSlideAtom, writeSlideAtomForSlide, writeSlideDrawing, writeSlideListWithText, writeSlideSchemeColorSchemeAtom, writeStyleTextPropAtom, writeUserEditAtom };
33
+ export { ALIGN_CENTER, ALIGN_DISTRIBUTED, ALIGN_JUSTIFY, ALIGN_JUSTIFY_LOW, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_THAI_DISTRIBUTED, CF_ANSI_TYPEFACE, CF_BOLD, CF_COLOR, CF_EMBOSS, CF_FEHINT, CF_HAS_STYLE, CF_ITALIC, CF_KUMI, CF_OLD_EA_TYPEFACE, CF_POSITION, CF_SHADOW, CF_SIZE, CF_SYMBOL_TYPEFACE, CF_TYPEFACE, CF_UNDERLINE, COLOR_INDEX_SRGB, COLOR_INDEX_UNDEFINED, COLOR_SCHEME_SLOT_COUNT, CONTAINER_REC_VER, CURRENT_USER_DOC_FILE_VERSION, CURRENT_USER_FIXED_SIZE, CURRENT_USER_HEADER_TOKEN_ENCRYPTED, CURRENT_USER_HEADER_TOKEN_PLAIN, CURRENT_USER_STREAM, CharacterProperties, CurrentUser, DEFAULT_INSET_LEFT_RIGHT_PT, DEFAULT_INSET_TOP_BOTTOM_PT, DocumentAtom, DrawingShape, LINE_BREAK, MASTER_SLIDE_ID, MASTER_UNITS_PER_POINT, MasterStyleLevel, MasterTextStyleAtom, NOTES_MASTER_SLIDE_ID_REF, NotesAtom, NotesPersist, OfficeArtChildAnchor, OfficeArtClientAnchor, OfficeArtClientData, OfficeArtClientTextbox, OfficeArtDgContainer, OfficeArtFOPT, OfficeArtFSP, OfficeArtFSPGR, OfficeArtSpContainer, OfficeArtSpgrContainer, OutlineText, PARAGRAPH_SEPARATOR, PF_ALIGN, PF_BULLET_CHAR, PF_BULLET_COLOR, PF_BULLET_FONT, PF_BULLET_HAS_COLOR, PF_BULLET_HAS_FONT, PF_BULLET_HAS_SIZE, PF_BULLET_SIZE, PF_CHAR_WRAP, PF_DEFAULT_TAB_SIZE, PF_FONT_ALIGN, PF_HAS_BULLET, PF_INDENT, PF_LEFT_MARGIN, PF_LINE_SPACING, PF_OVERFLOW, PF_SPACE_AFTER, PF_SPACE_BEFORE, PF_TAB_STOPS, PF_TEXT_DIRECTION, PF_WORD_WRAP, POINTS_PER_INCH, POWERPOINT_DOCUMENT_STREAM, ParagraphProperties, PersistDirectory, PersistDirectoryEntryToWrite, PointStruct, PptDocument, PptEncryptedError, PptFormatError, PptRecord, PptShape, PptUnsupportedContentError, RECORD_HEADER_SIZE, RT_CString, RT_ColorSchemeAtom, RT_CryptSession10Container, RT_CurrentUserAtom, RT_Document, RT_DocumentAtom, RT_Drawing, RT_DrawingGroup, RT_Environment, RT_ExternalObjectList, RT_FontCollection, RT_FontEntityAtom, RT_List, RT_MainMaster, RT_MasterTextPropAtom, RT_Notes, RT_NotesAtom, RT_OutlineTextRefAtom, RT_PersistDirectoryAtom, RT_PlaceholderAtom, RT_Slide, RT_SlideAtom, RT_SlideListWithText, RT_SlidePersistAtom, RT_StyleTextPropAtom, RT_TextBytesAtom, RT_TextCharsAtom, RT_TextHeaderAtom, RT_TextMasterStyleAtom, RT_TextRulerAtom, RT_TextSpecialInfoAtom, RT_TextSpecialInfoDefaultAtom, RT_UserEditAtom, RecordHeader, RecordWriteOptions, RgbColor, RunColor, SLIDE_LIST_INSTANCE_MASTERS, SLIDE_LIST_INSTANCE_NOTES, SLIDE_LIST_INSTANCE_SLIDES, STYLE_BOLD, STYLE_EMBOSS, STYLE_ITALIC, STYLE_SHADOW, STYLE_UNDERLINE, SUMMARY_INFORMATION_STREAM, ShapeRect, SlidePersist, SlidePersistRef, StyleRun, StyleTextProps, TEXT_TYPE_BODY, TEXT_TYPE_CENTER_BODY, TEXT_TYPE_CENTER_TITLE, TEXT_TYPE_HALF_BODY, TEXT_TYPE_NOTES, TEXT_TYPE_OTHER, TEXT_TYPE_QUARTER_BODY, TEXT_TYPE_TITLE, TextBody, TextParagraph, UserEdit, UserEditFields, asciiBytes, buildParagraphs, buildPersistDirectory, buildTextBody, characterCountOf, childRecords, collectFontFamilies, concatBytes, findChild, findChildren, findDescendants, i16le, i32le, isContainerRecord, layoutMetadataToSummaryInformation, masterUnitsToPoints, pointsToMasterUnits, readCurrentUserAtom, readDocumentAtom, readDrawingShapes, readFontNames, readNotesAtom, readNotesContainerAtom, readNotesListWithText, readNotesText, readPersistDirectoryAtom, readPpt, readPptContent, readPptStreams, readRecordAt, readRecordHeader, readRecordSequence, readSlideListWithText, readStyleTextPropAtom, readTextBody, readTextHeaderAtom, readTextMasterStyleAtom, readUserEditAtom, resolvePersistObject, splitParagraphs, u16le, u32le, u8, utf16le, writeAtom, writeContainer, writeCurrentUserAtom, writeDocumentAtom, writeDrawingWithClientData, writeEnvironment, writeMainMaster, writeMasterListWithText, writeNotesAtom, writeNotesContainer, writeNotesListWithText, writePersistDirectoryAtom, writePpt, writePptContent, writePptStreams, writeSlideAtom, writeSlideAtomForSlide, writeSlideDrawing, writeSlideListWithText, writeSlideSchemeColorSchemeAtom, writeStyleTextPropAtom, writeUserEditAtom };
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import { PptEncryptedError, PptFormatError, PptUnsupportedContentError } from ".
2
2
  import { CONTAINER_REC_VER, RECORD_HEADER_SIZE, isContainerRecord, readRecordHeader } from "./record/header.js";
3
3
  import { childRecords, findChild, findChildren, findDescendants, readRecordAt, readRecordSequence } from "./record/tree.js";
4
4
  import { OfficeArtChildAnchor, OfficeArtClientAnchor, OfficeArtClientData, OfficeArtClientTextbox, OfficeArtDgContainer, OfficeArtFOPT, OfficeArtFSP, OfficeArtFSPGR, OfficeArtSpContainer, OfficeArtSpgrContainer, RT_CString, RT_ColorSchemeAtom, RT_CryptSession10Container, RT_CurrentUserAtom, RT_Document, RT_DocumentAtom, RT_Drawing, RT_DrawingGroup, RT_Environment, RT_ExternalObjectList, RT_FontCollection, RT_FontEntityAtom, RT_List, RT_MainMaster, RT_MasterTextPropAtom, RT_Notes, RT_NotesAtom, RT_OutlineTextRefAtom, RT_PersistDirectoryAtom, RT_PlaceholderAtom, RT_Slide, RT_SlideAtom, RT_SlideListWithText, RT_SlidePersistAtom, RT_StyleTextPropAtom, RT_TextBytesAtom, RT_TextCharsAtom, RT_TextHeaderAtom, RT_TextMasterStyleAtom, RT_TextRulerAtom, RT_TextSpecialInfoAtom, RT_TextSpecialInfoDefaultAtom, RT_UserEditAtom, SLIDE_LIST_INSTANCE_MASTERS, SLIDE_LIST_INSTANCE_NOTES, SLIDE_LIST_INSTANCE_SLIDES } from "./record/types.js";
5
- import { ALIGN_CENTER, ALIGN_DISTRIBUTED, ALIGN_JUSTIFY, ALIGN_JUSTIFY_LOW, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_THAI_DISTRIBUTED, CF_ANSI_TYPEFACE, CF_BOLD, CF_COLOR, CF_EMBOSS, CF_FEHINT, CF_HAS_STYLE, CF_ITALIC, CF_KUMI, CF_OLD_EA_TYPEFACE, CF_POSITION, CF_SHADOW, CF_SIZE, CF_SYMBOL_TYPEFACE, CF_TYPEFACE, CF_UNDERLINE, COLOR_INDEX_SRGB, PF_ALIGN, PF_BULLET_CHAR, PF_BULLET_COLOR, PF_BULLET_FONT, PF_BULLET_HAS_COLOR, PF_BULLET_HAS_FONT, PF_BULLET_HAS_SIZE, PF_BULLET_SIZE, PF_CHAR_WRAP, PF_DEFAULT_TAB_SIZE, PF_FONT_ALIGN, PF_HAS_BULLET, PF_INDENT, PF_LEFT_MARGIN, PF_LINE_SPACING, PF_OVERFLOW, PF_SPACE_AFTER, PF_SPACE_BEFORE, PF_TAB_STOPS, PF_TEXT_DIRECTION, PF_WORD_WRAP, STYLE_BOLD, STYLE_EMBOSS, STYLE_ITALIC, STYLE_SHADOW, STYLE_UNDERLINE, readStyleTextPropAtom } from "./text/style.js";
5
+ import { ALIGN_CENTER, ALIGN_DISTRIBUTED, ALIGN_JUSTIFY, ALIGN_JUSTIFY_LOW, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_THAI_DISTRIBUTED, CF_ANSI_TYPEFACE, CF_BOLD, CF_COLOR, CF_EMBOSS, CF_FEHINT, CF_HAS_STYLE, CF_ITALIC, CF_KUMI, CF_OLD_EA_TYPEFACE, CF_POSITION, CF_SHADOW, CF_SIZE, CF_SYMBOL_TYPEFACE, CF_TYPEFACE, CF_UNDERLINE, COLOR_INDEX_SRGB, COLOR_INDEX_UNDEFINED, COLOR_SCHEME_SLOT_COUNT, PF_ALIGN, PF_BULLET_CHAR, PF_BULLET_COLOR, PF_BULLET_FONT, PF_BULLET_HAS_COLOR, PF_BULLET_HAS_FONT, PF_BULLET_HAS_SIZE, PF_BULLET_SIZE, PF_CHAR_WRAP, PF_DEFAULT_TAB_SIZE, PF_FONT_ALIGN, PF_HAS_BULLET, PF_INDENT, PF_LEFT_MARGIN, PF_LINE_SPACING, PF_OVERFLOW, PF_SPACE_AFTER, PF_SPACE_BEFORE, PF_TAB_STOPS, PF_TEXT_DIRECTION, PF_WORD_WRAP, STYLE_BOLD, STYLE_EMBOSS, STYLE_ITALIC, STYLE_SHADOW, STYLE_UNDERLINE, readStyleTextPropAtom, readTextMasterStyleAtom } from "./text/style.js";
6
6
  import { LINE_BREAK, PARAGRAPH_SEPARATOR, TEXT_TYPE_BODY, TEXT_TYPE_CENTER_BODY, TEXT_TYPE_CENTER_TITLE, TEXT_TYPE_HALF_BODY, TEXT_TYPE_NOTES, TEXT_TYPE_OTHER, TEXT_TYPE_QUARTER_BODY, TEXT_TYPE_TITLE, characterCountOf, readTextBody, readTextHeaderAtom, splitParagraphs } from "./text/atoms.js";
7
7
  import { MASTER_UNITS_PER_POINT, POINTS_PER_INCH, masterUnitsToPoints, pointsToMasterUnits } from "./units.js";
8
8
  import { buildTextBody, collectFontFamilies } from "./content-write.js";
@@ -30,4 +30,4 @@ import { layoutMetadataToSummaryInformation } from "./metadata.js";
30
30
  import { writeCurrentUserAtom } from "./stream/current-user-write.js";
31
31
  import { writePersistDirectoryAtom, writeUserEditAtom } from "./stream/persist-write.js";
32
32
  import { writePpt, writePptContent, writePptStreams } from "./write.js";
33
- export { ALIGN_CENTER, ALIGN_DISTRIBUTED, ALIGN_JUSTIFY, ALIGN_JUSTIFY_LOW, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_THAI_DISTRIBUTED, CF_ANSI_TYPEFACE, CF_BOLD, CF_COLOR, CF_EMBOSS, CF_FEHINT, CF_HAS_STYLE, CF_ITALIC, CF_KUMI, CF_OLD_EA_TYPEFACE, CF_POSITION, CF_SHADOW, CF_SIZE, CF_SYMBOL_TYPEFACE, CF_TYPEFACE, CF_UNDERLINE, COLOR_INDEX_SRGB, CONTAINER_REC_VER, CURRENT_USER_DOC_FILE_VERSION, CURRENT_USER_FIXED_SIZE, CURRENT_USER_HEADER_TOKEN_ENCRYPTED, CURRENT_USER_HEADER_TOKEN_PLAIN, CURRENT_USER_STREAM, DEFAULT_INSET_LEFT_RIGHT_PT, DEFAULT_INSET_TOP_BOTTOM_PT, LINE_BREAK, MASTER_SLIDE_ID, MASTER_UNITS_PER_POINT, NOTES_MASTER_SLIDE_ID_REF, OfficeArtChildAnchor, OfficeArtClientAnchor, OfficeArtClientData, OfficeArtClientTextbox, OfficeArtDgContainer, OfficeArtFOPT, OfficeArtFSP, OfficeArtFSPGR, OfficeArtSpContainer, OfficeArtSpgrContainer, PARAGRAPH_SEPARATOR, PF_ALIGN, PF_BULLET_CHAR, PF_BULLET_COLOR, PF_BULLET_FONT, PF_BULLET_HAS_COLOR, PF_BULLET_HAS_FONT, PF_BULLET_HAS_SIZE, PF_BULLET_SIZE, PF_CHAR_WRAP, PF_DEFAULT_TAB_SIZE, PF_FONT_ALIGN, PF_HAS_BULLET, PF_INDENT, PF_LEFT_MARGIN, PF_LINE_SPACING, PF_OVERFLOW, PF_SPACE_AFTER, PF_SPACE_BEFORE, PF_TAB_STOPS, PF_TEXT_DIRECTION, PF_WORD_WRAP, POINTS_PER_INCH, POWERPOINT_DOCUMENT_STREAM, PptEncryptedError, PptFormatError, PptUnsupportedContentError, RECORD_HEADER_SIZE, RT_CString, RT_ColorSchemeAtom, RT_CryptSession10Container, RT_CurrentUserAtom, RT_Document, RT_DocumentAtom, RT_Drawing, RT_DrawingGroup, RT_Environment, RT_ExternalObjectList, RT_FontCollection, RT_FontEntityAtom, RT_List, RT_MainMaster, RT_MasterTextPropAtom, RT_Notes, RT_NotesAtom, RT_OutlineTextRefAtom, RT_PersistDirectoryAtom, RT_PlaceholderAtom, RT_Slide, RT_SlideAtom, RT_SlideListWithText, RT_SlidePersistAtom, RT_StyleTextPropAtom, RT_TextBytesAtom, RT_TextCharsAtom, RT_TextHeaderAtom, RT_TextMasterStyleAtom, RT_TextRulerAtom, RT_TextSpecialInfoAtom, RT_TextSpecialInfoDefaultAtom, RT_UserEditAtom, SLIDE_LIST_INSTANCE_MASTERS, SLIDE_LIST_INSTANCE_NOTES, SLIDE_LIST_INSTANCE_SLIDES, STYLE_BOLD, STYLE_EMBOSS, STYLE_ITALIC, STYLE_SHADOW, STYLE_UNDERLINE, SUMMARY_INFORMATION_STREAM, TEXT_TYPE_BODY, TEXT_TYPE_CENTER_BODY, TEXT_TYPE_CENTER_TITLE, TEXT_TYPE_HALF_BODY, TEXT_TYPE_NOTES, TEXT_TYPE_OTHER, TEXT_TYPE_QUARTER_BODY, TEXT_TYPE_TITLE, asciiBytes, buildParagraphs, buildPersistDirectory, buildTextBody, characterCountOf, childRecords, collectFontFamilies, concatBytes, findChild, findChildren, findDescendants, i16le, i32le, isContainerRecord, layoutMetadataToSummaryInformation, masterUnitsToPoints, pointsToMasterUnits, readCurrentUserAtom, readDocumentAtom, readDrawingShapes, readFontNames, readNotesAtom, readNotesContainerAtom, readNotesListWithText, readNotesText, readPersistDirectoryAtom, readPpt, readPptContent, readPptStreams, readRecordAt, readRecordHeader, readRecordSequence, readSlideListWithText, readStyleTextPropAtom, readTextBody, readTextHeaderAtom, readUserEditAtom, resolvePersistObject, splitParagraphs, u16le, u32le, u8, utf16le, writeAtom, writeContainer, writeCurrentUserAtom, writeDocumentAtom, writeDrawingWithClientData, writeEnvironment, writeMainMaster, writeMasterListWithText, writeNotesAtom, writeNotesContainer, writeNotesListWithText, writePersistDirectoryAtom, writePpt, writePptContent, writePptStreams, writeSlideAtom, writeSlideAtomForSlide, writeSlideDrawing, writeSlideListWithText, writeSlideSchemeColorSchemeAtom, writeStyleTextPropAtom, writeUserEditAtom };
33
+ export { ALIGN_CENTER, ALIGN_DISTRIBUTED, ALIGN_JUSTIFY, ALIGN_JUSTIFY_LOW, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_THAI_DISTRIBUTED, CF_ANSI_TYPEFACE, CF_BOLD, CF_COLOR, CF_EMBOSS, CF_FEHINT, CF_HAS_STYLE, CF_ITALIC, CF_KUMI, CF_OLD_EA_TYPEFACE, CF_POSITION, CF_SHADOW, CF_SIZE, CF_SYMBOL_TYPEFACE, CF_TYPEFACE, CF_UNDERLINE, COLOR_INDEX_SRGB, COLOR_INDEX_UNDEFINED, COLOR_SCHEME_SLOT_COUNT, CONTAINER_REC_VER, CURRENT_USER_DOC_FILE_VERSION, CURRENT_USER_FIXED_SIZE, CURRENT_USER_HEADER_TOKEN_ENCRYPTED, CURRENT_USER_HEADER_TOKEN_PLAIN, CURRENT_USER_STREAM, DEFAULT_INSET_LEFT_RIGHT_PT, DEFAULT_INSET_TOP_BOTTOM_PT, LINE_BREAK, MASTER_SLIDE_ID, MASTER_UNITS_PER_POINT, NOTES_MASTER_SLIDE_ID_REF, OfficeArtChildAnchor, OfficeArtClientAnchor, OfficeArtClientData, OfficeArtClientTextbox, OfficeArtDgContainer, OfficeArtFOPT, OfficeArtFSP, OfficeArtFSPGR, OfficeArtSpContainer, OfficeArtSpgrContainer, PARAGRAPH_SEPARATOR, PF_ALIGN, PF_BULLET_CHAR, PF_BULLET_COLOR, PF_BULLET_FONT, PF_BULLET_HAS_COLOR, PF_BULLET_HAS_FONT, PF_BULLET_HAS_SIZE, PF_BULLET_SIZE, PF_CHAR_WRAP, PF_DEFAULT_TAB_SIZE, PF_FONT_ALIGN, PF_HAS_BULLET, PF_INDENT, PF_LEFT_MARGIN, PF_LINE_SPACING, PF_OVERFLOW, PF_SPACE_AFTER, PF_SPACE_BEFORE, PF_TAB_STOPS, PF_TEXT_DIRECTION, PF_WORD_WRAP, POINTS_PER_INCH, POWERPOINT_DOCUMENT_STREAM, PptEncryptedError, PptFormatError, PptUnsupportedContentError, RECORD_HEADER_SIZE, RT_CString, RT_ColorSchemeAtom, RT_CryptSession10Container, RT_CurrentUserAtom, RT_Document, RT_DocumentAtom, RT_Drawing, RT_DrawingGroup, RT_Environment, RT_ExternalObjectList, RT_FontCollection, RT_FontEntityAtom, RT_List, RT_MainMaster, RT_MasterTextPropAtom, RT_Notes, RT_NotesAtom, RT_OutlineTextRefAtom, RT_PersistDirectoryAtom, RT_PlaceholderAtom, RT_Slide, RT_SlideAtom, RT_SlideListWithText, RT_SlidePersistAtom, RT_StyleTextPropAtom, RT_TextBytesAtom, RT_TextCharsAtom, RT_TextHeaderAtom, RT_TextMasterStyleAtom, RT_TextRulerAtom, RT_TextSpecialInfoAtom, RT_TextSpecialInfoDefaultAtom, RT_UserEditAtom, SLIDE_LIST_INSTANCE_MASTERS, SLIDE_LIST_INSTANCE_NOTES, SLIDE_LIST_INSTANCE_SLIDES, STYLE_BOLD, STYLE_EMBOSS, STYLE_ITALIC, STYLE_SHADOW, STYLE_UNDERLINE, SUMMARY_INFORMATION_STREAM, TEXT_TYPE_BODY, TEXT_TYPE_CENTER_BODY, TEXT_TYPE_CENTER_TITLE, TEXT_TYPE_HALF_BODY, TEXT_TYPE_NOTES, TEXT_TYPE_OTHER, TEXT_TYPE_QUARTER_BODY, TEXT_TYPE_TITLE, asciiBytes, buildParagraphs, buildPersistDirectory, buildTextBody, characterCountOf, childRecords, collectFontFamilies, concatBytes, findChild, findChildren, findDescendants, i16le, i32le, isContainerRecord, layoutMetadataToSummaryInformation, masterUnitsToPoints, pointsToMasterUnits, readCurrentUserAtom, readDocumentAtom, readDrawingShapes, readFontNames, readNotesAtom, readNotesContainerAtom, readNotesListWithText, readNotesText, readPersistDirectoryAtom, readPpt, readPptContent, readPptStreams, readRecordAt, readRecordHeader, readRecordSequence, readSlideListWithText, readStyleTextPropAtom, readTextBody, readTextHeaderAtom, readTextMasterStyleAtom, readUserEditAtom, resolvePersistObject, splitParagraphs, u16le, u32le, u8, utf16le, writeAtom, writeContainer, writeCurrentUserAtom, writeDocumentAtom, writeDrawingWithClientData, writeEnvironment, writeMainMaster, writeMasterListWithText, writeNotesAtom, writeNotesContainer, writeNotesListWithText, writePersistDirectoryAtom, writePpt, writePptContent, writePptStreams, writeSlideAtom, writeSlideAtomForSlide, writeSlideDrawing, writeSlideListWithText, writeSlideSchemeColorSchemeAtom, writeStyleTextPropAtom, writeUserEditAtom };
@@ -0,0 +1,25 @@
1
+ import { t as PptRecord } from "./tree-PMcPNgd-.js";
2
+ import { CharacterProperties, MasterStyleLevel, MasterTextStyleAtom, ParagraphProperties, RgbColor } from "./text/style.js";
3
+ //#region src/document/master.d.ts
4
+ /** One master's own resolved facts: its text-style cascade table and its own colour scheme. Bundled together because both are keyed off the same masterIdRef a slide's SlideAtom names -- a caller resolving one always needs the other too. */
5
+ interface MasterInfo {
6
+ readonly styles: MasterStyleTable;
7
+ readonly colorScheme: readonly RgbColor[];
8
+ }
9
+ /** One master's own resolved text styles, keyed by TextTypeEnum member (text/atoms.ts's own TEXT_TYPE_* constants). A type absent from the map states nothing of its own; resolveCharacterProperties/resolveParagraphProperties below fall through to a sibling type in the same family (BODY/CENTER_BODY/HALF_BODY/QUARTER_BODY; TITLE/CENTER_TITLE) or leave the property undefined. */
10
+ interface MasterStyleTable {
11
+ readonly byType: ReadonlyMap<number, readonly MasterStyleLevel[]>;
12
+ }
13
+ /** Builds one MainMasterContainer's own MasterStyleTable from its direct-child TextMasterStyleAtoms, falling back to the document-wide default (the single OTHER-typed TextMasterStyleAtom [MS-PPT] states lives in the DocumentTextInfoContainer inside Environment) for any TextTypeEnum member the master itself carries no atom for. A real master this package's own writer produces always states TITLE/BODY/NOTES explicitly (master-write.ts's own comment), so the document default is realistically only ever consulted for OTHER-typed runs or a third-party master that omits one of the three -- but [MS-PPT] 2.9.35 makes it the genuine fallback of last resort for every type, not a special case for OTHER alone. */
14
+ declare function buildMasterStyleTable(masterAtoms: readonly MasterTextStyleAtom[], documentDefault: MasterTextStyleAtom | undefined): MasterStyleTable;
15
+ /** Resolves a run's own ParagraphProperties (possibly stating nothing at all, when the run's paragraph itself carries no TextPFException of its own) against the master cascade -- every field the run itself states wins outright; every field it doesn't falls through to the first master level that does. indentLevel is never itself resolved from the cascade: it is the run's own stated (or default-zero) outline depth, and is what selects which master levels apply in the first place. */
16
+ declare function resolveParagraphProperties(run: ParagraphProperties | undefined, table: MasterStyleTable, textType: number, indentLevel: number): ParagraphProperties;
17
+ /** The character-property counterpart of resolveParagraphProperties -- see that function's own comment for the cascade this implements. `color` resolves to whichever RunColor (literal or still-unresolved scheme reference) the cascade finds first; converting a scheme reference to an actual RgbColor is document/color-scheme.ts's own concern, deliberately kept separate since it needs the slide's colour scheme rather than anything the text-formatting cascade itself touches. */
18
+ declare function resolveCharacterProperties(run: CharacterProperties | undefined, table: MasterStyleTable, textType: number, indentLevel: number): CharacterProperties;
19
+ interface SlideAtomInfo {
20
+ readonly masterIdRef: number;
21
+ readonly notesIdRef: number;
22
+ }
23
+ declare function readSlideAtom(record: PptRecord): SlideAtomInfo;
24
+ //#endregion
25
+ export { readSlideAtom as a, buildMasterStyleTable as i, MasterStyleTable as n, resolveCharacterProperties as o, SlideAtomInfo as r, resolveParagraphProperties as s, MasterInfo as t };
@@ -0,0 +1,25 @@
1
+ import { t as PptRecord } from "./tree-Du_LXAF0.cjs";
2
+ import { CharacterProperties, MasterStyleLevel, MasterTextStyleAtom, ParagraphProperties, RgbColor } from "./text/style.cjs";
3
+ //#region src/document/master.d.ts
4
+ /** One master's own resolved facts: its text-style cascade table and its own colour scheme. Bundled together because both are keyed off the same masterIdRef a slide's SlideAtom names -- a caller resolving one always needs the other too. */
5
+ interface MasterInfo {
6
+ readonly styles: MasterStyleTable;
7
+ readonly colorScheme: readonly RgbColor[];
8
+ }
9
+ /** One master's own resolved text styles, keyed by TextTypeEnum member (text/atoms.ts's own TEXT_TYPE_* constants). A type absent from the map states nothing of its own; resolveCharacterProperties/resolveParagraphProperties below fall through to a sibling type in the same family (BODY/CENTER_BODY/HALF_BODY/QUARTER_BODY; TITLE/CENTER_TITLE) or leave the property undefined. */
10
+ interface MasterStyleTable {
11
+ readonly byType: ReadonlyMap<number, readonly MasterStyleLevel[]>;
12
+ }
13
+ /** Builds one MainMasterContainer's own MasterStyleTable from its direct-child TextMasterStyleAtoms, falling back to the document-wide default (the single OTHER-typed TextMasterStyleAtom [MS-PPT] states lives in the DocumentTextInfoContainer inside Environment) for any TextTypeEnum member the master itself carries no atom for. A real master this package's own writer produces always states TITLE/BODY/NOTES explicitly (master-write.ts's own comment), so the document default is realistically only ever consulted for OTHER-typed runs or a third-party master that omits one of the three -- but [MS-PPT] 2.9.35 makes it the genuine fallback of last resort for every type, not a special case for OTHER alone. */
14
+ declare function buildMasterStyleTable(masterAtoms: readonly MasterTextStyleAtom[], documentDefault: MasterTextStyleAtom | undefined): MasterStyleTable;
15
+ /** Resolves a run's own ParagraphProperties (possibly stating nothing at all, when the run's paragraph itself carries no TextPFException of its own) against the master cascade -- every field the run itself states wins outright; every field it doesn't falls through to the first master level that does. indentLevel is never itself resolved from the cascade: it is the run's own stated (or default-zero) outline depth, and is what selects which master levels apply in the first place. */
16
+ declare function resolveParagraphProperties(run: ParagraphProperties | undefined, table: MasterStyleTable, textType: number, indentLevel: number): ParagraphProperties;
17
+ /** The character-property counterpart of resolveParagraphProperties -- see that function's own comment for the cascade this implements. `color` resolves to whichever RunColor (literal or still-unresolved scheme reference) the cascade finds first; converting a scheme reference to an actual RgbColor is document/color-scheme.ts's own concern, deliberately kept separate since it needs the slide's colour scheme rather than anything the text-formatting cascade itself touches. */
18
+ declare function resolveCharacterProperties(run: CharacterProperties | undefined, table: MasterStyleTable, textType: number, indentLevel: number): CharacterProperties;
19
+ interface SlideAtomInfo {
20
+ readonly masterIdRef: number;
21
+ readonly notesIdRef: number;
22
+ }
23
+ declare function readSlideAtom(record: PptRecord): SlideAtomInfo;
24
+ //#endregion
25
+ export { readSlideAtom as a, buildMasterStyleTable as i, MasterStyleTable as n, resolveCharacterProperties as o, SlideAtomInfo as r, resolveParagraphProperties as s, MasterInfo as t };