ooxml-core 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -13
- package/dist/crypto/aes-ecb.d.ts +13 -0
- package/dist/crypto/aes-ecb.d.ts.map +1 -0
- package/dist/crypto/decrypt.d.ts +63 -0
- package/dist/crypto/decrypt.d.ts.map +1 -0
- package/dist/crypto/detect.d.ts +56 -0
- package/dist/crypto/detect.d.ts.map +1 -0
- package/dist/crypto/encrypt.d.ts +27 -0
- package/dist/crypto/encrypt.d.ts.map +1 -0
- package/dist/crypto/encryption-info-write.d.ts +46 -0
- package/dist/crypto/encryption-info-write.d.ts.map +1 -0
- package/dist/crypto/encryption-info.d.ts +22 -0
- package/dist/crypto/encryption-info.d.ts.map +1 -0
- package/dist/crypto/errors.d.ts +39 -0
- package/dist/crypto/errors.d.ts.map +1 -0
- package/dist/crypto/index.cjs +1805 -0
- package/dist/crypto/index.d.ts +26 -0
- package/dist/crypto/index.d.ts.map +1 -0
- package/dist/crypto/index.mjs +1774 -0
- package/dist/crypto/key-derivation.d.ts +73 -0
- package/dist/crypto/key-derivation.d.ts.map +1 -0
- package/dist/crypto/types.d.ts +104 -0
- package/dist/crypto/types.d.ts.map +1 -0
- package/dist/docx/embedded.cjs +2 -0
- package/dist/docx/embedded.mjs +2 -0
- package/dist/docx/index.cjs +2 -0
- package/dist/docx/index.mjs +2 -0
- package/dist/docx/load/detect.d.ts +14 -2
- package/dist/docx/load/detect.d.ts.map +1 -1
- package/dist/docx/load/index.cjs +8995 -7728
- package/dist/docx/load/index.d.ts +3 -1
- package/dist/docx/load/index.d.ts.map +1 -1
- package/dist/docx/load/index.mjs +8990 -7729
- package/dist/docx/load/legacy-doc.d.ts.map +1 -1
- package/dist/index.cjs +749 -19
- package/dist/index.mjs +749 -19
- package/dist/opc/index.cjs +797 -1
- package/dist/opc/index.d.ts +2 -0
- package/dist/opc/index.d.ts.map +1 -1
- package/dist/opc/index.mjs +784 -3
- package/dist/opc/properties/app.d.ts +10 -0
- package/dist/opc/properties/app.d.ts.map +1 -0
- package/dist/opc/properties/core.d.ts +13 -0
- package/dist/opc/properties/core.d.ts.map +1 -0
- package/dist/opc/properties/custom.d.ts +15 -0
- package/dist/opc/properties/custom.d.ts.map +1 -0
- package/dist/opc/properties/index.d.ts +5 -0
- package/dist/opc/properties/index.d.ts.map +1 -0
- package/dist/opc/properties/types.d.ts +114 -0
- package/dist/opc/properties/types.d.ts.map +1 -0
- package/dist/opc/relationship-types.d.ts +1 -0
- package/dist/opc/relationship-types.d.ts.map +1 -1
- package/dist/opc/safe-href.d.ts +34 -0
- package/dist/opc/safe-href.d.ts.map +1 -1
- package/dist/opc/signature/constants.d.ts +42 -0
- package/dist/opc/signature/constants.d.ts.map +1 -0
- package/dist/opc/signature/detection.d.ts +97 -0
- package/dist/opc/signature/detection.d.ts.map +1 -0
- package/dist/opc/signature/digest.d.ts +16 -0
- package/dist/opc/signature/digest.d.ts.map +1 -0
- package/dist/opc/signature/index.d.ts +8 -0
- package/dist/opc/signature/index.d.ts.map +1 -0
- package/dist/opc/signature/inspection-status.d.ts +24 -0
- package/dist/opc/signature/inspection-status.d.ts.map +1 -0
- package/dist/opc/signature/reference-utils.d.ts +12 -0
- package/dist/opc/signature/reference-utils.d.ts.map +1 -0
- package/dist/opc/signature/types.d.ts +90 -0
- package/dist/opc/signature/types.d.ts.map +1 -0
- package/dist/opc/signature/xml-utils.d.ts +35 -0
- package/dist/opc/signature/xml-utils.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-CojJtI77.d.ts → index-BWUBPGgv.d.ts} +9 -11
- package/dist/pptx/chunks/index-BWUBPGgv.d.ts.map +1 -0
- package/dist/pptx/chunks/{signature-inspection-status-Bh2oap7B.d.ts → inspection-status-B2E-jSpG.d.ts} +8 -8
- package/dist/pptx/chunks/inspection-status-B2E-jSpG.d.ts.map +1 -0
- package/dist/pptx/cli/index.cjs +1409 -895
- package/dist/pptx/cli/index.mjs +1409 -895
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/index.cjs +1933 -1391
- package/dist/pptx/index.d.ts +20 -67
- package/dist/pptx/index.d.ts.map +1 -1
- package/dist/pptx/index.mjs +1933 -1391
- package/dist/pptx/signature-node/index.cjs +5 -5
- package/dist/pptx/signature-node/index.d.ts +1 -1
- package/dist/pptx/signature-node/index.mjs +5 -5
- package/dist/visio/edit-master-index.d.ts +10 -0
- package/dist/visio/edit-master-index.d.ts.map +1 -0
- package/dist/visio/edit-master-scope.d.ts +7 -0
- package/dist/visio/edit-master-scope.d.ts.map +1 -0
- package/dist/visio/edit-scope.d.ts.map +1 -1
- package/dist/visio/formula-arithmetic.d.ts +8 -0
- package/dist/visio/formula-arithmetic.d.ts.map +1 -0
- package/dist/visio/formula-evaluate.d.ts.map +1 -1
- package/dist/visio/formula-master.d.ts +13 -0
- package/dist/visio/formula-master.d.ts.map +1 -0
- package/dist/visio/formula-numeric-functions.d.ts +8 -0
- package/dist/visio/formula-numeric-functions.d.ts.map +1 -0
- package/dist/visio/formula.d.ts +1 -1
- package/dist/visio/formula.d.ts.map +1 -1
- package/dist/visio/index.cjs +540 -61
- package/dist/visio/index.mjs +540 -61
- package/dist/xlsx/edit/annotations.d.ts +5 -1
- package/dist/xlsx/edit/annotations.d.ts.map +1 -1
- package/dist/xlsx/edit/cell-values.d.ts +7 -2
- package/dist/xlsx/edit/cell-values.d.ts.map +1 -1
- package/dist/xlsx/edit/clipboard.d.ts.map +1 -1
- package/dist/xlsx/edit/doc-properties.d.ts +14 -0
- package/dist/xlsx/edit/doc-properties.d.ts.map +1 -0
- package/dist/xlsx/edit/fill-series.d.ts.map +1 -1
- package/dist/xlsx/edit/find.d.ts +2 -1
- package/dist/xlsx/edit/find.d.ts.map +1 -1
- package/dist/xlsx/edit/format-lines.d.ts +22 -0
- package/dist/xlsx/edit/format-lines.d.ts.map +1 -0
- package/dist/xlsx/edit/format.d.ts +2 -1
- package/dist/xlsx/edit/format.d.ts.map +1 -1
- package/dist/xlsx/edit/history-refs.d.ts +51 -0
- package/dist/xlsx/edit/history-refs.d.ts.map +1 -0
- package/dist/xlsx/edit/history.d.ts +40 -5
- package/dist/xlsx/edit/history.d.ts.map +1 -1
- package/dist/xlsx/edit/index.d.ts +3 -0
- package/dist/xlsx/edit/index.d.ts.map +1 -1
- package/dist/xlsx/edit/input-text.d.ts +13 -0
- package/dist/xlsx/edit/input-text.d.ts.map +1 -0
- package/dist/xlsx/edit/merge.d.ts +10 -2
- package/dist/xlsx/edit/merge.d.ts.map +1 -1
- package/dist/xlsx/edit/session.d.ts.map +1 -1
- package/dist/xlsx/edit/sheets.d.ts.map +1 -1
- package/dist/xlsx/edit/shift-formulas.d.ts +2 -1
- package/dist/xlsx/edit/shift-formulas.d.ts.map +1 -1
- package/dist/xlsx/edit/shift-preserved.d.ts +17 -0
- package/dist/xlsx/edit/shift-preserved.d.ts.map +1 -0
- package/dist/xlsx/edit/shift-sheet.d.ts +2 -2
- package/dist/xlsx/edit/shift-sheet.d.ts.map +1 -1
- package/dist/xlsx/edit/structure.d.ts.map +1 -1
- package/dist/xlsx/edit/types.d.ts +7 -0
- package/dist/xlsx/edit/types.d.ts.map +1 -1
- package/dist/xlsx/edit/validation-list.d.ts +24 -0
- package/dist/xlsx/edit/validation-list.d.ts.map +1 -0
- package/dist/xlsx/edit/validation.d.ts +2 -1
- package/dist/xlsx/edit/validation.d.ts.map +1 -1
- package/dist/xlsx/formula/area-index.d.ts +18 -0
- package/dist/xlsx/formula/area-index.d.ts.map +1 -0
- package/dist/xlsx/formula/array-context.d.ts.map +1 -1
- package/dist/xlsx/formula/ast.d.ts +5 -1
- package/dist/xlsx/formula/ast.d.ts.map +1 -1
- package/dist/xlsx/formula/call.d.ts.map +1 -1
- package/dist/xlsx/formula/coerce.d.ts.map +1 -1
- package/dist/xlsx/formula/context.d.ts +5 -0
- package/dist/xlsx/formula/context.d.ts.map +1 -1
- package/dist/xlsx/formula/date-serial.d.ts +11 -4
- package/dist/xlsx/formula/date-serial.d.ts.map +1 -1
- package/dist/xlsx/formula/engine-core.d.ts +6 -0
- package/dist/xlsx/formula/engine-core.d.ts.map +1 -1
- package/dist/xlsx/formula/engine-host.d.ts +35 -3
- package/dist/xlsx/formula/engine-host.d.ts.map +1 -1
- package/dist/xlsx/formula/engine-util.d.ts.map +1 -1
- package/dist/xlsx/formula/engine.d.ts.map +1 -1
- package/dist/xlsx/formula/evaluator.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/array-shape.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/array.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/criteria-index.d.ts +12 -0
- package/dist/xlsx/formula/functions/criteria-index.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/criteria.d.ts +24 -16
- package/dist/xlsx/formula/functions/criteria.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/date-calc.d.ts +4 -0
- package/dist/xlsx/formula/functions/date-calc.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/depreciation.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/financial.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/helpers.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/logical.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/lookup-core.d.ts +14 -2
- package/dist/xlsx/formula/functions/lookup-core.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/lookup.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/math-mod.d.ts +8 -0
- package/dist/xlsx/formula/functions/math-mod.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/math-sum.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/math.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/statistical-count.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/statistical.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/stats-core.d.ts +6 -0
- package/dist/xlsx/formula/functions/stats-core.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/text-case.d.ts +14 -0
- package/dist/xlsx/formula/functions/text-case.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/text.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/workdays.d.ts.map +1 -1
- package/dist/xlsx/formula/graph-index.d.ts +15 -0
- package/dist/xlsx/formula/graph-index.d.ts.map +1 -0
- package/dist/xlsx/formula/graph.d.ts +13 -18
- package/dist/xlsx/formula/graph.d.ts.map +1 -1
- package/dist/xlsx/formula/operators.d.ts +9 -0
- package/dist/xlsx/formula/operators.d.ts.map +1 -1
- package/dist/xlsx/formula/parser.d.ts +2 -0
- package/dist/xlsx/formula/parser.d.ts.map +1 -1
- package/dist/xlsx/formula/references.d.ts +4 -1
- package/dist/xlsx/formula/references.d.ts.map +1 -1
- package/dist/xlsx/formula/text-number.d.ts.map +1 -1
- package/dist/xlsx/formula/transform.d.ts.map +1 -1
- package/dist/xlsx/formula/values.d.ts +44 -3
- package/dist/xlsx/formula/values.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +4698 -1322
- package/dist/xlsx/index.mjs +4688 -1323
- package/dist/xlsx/layout/anchors.d.ts +47 -0
- package/dist/xlsx/layout/anchors.d.ts.map +1 -0
- package/dist/xlsx/layout/cf-evaluator.d.ts +1 -2
- package/dist/xlsx/layout/cf-evaluator.d.ts.map +1 -1
- package/dist/xlsx/layout/cf-helpers.d.ts +8 -1
- package/dist/xlsx/layout/cf-helpers.d.ts.map +1 -1
- package/dist/xlsx/layout/index.d.ts +1 -0
- package/dist/xlsx/layout/index.d.ts.map +1 -1
- package/dist/xlsx/load/csv.d.ts +24 -3
- package/dist/xlsx/load/csv.d.ts.map +1 -1
- package/dist/xlsx/load/detect.d.ts +39 -7
- package/dist/xlsx/load/detect.d.ts.map +1 -1
- package/dist/xlsx/load/errors.d.ts +10 -0
- package/dist/xlsx/load/errors.d.ts.map +1 -0
- package/dist/xlsx/load/index.cjs +16220 -12163
- package/dist/xlsx/load/index.d.ts +5 -2
- package/dist/xlsx/load/index.d.ts.map +1 -1
- package/dist/xlsx/load/index.mjs +16213 -12164
- package/dist/xlsx/load/text-decode.d.ts +7 -0
- package/dist/xlsx/load/text-decode.d.ts.map +1 -0
- package/dist/xlsx/model.d.ts +121 -17
- package/dist/xlsx/model.d.ts.map +1 -1
- package/dist/xlsx/numfmt/date.d.ts +7 -0
- package/dist/xlsx/numfmt/date.d.ts.map +1 -1
- package/dist/xlsx/numfmt/format.d.ts.map +1 -1
- package/dist/xlsx/numfmt/fraction.d.ts +5 -1
- package/dist/xlsx/numfmt/fraction.d.ts.map +1 -1
- package/dist/xlsx/numfmt/input-date.d.ts.map +1 -1
- package/dist/xlsx/numfmt/input.d.ts.map +1 -1
- package/dist/xlsx/numfmt/number.d.ts.map +1 -1
- package/dist/xlsx/read/conditional.d.ts.map +1 -1
- package/dist/xlsx/read/drawing.d.ts +2 -2
- package/dist/xlsx/read/drawing.d.ts.map +1 -1
- package/dist/xlsx/read/load.d.ts.map +1 -1
- package/dist/xlsx/read/package.d.ts +18 -2
- package/dist/xlsx/read/package.d.ts.map +1 -1
- package/dist/xlsx/read/sheet-data.d.ts.map +1 -1
- package/dist/xlsx/read/sheet-props.d.ts +15 -1
- package/dist/xlsx/read/sheet-props.d.ts.map +1 -1
- package/dist/xlsx/read/smart-art.d.ts +12 -0
- package/dist/xlsx/read/smart-art.d.ts.map +1 -0
- package/dist/xlsx/read/styles.d.ts.map +1 -1
- package/dist/xlsx/read/workbook-part.d.ts +5 -2
- package/dist/xlsx/read/workbook-part.d.ts.map +1 -1
- package/dist/xlsx/read/worksheet.d.ts.map +1 -1
- package/dist/xlsx/write/attr-merge.d.ts +10 -0
- package/dist/xlsx/write/attr-merge.d.ts.map +1 -0
- package/dist/xlsx/write/carried-refs.d.ts +61 -0
- package/dist/xlsx/write/carried-refs.d.ts.map +1 -0
- package/dist/xlsx/write/comments.d.ts +12 -2
- package/dist/xlsx/write/comments.d.ts.map +1 -1
- package/dist/xlsx/write/conditional.d.ts.map +1 -1
- package/dist/xlsx/write/doc-props.d.ts +30 -0
- package/dist/xlsx/write/doc-props.d.ts.map +1 -0
- package/dist/xlsx/write/drawing.d.ts +5 -0
- package/dist/xlsx/write/drawing.d.ts.map +1 -1
- package/dist/xlsx/write/metadata.d.ts +23 -0
- package/dist/xlsx/write/metadata.d.ts.map +1 -0
- package/dist/xlsx/write/package-writer.d.ts +6 -0
- package/dist/xlsx/write/package-writer.d.ts.map +1 -1
- package/dist/xlsx/write/page-setup.d.ts +8 -0
- package/dist/xlsx/write/page-setup.d.ts.map +1 -0
- package/dist/xlsx/write/save.d.ts.map +1 -1
- package/dist/xlsx/write/sheet-data.d.ts +8 -0
- package/dist/xlsx/write/sheet-data.d.ts.map +1 -1
- package/dist/xlsx/write/sheet-parts.d.ts +6 -0
- package/dist/xlsx/write/sheet-parts.d.ts.map +1 -1
- package/dist/xlsx/write/sheet-props.d.ts +0 -6
- package/dist/xlsx/write/sheet-props.d.ts.map +1 -1
- package/dist/xlsx/write/styles.d.ts.map +1 -1
- package/dist/xlsx/write/table-patch.d.ts +12 -0
- package/dist/xlsx/write/table-patch.d.ts.map +1 -0
- package/dist/xlsx/write/tables.d.ts +9 -0
- package/dist/xlsx/write/tables.d.ts.map +1 -1
- package/dist/xlsx/write/vml-ids.d.ts +29 -0
- package/dist/xlsx/write/vml-ids.d.ts.map +1 -0
- package/dist/xlsx/write/workbook-part.d.ts +1 -4
- package/dist/xlsx/write/workbook-part.d.ts.map +1 -1
- package/dist/xlsx/write/worksheet.d.ts.map +1 -1
- package/dist/xml/index.cjs +4 -0
- package/dist/xml/index.mjs +4 -0
- package/dist/xml/namespaces.d.ts +4 -0
- package/dist/xml/namespaces.d.ts.map +1 -1
- package/package.json +6 -1
- package/dist/pptx/chunks/index-CojJtI77.d.ts.map +0 -1
- package/dist/pptx/chunks/signature-inspection-status-Bh2oap7B.d.ts.map +0 -1
package/dist/pptx/index.mjs
CHANGED
|
@@ -3161,9 +3161,9 @@ function chartColorChoiceValue(authored, color2, resolveColor2, opacity2) {
|
|
|
3161
3161
|
opacity2
|
|
3162
3162
|
);
|
|
3163
3163
|
}
|
|
3164
|
-
function writeChartColorChoice(
|
|
3165
|
-
|
|
3166
|
-
|
|
3164
|
+
function writeChartColorChoice(container2, key2, color2, resolveColor2, opacity2) {
|
|
3165
|
+
container2[key2] = chartColorChoiceValue(
|
|
3166
|
+
container2[key2],
|
|
3167
3167
|
color2,
|
|
3168
3168
|
resolveColor2,
|
|
3169
3169
|
opacity2
|
|
@@ -21427,12 +21427,12 @@ var init_ole2_parser_write_serialize = __esm({
|
|
|
21427
21427
|
});
|
|
21428
21428
|
|
|
21429
21429
|
// node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ole2-parser-write.js
|
|
21430
|
-
function buildOle2(
|
|
21430
|
+
function buildOle2(streams2, rootClsid, miniStreamCutoff = 4096) {
|
|
21431
21431
|
const sectorSize = 512;
|
|
21432
21432
|
const miniSectorSize = 64;
|
|
21433
21433
|
const regularStreams = [];
|
|
21434
21434
|
const miniStreams = [];
|
|
21435
|
-
for (const [name, data] of
|
|
21435
|
+
for (const [name, data] of streams2) {
|
|
21436
21436
|
if (data.length < miniStreamCutoff) {
|
|
21437
21437
|
miniStreams.push({ name, data });
|
|
21438
21438
|
} else {
|
|
@@ -21656,32 +21656,32 @@ function replaceOleEmbedding(originalBytes, newPayloadBytes, options = {}) {
|
|
|
21656
21656
|
const existing = ole.getStream(nativeStreamName);
|
|
21657
21657
|
const decoded = decodeOle10Native(existing);
|
|
21658
21658
|
const fileName = options.fileName ?? decoded?.fileName ?? "file.bin";
|
|
21659
|
-
const
|
|
21659
|
+
const streams2 = /* @__PURE__ */ new Map();
|
|
21660
21660
|
for (const entry of ole.entries) {
|
|
21661
21661
|
if (entry.name === "Root Entry" || entry.name === nativeStreamName) {
|
|
21662
21662
|
continue;
|
|
21663
21663
|
}
|
|
21664
21664
|
const data = ole.getStream(entry.name);
|
|
21665
21665
|
if (data) {
|
|
21666
|
-
|
|
21666
|
+
streams2.set(entry.name, data);
|
|
21667
21667
|
}
|
|
21668
21668
|
}
|
|
21669
|
-
|
|
21670
|
-
return new Uint8Array(buildOle2(
|
|
21669
|
+
streams2.set(nativeStreamName, encodeOle10Native(fileName, newPayloadBytes));
|
|
21670
|
+
return new Uint8Array(buildOle2(streams2));
|
|
21671
21671
|
}
|
|
21672
21672
|
if (ole.getStream(CONTENTS_STREAM2)) {
|
|
21673
|
-
const
|
|
21673
|
+
const streams2 = /* @__PURE__ */ new Map();
|
|
21674
21674
|
for (const entry of ole.entries) {
|
|
21675
21675
|
if (entry.name === "Root Entry" || entry.name === CONTENTS_STREAM2) {
|
|
21676
21676
|
continue;
|
|
21677
21677
|
}
|
|
21678
21678
|
const data = ole.getStream(entry.name);
|
|
21679
21679
|
if (data) {
|
|
21680
|
-
|
|
21680
|
+
streams2.set(entry.name, data);
|
|
21681
21681
|
}
|
|
21682
21682
|
}
|
|
21683
|
-
|
|
21684
|
-
return new Uint8Array(buildOle2(
|
|
21683
|
+
streams2.set(CONTENTS_STREAM2, newPayloadBytes);
|
|
21684
|
+
return new Uint8Array(buildOle2(streams2));
|
|
21685
21685
|
}
|
|
21686
21686
|
return newPayloadBytes;
|
|
21687
21687
|
} catch {
|
|
@@ -22617,17 +22617,17 @@ function unwrapXlsBytes(bytes) {
|
|
|
22617
22617
|
}
|
|
22618
22618
|
if (!canRebuild)
|
|
22619
22619
|
return originalBytes;
|
|
22620
|
-
const
|
|
22620
|
+
const streams2 = /* @__PURE__ */ new Map();
|
|
22621
22621
|
for (const entry of ole.entries) {
|
|
22622
22622
|
if (entry.type !== ENTRY_TYPE_STREAM) {
|
|
22623
22623
|
continue;
|
|
22624
22624
|
}
|
|
22625
22625
|
const data = entry.name.toLowerCase() === streamEntry.name.toLowerCase() ? editedWorkbookBytes : ole.getStream(entry.name);
|
|
22626
22626
|
if (data) {
|
|
22627
|
-
|
|
22627
|
+
streams2.set(entry.name, data);
|
|
22628
22628
|
}
|
|
22629
22629
|
}
|
|
22630
|
-
return new Uint8Array(buildOle2(
|
|
22630
|
+
return new Uint8Array(buildOle2(streams2, rootClsid));
|
|
22631
22631
|
}
|
|
22632
22632
|
};
|
|
22633
22633
|
} catch {
|
|
@@ -23339,17 +23339,17 @@ function unwrapDocBytes(bytes) {
|
|
|
23339
23339
|
tableStreamName: fib.tableStreamName,
|
|
23340
23340
|
tableBytes,
|
|
23341
23341
|
rewrap: (editedWordDocBytes, editedTableBytes) => {
|
|
23342
|
-
const
|
|
23342
|
+
const streams2 = /* @__PURE__ */ new Map();
|
|
23343
23343
|
for (const entry of ole.entries) {
|
|
23344
23344
|
if (entry.type !== ENTRY_TYPE_STREAM) {
|
|
23345
23345
|
continue;
|
|
23346
23346
|
}
|
|
23347
23347
|
const data = entry.name === "WordDocument" ? editedWordDocBytes : entry.name === fib.tableStreamName ? editedTableBytes : ole.getStream(entry.name);
|
|
23348
23348
|
if (data) {
|
|
23349
|
-
|
|
23349
|
+
streams2.set(entry.name, data);
|
|
23350
23350
|
}
|
|
23351
23351
|
}
|
|
23352
|
-
return new Uint8Array(buildOle2(
|
|
23352
|
+
return new Uint8Array(buildOle2(streams2, rootClsid));
|
|
23353
23353
|
}
|
|
23354
23354
|
};
|
|
23355
23355
|
} catch {
|
|
@@ -37121,16 +37121,16 @@ var init_smartart_layout_interpreter_composite_slots = __esm({
|
|
|
37121
37121
|
|
|
37122
37122
|
// src/pptx/core/utils/smartart-layout-interpreter-composite-iteration.ts
|
|
37123
37123
|
function resolveIterationRect(dims, box, iteration, iterationCount) {
|
|
37124
|
-
const
|
|
37124
|
+
const container2 = resolveSlot(dims, box, 1, 1);
|
|
37125
37125
|
if (iterationCount <= 1) {
|
|
37126
|
-
return
|
|
37126
|
+
return container2;
|
|
37127
37127
|
}
|
|
37128
|
-
if (
|
|
37129
|
-
const width =
|
|
37130
|
-
return { x:
|
|
37128
|
+
if (container2.width >= container2.height) {
|
|
37129
|
+
const width = container2.width / iterationCount;
|
|
37130
|
+
return { x: container2.x + width * iteration, y: container2.y, width, height: container2.height };
|
|
37131
37131
|
}
|
|
37132
|
-
const height =
|
|
37133
|
-
return { x:
|
|
37132
|
+
const height = container2.height / iterationCount;
|
|
37133
|
+
return { x: container2.x, y: container2.y + height * iteration, width: container2.width, height };
|
|
37134
37134
|
}
|
|
37135
37135
|
var init_smartart_layout_interpreter_composite_iteration = __esm({
|
|
37136
37136
|
"src/pptx/core/utils/smartart-layout-interpreter-composite-iteration.ts"() {
|
|
@@ -42070,9 +42070,9 @@ function findVarsContainer(node) {
|
|
|
42070
42070
|
continue;
|
|
42071
42071
|
}
|
|
42072
42072
|
if (CONTAINER_LOCAL_NAMES.has(localNameOf4(key2))) {
|
|
42073
|
-
const
|
|
42074
|
-
if (
|
|
42075
|
-
return
|
|
42073
|
+
const container2 = Array.isArray(value) ? value[0] : value;
|
|
42074
|
+
if (container2 && typeof container2 === "object") {
|
|
42075
|
+
return container2;
|
|
42076
42076
|
}
|
|
42077
42077
|
}
|
|
42078
42078
|
const nested = findVarsContainer(value);
|
|
@@ -42129,8 +42129,8 @@ function findNamedPresVars(node, presName) {
|
|
|
42129
42129
|
}
|
|
42130
42130
|
return void 0;
|
|
42131
42131
|
}
|
|
42132
|
-
function varValue(
|
|
42133
|
-
for (const [key2, value] of Object.entries(
|
|
42132
|
+
function varValue(container2, name) {
|
|
42133
|
+
for (const [key2, value] of Object.entries(container2)) {
|
|
42134
42134
|
if (key2.startsWith("@_") || localNameOf4(key2) !== name) {
|
|
42135
42135
|
continue;
|
|
42136
42136
|
}
|
|
@@ -42143,27 +42143,27 @@ function varValue(container, name) {
|
|
|
42143
42143
|
}
|
|
42144
42144
|
return void 0;
|
|
42145
42145
|
}
|
|
42146
|
-
function boolValue(
|
|
42147
|
-
const raw = varValue(
|
|
42146
|
+
function boolValue(container2, name) {
|
|
42147
|
+
const raw = varValue(container2, name);
|
|
42148
42148
|
if (raw === void 0) {
|
|
42149
42149
|
return void 0;
|
|
42150
42150
|
}
|
|
42151
42151
|
const lower = raw.toLowerCase();
|
|
42152
42152
|
return lower === "1" || lower === "true" || lower === "on";
|
|
42153
42153
|
}
|
|
42154
|
-
function intValue(
|
|
42155
|
-
const raw = varValue(
|
|
42154
|
+
function intValue(container2, name) {
|
|
42155
|
+
const raw = varValue(container2, name);
|
|
42156
42156
|
if (raw === void 0) {
|
|
42157
42157
|
return void 0;
|
|
42158
42158
|
}
|
|
42159
42159
|
const parsed = Number.parseInt(raw, 10);
|
|
42160
42160
|
return Number.isFinite(parsed) ? parsed : void 0;
|
|
42161
42161
|
}
|
|
42162
|
-
function parseSmartArtPresLayoutVars(
|
|
42163
|
-
if (!
|
|
42162
|
+
function parseSmartArtPresLayoutVars(container2) {
|
|
42163
|
+
if (!container2) {
|
|
42164
42164
|
return void 0;
|
|
42165
42165
|
}
|
|
42166
|
-
const vars = findVarsContainer(
|
|
42166
|
+
const vars = findVarsContainer(container2);
|
|
42167
42167
|
if (!vars) {
|
|
42168
42168
|
return void 0;
|
|
42169
42169
|
}
|
|
@@ -42204,7 +42204,7 @@ function parseSmartArtPresLayoutVars(container) {
|
|
|
42204
42204
|
if (resizeHandles !== void 0) {
|
|
42205
42205
|
result.resizeHandles = resizeHandles;
|
|
42206
42206
|
}
|
|
42207
|
-
const hierRootVars = findNamedPresVars(
|
|
42207
|
+
const hierRootVars = findNamedPresVars(container2, "hierRoot1");
|
|
42208
42208
|
if (hierRootVars) {
|
|
42209
42209
|
const rootHierBranch = varValue(hierRootVars, "hierBranch");
|
|
42210
42210
|
if (rootHierBranch && HIER_BRANCHES.has(rootHierBranch)) {
|
|
@@ -42213,7 +42213,7 @@ function parseSmartArtPresLayoutVars(container) {
|
|
|
42213
42213
|
result.hierarchyBranch = "init";
|
|
42214
42214
|
}
|
|
42215
42215
|
}
|
|
42216
|
-
const rootTextVars = findNamedPresVars(
|
|
42216
|
+
const rootTextVars = findNamedPresVars(container2, "rootText1");
|
|
42217
42217
|
if (rootTextVars) {
|
|
42218
42218
|
const rootChMax = intValue(rootTextVars, "chMax");
|
|
42219
42219
|
if (rootChMax !== void 0) {
|
|
@@ -42543,6 +42543,7 @@ var init_relationship_types = __esm({
|
|
|
42543
42543
|
diagramDrawing: "http://schemas.microsoft.com/office/2007/relationships/diagramDrawing",
|
|
42544
42544
|
coreProperties: "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",
|
|
42545
42545
|
extendedProperties: `${BASE}/extended-properties`,
|
|
42546
|
+
customProperties: `${BASE}/custom-properties`,
|
|
42546
42547
|
customXml: `${BASE}/customXml`,
|
|
42547
42548
|
worksheet: `${BASE}/worksheet`,
|
|
42548
42549
|
chartsheet: `${BASE}/chartsheet`,
|
|
@@ -42582,8 +42583,406 @@ var init_package = __esm({
|
|
|
42582
42583
|
});
|
|
42583
42584
|
|
|
42584
42585
|
// src/opc/safe-href.ts
|
|
42586
|
+
var OPEN_SCHEMES;
|
|
42585
42587
|
var init_safe_href = __esm({
|
|
42586
42588
|
"src/opc/safe-href.ts"() {
|
|
42589
|
+
OPEN_SCHEMES = /* @__PURE__ */ new Set(["http", "https", "mailto"]);
|
|
42590
|
+
/* @__PURE__ */ new Set([...OPEN_SCHEMES, "ftp", "file"]);
|
|
42591
|
+
}
|
|
42592
|
+
});
|
|
42593
|
+
|
|
42594
|
+
// src/opc/properties/types.ts
|
|
42595
|
+
var init_types3 = __esm({
|
|
42596
|
+
"src/opc/properties/types.ts"() {
|
|
42597
|
+
}
|
|
42598
|
+
});
|
|
42599
|
+
|
|
42600
|
+
// src/opc/properties/index.ts
|
|
42601
|
+
var init_properties = __esm({
|
|
42602
|
+
"src/opc/properties/index.ts"() {
|
|
42603
|
+
init_types3();
|
|
42604
|
+
}
|
|
42605
|
+
});
|
|
42606
|
+
|
|
42607
|
+
// src/opc/signature/detection.ts
|
|
42608
|
+
function detectDigitalSignatures(zipEntryPaths) {
|
|
42609
|
+
const sigPaths = zipEntryPaths.filter(
|
|
42610
|
+
(p) => p.startsWith(SIGNATURE_PREFIX) && p.endsWith(".xml")
|
|
42611
|
+
);
|
|
42612
|
+
return {
|
|
42613
|
+
hasSignatures: sigPaths.length > 0,
|
|
42614
|
+
signatureCount: sigPaths.length,
|
|
42615
|
+
signaturePaths: sigPaths
|
|
42616
|
+
};
|
|
42617
|
+
}
|
|
42618
|
+
function getSignaturePathsToStrip(zipEntryPaths) {
|
|
42619
|
+
return zipEntryPaths.filter((p) => p.startsWith(SIGNATURE_PREFIX));
|
|
42620
|
+
}
|
|
42621
|
+
function findByLocalName(parent, localName29) {
|
|
42622
|
+
if (!parent) {
|
|
42623
|
+
return void 0;
|
|
42624
|
+
}
|
|
42625
|
+
if (parent[localName29] !== void 0 && typeof parent[localName29] === "object") {
|
|
42626
|
+
return parent[localName29];
|
|
42627
|
+
}
|
|
42628
|
+
for (const key2 of Object.keys(parent)) {
|
|
42629
|
+
const parts = key2.split(":");
|
|
42630
|
+
if (parts[parts.length - 1] === localName29 && typeof parent[key2] === "object") {
|
|
42631
|
+
return parent[key2];
|
|
42632
|
+
}
|
|
42633
|
+
}
|
|
42634
|
+
return void 0;
|
|
42635
|
+
}
|
|
42636
|
+
function findScalarByLocalName(parent, localName29) {
|
|
42637
|
+
if (!parent) {
|
|
42638
|
+
return void 0;
|
|
42639
|
+
}
|
|
42640
|
+
if (parent[localName29] !== void 0) {
|
|
42641
|
+
const v = parent[localName29];
|
|
42642
|
+
if (typeof v === "string") {
|
|
42643
|
+
return v;
|
|
42644
|
+
}
|
|
42645
|
+
if (typeof v === "number" || typeof v === "boolean") {
|
|
42646
|
+
return String(v);
|
|
42647
|
+
}
|
|
42648
|
+
if (typeof v === "object" && v !== null && "#text" in v) {
|
|
42649
|
+
return String(v["#text"]);
|
|
42650
|
+
}
|
|
42651
|
+
}
|
|
42652
|
+
for (const key2 of Object.keys(parent)) {
|
|
42653
|
+
const parts = key2.split(":");
|
|
42654
|
+
if (parts[parts.length - 1] === localName29) {
|
|
42655
|
+
const v = parent[key2];
|
|
42656
|
+
if (typeof v === "string") {
|
|
42657
|
+
return v;
|
|
42658
|
+
}
|
|
42659
|
+
if (typeof v === "number" || typeof v === "boolean") {
|
|
42660
|
+
return String(v);
|
|
42661
|
+
}
|
|
42662
|
+
if (typeof v === "object" && v !== null && "#text" in v) {
|
|
42663
|
+
return String(v["#text"]);
|
|
42664
|
+
}
|
|
42665
|
+
}
|
|
42666
|
+
}
|
|
42667
|
+
return void 0;
|
|
42668
|
+
}
|
|
42669
|
+
function findAllByLocalName(parent, localName29) {
|
|
42670
|
+
if (!parent) {
|
|
42671
|
+
return [];
|
|
42672
|
+
}
|
|
42673
|
+
for (const key2 of Object.keys(parent)) {
|
|
42674
|
+
const parts = key2.split(":");
|
|
42675
|
+
if (parts[parts.length - 1] === localName29) {
|
|
42676
|
+
const v = parent[key2];
|
|
42677
|
+
if (Array.isArray(v)) {
|
|
42678
|
+
return v;
|
|
42679
|
+
}
|
|
42680
|
+
if (typeof v === "object" && v !== null) {
|
|
42681
|
+
return [v];
|
|
42682
|
+
}
|
|
42683
|
+
}
|
|
42684
|
+
}
|
|
42685
|
+
return [];
|
|
42686
|
+
}
|
|
42687
|
+
function parseSignatureXml(signatureXml, signaturePath) {
|
|
42688
|
+
const signature = findByLocalName(signatureXml, "Signature");
|
|
42689
|
+
const signedInfo = findByLocalName(signature, "SignedInfo");
|
|
42690
|
+
const sigMethodNode = findByLocalName(signedInfo, "SignatureMethod");
|
|
42691
|
+
const signatureMethod = sigMethodNode?.["@_Algorithm"];
|
|
42692
|
+
const signatureValue = findScalarByLocalName(signature, "SignatureValue")?.replace(/\s+/g, "");
|
|
42693
|
+
const references = [];
|
|
42694
|
+
const refNodes = findAllByLocalName(signedInfo, "Reference");
|
|
42695
|
+
for (const ref of refNodes) {
|
|
42696
|
+
const uri = String(ref["@_URI"] || "");
|
|
42697
|
+
const dmNode = findByLocalName(ref, "DigestMethod");
|
|
42698
|
+
const digestMethod2 = dmNode?.["@_Algorithm"];
|
|
42699
|
+
const digestValue = findScalarByLocalName(ref, "DigestValue")?.replace(/\s+/g, "");
|
|
42700
|
+
references.push({
|
|
42701
|
+
uri,
|
|
42702
|
+
...digestMethod2 === void 0 ? {} : { digestMethod: digestMethod2 },
|
|
42703
|
+
...digestValue === void 0 ? {} : { digestValue }
|
|
42704
|
+
});
|
|
42705
|
+
}
|
|
42706
|
+
const digestMethod = references[0]?.digestMethod;
|
|
42707
|
+
const keyInfo = findByLocalName(signature, "KeyInfo");
|
|
42708
|
+
const x509Data = findByLocalName(keyInfo, "X509Data");
|
|
42709
|
+
let certificate;
|
|
42710
|
+
if (x509Data) {
|
|
42711
|
+
const certBase64 = findScalarByLocalName(x509Data, "X509Certificate")?.replace(/\s+/g, "");
|
|
42712
|
+
if (certBase64) {
|
|
42713
|
+
const issuerSerial = findByLocalName(x509Data, "X509IssuerSerial");
|
|
42714
|
+
const issuer = findScalarByLocalName(issuerSerial, "X509IssuerName");
|
|
42715
|
+
const serialNumber = findScalarByLocalName(issuerSerial, "X509SerialNumber");
|
|
42716
|
+
const subject = findScalarByLocalName(x509Data, "X509SubjectName");
|
|
42717
|
+
certificate = {
|
|
42718
|
+
certificateBase64: certBase64,
|
|
42719
|
+
...issuer ? { issuer } : {},
|
|
42720
|
+
...subject ? { subject } : {},
|
|
42721
|
+
...serialNumber ? { serialNumber } : {}
|
|
42722
|
+
};
|
|
42723
|
+
}
|
|
42724
|
+
}
|
|
42725
|
+
let status = "unverified";
|
|
42726
|
+
if (certificate?.validTo) {
|
|
42727
|
+
const expiry = new Date(certificate.validTo);
|
|
42728
|
+
if (expiry < /* @__PURE__ */ new Date()) {
|
|
42729
|
+
status = "expired";
|
|
42730
|
+
}
|
|
42731
|
+
}
|
|
42732
|
+
return {
|
|
42733
|
+
signaturePath,
|
|
42734
|
+
...signatureMethod === void 0 ? {} : { signatureMethod },
|
|
42735
|
+
...digestMethod === void 0 ? {} : { digestMethod },
|
|
42736
|
+
...signatureValue === void 0 ? {} : { signatureValue },
|
|
42737
|
+
...certificate === void 0 ? {} : { certificate },
|
|
42738
|
+
status,
|
|
42739
|
+
references
|
|
42740
|
+
};
|
|
42741
|
+
}
|
|
42742
|
+
async function verifySignatureDigests(signature, getPartContent) {
|
|
42743
|
+
if (!signature.references.length) {
|
|
42744
|
+
return "unverified";
|
|
42745
|
+
}
|
|
42746
|
+
if (typeof globalThis.crypto?.subtle === "undefined") {
|
|
42747
|
+
return "unverified";
|
|
42748
|
+
}
|
|
42749
|
+
for (const ref of signature.references) {
|
|
42750
|
+
if (!ref.digestValue || !ref.uri) {
|
|
42751
|
+
continue;
|
|
42752
|
+
}
|
|
42753
|
+
const algo = ref.digestMethod?.toLowerCase() || "";
|
|
42754
|
+
let hashAlgo;
|
|
42755
|
+
if (algo.includes("sha256") || algo.includes("sha-256")) {
|
|
42756
|
+
hashAlgo = "SHA-256";
|
|
42757
|
+
} else if (algo.includes("sha512") || algo.includes("sha-512")) {
|
|
42758
|
+
hashAlgo = "SHA-512";
|
|
42759
|
+
} else if (algo.includes("sha1") || algo.includes("sha-1")) {
|
|
42760
|
+
hashAlgo = "SHA-1";
|
|
42761
|
+
} else {
|
|
42762
|
+
continue;
|
|
42763
|
+
}
|
|
42764
|
+
const content = await getPartContent(ref.uri);
|
|
42765
|
+
if (!content) {
|
|
42766
|
+
continue;
|
|
42767
|
+
}
|
|
42768
|
+
try {
|
|
42769
|
+
const digest2 = await crypto.subtle.digest(hashAlgo, content);
|
|
42770
|
+
const digestBase64 = arrayBufferToBase64(digest2);
|
|
42771
|
+
if (digestBase64 !== ref.digestValue) {
|
|
42772
|
+
return "invalid";
|
|
42773
|
+
}
|
|
42774
|
+
} catch {
|
|
42775
|
+
return "unverified";
|
|
42776
|
+
}
|
|
42777
|
+
}
|
|
42778
|
+
return signature.certificate ? "valid" : "unknownCA";
|
|
42779
|
+
}
|
|
42780
|
+
function arrayBufferToBase64(buffer) {
|
|
42781
|
+
const bytes = new Uint8Array(buffer);
|
|
42782
|
+
let binary = "";
|
|
42783
|
+
for (let i2 = 0; i2 < bytes.byteLength; i2++) {
|
|
42784
|
+
binary += String.fromCharCode(bytes[i2]);
|
|
42785
|
+
}
|
|
42786
|
+
return btoa(binary);
|
|
42787
|
+
}
|
|
42788
|
+
var SIGNATURE_PART_PREFIX, SIGNATURE_PREFIX;
|
|
42789
|
+
var init_detection = __esm({
|
|
42790
|
+
"src/opc/signature/detection.ts"() {
|
|
42791
|
+
SIGNATURE_PART_PREFIX = "_xmlsignatures/";
|
|
42792
|
+
SIGNATURE_PREFIX = SIGNATURE_PART_PREFIX;
|
|
42793
|
+
}
|
|
42794
|
+
});
|
|
42795
|
+
|
|
42796
|
+
// src/opc/signature/constants.ts
|
|
42797
|
+
var DIGITAL_SIGNATURE_ORIGIN_REL_TYPE, DIGITAL_SIGNATURE_REL_TYPE, PPTX_VIEWER_MANIFEST_NS, XMLDSIG_NS, OPC_RELATIONSHIP_TRANSFORM, XML_TRANSFORM_ENVELOPED_SIGNATURE, SUPPORTED_XML_CANON_TRANSFORMS, ENTERPRISE_TRUST_ROOTS_FILE_ENV, ENTERPRISE_TRUST_ROOTS_PEM_ENV, ENTERPRISE_REQUIRE_REVOCATION_ENV, ENTERPRISE_FAIL_ON_REVOCATION_UNKNOWN_ENV, ENTERPRISE_REQUIRE_TIMESTAMP_ENV, DIGEST_ALGORITHM_TO_HASH, DIGEST_ALGORITHM_TO_WEB_CRYPTO;
|
|
42798
|
+
var init_constants3 = __esm({
|
|
42799
|
+
"src/opc/signature/constants.ts"() {
|
|
42800
|
+
DIGITAL_SIGNATURE_ORIGIN_REL_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/origin";
|
|
42801
|
+
DIGITAL_SIGNATURE_REL_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/signature";
|
|
42802
|
+
PPTX_VIEWER_MANIFEST_NS = "urn:pptx-viewer:ooxml-signature:v1";
|
|
42803
|
+
XMLDSIG_NS = "http://www.w3.org/2000/09/xmldsig#";
|
|
42804
|
+
OPC_RELATIONSHIP_TRANSFORM = "http://schemas.openxmlformats.org/package/2006/RelationshipTransform";
|
|
42805
|
+
XML_TRANSFORM_ENVELOPED_SIGNATURE = "http://www.w3.org/2000/09/xmldsig#enveloped-signature";
|
|
42806
|
+
SUPPORTED_XML_CANON_TRANSFORMS = /* @__PURE__ */ new Set([
|
|
42807
|
+
"http://www.w3.org/TR/2001/REC-xml-c14n-20010315",
|
|
42808
|
+
"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments",
|
|
42809
|
+
"http://www.w3.org/2001/10/xml-exc-c14n#",
|
|
42810
|
+
"http://www.w3.org/2001/10/xml-exc-c14n#WithComments",
|
|
42811
|
+
XML_TRANSFORM_ENVELOPED_SIGNATURE
|
|
42812
|
+
]);
|
|
42813
|
+
ENTERPRISE_TRUST_ROOTS_FILE_ENV = "PPTX_VIEWER_TRUST_ROOTS_FILE";
|
|
42814
|
+
ENTERPRISE_TRUST_ROOTS_PEM_ENV = "PPTX_VIEWER_TRUST_ROOTS_PEM";
|
|
42815
|
+
ENTERPRISE_REQUIRE_REVOCATION_ENV = "PPTX_VIEWER_REQUIRE_REVOCATION_CHECK";
|
|
42816
|
+
ENTERPRISE_FAIL_ON_REVOCATION_UNKNOWN_ENV = "PPTX_VIEWER_FAIL_ON_REVOCATION_UNKNOWN";
|
|
42817
|
+
ENTERPRISE_REQUIRE_TIMESTAMP_ENV = "PPTX_VIEWER_REQUIRE_TIMESTAMP";
|
|
42818
|
+
DIGEST_ALGORITHM_TO_HASH = {
|
|
42819
|
+
"http://www.w3.org/2000/09/xmldsig#sha1": "sha1",
|
|
42820
|
+
"http://www.w3.org/2001/04/xmlenc#sha256": "sha256",
|
|
42821
|
+
"http://www.w3.org/2001/04/xmlenc#sha384": "sha384",
|
|
42822
|
+
"http://www.w3.org/2001/04/xmlenc#sha512": "sha512"
|
|
42823
|
+
};
|
|
42824
|
+
DIGEST_ALGORITHM_TO_WEB_CRYPTO = {
|
|
42825
|
+
"http://www.w3.org/2000/09/xmldsig#sha1": "SHA-1",
|
|
42826
|
+
"http://www.w3.org/2001/04/xmlenc#sha256": "SHA-256",
|
|
42827
|
+
"http://www.w3.org/2001/04/xmlenc#sha384": "SHA-384",
|
|
42828
|
+
"http://www.w3.org/2001/04/xmlenc#sha512": "SHA-512"
|
|
42829
|
+
};
|
|
42830
|
+
}
|
|
42831
|
+
});
|
|
42832
|
+
|
|
42833
|
+
// src/opc/signature/xml-utils.ts
|
|
42834
|
+
function escapeXmlAttr(value) {
|
|
42835
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
42836
|
+
}
|
|
42837
|
+
function escapeXmlText(value) {
|
|
42838
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
42839
|
+
}
|
|
42840
|
+
function isValidBase64(value) {
|
|
42841
|
+
return typeof value === "string" && value.length > 0 && /^[A-Za-z0-9+/=\s]+$/.test(value);
|
|
42842
|
+
}
|
|
42843
|
+
function extractTagAttribute(xml, tagName, attributeName) {
|
|
42844
|
+
const pattern = new RegExp(
|
|
42845
|
+
`<${tagName}\\b[^>]*\\b${attributeName}="(?<attributeValue>[^"]+)"`,
|
|
42846
|
+
"i"
|
|
42847
|
+
);
|
|
42848
|
+
const match = xml.match(pattern);
|
|
42849
|
+
return match?.groups?.["attributeValue"]?.trim();
|
|
42850
|
+
}
|
|
42851
|
+
function extractFirstTagText(xml, localName29) {
|
|
42852
|
+
const pattern = new RegExp(
|
|
42853
|
+
`<([\\w.-]+:)?${localName29}\\b[^>]*>([\\s\\S]*?)<\\/([\\w.-]+:)?${localName29}>`,
|
|
42854
|
+
"i"
|
|
42855
|
+
);
|
|
42856
|
+
const match = xml.match(pattern);
|
|
42857
|
+
return match?.[2]?.replace(/\s+/g, "").trim() || void 0;
|
|
42858
|
+
}
|
|
42859
|
+
function extractAllTagText(xml, localName29) {
|
|
42860
|
+
const result = [];
|
|
42861
|
+
const regex = new RegExp(
|
|
42862
|
+
`<([\\w.-]+:)?${localName29}\\b[^>]*>([\\s\\S]*?)<\\/([\\w.-]+:)?${localName29}>`,
|
|
42863
|
+
"gi"
|
|
42864
|
+
);
|
|
42865
|
+
let match = regex.exec(xml);
|
|
42866
|
+
while (match) {
|
|
42867
|
+
const value = match[2]?.replace(/\s+/g, "").trim();
|
|
42868
|
+
if (value) {
|
|
42869
|
+
result.push(value);
|
|
42870
|
+
}
|
|
42871
|
+
match = regex.exec(xml);
|
|
42872
|
+
}
|
|
42873
|
+
return result;
|
|
42874
|
+
}
|
|
42875
|
+
var init_xml_utils2 = __esm({
|
|
42876
|
+
"src/opc/signature/xml-utils.ts"() {
|
|
42877
|
+
}
|
|
42878
|
+
});
|
|
42879
|
+
|
|
42880
|
+
// src/opc/signature/reference-utils.ts
|
|
42881
|
+
function normalizePartPath(partPath) {
|
|
42882
|
+
return partPath.replace(/\\/g, "/").replace(/^\/+/, "");
|
|
42883
|
+
}
|
|
42884
|
+
function resolveReferenceUriToPart(uri) {
|
|
42885
|
+
const trimmed = uri.trim();
|
|
42886
|
+
if (trimmed.length === 0 || trimmed.startsWith("#")) {
|
|
42887
|
+
return void 0;
|
|
42888
|
+
}
|
|
42889
|
+
const decoded = decodeURIComponent(trimmed);
|
|
42890
|
+
return normalizePartPath(decoded.startsWith("/") ? decoded.slice(1) : decoded);
|
|
42891
|
+
}
|
|
42892
|
+
var init_reference_utils = __esm({
|
|
42893
|
+
"src/opc/signature/reference-utils.ts"() {
|
|
42894
|
+
}
|
|
42895
|
+
});
|
|
42896
|
+
|
|
42897
|
+
// src/opc/signature/digest.ts
|
|
42898
|
+
async function computeDigestBase64(content, digestAlgorithmUri) {
|
|
42899
|
+
const webCryptoAlgo = DIGEST_ALGORITHM_TO_WEB_CRYPTO[digestAlgorithmUri];
|
|
42900
|
+
if (!webCryptoAlgo) {
|
|
42901
|
+
return void 0;
|
|
42902
|
+
}
|
|
42903
|
+
if (typeof globalThis.crypto?.subtle === "undefined") {
|
|
42904
|
+
return void 0;
|
|
42905
|
+
}
|
|
42906
|
+
const buf = new ArrayBuffer(content.byteLength);
|
|
42907
|
+
new Uint8Array(buf).set(content);
|
|
42908
|
+
const digest2 = await globalThis.crypto.subtle.digest(webCryptoAlgo, buf);
|
|
42909
|
+
return uint8ArrayToBase64(new Uint8Array(digest2));
|
|
42910
|
+
}
|
|
42911
|
+
function uint8ArrayToBase64(bytes) {
|
|
42912
|
+
let binary = "";
|
|
42913
|
+
for (let i2 = 0; i2 < bytes.byteLength; i2++) {
|
|
42914
|
+
binary += String.fromCharCode(bytes[i2]);
|
|
42915
|
+
}
|
|
42916
|
+
return btoa(binary);
|
|
42917
|
+
}
|
|
42918
|
+
var init_digest = __esm({
|
|
42919
|
+
"src/opc/signature/digest.ts"() {
|
|
42920
|
+
init_constants3();
|
|
42921
|
+
}
|
|
42922
|
+
});
|
|
42923
|
+
|
|
42924
|
+
// src/opc/signature/inspection-status.ts
|
|
42925
|
+
function computeDetailStatus(detail, policy) {
|
|
42926
|
+
const hasDigestMismatch = detail.referenceChecks.some(
|
|
42927
|
+
(check) => check.digestStatus === "mismatch"
|
|
42928
|
+
);
|
|
42929
|
+
const hasMissingPart = detail.missingPartReferences.length > 0;
|
|
42930
|
+
const hasVerifiedDigest = detail.referenceChecks.some(
|
|
42931
|
+
(check) => check.digestStatus === "verified"
|
|
42932
|
+
);
|
|
42933
|
+
const revocationUnknown = detail.certificateRevocationStatus === "unknown" || detail.certificateRevocationStatus === "not-checked" || detail.certificateRevocationStatus === "error";
|
|
42934
|
+
const timestampMissingOrUntrusted = detail.timestampAuthorityStatus === "not-present" || detail.timestampAuthorityStatus === "not-checked" || detail.timestampAuthorityStatus === "error" || detail.timestampAuthorityStatus === "untrusted";
|
|
42935
|
+
if (detail.signatureValueStatus === "invalid") {
|
|
42936
|
+
return "signature-invalid";
|
|
42937
|
+
}
|
|
42938
|
+
if (hasMissingPart) {
|
|
42939
|
+
return "reference-missing";
|
|
42940
|
+
}
|
|
42941
|
+
if (hasDigestMismatch) {
|
|
42942
|
+
return "digest-mismatch";
|
|
42943
|
+
}
|
|
42944
|
+
if (detail.certificateRevocationStatus === "revoked") {
|
|
42945
|
+
return "certificate-revoked";
|
|
42946
|
+
}
|
|
42947
|
+
if (policy.requireRevocationCheck && (policy.failOnRevocationUnknown ? revocationUnknown : detail.certificateRevocationStatus !== "good")) {
|
|
42948
|
+
return "certificate-untrusted";
|
|
42949
|
+
}
|
|
42950
|
+
if (detail.timestampAuthorityStatus === "invalid") {
|
|
42951
|
+
return "timestamp-invalid";
|
|
42952
|
+
}
|
|
42953
|
+
if (policy.requireTimestamp && timestampMissingOrUntrusted) {
|
|
42954
|
+
return "timestamp-untrusted";
|
|
42955
|
+
}
|
|
42956
|
+
if (detail.timestampAuthorityStatus === "untrusted") {
|
|
42957
|
+
return "timestamp-untrusted";
|
|
42958
|
+
}
|
|
42959
|
+
if (detail.certificateTrustStatus === "untrusted" && detail.signatureValueStatus === "verified") {
|
|
42960
|
+
return "certificate-untrusted";
|
|
42961
|
+
}
|
|
42962
|
+
if (hasVerifiedDigest && detail.signatureValueStatus === "verified") {
|
|
42963
|
+
return "verified";
|
|
42964
|
+
}
|
|
42965
|
+
return "structural-only";
|
|
42966
|
+
}
|
|
42967
|
+
function computeVerificationStatus(details) {
|
|
42968
|
+
const hasInvalidSignature = details.some((detail) => detail.status === "signature-invalid");
|
|
42969
|
+
const hasMissing = details.some((detail) => detail.status === "reference-missing");
|
|
42970
|
+
const hasMismatch = details.some((detail) => detail.status === "digest-mismatch");
|
|
42971
|
+
const hasUntrusted = details.some((detail) => detail.status === "certificate-untrusted");
|
|
42972
|
+
const hasRevoked = details.some((detail) => detail.status === "certificate-revoked");
|
|
42973
|
+
const hasTimestampInvalid = details.some((detail) => detail.status === "timestamp-invalid");
|
|
42974
|
+
const hasTimestampUntrusted = details.some((detail) => detail.status === "timestamp-untrusted");
|
|
42975
|
+
const allVerified = details.every((detail) => detail.status === "verified");
|
|
42976
|
+
return hasInvalidSignature ? "signature-invalid" : hasRevoked ? "certificate-revoked" : hasTimestampInvalid ? "timestamp-invalid" : hasTimestampUntrusted ? "timestamp-untrusted" : hasMissing ? "reference-missing" : hasMismatch ? "digest-mismatch" : allVerified ? "verified-trusted" : hasUntrusted ? "verified-untrusted" : "present-not-verified";
|
|
42977
|
+
}
|
|
42978
|
+
var init_inspection_status = __esm({
|
|
42979
|
+
"src/opc/signature/inspection-status.ts"() {
|
|
42980
|
+
}
|
|
42981
|
+
});
|
|
42982
|
+
|
|
42983
|
+
// src/opc/signature/index.ts
|
|
42984
|
+
var init_signature = __esm({
|
|
42985
|
+
"src/opc/signature/index.ts"() {
|
|
42587
42986
|
}
|
|
42588
42987
|
});
|
|
42589
42988
|
|
|
@@ -42595,6 +42994,8 @@ var init_opc = __esm({
|
|
|
42595
42994
|
init_content_types();
|
|
42596
42995
|
init_package();
|
|
42597
42996
|
init_safe_href();
|
|
42997
|
+
init_properties();
|
|
42998
|
+
init_signature();
|
|
42598
42999
|
}
|
|
42599
43000
|
});
|
|
42600
43001
|
|
|
@@ -44286,25 +44687,43 @@ var init_theme_override_utils = __esm({
|
|
|
44286
44687
|
}
|
|
44287
44688
|
});
|
|
44288
44689
|
|
|
44289
|
-
// src/
|
|
44290
|
-
function
|
|
44291
|
-
if (
|
|
44292
|
-
return
|
|
44293
|
-
}
|
|
44294
|
-
const header = new Uint8Array(data, 0, 8);
|
|
44295
|
-
if (OLE_MAGIC2.every((byte, i2) => header[i2] === byte)) {
|
|
44296
|
-
return { format: "ole", encrypted: true };
|
|
44690
|
+
// src/crypto/detect.ts
|
|
44691
|
+
function toArrayBuffer(bytes) {
|
|
44692
|
+
if (bytes.byteOffset === 0 && bytes.byteLength === bytes.buffer.byteLength) {
|
|
44693
|
+
return bytes.buffer;
|
|
44297
44694
|
}
|
|
44298
|
-
|
|
44299
|
-
|
|
44695
|
+
return bytes.slice().buffer;
|
|
44696
|
+
}
|
|
44697
|
+
function isCompoundFile(input) {
|
|
44698
|
+
const bytes = toBytes(input);
|
|
44699
|
+
return bytes.length >= 8 && OLE_MAGIC2.every((value, index) => bytes[index] === value);
|
|
44700
|
+
}
|
|
44701
|
+
function openEncryptedPackage(input) {
|
|
44702
|
+
const bytes = toBytes(input);
|
|
44703
|
+
if (!isCompoundFile(bytes)) return void 0;
|
|
44704
|
+
try {
|
|
44705
|
+
const file = parseOle2(toArrayBuffer(bytes));
|
|
44706
|
+
if (!file.entries.some((entry) => entry.name === "EncryptedPackage")) return void 0;
|
|
44707
|
+
const encryptionInfo = file.getStream("EncryptionInfo");
|
|
44708
|
+
const encryptedPackage = encryptionInfo && file.getStream("EncryptedPackage");
|
|
44709
|
+
return encryptionInfo && encryptedPackage ? { encryptionInfo, encryptedPackage } : void 0;
|
|
44710
|
+
} catch {
|
|
44711
|
+
return void 0;
|
|
44300
44712
|
}
|
|
44713
|
+
}
|
|
44714
|
+
function detectFileFormat(data) {
|
|
44715
|
+
const bytes = toBytes(data);
|
|
44716
|
+
if (bytes.length < 8) return { format: "unknown", encrypted: false };
|
|
44717
|
+
if (isCompoundFile(bytes)) return { format: "ole", encrypted: true };
|
|
44718
|
+
if (bytes[0] === 80 && bytes[1] === 75) return { format: "zip", encrypted: false };
|
|
44301
44719
|
return { format: "unknown", encrypted: false };
|
|
44302
44720
|
}
|
|
44303
|
-
var OLE_MAGIC2,
|
|
44304
|
-
var
|
|
44305
|
-
"src/
|
|
44306
|
-
|
|
44307
|
-
|
|
44721
|
+
var OLE_MAGIC2, toBytes, EncryptedFileError;
|
|
44722
|
+
var init_detect = __esm({
|
|
44723
|
+
"src/crypto/detect.ts"() {
|
|
44724
|
+
init_ole2_parser_read();
|
|
44725
|
+
OLE_MAGIC2 = [208, 207, 17, 224, 161, 177, 26, 225];
|
|
44726
|
+
toBytes = (input) => input instanceof Uint8Array ? input : new Uint8Array(input);
|
|
44308
44727
|
EncryptedFileError = class extends Error {
|
|
44309
44728
|
isEncrypted = true;
|
|
44310
44729
|
constructor(message) {
|
|
@@ -44315,31 +44734,10 @@ var init_encryption_detection = __esm({
|
|
|
44315
44734
|
}
|
|
44316
44735
|
});
|
|
44317
44736
|
|
|
44318
|
-
// src/pptx/core/utils/
|
|
44319
|
-
var
|
|
44320
|
-
"src/pptx/core/utils/
|
|
44321
|
-
|
|
44322
|
-
init_ole2_parser_read2();
|
|
44323
|
-
init_ole2_parser_write2();
|
|
44324
|
-
}
|
|
44325
|
-
});
|
|
44326
|
-
|
|
44327
|
-
// src/pptx/core/utils/ooxml-crypto-errors.ts
|
|
44328
|
-
var IncorrectPasswordError, DataIntegrityError;
|
|
44329
|
-
var init_ooxml_crypto_errors = __esm({
|
|
44330
|
-
"src/pptx/core/utils/ooxml-crypto-errors.ts"() {
|
|
44331
|
-
IncorrectPasswordError = class extends Error {
|
|
44332
|
-
constructor(message = "The password is incorrect.") {
|
|
44333
|
-
super(message);
|
|
44334
|
-
this.name = "IncorrectPasswordError";
|
|
44335
|
-
}
|
|
44336
|
-
};
|
|
44337
|
-
DataIntegrityError = class extends Error {
|
|
44338
|
-
constructor(message = "Data integrity check failed. The encrypted file may be corrupted or tampered with.") {
|
|
44339
|
-
super(message);
|
|
44340
|
-
this.name = "DataIntegrityError";
|
|
44341
|
-
}
|
|
44342
|
-
};
|
|
44737
|
+
// src/pptx/core/utils/encryption-detection.ts
|
|
44738
|
+
var init_encryption_detection = __esm({
|
|
44739
|
+
"src/pptx/core/utils/encryption-detection.ts"() {
|
|
44740
|
+
init_detect();
|
|
44343
44741
|
}
|
|
44344
44742
|
});
|
|
44345
44743
|
|
|
@@ -44465,71 +44863,644 @@ var init_ooxml_crypto_primitives = __esm({
|
|
|
44465
44863
|
}
|
|
44466
44864
|
});
|
|
44467
44865
|
|
|
44468
|
-
// src/
|
|
44469
|
-
|
|
44470
|
-
|
|
44866
|
+
// src/crypto/aes-ecb.ts
|
|
44867
|
+
async function aesEcbDecrypt(key2, data) {
|
|
44868
|
+
const plain = await aesCbcDecryptRaw(key2, new Uint8Array(BLOCK), data);
|
|
44869
|
+
for (let at2 = BLOCK; at2 < plain.length && at2 < data.length; at2++) {
|
|
44870
|
+
plain[at2] = plain[at2] ^ data[at2 - BLOCK];
|
|
44871
|
+
}
|
|
44872
|
+
return plain;
|
|
44873
|
+
}
|
|
44874
|
+
async function aesEcbEncrypt(key2, data) {
|
|
44875
|
+
const padded = new Uint8Array(Math.ceil(data.length / BLOCK) * BLOCK);
|
|
44876
|
+
padded.set(data);
|
|
44877
|
+
const subtle = getSubtle();
|
|
44878
|
+
const cryptoKey = await subtle.importKey("raw", key2, { name: "AES-CBC" }, false, [
|
|
44879
|
+
"encrypt"
|
|
44880
|
+
]);
|
|
44881
|
+
const iv = new Uint8Array(BLOCK);
|
|
44882
|
+
const out = new Uint8Array(padded.length);
|
|
44883
|
+
for (let start = 0; start < padded.length; start += BLOCK * BATCH) {
|
|
44884
|
+
const end = Math.min(padded.length, start + BLOCK * BATCH);
|
|
44885
|
+
const jobs = [];
|
|
44886
|
+
for (let at2 = start; at2 < end; at2 += BLOCK) {
|
|
44887
|
+
const block = padded.slice(at2, at2 + BLOCK);
|
|
44888
|
+
jobs.push(
|
|
44889
|
+
subtle.encrypt({ name: "AES-CBC", iv }, cryptoKey, block).then((result) => {
|
|
44890
|
+
out.set(new Uint8Array(result, 0, BLOCK), at2);
|
|
44891
|
+
})
|
|
44892
|
+
);
|
|
44893
|
+
}
|
|
44894
|
+
await Promise.all(jobs);
|
|
44895
|
+
}
|
|
44896
|
+
return out;
|
|
44897
|
+
}
|
|
44898
|
+
var BLOCK, BATCH;
|
|
44899
|
+
var init_aes_ecb = __esm({
|
|
44900
|
+
"src/crypto/aes-ecb.ts"() {
|
|
44471
44901
|
init_ooxml_crypto_primitives();
|
|
44902
|
+
BLOCK = 16;
|
|
44903
|
+
BATCH = 4096;
|
|
44472
44904
|
}
|
|
44473
44905
|
});
|
|
44474
44906
|
|
|
44475
|
-
// src/
|
|
44476
|
-
|
|
44907
|
+
// src/crypto/errors.ts
|
|
44908
|
+
var IncorrectPasswordError, DataIntegrityError;
|
|
44909
|
+
var init_errors = __esm({
|
|
44910
|
+
"src/crypto/errors.ts"() {
|
|
44911
|
+
IncorrectPasswordError = class extends Error {
|
|
44912
|
+
code = "incorrect-password";
|
|
44913
|
+
constructor(message = "The password is incorrect.") {
|
|
44914
|
+
super(message);
|
|
44915
|
+
this.name = "IncorrectPasswordError";
|
|
44916
|
+
}
|
|
44917
|
+
};
|
|
44918
|
+
DataIntegrityError = class extends Error {
|
|
44919
|
+
code = "data-integrity";
|
|
44920
|
+
constructor(message = "Data integrity check failed. The encrypted file may be corrupted or tampered with.") {
|
|
44921
|
+
super(message);
|
|
44922
|
+
this.name = "DataIntegrityError";
|
|
44923
|
+
}
|
|
44924
|
+
};
|
|
44925
|
+
}
|
|
44926
|
+
});
|
|
44927
|
+
|
|
44928
|
+
// src/digest/algorithm-names.ts
|
|
44929
|
+
function normalizeDigestAlgorithmName(name) {
|
|
44930
|
+
const key2 = name.toUpperCase().replace(/[-_\s]/g, "");
|
|
44931
|
+
return Object.hasOwn(CANONICAL_BY_LOOKUP_KEY, key2) ? CANONICAL_BY_LOOKUP_KEY[key2] : void 0;
|
|
44932
|
+
}
|
|
44933
|
+
var CANONICAL_BY_LOOKUP_KEY;
|
|
44934
|
+
var init_algorithm_names = __esm({
|
|
44935
|
+
"src/digest/algorithm-names.ts"() {
|
|
44936
|
+
CANONICAL_BY_LOOKUP_KEY = {
|
|
44937
|
+
SHA1: "SHA-1",
|
|
44938
|
+
SHA256: "SHA-256",
|
|
44939
|
+
SHA384: "SHA-384",
|
|
44940
|
+
SHA512: "SHA-512",
|
|
44941
|
+
MD2: "MD2",
|
|
44942
|
+
MD4: "MD4",
|
|
44943
|
+
MD5: "MD5",
|
|
44944
|
+
RIPEMD128: "RIPEMD-128",
|
|
44945
|
+
RIPEMD160: "RIPEMD-160",
|
|
44946
|
+
WHIRLPOOL: "WHIRLPOOL"
|
|
44947
|
+
};
|
|
44948
|
+
}
|
|
44949
|
+
});
|
|
44950
|
+
|
|
44951
|
+
// src/digest/sha256.ts
|
|
44952
|
+
function compress(h2, view, offset) {
|
|
44953
|
+
for (let i2 = 0; i2 < 16; i2++) W[i2] = view.getUint32(offset + i2 * 4);
|
|
44954
|
+
for (let i2 = 16; i2 < 64; i2++) {
|
|
44955
|
+
const a2 = W[i2 - 15];
|
|
44956
|
+
const b2 = W[i2 - 2];
|
|
44957
|
+
const s0 = rotr(a2, 7) ^ rotr(a2, 18) ^ a2 >>> 3;
|
|
44958
|
+
const s1 = rotr(b2, 17) ^ rotr(b2, 19) ^ b2 >>> 10;
|
|
44959
|
+
W[i2] = W[i2 - 16] + s0 + W[i2 - 7] + s1 >>> 0;
|
|
44960
|
+
}
|
|
44961
|
+
let a = h2[0], b = h2[1], c = h2[2], d = h2[3], e = h2[4], f6 = h2[5], g2 = h2[6], k = h2[7];
|
|
44962
|
+
for (let i2 = 0; i2 < 64; i2++) {
|
|
44963
|
+
const S1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
|
|
44964
|
+
const ch = e & f6 ^ ~e & g2;
|
|
44965
|
+
const t1 = k + S1 + ch + K[i2] + W[i2] >>> 0;
|
|
44966
|
+
const S0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22);
|
|
44967
|
+
const maj = a & b ^ a & c ^ b & c;
|
|
44968
|
+
const t2 = S0 + maj >>> 0;
|
|
44969
|
+
k = g2;
|
|
44970
|
+
g2 = f6;
|
|
44971
|
+
f6 = e;
|
|
44972
|
+
e = d + t1 >>> 0;
|
|
44973
|
+
d = c;
|
|
44974
|
+
c = b;
|
|
44975
|
+
b = a;
|
|
44976
|
+
a = t1 + t2 >>> 0;
|
|
44977
|
+
}
|
|
44978
|
+
h2[0] = h2[0] + a >>> 0;
|
|
44979
|
+
h2[1] = h2[1] + b >>> 0;
|
|
44980
|
+
h2[2] = h2[2] + c >>> 0;
|
|
44981
|
+
h2[3] = h2[3] + d >>> 0;
|
|
44982
|
+
h2[4] = h2[4] + e >>> 0;
|
|
44983
|
+
h2[5] = h2[5] + f6 >>> 0;
|
|
44984
|
+
h2[6] = h2[6] + g2 >>> 0;
|
|
44985
|
+
h2[7] = h2[7] + k >>> 0;
|
|
44986
|
+
}
|
|
44987
|
+
function pad64(data) {
|
|
44988
|
+
const padded = new Uint8Array(Math.ceil((data.length + 9) / 64) * 64);
|
|
44989
|
+
padded.set(data);
|
|
44990
|
+
padded[data.length] = 128;
|
|
44991
|
+
const bits = data.length * 8;
|
|
44992
|
+
const view = new DataView(padded.buffer);
|
|
44993
|
+
view.setUint32(padded.length - 8, Math.floor(bits / 4294967296));
|
|
44994
|
+
view.setUint32(padded.length - 4, bits >>> 0);
|
|
44995
|
+
return view;
|
|
44996
|
+
}
|
|
44997
|
+
function wordsOut(h2) {
|
|
44998
|
+
const out = new Uint8Array(h2.length * 4);
|
|
44999
|
+
const view = new DataView(out.buffer);
|
|
45000
|
+
for (let i2 = 0; i2 < h2.length; i2++) view.setUint32(i2 * 4, h2[i2]);
|
|
45001
|
+
return out;
|
|
45002
|
+
}
|
|
45003
|
+
function sha256(data) {
|
|
45004
|
+
const h2 = new Uint32Array(IV);
|
|
45005
|
+
const view = pad64(data);
|
|
45006
|
+
for (let offset = 0; offset < view.byteLength; offset += 64) compress(h2, view, offset);
|
|
45007
|
+
return wordsOut(h2);
|
|
45008
|
+
}
|
|
45009
|
+
var K, IV, W, rotr;
|
|
45010
|
+
var init_sha256 = __esm({
|
|
45011
|
+
"src/digest/sha256.ts"() {
|
|
45012
|
+
K = new Uint32Array([
|
|
45013
|
+
1116352408,
|
|
45014
|
+
1899447441,
|
|
45015
|
+
3049323471,
|
|
45016
|
+
3921009573,
|
|
45017
|
+
961987163,
|
|
45018
|
+
1508970993,
|
|
45019
|
+
2453635748,
|
|
45020
|
+
2870763221,
|
|
45021
|
+
3624381080,
|
|
45022
|
+
310598401,
|
|
45023
|
+
607225278,
|
|
45024
|
+
1426881987,
|
|
45025
|
+
1925078388,
|
|
45026
|
+
2162078206,
|
|
45027
|
+
2614888103,
|
|
45028
|
+
3248222580,
|
|
45029
|
+
3835390401,
|
|
45030
|
+
4022224774,
|
|
45031
|
+
264347078,
|
|
45032
|
+
604807628,
|
|
45033
|
+
770255983,
|
|
45034
|
+
1249150122,
|
|
45035
|
+
1555081692,
|
|
45036
|
+
1996064986,
|
|
45037
|
+
2554220882,
|
|
45038
|
+
2821834349,
|
|
45039
|
+
2952996808,
|
|
45040
|
+
3210313671,
|
|
45041
|
+
3336571891,
|
|
45042
|
+
3584528711,
|
|
45043
|
+
113926993,
|
|
45044
|
+
338241895,
|
|
45045
|
+
666307205,
|
|
45046
|
+
773529912,
|
|
45047
|
+
1294757372,
|
|
45048
|
+
1396182291,
|
|
45049
|
+
1695183700,
|
|
45050
|
+
1986661051,
|
|
45051
|
+
2177026350,
|
|
45052
|
+
2456956037,
|
|
45053
|
+
2730485921,
|
|
45054
|
+
2820302411,
|
|
45055
|
+
3259730800,
|
|
45056
|
+
3345764771,
|
|
45057
|
+
3516065817,
|
|
45058
|
+
3600352804,
|
|
45059
|
+
4094571909,
|
|
45060
|
+
275423344,
|
|
45061
|
+
430227734,
|
|
45062
|
+
506948616,
|
|
45063
|
+
659060556,
|
|
45064
|
+
883997877,
|
|
45065
|
+
958139571,
|
|
45066
|
+
1322822218,
|
|
45067
|
+
1537002063,
|
|
45068
|
+
1747873779,
|
|
45069
|
+
1955562222,
|
|
45070
|
+
2024104815,
|
|
45071
|
+
2227730452,
|
|
45072
|
+
2361852424,
|
|
45073
|
+
2428436474,
|
|
45074
|
+
2756734187,
|
|
45075
|
+
3204031479,
|
|
45076
|
+
3329325298
|
|
45077
|
+
]);
|
|
45078
|
+
IV = [
|
|
45079
|
+
1779033703,
|
|
45080
|
+
3144134277,
|
|
45081
|
+
1013904242,
|
|
45082
|
+
2773480762,
|
|
45083
|
+
1359893119,
|
|
45084
|
+
2600822924,
|
|
45085
|
+
528734635,
|
|
45086
|
+
1541459225
|
|
45087
|
+
];
|
|
45088
|
+
W = new Uint32Array(64);
|
|
45089
|
+
rotr = (x, n) => x >>> n | x << 32 - n;
|
|
45090
|
+
}
|
|
45091
|
+
});
|
|
45092
|
+
|
|
45093
|
+
// src/digest/sha1.ts
|
|
45094
|
+
function compress2(h2, view, offset) {
|
|
45095
|
+
for (let i2 = 0; i2 < 16; i2++) W2[i2] = view.getUint32(offset + i2 * 4);
|
|
45096
|
+
for (let i2 = 16; i2 < 80; i2++) W2[i2] = rotl(W2[i2 - 3] ^ W2[i2 - 8] ^ W2[i2 - 14] ^ W2[i2 - 16], 1);
|
|
45097
|
+
let a = h2[0], b = h2[1], c = h2[2], d = h2[3], e = h2[4];
|
|
45098
|
+
for (let i2 = 0; i2 < 80; i2++) {
|
|
45099
|
+
let f6;
|
|
45100
|
+
let k;
|
|
45101
|
+
if (i2 < 20) {
|
|
45102
|
+
f6 = b & c | ~b & d;
|
|
45103
|
+
k = 1518500249;
|
|
45104
|
+
} else if (i2 < 40) {
|
|
45105
|
+
f6 = b ^ c ^ d;
|
|
45106
|
+
k = 1859775393;
|
|
45107
|
+
} else if (i2 < 60) {
|
|
45108
|
+
f6 = b & c | b & d | c & d;
|
|
45109
|
+
k = 2400959708;
|
|
45110
|
+
} else {
|
|
45111
|
+
f6 = b ^ c ^ d;
|
|
45112
|
+
k = 3395469782;
|
|
45113
|
+
}
|
|
45114
|
+
const t = rotl(a, 5) + f6 + e + k + W2[i2] >>> 0;
|
|
45115
|
+
e = d;
|
|
45116
|
+
d = c;
|
|
45117
|
+
c = rotl(b, 30) >>> 0;
|
|
45118
|
+
b = a;
|
|
45119
|
+
a = t;
|
|
45120
|
+
}
|
|
45121
|
+
h2[0] = h2[0] + a >>> 0;
|
|
45122
|
+
h2[1] = h2[1] + b >>> 0;
|
|
45123
|
+
h2[2] = h2[2] + c >>> 0;
|
|
45124
|
+
h2[3] = h2[3] + d >>> 0;
|
|
45125
|
+
h2[4] = h2[4] + e >>> 0;
|
|
45126
|
+
}
|
|
45127
|
+
function sha1(data) {
|
|
45128
|
+
const h2 = new Uint32Array([1732584193, 4023233417, 2562383102, 271733878, 3285377520]);
|
|
45129
|
+
const view = pad64(data);
|
|
45130
|
+
for (let offset = 0; offset < view.byteLength; offset += 64) compress2(h2, view, offset);
|
|
45131
|
+
return wordsOut(h2);
|
|
45132
|
+
}
|
|
45133
|
+
var W2, rotl;
|
|
45134
|
+
var init_sha1 = __esm({
|
|
45135
|
+
"src/digest/sha1.ts"() {
|
|
45136
|
+
init_sha256();
|
|
45137
|
+
W2 = new Uint32Array(80);
|
|
45138
|
+
rotl = (x, n) => x << n | x >>> 32 - n;
|
|
45139
|
+
}
|
|
45140
|
+
});
|
|
45141
|
+
|
|
45142
|
+
// src/digest/sha512.ts
|
|
45143
|
+
function compress3(h2, data, offset) {
|
|
45144
|
+
for (let i2 = 0; i2 < 32; i2++) {
|
|
45145
|
+
const o = offset + i2 * 4;
|
|
45146
|
+
W3[i2] = (data[o] << 24 | data[o + 1] << 16 | data[o + 2] << 8 | data[o + 3]) >>> 0;
|
|
45147
|
+
}
|
|
45148
|
+
for (let i2 = 16; i2 < 80; i2++) {
|
|
45149
|
+
const xh = W3[(i2 - 15) * 2];
|
|
45150
|
+
const xl = W3[(i2 - 15) * 2 + 1];
|
|
45151
|
+
const s0h = (xh >>> 1 | xl << 31) ^ (xh >>> 8 | xl << 24) ^ xh >>> 7;
|
|
45152
|
+
const s0l = (xl >>> 1 | xh << 31) ^ (xl >>> 8 | xh << 24) ^ (xl >>> 7 | xh << 25);
|
|
45153
|
+
const yh = W3[(i2 - 2) * 2];
|
|
45154
|
+
const yl = W3[(i2 - 2) * 2 + 1];
|
|
45155
|
+
const s1h = (yh >>> 19 | yl << 13) ^ (yl >>> 29 | yh << 3) ^ yh >>> 6;
|
|
45156
|
+
const s1l = (yl >>> 19 | yh << 13) ^ (yh >>> 29 | yl << 3) ^ (yl >>> 6 | yh << 26);
|
|
45157
|
+
let lo = (s0l >>> 0) + (s1l >>> 0) + W3[(i2 - 7) * 2 + 1] + W3[(i2 - 16) * 2 + 1];
|
|
45158
|
+
const hi = s0h + s1h + W3[(i2 - 7) * 2] + W3[(i2 - 16) * 2] + Math.floor(lo / 4294967296);
|
|
45159
|
+
lo >>>= 0;
|
|
45160
|
+
W3[i2 * 2] = hi >>> 0;
|
|
45161
|
+
W3[i2 * 2 + 1] = lo;
|
|
45162
|
+
}
|
|
45163
|
+
let ah = h2[0], al = h2[1], bh = h2[2], bl = h2[3], ch = h2[4], cl = h2[5], dh = h2[6], dl = h2[7];
|
|
45164
|
+
let eh = h2[8], el = h2[9], fh = h2[10], fl = h2[11], gh = h2[12], gl = h2[13], hh = h2[14], hl = h2[15];
|
|
45165
|
+
for (let i2 = 0; i2 < 80; i2++) {
|
|
45166
|
+
const S1h = (eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (el >>> 9 | eh << 23);
|
|
45167
|
+
const S1l = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (eh >>> 9 | el << 23);
|
|
45168
|
+
const chh = eh & fh ^ ~eh & gh;
|
|
45169
|
+
const chl = el & fl ^ ~el & gl;
|
|
45170
|
+
let t1l = (hl >>> 0) + (S1l >>> 0) + (chl >>> 0) + K2[i2 * 2 + 1] + W3[i2 * 2 + 1];
|
|
45171
|
+
const t1h = hh + S1h + chh + K2[i2 * 2] + W3[i2 * 2] + Math.floor(t1l / 4294967296);
|
|
45172
|
+
t1l >>>= 0;
|
|
45173
|
+
const S0h = (ah >>> 28 | al << 4) ^ (al >>> 2 | ah << 30) ^ (al >>> 7 | ah << 25);
|
|
45174
|
+
const S0l = (al >>> 28 | ah << 4) ^ (ah >>> 2 | al << 30) ^ (ah >>> 7 | al << 25);
|
|
45175
|
+
const majh = ah & bh ^ ah & ch ^ bh & ch;
|
|
45176
|
+
const majl = al & bl ^ al & cl ^ bl & cl;
|
|
45177
|
+
let t2l = (S0l >>> 0) + (majl >>> 0);
|
|
45178
|
+
const t2h = S0h + majh + Math.floor(t2l / 4294967296);
|
|
45179
|
+
t2l >>>= 0;
|
|
45180
|
+
hh = gh;
|
|
45181
|
+
hl = gl;
|
|
45182
|
+
gh = fh;
|
|
45183
|
+
gl = fl;
|
|
45184
|
+
fh = eh;
|
|
45185
|
+
fl = el;
|
|
45186
|
+
let nl = (dl >>> 0) + t1l;
|
|
45187
|
+
eh = dh + t1h + Math.floor(nl / 4294967296) >>> 0;
|
|
45188
|
+
el = nl >>> 0;
|
|
45189
|
+
dh = ch;
|
|
45190
|
+
dl = cl;
|
|
45191
|
+
ch = bh;
|
|
45192
|
+
cl = bl;
|
|
45193
|
+
bh = ah;
|
|
45194
|
+
bl = al;
|
|
45195
|
+
nl = t1l + t2l;
|
|
45196
|
+
ah = t1h + t2h + Math.floor(nl / 4294967296) >>> 0;
|
|
45197
|
+
al = nl >>> 0;
|
|
45198
|
+
}
|
|
45199
|
+
const add7 = (i2, xh, xl) => {
|
|
45200
|
+
const lo = (h2[i2 + 1] >>> 0) + (xl >>> 0);
|
|
45201
|
+
h2[i2] = h2[i2] + xh + Math.floor(lo / 4294967296) >>> 0;
|
|
45202
|
+
h2[i2 + 1] = lo >>> 0;
|
|
45203
|
+
};
|
|
45204
|
+
add7(0, ah, al);
|
|
45205
|
+
add7(2, bh, bl);
|
|
45206
|
+
add7(4, ch, cl);
|
|
45207
|
+
add7(6, dh, dl);
|
|
45208
|
+
add7(8, eh, el);
|
|
45209
|
+
add7(10, fh, fl);
|
|
45210
|
+
add7(12, gh, gl);
|
|
45211
|
+
add7(14, hh, hl);
|
|
45212
|
+
}
|
|
45213
|
+
function digest64(data, iv, bytes) {
|
|
45214
|
+
const h2 = new Uint32Array(iv);
|
|
45215
|
+
const padded = new Uint8Array(Math.ceil((data.length + 17) / 128) * 128);
|
|
45216
|
+
padded.set(data);
|
|
45217
|
+
padded[data.length] = 128;
|
|
45218
|
+
const bits = data.length * 8;
|
|
45219
|
+
const view = new DataView(padded.buffer);
|
|
45220
|
+
view.setUint32(padded.length - 8, Math.floor(bits / 4294967296));
|
|
45221
|
+
view.setUint32(padded.length - 4, bits >>> 0);
|
|
45222
|
+
for (let offset = 0; offset < padded.length; offset += 128) compress3(h2, padded, offset);
|
|
45223
|
+
const out = new Uint8Array(bytes);
|
|
45224
|
+
const outView = new DataView(out.buffer);
|
|
45225
|
+
for (let i2 = 0; i2 < bytes / 4; i2++) outView.setUint32(i2 * 4, h2[i2]);
|
|
45226
|
+
return out;
|
|
45227
|
+
}
|
|
45228
|
+
var K2, IV_512, IV_384, W3, sha512, sha384;
|
|
45229
|
+
var init_sha512 = __esm({
|
|
45230
|
+
"src/digest/sha512.ts"() {
|
|
45231
|
+
K2 = new Uint32Array([
|
|
45232
|
+
1116352408,
|
|
45233
|
+
3609767458,
|
|
45234
|
+
1899447441,
|
|
45235
|
+
602891725,
|
|
45236
|
+
3049323471,
|
|
45237
|
+
3964484399,
|
|
45238
|
+
3921009573,
|
|
45239
|
+
2173295548,
|
|
45240
|
+
961987163,
|
|
45241
|
+
4081628472,
|
|
45242
|
+
1508970993,
|
|
45243
|
+
3053834265,
|
|
45244
|
+
2453635748,
|
|
45245
|
+
2937671579,
|
|
45246
|
+
2870763221,
|
|
45247
|
+
3664609560,
|
|
45248
|
+
3624381080,
|
|
45249
|
+
2734883394,
|
|
45250
|
+
310598401,
|
|
45251
|
+
1164996542,
|
|
45252
|
+
607225278,
|
|
45253
|
+
1323610764,
|
|
45254
|
+
1426881987,
|
|
45255
|
+
3590304994,
|
|
45256
|
+
1925078388,
|
|
45257
|
+
4068182383,
|
|
45258
|
+
2162078206,
|
|
45259
|
+
991336113,
|
|
45260
|
+
2614888103,
|
|
45261
|
+
633803317,
|
|
45262
|
+
3248222580,
|
|
45263
|
+
3479774868,
|
|
45264
|
+
3835390401,
|
|
45265
|
+
2666613458,
|
|
45266
|
+
4022224774,
|
|
45267
|
+
944711139,
|
|
45268
|
+
264347078,
|
|
45269
|
+
2341262773,
|
|
45270
|
+
604807628,
|
|
45271
|
+
2007800933,
|
|
45272
|
+
770255983,
|
|
45273
|
+
1495990901,
|
|
45274
|
+
1249150122,
|
|
45275
|
+
1856431235,
|
|
45276
|
+
1555081692,
|
|
45277
|
+
3175218132,
|
|
45278
|
+
1996064986,
|
|
45279
|
+
2198950837,
|
|
45280
|
+
2554220882,
|
|
45281
|
+
3999719339,
|
|
45282
|
+
2821834349,
|
|
45283
|
+
766784016,
|
|
45284
|
+
2952996808,
|
|
45285
|
+
2566594879,
|
|
45286
|
+
3210313671,
|
|
45287
|
+
3203337956,
|
|
45288
|
+
3336571891,
|
|
45289
|
+
1034457026,
|
|
45290
|
+
3584528711,
|
|
45291
|
+
2466948901,
|
|
45292
|
+
113926993,
|
|
45293
|
+
3758326383,
|
|
45294
|
+
338241895,
|
|
45295
|
+
168717936,
|
|
45296
|
+
666307205,
|
|
45297
|
+
1188179964,
|
|
45298
|
+
773529912,
|
|
45299
|
+
1546045734,
|
|
45300
|
+
1294757372,
|
|
45301
|
+
1522805485,
|
|
45302
|
+
1396182291,
|
|
45303
|
+
2643833823,
|
|
45304
|
+
1695183700,
|
|
45305
|
+
2343527390,
|
|
45306
|
+
1986661051,
|
|
45307
|
+
1014477480,
|
|
45308
|
+
2177026350,
|
|
45309
|
+
1206759142,
|
|
45310
|
+
2456956037,
|
|
45311
|
+
344077627,
|
|
45312
|
+
2730485921,
|
|
45313
|
+
1290863460,
|
|
45314
|
+
2820302411,
|
|
45315
|
+
3158454273,
|
|
45316
|
+
3259730800,
|
|
45317
|
+
3505952657,
|
|
45318
|
+
3345764771,
|
|
45319
|
+
106217008,
|
|
45320
|
+
3516065817,
|
|
45321
|
+
3606008344,
|
|
45322
|
+
3600352804,
|
|
45323
|
+
1432725776,
|
|
45324
|
+
4094571909,
|
|
45325
|
+
1467031594,
|
|
45326
|
+
275423344,
|
|
45327
|
+
851169720,
|
|
45328
|
+
430227734,
|
|
45329
|
+
3100823752,
|
|
45330
|
+
506948616,
|
|
45331
|
+
1363258195,
|
|
45332
|
+
659060556,
|
|
45333
|
+
3750685593,
|
|
45334
|
+
883997877,
|
|
45335
|
+
3785050280,
|
|
45336
|
+
958139571,
|
|
45337
|
+
3318307427,
|
|
45338
|
+
1322822218,
|
|
45339
|
+
3812723403,
|
|
45340
|
+
1537002063,
|
|
45341
|
+
2003034995,
|
|
45342
|
+
1747873779,
|
|
45343
|
+
3602036899,
|
|
45344
|
+
1955562222,
|
|
45345
|
+
1575990012,
|
|
45346
|
+
2024104815,
|
|
45347
|
+
1125592928,
|
|
45348
|
+
2227730452,
|
|
45349
|
+
2716904306,
|
|
45350
|
+
2361852424,
|
|
45351
|
+
442776044,
|
|
45352
|
+
2428436474,
|
|
45353
|
+
593698344,
|
|
45354
|
+
2756734187,
|
|
45355
|
+
3733110249,
|
|
45356
|
+
3204031479,
|
|
45357
|
+
2999351573,
|
|
45358
|
+
3329325298,
|
|
45359
|
+
3815920427,
|
|
45360
|
+
3391569614,
|
|
45361
|
+
3928383900,
|
|
45362
|
+
3515267271,
|
|
45363
|
+
566280711,
|
|
45364
|
+
3940187606,
|
|
45365
|
+
3454069534,
|
|
45366
|
+
4118630271,
|
|
45367
|
+
4000239992,
|
|
45368
|
+
116418474,
|
|
45369
|
+
1914138554,
|
|
45370
|
+
174292421,
|
|
45371
|
+
2731055270,
|
|
45372
|
+
289380356,
|
|
45373
|
+
3203993006,
|
|
45374
|
+
460393269,
|
|
45375
|
+
320620315,
|
|
45376
|
+
685471733,
|
|
45377
|
+
587496836,
|
|
45378
|
+
852142971,
|
|
45379
|
+
1086792851,
|
|
45380
|
+
1017036298,
|
|
45381
|
+
365543100,
|
|
45382
|
+
1126000580,
|
|
45383
|
+
2618297676,
|
|
45384
|
+
1288033470,
|
|
45385
|
+
3409855158,
|
|
45386
|
+
1501505948,
|
|
45387
|
+
4234509866,
|
|
45388
|
+
1607167915,
|
|
45389
|
+
987167468,
|
|
45390
|
+
1816402316,
|
|
45391
|
+
1246189591
|
|
45392
|
+
]);
|
|
45393
|
+
IV_512 = [
|
|
45394
|
+
1779033703,
|
|
45395
|
+
4089235720,
|
|
45396
|
+
3144134277,
|
|
45397
|
+
2227873595,
|
|
45398
|
+
1013904242,
|
|
45399
|
+
4271175723,
|
|
45400
|
+
2773480762,
|
|
45401
|
+
1595750129,
|
|
45402
|
+
1359893119,
|
|
45403
|
+
2917565137,
|
|
45404
|
+
2600822924,
|
|
45405
|
+
725511199,
|
|
45406
|
+
528734635,
|
|
45407
|
+
4215389547,
|
|
45408
|
+
1541459225,
|
|
45409
|
+
327033209
|
|
45410
|
+
];
|
|
45411
|
+
IV_384 = [
|
|
45412
|
+
3418070365,
|
|
45413
|
+
3238371032,
|
|
45414
|
+
1654270250,
|
|
45415
|
+
914150663,
|
|
45416
|
+
2438529370,
|
|
45417
|
+
812702999,
|
|
45418
|
+
355462360,
|
|
45419
|
+
4144912697,
|
|
45420
|
+
1731405415,
|
|
45421
|
+
4290775857,
|
|
45422
|
+
2394180231,
|
|
45423
|
+
1750603025,
|
|
45424
|
+
3675008525,
|
|
45425
|
+
1694076839,
|
|
45426
|
+
1203062813,
|
|
45427
|
+
3204075428
|
|
45428
|
+
];
|
|
45429
|
+
W3 = new Uint32Array(160);
|
|
45430
|
+
sha512 = (data) => digest64(data, IV_512, 64);
|
|
45431
|
+
sha384 = (data) => digest64(data, IV_384, 48);
|
|
45432
|
+
}
|
|
45433
|
+
});
|
|
45434
|
+
|
|
45435
|
+
// src/digest/digest.ts
|
|
45436
|
+
function digestFunction(name) {
|
|
45437
|
+
const canonical = normalizeDigestAlgorithmName(name);
|
|
45438
|
+
return canonical && canonical in DIGESTS ? DIGESTS[canonical] : void 0;
|
|
45439
|
+
}
|
|
45440
|
+
var DIGESTS;
|
|
45441
|
+
var init_digest2 = __esm({
|
|
45442
|
+
"src/digest/digest.ts"() {
|
|
45443
|
+
init_algorithm_names();
|
|
45444
|
+
init_sha1();
|
|
45445
|
+
init_sha256();
|
|
45446
|
+
init_sha512();
|
|
45447
|
+
DIGESTS = {
|
|
45448
|
+
"SHA-1": sha1,
|
|
45449
|
+
"SHA-256": sha256,
|
|
45450
|
+
"SHA-384": sha384,
|
|
45451
|
+
"SHA-512": sha512
|
|
45452
|
+
};
|
|
45453
|
+
}
|
|
45454
|
+
});
|
|
45455
|
+
|
|
45456
|
+
// src/crypto/key-derivation.ts
|
|
45457
|
+
async function spinPassword(password, salt, spinCount, hashAlgorithm) {
|
|
45458
|
+
if (!Number.isInteger(spinCount) || spinCount < 0 || spinCount > MAX_SPIN_COUNT) {
|
|
45459
|
+
throw new Error(`Unsupported encryption spin count: ${spinCount}.`);
|
|
45460
|
+
}
|
|
44477
45461
|
const passwordBytes = encodePasswordUtf16LE(password);
|
|
45462
|
+
const digest2 = digestFunction(hashAlgorithm);
|
|
45463
|
+
if (digest2) {
|
|
45464
|
+
let h3 = digest2(concatArrays(salt, passwordBytes));
|
|
45465
|
+
const buffer = new Uint8Array(4 + h3.length);
|
|
45466
|
+
const view = new DataView(buffer.buffer);
|
|
45467
|
+
for (let i2 = 0; i2 < spinCount; i2++) {
|
|
45468
|
+
view.setUint32(0, i2, true);
|
|
45469
|
+
buffer.set(h3, 4);
|
|
45470
|
+
h3 = digest2(buffer);
|
|
45471
|
+
}
|
|
45472
|
+
return h3;
|
|
45473
|
+
}
|
|
44478
45474
|
let h2 = await hash(hashAlgorithm, concatArrays(salt, passwordBytes));
|
|
44479
45475
|
for (let i2 = 0; i2 < spinCount; i2++) {
|
|
44480
45476
|
h2 = await hash(hashAlgorithm, concatArrays(uint32LE(i2), h2));
|
|
44481
45477
|
}
|
|
44482
|
-
h2 = await hash(hashAlgorithm, concatArrays(h2, blockKey));
|
|
44483
|
-
const cbRequiredKeyLength = keyBits / 8;
|
|
44484
|
-
const cbHash = hashSize;
|
|
44485
|
-
const ipad = 54;
|
|
44486
|
-
const opad = 92;
|
|
44487
|
-
if (cbHash >= cbRequiredKeyLength) {
|
|
44488
|
-
return h2.subarray(0, cbRequiredKeyLength);
|
|
44489
|
-
}
|
|
44490
|
-
const x1Input = new Uint8Array(64);
|
|
44491
|
-
x1Input.fill(ipad);
|
|
44492
|
-
for (let i2 = 0; i2 < h2.length && i2 < 64; i2++) {
|
|
44493
|
-
x1Input[i2] = h2[i2] ^ ipad;
|
|
44494
|
-
}
|
|
44495
|
-
const x1 = await hash(hashAlgorithm, x1Input);
|
|
44496
|
-
const x2Input = new Uint8Array(64);
|
|
44497
|
-
x2Input.fill(opad);
|
|
44498
|
-
for (let i2 = 0; i2 < h2.length && i2 < 64; i2++) {
|
|
44499
|
-
x2Input[i2] = h2[i2] ^ opad;
|
|
44500
|
-
}
|
|
44501
|
-
const x2 = await hash(hashAlgorithm, x2Input);
|
|
44502
|
-
const x3 = concatArrays(x1, x2);
|
|
44503
|
-
return x3.subarray(0, cbRequiredKeyLength);
|
|
44504
|
-
}
|
|
44505
|
-
async function computeStandardKeyBase(password, salt) {
|
|
44506
|
-
const passwordBytes = encodePasswordUtf16LE(password);
|
|
44507
|
-
let h2 = await hash("SHA-1", concatArrays(salt, passwordBytes));
|
|
44508
|
-
for (let i2 = 0; i2 < 5e4; i2++) {
|
|
44509
|
-
h2 = await hash("SHA-1", concatArrays(uint32LE(i2), h2));
|
|
44510
|
-
}
|
|
44511
45478
|
return h2;
|
|
44512
45479
|
}
|
|
45480
|
+
async function extendKey(h2, hashAlgorithm, keyLength) {
|
|
45481
|
+
const pad2 = async (value) => {
|
|
45482
|
+
const input = new Uint8Array(64).fill(value);
|
|
45483
|
+
for (let i2 = 0; i2 < h2.length && i2 < 64; i2++) input[i2] = h2[i2] ^ value;
|
|
45484
|
+
return hash(hashAlgorithm, input);
|
|
45485
|
+
};
|
|
45486
|
+
const x3 = concatArrays(await pad2(54), await pad2(92));
|
|
45487
|
+
return x3.subarray(0, keyLength);
|
|
45488
|
+
}
|
|
45489
|
+
function computeAgileKeyBase(password, salt, spinCount, hashAlgorithm) {
|
|
45490
|
+
return spinPassword(password, salt, spinCount, hashAlgorithm);
|
|
45491
|
+
}
|
|
45492
|
+
async function deriveAgileKeyFromBase(base, hashAlgorithm, blockKey, keyBits, hashSize) {
|
|
45493
|
+
const h2 = await hash(hashAlgorithm, concatArrays(base, blockKey));
|
|
45494
|
+
const keyLength = keyBits / 8;
|
|
45495
|
+
if (hashSize >= keyLength) return h2.subarray(0, keyLength);
|
|
45496
|
+
return extendKey(h2, hashAlgorithm, keyLength);
|
|
45497
|
+
}
|
|
45498
|
+
function computeStandardKeyBase(password, salt) {
|
|
45499
|
+
return spinPassword(password, salt, 5e4, "SHA-1");
|
|
45500
|
+
}
|
|
44513
45501
|
async function deriveStandardKeyFromBase(base, keySize, blockNumber = 0) {
|
|
44514
45502
|
const h2 = await hash("SHA-1", concatArrays(base, uint32LE(blockNumber)));
|
|
44515
|
-
|
|
44516
|
-
if (h2.length >= cbRequiredKeyLength) {
|
|
44517
|
-
return h2.subarray(0, cbRequiredKeyLength);
|
|
44518
|
-
}
|
|
44519
|
-
const x1Input = new Uint8Array(64);
|
|
44520
|
-
x1Input.fill(54);
|
|
44521
|
-
for (let i2 = 0; i2 < h2.length && i2 < 64; i2++) {
|
|
44522
|
-
x1Input[i2] = h2[i2] ^ 54;
|
|
44523
|
-
}
|
|
44524
|
-
const x1 = await hash("SHA-1", x1Input);
|
|
44525
|
-
const x2Input = new Uint8Array(64);
|
|
44526
|
-
x2Input.fill(92);
|
|
44527
|
-
for (let i2 = 0; i2 < h2.length && i2 < 64; i2++) {
|
|
44528
|
-
x2Input[i2] = h2[i2] ^ 92;
|
|
44529
|
-
}
|
|
44530
|
-
const x2 = await hash("SHA-1", x2Input);
|
|
44531
|
-
const x3 = concatArrays(x1, x2);
|
|
44532
|
-
return x3.subarray(0, cbRequiredKeyLength);
|
|
45503
|
+
return extendKey(h2, "SHA-1", keySize / 8);
|
|
44533
45504
|
}
|
|
44534
45505
|
async function deriveStandardKey(password, salt, keySize, _algIdHash, blockNumber = 0) {
|
|
44535
45506
|
const base = await computeStandardKeyBase(password, salt);
|
|
@@ -44537,21 +45508,376 @@ async function deriveStandardKey(password, salt, keySize, _algIdHash, blockNumbe
|
|
|
44537
45508
|
}
|
|
44538
45509
|
async function generateIV(hashAlgorithm, salt, blockKey, blockSize) {
|
|
44539
45510
|
const h2 = await hash(hashAlgorithm, concatArrays(salt, blockKey));
|
|
44540
|
-
if (h2.length >= blockSize)
|
|
44541
|
-
|
|
44542
|
-
}
|
|
44543
|
-
const padded = new Uint8Array(blockSize);
|
|
44544
|
-
padded.fill(54);
|
|
45511
|
+
if (h2.length >= blockSize) return h2.subarray(0, blockSize);
|
|
45512
|
+
const padded = new Uint8Array(blockSize).fill(54);
|
|
44545
45513
|
padded.set(h2);
|
|
44546
45514
|
return padded;
|
|
44547
45515
|
}
|
|
45516
|
+
var BLOCK_KEYS, MAX_SPIN_COUNT;
|
|
45517
|
+
var init_key_derivation = __esm({
|
|
45518
|
+
"src/crypto/key-derivation.ts"() {
|
|
45519
|
+
init_ooxml_crypto_primitives();
|
|
45520
|
+
init_digest2();
|
|
45521
|
+
BLOCK_KEYS = {
|
|
45522
|
+
verifierHashInput: new Uint8Array([254, 167, 210, 118, 59, 75, 158, 121]),
|
|
45523
|
+
verifierHashValue: new Uint8Array([215, 170, 15, 109, 48, 97, 52, 78]),
|
|
45524
|
+
encryptedKeyValue: new Uint8Array([20, 110, 11, 231, 171, 172, 208, 214]),
|
|
45525
|
+
dataIntegrityHmacKey: new Uint8Array([95, 178, 173, 1, 12, 185, 225, 246]),
|
|
45526
|
+
dataIntegrityHmacValue: new Uint8Array([160, 103, 127, 2, 178, 44, 132, 51])
|
|
45527
|
+
};
|
|
45528
|
+
MAX_SPIN_COUNT = 1e7;
|
|
45529
|
+
}
|
|
45530
|
+
});
|
|
45531
|
+
|
|
45532
|
+
// src/crypto/decrypt.ts
|
|
45533
|
+
async function verifyAgilePassword(info, password) {
|
|
45534
|
+
const pke = info.passwordKeyEncryptor;
|
|
45535
|
+
const base = await computeAgileKeyBase(password, pke.saltValue, pke.spinCount, pke.hashAlgorithm);
|
|
45536
|
+
const blockKey = (block) => deriveAgileKeyFromBase(base, pke.hashAlgorithm, block, pke.keyBits, pke.hashSize);
|
|
45537
|
+
const verifierHashInput = await aesCbcDecryptRaw(
|
|
45538
|
+
await blockKey(BLOCK_KEYS.verifierHashInput),
|
|
45539
|
+
pke.saltValue,
|
|
45540
|
+
pke.encryptedVerifierHashInput
|
|
45541
|
+
);
|
|
45542
|
+
const verifierHashValue = await aesCbcDecryptRaw(
|
|
45543
|
+
await blockKey(BLOCK_KEYS.verifierHashValue),
|
|
45544
|
+
pke.saltValue,
|
|
45545
|
+
pke.encryptedVerifierHashValue
|
|
45546
|
+
);
|
|
45547
|
+
const computedHash = await hash(pke.hashAlgorithm, verifierHashInput.subarray(0, pke.saltSize));
|
|
45548
|
+
if (computedHash.length < pke.hashSize || verifierHashValue.length < pke.hashSize) return null;
|
|
45549
|
+
let difference = 0;
|
|
45550
|
+
for (let i2 = 0; i2 < pke.hashSize; i2++) difference |= verifierHashValue[i2] ^ computedHash[i2];
|
|
45551
|
+
if (difference !== 0) return null;
|
|
45552
|
+
const decryptedKey = await aesCbcDecryptRaw(
|
|
45553
|
+
await blockKey(BLOCK_KEYS.encryptedKeyValue),
|
|
45554
|
+
pke.saltValue,
|
|
45555
|
+
pke.encryptedKeyValue
|
|
45556
|
+
);
|
|
45557
|
+
return decryptedKey.subarray(0, info.keyData.keyBits / 8);
|
|
45558
|
+
}
|
|
45559
|
+
async function verifyStandardPassword(info, password) {
|
|
45560
|
+
const key2 = await deriveStandardKey(
|
|
45561
|
+
password,
|
|
45562
|
+
info.verifier.salt,
|
|
45563
|
+
info.header.keySize,
|
|
45564
|
+
info.header.algIdHash
|
|
45565
|
+
);
|
|
45566
|
+
const decryptedVerifier = await aesEcbDecrypt(key2, info.verifier.encryptedVerifier);
|
|
45567
|
+
const decryptedHash = await aesEcbDecrypt(key2, info.verifier.encryptedVerifierHash);
|
|
45568
|
+
const computedHash = await hash("SHA-1", decryptedVerifier);
|
|
45569
|
+
const hashSize = info.verifier.verifierHashSize;
|
|
45570
|
+
let match = true;
|
|
45571
|
+
for (let i2 = 0; i2 < Math.min(hashSize, 20); i2++) {
|
|
45572
|
+
if (computedHash[i2] !== decryptedHash[i2]) {
|
|
45573
|
+
match = false;
|
|
45574
|
+
break;
|
|
45575
|
+
}
|
|
45576
|
+
}
|
|
45577
|
+
return match ? key2 : null;
|
|
45578
|
+
}
|
|
45579
|
+
async function verifyAgileDataIntegrity(info, key2, encryptedPackage) {
|
|
45580
|
+
const keyData = info.keyData;
|
|
45581
|
+
if (!info.dataIntegrity) {
|
|
45582
|
+
return;
|
|
45583
|
+
}
|
|
45584
|
+
const hmacKeyIV = await generateIV(
|
|
45585
|
+
keyData.hashAlgorithm,
|
|
45586
|
+
keyData.saltValue,
|
|
45587
|
+
BLOCK_KEYS.dataIntegrityHmacKey,
|
|
45588
|
+
keyData.blockSize
|
|
45589
|
+
);
|
|
45590
|
+
const decryptedHmacKey = await aesCbcDecryptRaw(
|
|
45591
|
+
key2,
|
|
45592
|
+
hmacKeyIV,
|
|
45593
|
+
info.dataIntegrity.encryptedHmacKey
|
|
45594
|
+
);
|
|
45595
|
+
const hmacKey = decryptedHmacKey.subarray(0, keyData.hashSize);
|
|
45596
|
+
const hmacValueIV = await generateIV(
|
|
45597
|
+
keyData.hashAlgorithm,
|
|
45598
|
+
keyData.saltValue,
|
|
45599
|
+
BLOCK_KEYS.dataIntegrityHmacValue,
|
|
45600
|
+
keyData.blockSize
|
|
45601
|
+
);
|
|
45602
|
+
const decryptedHmacValue = await aesCbcDecryptRaw(
|
|
45603
|
+
key2,
|
|
45604
|
+
hmacValueIV,
|
|
45605
|
+
info.dataIntegrity.encryptedHmacValue
|
|
45606
|
+
);
|
|
45607
|
+
const expectedHmac = decryptedHmacValue.subarray(0, keyData.hashSize);
|
|
45608
|
+
const computedHmac = await hmac(keyData.hashAlgorithm, hmacKey, encryptedPackage);
|
|
45609
|
+
let match = true;
|
|
45610
|
+
if (computedHmac.length < keyData.hashSize) {
|
|
45611
|
+
match = false;
|
|
45612
|
+
} else {
|
|
45613
|
+
for (let i2 = 0; i2 < keyData.hashSize; i2++) {
|
|
45614
|
+
if (computedHmac[i2] !== expectedHmac[i2]) {
|
|
45615
|
+
match = false;
|
|
45616
|
+
break;
|
|
45617
|
+
}
|
|
45618
|
+
}
|
|
45619
|
+
}
|
|
45620
|
+
if (!match) {
|
|
45621
|
+
throw new DataIntegrityError(
|
|
45622
|
+
"Data integrity check failed. The encrypted file may be corrupted or tampered with."
|
|
45623
|
+
);
|
|
45624
|
+
}
|
|
45625
|
+
}
|
|
45626
|
+
async function decryptAgilePackage(encryptedPackage, key2, info) {
|
|
45627
|
+
const keyData = info.keyData;
|
|
45628
|
+
const sizeView = new DataView(encryptedPackage.buffer, encryptedPackage.byteOffset, 8);
|
|
45629
|
+
const originalSize = sizeView.getUint32(0, true) + sizeView.getUint32(4, true) * 4294967296;
|
|
45630
|
+
const encryptedData = encryptedPackage.subarray(8);
|
|
45631
|
+
const segmentSize = 4096;
|
|
45632
|
+
const result = new Uint8Array(originalSize);
|
|
45633
|
+
let resultOffset = 0;
|
|
45634
|
+
const numSegments = Math.ceil(encryptedData.length / segmentSize);
|
|
45635
|
+
for (let segment = 0; segment < numSegments; segment++) {
|
|
45636
|
+
const segmentStart = segment * segmentSize;
|
|
45637
|
+
const segmentEnd = Math.min(segmentStart + segmentSize, encryptedData.length);
|
|
45638
|
+
const segmentData = encryptedData.subarray(segmentStart, segmentEnd);
|
|
45639
|
+
const blockKeyBytes = uint32LE(segment);
|
|
45640
|
+
const segmentIV = await generateIV(
|
|
45641
|
+
keyData.hashAlgorithm,
|
|
45642
|
+
keyData.saltValue,
|
|
45643
|
+
blockKeyBytes,
|
|
45644
|
+
keyData.blockSize
|
|
45645
|
+
);
|
|
45646
|
+
const decrypted = await aesCbcDecryptRaw(key2, segmentIV, segmentData);
|
|
45647
|
+
const bytesToCopy = Math.min(decrypted.length, originalSize - resultOffset);
|
|
45648
|
+
result.set(decrypted.subarray(0, bytesToCopy), resultOffset);
|
|
45649
|
+
resultOffset += bytesToCopy;
|
|
45650
|
+
}
|
|
45651
|
+
return result.buffer;
|
|
45652
|
+
}
|
|
45653
|
+
async function decryptStandardPackage(encryptedPackage, key2) {
|
|
45654
|
+
const sizeView = new DataView(encryptedPackage.buffer, encryptedPackage.byteOffset, 8);
|
|
45655
|
+
const originalSize = sizeView.getUint32(0, true);
|
|
45656
|
+
const encryptedData = encryptedPackage.subarray(8);
|
|
45657
|
+
const decrypted = await aesEcbDecrypt(key2, encryptedData);
|
|
45658
|
+
return decrypted.slice(0, originalSize).buffer;
|
|
45659
|
+
}
|
|
45660
|
+
var init_decrypt = __esm({
|
|
45661
|
+
"src/crypto/decrypt.ts"() {
|
|
45662
|
+
init_ooxml_crypto_primitives();
|
|
45663
|
+
init_aes_ecb();
|
|
45664
|
+
init_errors();
|
|
45665
|
+
init_key_derivation();
|
|
45666
|
+
}
|
|
45667
|
+
});
|
|
45668
|
+
|
|
45669
|
+
// src/crypto/encryption-info-write.ts
|
|
45670
|
+
function buildAgileEncryptionInfoXml(keyData, pke, dataIntegrity) {
|
|
45671
|
+
const xmlNs = "http://schemas.microsoft.com/office/2006/encryption";
|
|
45672
|
+
const pNs = "http://schemas.microsoft.com/office/2006/keyEncryptor/password";
|
|
45673
|
+
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
|
|
45674
|
+
<encryption xmlns="${xmlNs}" xmlns:p="${pNs}"><keyData saltSize="${keyData.saltSize}" blockSize="${keyData.blockSize}" keyBits="${keyData.keyBits}" hashSize="${keyData.hashSize}" cipherAlgorithm="${keyData.cipherAlgorithm}" cipherChaining="${keyData.cipherChaining}" hashAlgorithm="${keyData.hashAlgorithm}" saltValue="${base64Encode(keyData.saltValue)}"/><dataIntegrity encryptedHmacKey="${base64Encode(dataIntegrity.encryptedHmacKey)}" encryptedHmacValue="${base64Encode(dataIntegrity.encryptedHmacValue)}"/><keyEncryptors><keyEncryptor uri="http://schemas.microsoft.com/office/2006/keyEncryptor/password"><p:encryptedKey spinCount="${pke.spinCount}" saltSize="${pke.saltSize}" blockSize="${pke.blockSize}" keyBits="${pke.keyBits}" hashSize="${pke.hashSize}" cipherAlgorithm="${pke.cipherAlgorithm}" cipherChaining="${pke.cipherChaining}" hashAlgorithm="${pke.hashAlgorithm}" saltValue="${base64Encode(pke.saltValue)}" encryptedVerifierHashInput="${base64Encode(pke.encryptedVerifierHashInput)}" encryptedVerifierHashValue="${base64Encode(pke.encryptedVerifierHashValue)}" encryptedKeyValue="${base64Encode(pke.encryptedKeyValue)}"/></keyEncryptor></keyEncryptors></encryption>`;
|
|
45675
|
+
}
|
|
45676
|
+
function buildEncryptionInfoStream(xmlString) {
|
|
45677
|
+
const xmlBytes = new TextEncoder().encode(xmlString);
|
|
45678
|
+
const result = new Uint8Array(8 + xmlBytes.length);
|
|
45679
|
+
const view = new DataView(result.buffer);
|
|
45680
|
+
view.setUint16(0, 4, true);
|
|
45681
|
+
view.setUint16(2, 4, true);
|
|
45682
|
+
view.setUint32(4, 64, true);
|
|
45683
|
+
result.set(xmlBytes, 8);
|
|
45684
|
+
return result;
|
|
45685
|
+
}
|
|
45686
|
+
function buildStandardEncryptionInfoStream(keyBits, salt, encryptedVerifier, encryptedVerifierHash) {
|
|
45687
|
+
const algId = STANDARD_ALG_IDS[keyBits];
|
|
45688
|
+
if (!algId) {
|
|
45689
|
+
throw new Error(
|
|
45690
|
+
`Unsupported standard encryption key size: ${keyBits} bits. Use 128, 192, or 256.`
|
|
45691
|
+
);
|
|
45692
|
+
}
|
|
45693
|
+
const cspNameBytes = new Uint8Array((STANDARD_CSP_NAME.length + 1) * 2);
|
|
45694
|
+
for (let i2 = 0; i2 < STANDARD_CSP_NAME.length; i2++) {
|
|
45695
|
+
const code = STANDARD_CSP_NAME.charCodeAt(i2);
|
|
45696
|
+
cspNameBytes[i2 * 2] = code & 255;
|
|
45697
|
+
cspNameBytes[i2 * 2 + 1] = code >> 8 & 255;
|
|
45698
|
+
}
|
|
45699
|
+
const headerFixedSize = 32;
|
|
45700
|
+
const headerSize = headerFixedSize + cspNameBytes.length;
|
|
45701
|
+
const verifierSize = 4 + 16 + 16 + 4 + 32;
|
|
45702
|
+
const totalSize = 12 + headerSize + verifierSize;
|
|
45703
|
+
const data = new Uint8Array(totalSize);
|
|
45704
|
+
const view = new DataView(data.buffer);
|
|
45705
|
+
view.setUint16(0, 4, true);
|
|
45706
|
+
view.setUint16(2, 2, true);
|
|
45707
|
+
view.setUint32(4, STANDARD_FLAGS, true);
|
|
45708
|
+
view.setUint32(8, headerSize, true);
|
|
45709
|
+
const h2 = 12;
|
|
45710
|
+
view.setUint32(h2, STANDARD_FLAGS, true);
|
|
45711
|
+
view.setUint32(h2 + 4, 0, true);
|
|
45712
|
+
view.setUint32(h2 + 8, algId, true);
|
|
45713
|
+
view.setUint32(h2 + 12, STANDARD_ALG_ID_HASH_SHA1, true);
|
|
45714
|
+
view.setUint32(h2 + 16, keyBits, true);
|
|
45715
|
+
view.setUint32(h2 + 20, STANDARD_PROVIDER_TYPE_RSA_AES, true);
|
|
45716
|
+
view.setUint32(h2 + 24, 0, true);
|
|
45717
|
+
view.setUint32(h2 + 28, 0, true);
|
|
45718
|
+
data.set(cspNameBytes, h2 + 32);
|
|
45719
|
+
const v = 12 + headerSize;
|
|
45720
|
+
view.setUint32(v, 16, true);
|
|
45721
|
+
data.set(salt.subarray(0, 16), v + 4);
|
|
45722
|
+
data.set(encryptedVerifier.subarray(0, 16), v + 20);
|
|
45723
|
+
view.setUint32(v + 36, 20, true);
|
|
45724
|
+
data.set(encryptedVerifierHash.subarray(0, 32), v + 40);
|
|
45725
|
+
return data;
|
|
45726
|
+
}
|
|
45727
|
+
var STANDARD_ALG_IDS, STANDARD_ALG_ID_HASH_SHA1, STANDARD_PROVIDER_TYPE_RSA_AES, STANDARD_CSP_NAME, STANDARD_FLAGS;
|
|
45728
|
+
var init_encryption_info_write = __esm({
|
|
45729
|
+
"src/crypto/encryption-info-write.ts"() {
|
|
45730
|
+
init_ooxml_crypto_primitives();
|
|
45731
|
+
STANDARD_ALG_IDS = {
|
|
45732
|
+
128: 26126,
|
|
45733
|
+
// CALG_AES_128
|
|
45734
|
+
192: 26127,
|
|
45735
|
+
// CALG_AES_192
|
|
45736
|
+
256: 26128
|
|
45737
|
+
// CALG_AES_256
|
|
45738
|
+
};
|
|
45739
|
+
STANDARD_ALG_ID_HASH_SHA1 = 32772;
|
|
45740
|
+
STANDARD_PROVIDER_TYPE_RSA_AES = 24;
|
|
45741
|
+
STANDARD_CSP_NAME = "Microsoft Enhanced RSA and AES Cryptographic Provider";
|
|
45742
|
+
STANDARD_FLAGS = 36;
|
|
45743
|
+
}
|
|
45744
|
+
});
|
|
45745
|
+
|
|
45746
|
+
// src/crypto/encrypt.ts
|
|
45747
|
+
function container(encryptionInfo, encryptedPackage) {
|
|
45748
|
+
const streams2 = /* @__PURE__ */ new Map();
|
|
45749
|
+
streams2.set("EncryptionInfo", encryptionInfo);
|
|
45750
|
+
streams2.set("EncryptedPackage", encryptedPackage);
|
|
45751
|
+
return new Uint8Array(buildOle2(streams2));
|
|
45752
|
+
}
|
|
45753
|
+
function randomBytes(size) {
|
|
45754
|
+
const bytes = new Uint8Array(size);
|
|
45755
|
+
getCrypto().getRandomValues(bytes);
|
|
45756
|
+
return bytes;
|
|
45757
|
+
}
|
|
45758
|
+
function padTo(data, blockSize) {
|
|
45759
|
+
const padded = new Uint8Array(Math.ceil(data.length / blockSize) * blockSize);
|
|
45760
|
+
padded.set(data);
|
|
45761
|
+
return padded;
|
|
45762
|
+
}
|
|
45763
|
+
function withSizePrefix(size, body) {
|
|
45764
|
+
const out = new Uint8Array(8 + body.length);
|
|
45765
|
+
const view = new DataView(out.buffer, 0, 8);
|
|
45766
|
+
view.setUint32(0, size % 4294967296, true);
|
|
45767
|
+
view.setUint32(4, Math.floor(size / 4294967296), true);
|
|
45768
|
+
out.set(body, 8);
|
|
45769
|
+
return out;
|
|
45770
|
+
}
|
|
45771
|
+
async function encryptAgilePackage(packageData, key2, info) {
|
|
45772
|
+
const { hashAlgorithm, saltValue, blockSize } = info.keyData;
|
|
45773
|
+
const padded = padTo(packageData, SEGMENT_SIZE);
|
|
45774
|
+
const encrypted = withSizePrefix(packageData.length, padded);
|
|
45775
|
+
for (let start = 0; start < padded.length; start += SEGMENT_SIZE) {
|
|
45776
|
+
const iv = await generateIV(
|
|
45777
|
+
hashAlgorithm,
|
|
45778
|
+
saltValue,
|
|
45779
|
+
uint32LE(start / SEGMENT_SIZE),
|
|
45780
|
+
blockSize
|
|
45781
|
+
);
|
|
45782
|
+
const segment = padded.subarray(start, start + SEGMENT_SIZE);
|
|
45783
|
+
encrypted.set(await aesCbcEncryptNoPad(key2, iv, segment), 8 + start);
|
|
45784
|
+
}
|
|
45785
|
+
return encrypted;
|
|
45786
|
+
}
|
|
45787
|
+
async function encryptStandardPackage(packageData, key2) {
|
|
45788
|
+
const encryptedData = await aesEcbEncrypt(key2, packageData);
|
|
45789
|
+
return withSizePrefix(packageData.length, encryptedData);
|
|
45790
|
+
}
|
|
45791
|
+
async function encryptAgile(packageData, password, options = {}) {
|
|
45792
|
+
const keyBits = options.algorithm === "AES128" ? 128 : 256;
|
|
45793
|
+
const hashAlgorithm = "SHA-512";
|
|
45794
|
+
const hashSize = 64;
|
|
45795
|
+
const blockSize = 16;
|
|
45796
|
+
const spinCount = options.spinCount ?? 1e5;
|
|
45797
|
+
const keyDataSalt = randomBytes(16);
|
|
45798
|
+
const pkeSalt = randomBytes(16);
|
|
45799
|
+
const documentKey = randomBytes(keyBits / 8);
|
|
45800
|
+
const verifierHashInput = randomBytes(16);
|
|
45801
|
+
const verifierHash = await hash(hashAlgorithm, verifierHashInput);
|
|
45802
|
+
const base = await computeAgileKeyBase(password, pkeSalt, spinCount, hashAlgorithm);
|
|
45803
|
+
const encryptUnder = async (block, data) => {
|
|
45804
|
+
const key2 = await deriveAgileKeyFromBase(base, hashAlgorithm, block, keyBits, hashSize);
|
|
45805
|
+
return aesCbcEncryptNoPad(key2, pkeSalt, padTo(data, blockSize));
|
|
45806
|
+
};
|
|
45807
|
+
const passwordKeyEncryptor = {
|
|
45808
|
+
saltSize: 16,
|
|
45809
|
+
blockSize,
|
|
45810
|
+
keyBits,
|
|
45811
|
+
hashSize,
|
|
45812
|
+
cipherAlgorithm: "AES",
|
|
45813
|
+
cipherChaining: "ChainingModeCBC",
|
|
45814
|
+
hashAlgorithm,
|
|
45815
|
+
saltValue: pkeSalt,
|
|
45816
|
+
spinCount,
|
|
45817
|
+
encryptedVerifierHashInput: await encryptUnder(BLOCK_KEYS.verifierHashInput, verifierHashInput),
|
|
45818
|
+
encryptedVerifierHashValue: await encryptUnder(BLOCK_KEYS.verifierHashValue, verifierHash),
|
|
45819
|
+
encryptedKeyValue: await encryptUnder(BLOCK_KEYS.encryptedKeyValue, documentKey)
|
|
45820
|
+
};
|
|
45821
|
+
const keyData = {
|
|
45822
|
+
saltSize: 16,
|
|
45823
|
+
blockSize,
|
|
45824
|
+
keyBits,
|
|
45825
|
+
hashSize,
|
|
45826
|
+
cipherAlgorithm: "AES",
|
|
45827
|
+
cipherChaining: "ChainingModeCBC",
|
|
45828
|
+
hashAlgorithm,
|
|
45829
|
+
saltValue: keyDataSalt
|
|
45830
|
+
};
|
|
45831
|
+
const info = {
|
|
45832
|
+
keyData};
|
|
45833
|
+
const encryptedPackage = await encryptAgilePackage(packageData, documentKey, info);
|
|
45834
|
+
const hmacKey = randomBytes(hashSize);
|
|
45835
|
+
const hmacValue = await hmac(hashAlgorithm, hmacKey, encryptedPackage);
|
|
45836
|
+
const encryptIntegrity = async (block, data) => {
|
|
45837
|
+
const iv = await generateIV(hashAlgorithm, keyDataSalt, block, blockSize);
|
|
45838
|
+
return aesCbcEncryptNoPad(documentKey, iv, padTo(data, blockSize));
|
|
45839
|
+
};
|
|
45840
|
+
const dataIntegrity = {
|
|
45841
|
+
encryptedHmacKey: await encryptIntegrity(BLOCK_KEYS.dataIntegrityHmacKey, hmacKey),
|
|
45842
|
+
encryptedHmacValue: await encryptIntegrity(BLOCK_KEYS.dataIntegrityHmacValue, hmacValue)
|
|
45843
|
+
};
|
|
45844
|
+
const xml = buildAgileEncryptionInfoXml(keyData, passwordKeyEncryptor, dataIntegrity);
|
|
45845
|
+
return container(buildEncryptionInfoStream(xml), encryptedPackage);
|
|
45846
|
+
}
|
|
45847
|
+
async function encryptStandard(packageData, password, options = {}) {
|
|
45848
|
+
const keyBits = options.algorithm === "AES128" ? 128 : 256;
|
|
45849
|
+
const salt = randomBytes(16);
|
|
45850
|
+
const key2 = await deriveStandardKey(password, salt, keyBits);
|
|
45851
|
+
const verifier = randomBytes(16);
|
|
45852
|
+
const paddedVerifierHash = new Uint8Array(32);
|
|
45853
|
+
paddedVerifierHash.set((await hash("SHA-1", verifier)).subarray(0, 20));
|
|
45854
|
+
const encryptionInfo = buildStandardEncryptionInfoStream(
|
|
45855
|
+
keyBits,
|
|
45856
|
+
salt,
|
|
45857
|
+
await aesEcbEncrypt(key2, verifier),
|
|
45858
|
+
await aesEcbEncrypt(key2, paddedVerifierHash)
|
|
45859
|
+
);
|
|
45860
|
+
return container(encryptionInfo, await encryptStandardPackage(packageData, key2));
|
|
45861
|
+
}
|
|
45862
|
+
var SEGMENT_SIZE;
|
|
45863
|
+
var init_encrypt = __esm({
|
|
45864
|
+
"src/crypto/encrypt.ts"() {
|
|
45865
|
+
init_ole2_parser_write();
|
|
45866
|
+
init_ooxml_crypto_primitives();
|
|
45867
|
+
init_aes_ecb();
|
|
45868
|
+
init_encryption_info_write();
|
|
45869
|
+
init_key_derivation();
|
|
45870
|
+
SEGMENT_SIZE = 4096;
|
|
45871
|
+
}
|
|
45872
|
+
});
|
|
45873
|
+
|
|
45874
|
+
// src/crypto/encryption-info.ts
|
|
44548
45875
|
function parseEncryptionInfo(data) {
|
|
45876
|
+
if (data.byteLength < 8) throw new Error("The EncryptionInfo stream is truncated.");
|
|
44549
45877
|
const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
44550
45878
|
const versionMajor = view.getUint16(0, true);
|
|
44551
45879
|
const versionMinor = view.getUint16(2, true);
|
|
44552
|
-
if (versionMajor === 4 && versionMinor === 4)
|
|
44553
|
-
return parseAgileEncryptionInfo(data);
|
|
44554
|
-
}
|
|
45880
|
+
if (versionMajor === 4 && versionMinor === 4) return parseAgileEncryptionInfo(data);
|
|
44555
45881
|
if ((versionMajor === 2 || versionMajor === 3 || versionMajor === 4) && versionMinor === 2) {
|
|
44556
45882
|
return parseStandardEncryptionInfo(data);
|
|
44557
45883
|
}
|
|
@@ -44567,19 +45893,15 @@ function parseStandardEncryptionInfo(data) {
|
|
|
44567
45893
|
const headerSize = view.getUint32(8, true);
|
|
44568
45894
|
const headerOffset = 12;
|
|
44569
45895
|
const hFlags = view.getUint32(headerOffset, true);
|
|
44570
|
-
view.getUint32(headerOffset + 4, true);
|
|
44571
45896
|
const algId = view.getUint32(headerOffset + 8, true);
|
|
44572
45897
|
const algIdHash = view.getUint32(headerOffset + 12, true);
|
|
44573
45898
|
const keySize = view.getUint32(headerOffset + 16, true);
|
|
44574
45899
|
const providerType = view.getUint32(headerOffset + 20, true);
|
|
44575
45900
|
let cspName = "";
|
|
44576
|
-
const cspOffset = headerOffset + 32;
|
|
44577
45901
|
const cspEnd = headerOffset + headerSize;
|
|
44578
|
-
for (let i2 =
|
|
45902
|
+
for (let i2 = headerOffset + 32; i2 < cspEnd - 1; i2 += 2) {
|
|
44579
45903
|
const ch = view.getUint16(i2, true);
|
|
44580
|
-
if (ch === 0)
|
|
44581
|
-
break;
|
|
44582
|
-
}
|
|
45904
|
+
if (ch === 0) break;
|
|
44583
45905
|
cspName += String.fromCharCode(ch);
|
|
44584
45906
|
}
|
|
44585
45907
|
const verifierOffset = 12 + headerSize;
|
|
@@ -44599,14 +45921,7 @@ function parseStandardEncryptionInfo(data) {
|
|
|
44599
45921
|
isStandard: true,
|
|
44600
45922
|
flags,
|
|
44601
45923
|
headerSize,
|
|
44602
|
-
header: {
|
|
44603
|
-
flags: hFlags,
|
|
44604
|
-
algId,
|
|
44605
|
-
algIdHash,
|
|
44606
|
-
keySize,
|
|
44607
|
-
providerType,
|
|
44608
|
-
cspName
|
|
44609
|
-
},
|
|
45924
|
+
header: { flags: hFlags, algId, algIdHash, keySize, providerType, cspName },
|
|
44610
45925
|
verifier: {
|
|
44611
45926
|
saltSize,
|
|
44612
45927
|
salt: new Uint8Array(salt),
|
|
@@ -44616,615 +45931,157 @@ function parseStandardEncryptionInfo(data) {
|
|
|
44616
45931
|
}
|
|
44617
45932
|
};
|
|
44618
45933
|
}
|
|
45934
|
+
function tagAttribute(xml, tag, attr4) {
|
|
45935
|
+
const tagMatch = xml.match(new RegExp(`<[^>]*${tag}[^>]*>`, "i"));
|
|
45936
|
+
if (!tagMatch) return "";
|
|
45937
|
+
const attrMatch = tagMatch[0].match(new RegExp(`\\b${attr4}="([^"]*)"`, "i"));
|
|
45938
|
+
return attrMatch?.[1] ?? "";
|
|
45939
|
+
}
|
|
44619
45940
|
function parseAgileEncryptionInfo(data) {
|
|
44620
|
-
const
|
|
44621
|
-
const
|
|
44622
|
-
const
|
|
44623
|
-
|
|
44624
|
-
|
|
44625
|
-
|
|
44626
|
-
return "";
|
|
44627
|
-
}
|
|
44628
|
-
const attrRegex = new RegExp(`${attr4}="([^"]*)"`, "i");
|
|
44629
|
-
const attrMatch = tagMatch[0].match(attrRegex);
|
|
44630
|
-
return attrMatch ? attrMatch[1] : "";
|
|
44631
|
-
};
|
|
44632
|
-
const keyDataSaltSize = parseInt(getAttr(xmlStr, "keyData", "saltSize"), 10);
|
|
44633
|
-
const keyDataBlockSize = parseInt(getAttr(xmlStr, "keyData", "blockSize"), 10);
|
|
44634
|
-
const keyDataKeyBits = parseInt(getAttr(xmlStr, "keyData", "keyBits"), 10);
|
|
44635
|
-
const keyDataHashSize = parseInt(getAttr(xmlStr, "keyData", "hashSize"), 10);
|
|
44636
|
-
const keyDataCipherAlgorithm = getAttr(xmlStr, "keyData", "cipherAlgorithm");
|
|
44637
|
-
const keyDataCipherChaining = getAttr(xmlStr, "keyData", "cipherChaining");
|
|
44638
|
-
const keyDataHashAlgorithm = getAttr(xmlStr, "keyData", "hashAlgorithm");
|
|
44639
|
-
const keyDataSaltValue = getAttr(xmlStr, "keyData", "saltValue");
|
|
44640
|
-
const encryptedHmacKey = getAttr(xmlStr, "dataIntegrity", "encryptedHmacKey");
|
|
44641
|
-
const encryptedHmacValue = getAttr(xmlStr, "dataIntegrity", "encryptedHmacValue");
|
|
44642
|
-
const encKeyTag = xmlStr.match(/<[^>]*encryptedKey[^>]*>/i);
|
|
44643
|
-
const encKeyStr = encKeyTag ? encKeyTag[0] : "";
|
|
44644
|
-
const getEncKeyAttr = (attr4) => {
|
|
44645
|
-
const regex = new RegExp(`${attr4}="([^"]*)"`, "i");
|
|
44646
|
-
const match = encKeyStr.match(regex);
|
|
44647
|
-
return match ? match[1] : "";
|
|
44648
|
-
};
|
|
44649
|
-
const pkeSaltSize = parseInt(getEncKeyAttr("saltSize"), 10);
|
|
44650
|
-
const pkeBlockSize = parseInt(getEncKeyAttr("blockSize"), 10);
|
|
44651
|
-
const pkeKeyBits = parseInt(getEncKeyAttr("keyBits"), 10);
|
|
44652
|
-
const pkeHashSize = parseInt(getEncKeyAttr("hashSize"), 10);
|
|
44653
|
-
const pkeCipherAlgorithm = getEncKeyAttr("cipherAlgorithm");
|
|
44654
|
-
const pkeCipherChaining = getEncKeyAttr("cipherChaining");
|
|
44655
|
-
const pkeHashAlgorithm = getEncKeyAttr("hashAlgorithm");
|
|
44656
|
-
const pkeSaltValue = getEncKeyAttr("saltValue");
|
|
44657
|
-
const pkeSpinCount = parseInt(getEncKeyAttr("spinCount"), 10);
|
|
44658
|
-
const pkeEncryptedVerifierHashInput = getEncKeyAttr("encryptedVerifierHashInput");
|
|
44659
|
-
const pkeEncryptedVerifierHashValue = getEncKeyAttr("encryptedVerifierHashValue");
|
|
44660
|
-
const pkeEncryptedKeyValue = getEncKeyAttr("encryptedKeyValue");
|
|
45941
|
+
const xml = new TextDecoder("utf-8").decode(data.subarray(8));
|
|
45942
|
+
const keyData = (attr4) => tagAttribute(xml, "keyData", attr4);
|
|
45943
|
+
const integrity = (attr4) => tagAttribute(xml, "dataIntegrity", attr4);
|
|
45944
|
+
const pke = (attr4) => tagAttribute(xml, "encryptedKey", attr4);
|
|
45945
|
+
const int = (value) => parseInt(value, 10);
|
|
45946
|
+
const encryptedHmacKey = integrity("encryptedHmacKey");
|
|
44661
45947
|
return {
|
|
44662
45948
|
version: { major: 4, minor: 4 },
|
|
44663
45949
|
isAgile: true,
|
|
44664
45950
|
keyData: {
|
|
44665
|
-
saltSize:
|
|
44666
|
-
blockSize:
|
|
44667
|
-
keyBits:
|
|
44668
|
-
hashSize:
|
|
44669
|
-
cipherAlgorithm:
|
|
44670
|
-
cipherChaining:
|
|
44671
|
-
hashAlgorithm:
|
|
44672
|
-
saltValue: base64Decode(
|
|
45951
|
+
saltSize: int(keyData("saltSize")),
|
|
45952
|
+
blockSize: int(keyData("blockSize")),
|
|
45953
|
+
keyBits: int(keyData("keyBits")),
|
|
45954
|
+
hashSize: int(keyData("hashSize")),
|
|
45955
|
+
cipherAlgorithm: keyData("cipherAlgorithm"),
|
|
45956
|
+
cipherChaining: keyData("cipherChaining"),
|
|
45957
|
+
hashAlgorithm: keyData("hashAlgorithm"),
|
|
45958
|
+
saltValue: base64Decode(keyData("saltValue"))
|
|
44673
45959
|
},
|
|
44674
|
-
|
|
44675
|
-
|
|
44676
|
-
|
|
44677
|
-
|
|
45960
|
+
...encryptedHmacKey ? {
|
|
45961
|
+
dataIntegrity: {
|
|
45962
|
+
encryptedHmacKey: base64Decode(encryptedHmacKey),
|
|
45963
|
+
encryptedHmacValue: base64Decode(integrity("encryptedHmacValue"))
|
|
45964
|
+
}
|
|
45965
|
+
} : {},
|
|
44678
45966
|
passwordKeyEncryptor: {
|
|
44679
|
-
saltSize:
|
|
44680
|
-
blockSize:
|
|
44681
|
-
keyBits:
|
|
44682
|
-
hashSize:
|
|
44683
|
-
cipherAlgorithm:
|
|
44684
|
-
cipherChaining:
|
|
44685
|
-
hashAlgorithm:
|
|
44686
|
-
saltValue: base64Decode(
|
|
44687
|
-
spinCount:
|
|
44688
|
-
encryptedVerifierHashInput: base64Decode(
|
|
44689
|
-
encryptedVerifierHashValue: base64Decode(
|
|
44690
|
-
encryptedKeyValue: base64Decode(
|
|
44691
|
-
}
|
|
44692
|
-
};
|
|
44693
|
-
}
|
|
44694
|
-
var
|
|
44695
|
-
var
|
|
44696
|
-
"src/
|
|
44697
|
-
|
|
44698
|
-
BLOCK_KEYS = {
|
|
44699
|
-
verifierHashInput: new Uint8Array([254, 167, 210, 118, 59, 75, 158, 121]),
|
|
44700
|
-
verifierHashValue: new Uint8Array([215, 170, 15, 109, 48, 97, 52, 78]),
|
|
44701
|
-
encryptedKeyValue: new Uint8Array([20, 110, 11, 231, 171, 172, 208, 214]),
|
|
44702
|
-
dataIntegrityHmacKey: new Uint8Array([95, 178, 173, 1, 12, 185, 225, 246]),
|
|
44703
|
-
dataIntegrityHmacValue: new Uint8Array([160, 103, 127, 2, 178, 44, 132, 51])
|
|
44704
|
-
};
|
|
45967
|
+
saltSize: int(pke("saltSize")),
|
|
45968
|
+
blockSize: int(pke("blockSize")),
|
|
45969
|
+
keyBits: int(pke("keyBits")),
|
|
45970
|
+
hashSize: int(pke("hashSize")),
|
|
45971
|
+
cipherAlgorithm: pke("cipherAlgorithm"),
|
|
45972
|
+
cipherChaining: pke("cipherChaining"),
|
|
45973
|
+
hashAlgorithm: pke("hashAlgorithm"),
|
|
45974
|
+
saltValue: base64Decode(pke("saltValue")),
|
|
45975
|
+
spinCount: int(pke("spinCount")),
|
|
45976
|
+
encryptedVerifierHashInput: base64Decode(pke("encryptedVerifierHashInput")),
|
|
45977
|
+
encryptedVerifierHashValue: base64Decode(pke("encryptedVerifierHashValue")),
|
|
45978
|
+
encryptedKeyValue: base64Decode(pke("encryptedKeyValue"))
|
|
45979
|
+
}
|
|
45980
|
+
};
|
|
45981
|
+
}
|
|
45982
|
+
var RC4_ALG_ID;
|
|
45983
|
+
var init_encryption_info = __esm({
|
|
45984
|
+
"src/crypto/encryption-info.ts"() {
|
|
45985
|
+
init_ooxml_crypto_primitives();
|
|
44705
45986
|
RC4_ALG_ID = 26625;
|
|
44706
45987
|
}
|
|
44707
45988
|
});
|
|
44708
45989
|
|
|
44709
|
-
// src/
|
|
44710
|
-
|
|
44711
|
-
const
|
|
44712
|
-
|
|
44713
|
-
|
|
44714
|
-
|
|
44715
|
-
|
|
44716
|
-
|
|
44717
|
-
|
|
44718
|
-
pke.keyBits,
|
|
44719
|
-
pke.hashSize
|
|
44720
|
-
);
|
|
44721
|
-
const verifierHashInput = await aesCbcDecryptRaw(
|
|
44722
|
-
verifierInputKey,
|
|
44723
|
-
pke.saltValue,
|
|
44724
|
-
pke.encryptedVerifierHashInput
|
|
44725
|
-
);
|
|
44726
|
-
const verifierHashKey = await deriveAgileKey(
|
|
44727
|
-
password,
|
|
44728
|
-
pke.saltValue,
|
|
44729
|
-
pke.spinCount,
|
|
44730
|
-
pke.hashAlgorithm,
|
|
44731
|
-
BLOCK_KEYS.verifierHashValue,
|
|
44732
|
-
pke.keyBits,
|
|
44733
|
-
pke.hashSize
|
|
44734
|
-
);
|
|
44735
|
-
const verifierHashValue = await aesCbcDecryptRaw(
|
|
44736
|
-
verifierHashKey,
|
|
44737
|
-
pke.saltValue,
|
|
44738
|
-
pke.encryptedVerifierHashValue
|
|
44739
|
-
);
|
|
44740
|
-
const computedHash = await hash(pke.hashAlgorithm, verifierHashInput.subarray(0, pke.saltSize));
|
|
44741
|
-
const expectedHash = verifierHashValue.subarray(0, pke.hashSize);
|
|
44742
|
-
const actualHash = computedHash.subarray(0, pke.hashSize);
|
|
44743
|
-
let match = true;
|
|
44744
|
-
for (let i2 = 0; i2 < pke.hashSize; i2++) {
|
|
44745
|
-
if (expectedHash[i2] !== actualHash[i2]) {
|
|
44746
|
-
match = false;
|
|
44747
|
-
break;
|
|
44748
|
-
}
|
|
44749
|
-
}
|
|
44750
|
-
if (!match) {
|
|
44751
|
-
return null;
|
|
45990
|
+
// src/crypto/index.ts
|
|
45991
|
+
function streams(bytes) {
|
|
45992
|
+
const opened = openEncryptedPackage(bytes);
|
|
45993
|
+
if (opened) return { info: opened.encryptionInfo, data: opened.encryptedPackage };
|
|
45994
|
+
const file = parseOle2(toArrayBuffer(bytes));
|
|
45995
|
+
if (!file.getStream("EncryptionInfo")) {
|
|
45996
|
+
throw new Error(
|
|
45997
|
+
"EncryptionInfo stream not found. The file may not be an encrypted OOXML package."
|
|
45998
|
+
);
|
|
44752
45999
|
}
|
|
44753
|
-
|
|
44754
|
-
password,
|
|
44755
|
-
pke.saltValue,
|
|
44756
|
-
pke.spinCount,
|
|
44757
|
-
pke.hashAlgorithm,
|
|
44758
|
-
BLOCK_KEYS.encryptedKeyValue,
|
|
44759
|
-
pke.keyBits,
|
|
44760
|
-
pke.hashSize
|
|
44761
|
-
);
|
|
44762
|
-
const decryptedKey = await aesCbcDecryptRaw(encKeyKey, pke.saltValue, pke.encryptedKeyValue);
|
|
44763
|
-
return decryptedKey.subarray(0, info.keyData.keyBits / 8);
|
|
46000
|
+
throw new Error("EncryptedPackage stream not found. The file may be corrupted.");
|
|
44764
46001
|
}
|
|
44765
|
-
async function
|
|
44766
|
-
const
|
|
44767
|
-
|
|
44768
|
-
|
|
44769
|
-
info
|
|
44770
|
-
|
|
44771
|
-
|
|
44772
|
-
const iv = new Uint8Array(16);
|
|
44773
|
-
const decryptedVerifier = await aesCbcDecryptRaw(key2, iv, info.verifier.encryptedVerifier);
|
|
44774
|
-
const decryptedHash = await aesCbcDecryptRaw(key2, iv, info.verifier.encryptedVerifierHash);
|
|
44775
|
-
const computedHash = await hash("SHA-1", decryptedVerifier);
|
|
44776
|
-
const hashSize = info.verifier.verifierHashSize;
|
|
44777
|
-
let match = true;
|
|
44778
|
-
for (let i2 = 0; i2 < Math.min(hashSize, 20); i2++) {
|
|
44779
|
-
if (computedHash[i2] !== decryptedHash[i2]) {
|
|
44780
|
-
match = false;
|
|
44781
|
-
break;
|
|
44782
|
-
}
|
|
46002
|
+
async function decryptOoxmlPackage(input, password) {
|
|
46003
|
+
const { info: infoStream, data } = streams(toBytes(input));
|
|
46004
|
+
const info = parseEncryptionInfo(infoStream);
|
|
46005
|
+
if (isStandard(info)) {
|
|
46006
|
+
const key3 = await verifyStandardPassword(info, password);
|
|
46007
|
+
if (!key3) throw new IncorrectPasswordError();
|
|
46008
|
+
return new Uint8Array(await decryptStandardPackage(data, key3));
|
|
44783
46009
|
}
|
|
44784
|
-
|
|
46010
|
+
const key2 = await verifyAgilePassword(info, password);
|
|
46011
|
+
if (!key2) throw new IncorrectPasswordError();
|
|
46012
|
+
await verifyAgileDataIntegrity(info, key2, data);
|
|
46013
|
+
return new Uint8Array(await decryptAgilePackage(data, key2, info));
|
|
44785
46014
|
}
|
|
44786
|
-
|
|
44787
|
-
const
|
|
44788
|
-
|
|
44789
|
-
return;
|
|
44790
|
-
}
|
|
44791
|
-
const hmacKeyIV = await generateIV(
|
|
44792
|
-
keyData.hashAlgorithm,
|
|
44793
|
-
keyData.saltValue,
|
|
44794
|
-
BLOCK_KEYS.dataIntegrityHmacKey,
|
|
44795
|
-
keyData.blockSize
|
|
44796
|
-
);
|
|
44797
|
-
const decryptedHmacKey = await aesCbcDecryptRaw(
|
|
44798
|
-
key2,
|
|
44799
|
-
hmacKeyIV,
|
|
44800
|
-
info.dataIntegrity.encryptedHmacKey
|
|
44801
|
-
);
|
|
44802
|
-
const hmacKey = decryptedHmacKey.subarray(0, keyData.hashSize);
|
|
44803
|
-
const hmacValueIV = await generateIV(
|
|
44804
|
-
keyData.hashAlgorithm,
|
|
44805
|
-
keyData.saltValue,
|
|
44806
|
-
BLOCK_KEYS.dataIntegrityHmacValue,
|
|
44807
|
-
keyData.blockSize
|
|
44808
|
-
);
|
|
44809
|
-
const decryptedHmacValue = await aesCbcDecryptRaw(
|
|
44810
|
-
key2,
|
|
44811
|
-
hmacValueIV,
|
|
44812
|
-
info.dataIntegrity.encryptedHmacValue
|
|
44813
|
-
);
|
|
44814
|
-
const expectedHmac = decryptedHmacValue.subarray(0, keyData.hashSize);
|
|
44815
|
-
const computedHmac = await hmac(keyData.hashAlgorithm, hmacKey, encryptedPackage);
|
|
44816
|
-
let match = true;
|
|
44817
|
-
if (computedHmac.length < keyData.hashSize) {
|
|
44818
|
-
match = false;
|
|
44819
|
-
} else {
|
|
44820
|
-
for (let i2 = 0; i2 < keyData.hashSize; i2++) {
|
|
44821
|
-
if (computedHmac[i2] !== expectedHmac[i2]) {
|
|
44822
|
-
match = false;
|
|
44823
|
-
break;
|
|
44824
|
-
}
|
|
44825
|
-
}
|
|
44826
|
-
}
|
|
44827
|
-
if (!match) {
|
|
44828
|
-
throw new DataIntegrityError(
|
|
44829
|
-
"Data integrity check failed. The encrypted file may be corrupted or tampered with."
|
|
44830
|
-
);
|
|
44831
|
-
}
|
|
46015
|
+
function encryptOoxmlPackage(input, password, options = {}) {
|
|
46016
|
+
const bytes = toBytes(input);
|
|
46017
|
+
return options.encryptionScheme === "standard" ? encryptStandard(bytes, password, options) : encryptAgile(bytes, password, options);
|
|
44832
46018
|
}
|
|
44833
|
-
async function
|
|
44834
|
-
|
|
44835
|
-
|
|
44836
|
-
|
|
44837
|
-
|
|
44838
|
-
|
|
44839
|
-
|
|
44840
|
-
|
|
44841
|
-
|
|
44842
|
-
for (let segment = 0; segment < numSegments; segment++) {
|
|
44843
|
-
const segmentStart = segment * segmentSize;
|
|
44844
|
-
const segmentEnd = Math.min(segmentStart + segmentSize, encryptedData.length);
|
|
44845
|
-
const segmentData = encryptedData.subarray(segmentStart, segmentEnd);
|
|
44846
|
-
const blockKeyBytes = uint32LE(segment);
|
|
44847
|
-
const segmentIV = await generateIV(
|
|
44848
|
-
keyData.hashAlgorithm,
|
|
44849
|
-
keyData.saltValue,
|
|
44850
|
-
blockKeyBytes,
|
|
44851
|
-
keyData.blockSize
|
|
44852
|
-
);
|
|
44853
|
-
const decrypted = await aesCbcDecryptRaw(key2, segmentIV, segmentData);
|
|
44854
|
-
const bytesToCopy = Math.min(decrypted.length, originalSize - resultOffset);
|
|
44855
|
-
result.set(decrypted.subarray(0, bytesToCopy), resultOffset);
|
|
44856
|
-
resultOffset += bytesToCopy;
|
|
46019
|
+
async function verifyOoxmlPackagePassword(input, password) {
|
|
46020
|
+
try {
|
|
46021
|
+
const opened = openEncryptedPackage(input);
|
|
46022
|
+
if (!opened) return false;
|
|
46023
|
+
const info = parseEncryptionInfo(opened.encryptionInfo);
|
|
46024
|
+
const key2 = isStandard(info) ? await verifyStandardPassword(info, password) : await verifyAgilePassword(info, password);
|
|
46025
|
+
return key2 !== null;
|
|
46026
|
+
} catch {
|
|
46027
|
+
return false;
|
|
44857
46028
|
}
|
|
44858
|
-
return result.buffer;
|
|
44859
46029
|
}
|
|
44860
|
-
|
|
44861
|
-
|
|
44862
|
-
|
|
44863
|
-
|
|
44864
|
-
|
|
44865
|
-
|
|
44866
|
-
|
|
44867
|
-
|
|
44868
|
-
|
|
44869
|
-
|
|
44870
|
-
init_ooxml_crypto_errors();
|
|
44871
|
-
init_ooxml_crypto_key_derivation();
|
|
44872
|
-
init_ooxml_crypto_primitives2();
|
|
46030
|
+
var isStandard;
|
|
46031
|
+
var init_crypto = __esm({
|
|
46032
|
+
"src/crypto/index.ts"() {
|
|
46033
|
+
init_ole2_parser_read();
|
|
46034
|
+
init_decrypt();
|
|
46035
|
+
init_detect();
|
|
46036
|
+
init_encrypt();
|
|
46037
|
+
init_encryption_info();
|
|
46038
|
+
init_errors();
|
|
46039
|
+
isStandard = (info) => "isStandard" in info && info.isStandard;
|
|
44873
46040
|
}
|
|
44874
46041
|
});
|
|
44875
46042
|
|
|
44876
|
-
// src/pptx/core/utils/ooxml-crypto-
|
|
44877
|
-
|
|
44878
|
-
|
|
44879
|
-
|
|
44880
|
-
const paddedSize = Math.ceil(packageData.length / segmentSize) * segmentSize;
|
|
44881
|
-
const paddedData = new Uint8Array(paddedSize);
|
|
44882
|
-
paddedData.set(packageData);
|
|
44883
|
-
const encrypted = new Uint8Array(8 + paddedSize);
|
|
44884
|
-
const sizeView = new DataView(encrypted.buffer, 0, 8);
|
|
44885
|
-
sizeView.setUint32(0, packageData.length, true);
|
|
44886
|
-
sizeView.setUint32(4, 0, true);
|
|
44887
|
-
const numSegments = Math.ceil(paddedSize / segmentSize);
|
|
44888
|
-
for (let segment = 0; segment < numSegments; segment++) {
|
|
44889
|
-
const segmentStart = segment * segmentSize;
|
|
44890
|
-
const segmentEnd = segmentStart + segmentSize;
|
|
44891
|
-
const segmentData = paddedData.subarray(segmentStart, segmentEnd);
|
|
44892
|
-
const blockKeyBytes = uint32LE(segment);
|
|
44893
|
-
const segmentIV = await generateIV(
|
|
44894
|
-
keyData.hashAlgorithm,
|
|
44895
|
-
keyData.saltValue,
|
|
44896
|
-
blockKeyBytes,
|
|
44897
|
-
keyData.blockSize
|
|
44898
|
-
);
|
|
44899
|
-
const encryptedSegment = await aesCbcEncryptNoPad(key2, segmentIV, segmentData);
|
|
44900
|
-
encrypted.set(encryptedSegment, 8 + segmentStart);
|
|
44901
|
-
}
|
|
44902
|
-
return encrypted;
|
|
44903
|
-
}
|
|
44904
|
-
function buildAgileEncryptionInfoXml(keyData, pke, dataIntegrity) {
|
|
44905
|
-
const xmlNs = "http://schemas.microsoft.com/office/2006/encryption";
|
|
44906
|
-
const pNs = "http://schemas.microsoft.com/office/2006/keyEncryptor/password";
|
|
44907
|
-
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
|
|
44908
|
-
<encryption xmlns="${xmlNs}" xmlns:p="${pNs}"><keyData saltSize="${keyData.saltSize}" blockSize="${keyData.blockSize}" keyBits="${keyData.keyBits}" hashSize="${keyData.hashSize}" cipherAlgorithm="${keyData.cipherAlgorithm}" cipherChaining="${keyData.cipherChaining}" hashAlgorithm="${keyData.hashAlgorithm}" saltValue="${base64Encode(keyData.saltValue)}"/><dataIntegrity encryptedHmacKey="${base64Encode(dataIntegrity.encryptedHmacKey)}" encryptedHmacValue="${base64Encode(dataIntegrity.encryptedHmacValue)}"/><keyEncryptors><keyEncryptor uri="http://schemas.microsoft.com/office/2006/keyEncryptor/password"><p:encryptedKey spinCount="${pke.spinCount}" saltSize="${pke.saltSize}" blockSize="${pke.blockSize}" keyBits="${pke.keyBits}" hashSize="${pke.hashSize}" cipherAlgorithm="${pke.cipherAlgorithm}" cipherChaining="${pke.cipherChaining}" hashAlgorithm="${pke.hashAlgorithm}" saltValue="${base64Encode(pke.saltValue)}" encryptedVerifierHashInput="${base64Encode(pke.encryptedVerifierHashInput)}" encryptedVerifierHashValue="${base64Encode(pke.encryptedVerifierHashValue)}" encryptedKeyValue="${base64Encode(pke.encryptedKeyValue)}"/></keyEncryptor></keyEncryptors></encryption>`;
|
|
44909
|
-
}
|
|
44910
|
-
function buildEncryptionInfoStream(xmlString) {
|
|
44911
|
-
const xmlBytes = new TextEncoder().encode(xmlString);
|
|
44912
|
-
const result = new Uint8Array(8 + xmlBytes.length);
|
|
44913
|
-
const view = new DataView(result.buffer);
|
|
44914
|
-
view.setUint16(0, 4, true);
|
|
44915
|
-
view.setUint16(2, 4, true);
|
|
44916
|
-
view.setUint32(4, 64, true);
|
|
44917
|
-
result.set(xmlBytes, 8);
|
|
44918
|
-
return result;
|
|
44919
|
-
}
|
|
44920
|
-
async function encryptStandardPackage(packageData, key2) {
|
|
44921
|
-
const blockSize = 16;
|
|
44922
|
-
const paddedSize = Math.ceil(packageData.length / blockSize) * blockSize;
|
|
44923
|
-
const paddedData = new Uint8Array(paddedSize);
|
|
44924
|
-
paddedData.set(packageData);
|
|
44925
|
-
const iv = new Uint8Array(blockSize);
|
|
44926
|
-
const encryptedData = await aesCbcEncryptNoPad(key2, iv, paddedData);
|
|
44927
|
-
const encrypted = new Uint8Array(8 + encryptedData.length);
|
|
44928
|
-
const sizeView = new DataView(encrypted.buffer, 0, 8);
|
|
44929
|
-
sizeView.setUint32(0, packageData.length, true);
|
|
44930
|
-
sizeView.setUint32(4, 0, true);
|
|
44931
|
-
encrypted.set(encryptedData, 8);
|
|
44932
|
-
return encrypted;
|
|
44933
|
-
}
|
|
44934
|
-
function buildStandardEncryptionInfoStream(keyBits, salt, encryptedVerifier, encryptedVerifierHash) {
|
|
44935
|
-
const algId = STANDARD_ALG_IDS[keyBits];
|
|
44936
|
-
if (!algId) {
|
|
44937
|
-
throw new Error(
|
|
44938
|
-
`Unsupported standard encryption key size: ${keyBits} bits. Use 128, 192, or 256.`
|
|
44939
|
-
);
|
|
44940
|
-
}
|
|
44941
|
-
const cspNameBytes = new Uint8Array((STANDARD_CSP_NAME.length + 1) * 2);
|
|
44942
|
-
for (let i2 = 0; i2 < STANDARD_CSP_NAME.length; i2++) {
|
|
44943
|
-
const code = STANDARD_CSP_NAME.charCodeAt(i2);
|
|
44944
|
-
cspNameBytes[i2 * 2] = code & 255;
|
|
44945
|
-
cspNameBytes[i2 * 2 + 1] = code >> 8 & 255;
|
|
44946
|
-
}
|
|
44947
|
-
const headerFixedSize = 32;
|
|
44948
|
-
const headerSize = headerFixedSize + cspNameBytes.length;
|
|
44949
|
-
const verifierSize = 4 + 16 + 16 + 4 + 32;
|
|
44950
|
-
const totalSize = 12 + headerSize + verifierSize;
|
|
44951
|
-
const data = new Uint8Array(totalSize);
|
|
44952
|
-
const view = new DataView(data.buffer);
|
|
44953
|
-
view.setUint16(0, 4, true);
|
|
44954
|
-
view.setUint16(2, 2, true);
|
|
44955
|
-
view.setUint32(4, STANDARD_FLAGS, true);
|
|
44956
|
-
view.setUint32(8, headerSize, true);
|
|
44957
|
-
const h2 = 12;
|
|
44958
|
-
view.setUint32(h2, STANDARD_FLAGS, true);
|
|
44959
|
-
view.setUint32(h2 + 4, 0, true);
|
|
44960
|
-
view.setUint32(h2 + 8, algId, true);
|
|
44961
|
-
view.setUint32(h2 + 12, STANDARD_ALG_ID_HASH_SHA1, true);
|
|
44962
|
-
view.setUint32(h2 + 16, keyBits, true);
|
|
44963
|
-
view.setUint32(h2 + 20, STANDARD_PROVIDER_TYPE_RSA_AES, true);
|
|
44964
|
-
view.setUint32(h2 + 24, 0, true);
|
|
44965
|
-
view.setUint32(h2 + 28, 0, true);
|
|
44966
|
-
data.set(cspNameBytes, h2 + 32);
|
|
44967
|
-
const v = 12 + headerSize;
|
|
44968
|
-
view.setUint32(v, 16, true);
|
|
44969
|
-
data.set(salt.subarray(0, 16), v + 4);
|
|
44970
|
-
data.set(encryptedVerifier.subarray(0, 16), v + 20);
|
|
44971
|
-
view.setUint32(v + 36, 20, true);
|
|
44972
|
-
data.set(encryptedVerifierHash.subarray(0, 32), v + 40);
|
|
44973
|
-
return data;
|
|
44974
|
-
}
|
|
44975
|
-
async function encryptPptxStandard(pptxBuffer, password, options) {
|
|
44976
|
-
const algorithm = options?.algorithm ?? "AES256";
|
|
44977
|
-
const keyBits = algorithm === "AES128" ? 128 : 256;
|
|
44978
|
-
const crypto2 = getCrypto();
|
|
44979
|
-
const salt = new Uint8Array(16);
|
|
44980
|
-
crypto2.getRandomValues(salt);
|
|
44981
|
-
const key2 = await deriveStandardKey(password, salt, keyBits);
|
|
44982
|
-
const verifier = new Uint8Array(16);
|
|
44983
|
-
crypto2.getRandomValues(verifier);
|
|
44984
|
-
const verifierHash = await hash("SHA-1", verifier);
|
|
44985
|
-
const paddedVerifierHash = new Uint8Array(32);
|
|
44986
|
-
paddedVerifierHash.set(verifierHash.subarray(0, 20));
|
|
44987
|
-
const zeroIv = new Uint8Array(16);
|
|
44988
|
-
const encryptedVerifier = await aesCbcEncryptNoPad(key2, zeroIv, verifier);
|
|
44989
|
-
const encryptedVerifierHash = await aesCbcEncryptNoPad(key2, zeroIv, paddedVerifierHash);
|
|
44990
|
-
const encryptionInfoBytes = buildStandardEncryptionInfoStream(
|
|
44991
|
-
keyBits,
|
|
44992
|
-
salt,
|
|
44993
|
-
encryptedVerifier,
|
|
44994
|
-
encryptedVerifierHash
|
|
44995
|
-
);
|
|
44996
|
-
const packageData = new Uint8Array(pptxBuffer);
|
|
44997
|
-
const encryptedPackage = await encryptStandardPackage(packageData, key2);
|
|
44998
|
-
const ole2Streams = /* @__PURE__ */ new Map();
|
|
44999
|
-
ole2Streams.set("EncryptionInfo", encryptionInfoBytes);
|
|
45000
|
-
ole2Streams.set("EncryptedPackage", encryptedPackage);
|
|
45001
|
-
return buildOle2(ole2Streams);
|
|
45002
|
-
}
|
|
45003
|
-
var STANDARD_ALG_IDS, STANDARD_ALG_ID_HASH_SHA1, STANDARD_PROVIDER_TYPE_RSA_AES, STANDARD_CSP_NAME, STANDARD_FLAGS;
|
|
45004
|
-
var init_ooxml_crypto_encrypt = __esm({
|
|
45005
|
-
"src/pptx/core/utils/ooxml-crypto-encrypt.ts"() {
|
|
45006
|
-
init_ole2_parser();
|
|
45007
|
-
init_ooxml_crypto_key_derivation();
|
|
45008
|
-
init_ooxml_crypto_primitives2();
|
|
45009
|
-
STANDARD_ALG_IDS = {
|
|
45010
|
-
128: 26126,
|
|
45011
|
-
// CALG_AES_128
|
|
45012
|
-
192: 26127,
|
|
45013
|
-
// CALG_AES_192
|
|
45014
|
-
256: 26128
|
|
45015
|
-
// CALG_AES_256
|
|
45016
|
-
};
|
|
45017
|
-
STANDARD_ALG_ID_HASH_SHA1 = 32772;
|
|
45018
|
-
STANDARD_PROVIDER_TYPE_RSA_AES = 24;
|
|
45019
|
-
STANDARD_CSP_NAME = "Microsoft Enhanced RSA and AES Cryptographic Provider";
|
|
45020
|
-
STANDARD_FLAGS = 36;
|
|
46043
|
+
// src/pptx/core/utils/ooxml-crypto-primitives.ts
|
|
46044
|
+
var init_ooxml_crypto_primitives2 = __esm({
|
|
46045
|
+
"src/pptx/core/utils/ooxml-crypto-primitives.ts"() {
|
|
46046
|
+
init_ooxml_crypto_primitives();
|
|
45021
46047
|
}
|
|
45022
46048
|
});
|
|
45023
46049
|
|
|
45024
46050
|
// src/pptx/core/utils/ooxml-crypto.ts
|
|
45025
46051
|
async function decryptPptx(encryptedBuffer, password) {
|
|
45026
|
-
|
|
45027
|
-
const encryptionInfoStream = ole2.getStream("EncryptionInfo");
|
|
45028
|
-
if (!encryptionInfoStream) {
|
|
45029
|
-
throw new Error(
|
|
45030
|
-
"EncryptionInfo stream not found. The file may not be an encrypted OOXML package."
|
|
45031
|
-
);
|
|
45032
|
-
}
|
|
45033
|
-
const encryptedPackage = ole2.getStream("EncryptedPackage");
|
|
45034
|
-
if (!encryptedPackage) {
|
|
45035
|
-
throw new Error("EncryptedPackage stream not found. The file may be corrupted.");
|
|
45036
|
-
}
|
|
45037
|
-
const info = parseEncryptionInfo(encryptionInfoStream);
|
|
45038
|
-
if ("isStandard" in info && info.isStandard) {
|
|
45039
|
-
const key3 = await verifyStandardPassword(info, password);
|
|
45040
|
-
if (!key3) {
|
|
45041
|
-
throw new IncorrectPasswordError();
|
|
45042
|
-
}
|
|
45043
|
-
return decryptStandardPackage(encryptedPackage, key3);
|
|
45044
|
-
}
|
|
45045
|
-
const agileInfo = info;
|
|
45046
|
-
const key2 = await verifyAgilePassword(agileInfo, password);
|
|
45047
|
-
if (!key2) {
|
|
45048
|
-
throw new IncorrectPasswordError();
|
|
45049
|
-
}
|
|
45050
|
-
await verifyAgileDataIntegrity(agileInfo, key2, encryptedPackage);
|
|
45051
|
-
return decryptAgilePackage(encryptedPackage, key2, agileInfo);
|
|
46052
|
+
return (await decryptOoxmlPackage(encryptedBuffer, password)).buffer;
|
|
45052
46053
|
}
|
|
45053
46054
|
async function encryptPptx(pptxBuffer, password, options) {
|
|
45054
|
-
|
|
45055
|
-
return encryptPptxStandard(pptxBuffer, password, options);
|
|
45056
|
-
}
|
|
45057
|
-
const algorithm = options?.algorithm ?? "AES256";
|
|
45058
|
-
const keyBits = algorithm === "AES128" ? 128 : 256;
|
|
45059
|
-
const crypto2 = getCrypto();
|
|
45060
|
-
const keyDataSalt = new Uint8Array(16);
|
|
45061
|
-
crypto2.getRandomValues(keyDataSalt);
|
|
45062
|
-
const pkeSalt = new Uint8Array(16);
|
|
45063
|
-
crypto2.getRandomValues(pkeSalt);
|
|
45064
|
-
const documentKey = new Uint8Array(keyBits / 8);
|
|
45065
|
-
crypto2.getRandomValues(documentKey);
|
|
45066
|
-
const hashAlgorithm = "SHA-512";
|
|
45067
|
-
const hashSize = 64;
|
|
45068
|
-
const blockSize = 16;
|
|
45069
|
-
const spinCount = options?.spinCount ?? 1e5;
|
|
45070
|
-
const verifierHashInput = new Uint8Array(16);
|
|
45071
|
-
crypto2.getRandomValues(verifierHashInput);
|
|
45072
|
-
const verifierHash = await hash(hashAlgorithm, verifierHashInput);
|
|
45073
|
-
const verifierInputKey = await deriveAgileKey(
|
|
45074
|
-
password,
|
|
45075
|
-
pkeSalt,
|
|
45076
|
-
spinCount,
|
|
45077
|
-
hashAlgorithm,
|
|
45078
|
-
BLOCK_KEYS.verifierHashInput,
|
|
45079
|
-
keyBits,
|
|
45080
|
-
hashSize
|
|
45081
|
-
);
|
|
45082
|
-
const paddedVerifierInput = new Uint8Array(
|
|
45083
|
-
Math.ceil(verifierHashInput.length / blockSize) * blockSize
|
|
45084
|
-
);
|
|
45085
|
-
paddedVerifierInput.set(verifierHashInput);
|
|
45086
|
-
const encryptedVerifierHashInput = await aesCbcEncryptNoPad(
|
|
45087
|
-
verifierInputKey,
|
|
45088
|
-
pkeSalt,
|
|
45089
|
-
paddedVerifierInput
|
|
45090
|
-
);
|
|
45091
|
-
const verifierHashKey = await deriveAgileKey(
|
|
45092
|
-
password,
|
|
45093
|
-
pkeSalt,
|
|
45094
|
-
spinCount,
|
|
45095
|
-
hashAlgorithm,
|
|
45096
|
-
BLOCK_KEYS.verifierHashValue,
|
|
45097
|
-
keyBits,
|
|
45098
|
-
hashSize
|
|
45099
|
-
);
|
|
45100
|
-
const paddedVerifierHash = new Uint8Array(Math.ceil(verifierHash.length / blockSize) * blockSize);
|
|
45101
|
-
paddedVerifierHash.set(verifierHash);
|
|
45102
|
-
const encryptedVerifierHashValue = await aesCbcEncryptNoPad(
|
|
45103
|
-
verifierHashKey,
|
|
45104
|
-
pkeSalt,
|
|
45105
|
-
paddedVerifierHash
|
|
45106
|
-
);
|
|
45107
|
-
const encKeyKey = await deriveAgileKey(
|
|
45108
|
-
password,
|
|
45109
|
-
pkeSalt,
|
|
45110
|
-
spinCount,
|
|
45111
|
-
hashAlgorithm,
|
|
45112
|
-
BLOCK_KEYS.encryptedKeyValue,
|
|
45113
|
-
keyBits,
|
|
45114
|
-
hashSize
|
|
45115
|
-
);
|
|
45116
|
-
const paddedDocumentKey = new Uint8Array(Math.ceil(documentKey.length / blockSize) * blockSize);
|
|
45117
|
-
paddedDocumentKey.set(documentKey);
|
|
45118
|
-
const encryptedKeyValue = await aesCbcEncryptNoPad(encKeyKey, pkeSalt, paddedDocumentKey);
|
|
45119
|
-
const encInfo = {
|
|
45120
|
-
keyData: {
|
|
45121
|
-
saltSize: 16,
|
|
45122
|
-
blockSize,
|
|
45123
|
-
keyBits,
|
|
45124
|
-
hashSize,
|
|
45125
|
-
cipherAlgorithm: "AES",
|
|
45126
|
-
cipherChaining: "ChainingModeCBC",
|
|
45127
|
-
hashAlgorithm,
|
|
45128
|
-
saltValue: keyDataSalt
|
|
45129
|
-
},
|
|
45130
|
-
dataIntegrity: {
|
|
45131
|
-
encryptedHmacKey: new Uint8Array(0),
|
|
45132
|
-
// Will be filled after encryption
|
|
45133
|
-
encryptedHmacValue: new Uint8Array(0)
|
|
45134
|
-
},
|
|
45135
|
-
passwordKeyEncryptor: {
|
|
45136
|
-
saltSize: 16,
|
|
45137
|
-
blockSize,
|
|
45138
|
-
keyBits,
|
|
45139
|
-
hashSize,
|
|
45140
|
-
cipherAlgorithm: "AES",
|
|
45141
|
-
cipherChaining: "ChainingModeCBC",
|
|
45142
|
-
hashAlgorithm,
|
|
45143
|
-
saltValue: pkeSalt,
|
|
45144
|
-
spinCount,
|
|
45145
|
-
encryptedVerifierHashInput,
|
|
45146
|
-
encryptedVerifierHashValue,
|
|
45147
|
-
encryptedKeyValue
|
|
45148
|
-
}
|
|
45149
|
-
};
|
|
45150
|
-
const packageData = new Uint8Array(pptxBuffer);
|
|
45151
|
-
const encryptedPackage = await encryptAgilePackage(packageData, documentKey, encInfo);
|
|
45152
|
-
const hmacKeyRandom = new Uint8Array(hashSize);
|
|
45153
|
-
crypto2.getRandomValues(hmacKeyRandom);
|
|
45154
|
-
const hmacValue = await hmac(hashAlgorithm, hmacKeyRandom, encryptedPackage);
|
|
45155
|
-
const hmacKeyIV = await generateIV(
|
|
45156
|
-
hashAlgorithm,
|
|
45157
|
-
keyDataSalt,
|
|
45158
|
-
BLOCK_KEYS.dataIntegrityHmacKey,
|
|
45159
|
-
blockSize
|
|
45160
|
-
);
|
|
45161
|
-
const paddedHmacKey = new Uint8Array(Math.ceil(hmacKeyRandom.length / blockSize) * blockSize);
|
|
45162
|
-
paddedHmacKey.set(hmacKeyRandom);
|
|
45163
|
-
const encryptedHmacKey = await aesCbcEncryptNoPad(documentKey, hmacKeyIV, paddedHmacKey);
|
|
45164
|
-
const hmacValueIV = await generateIV(
|
|
45165
|
-
hashAlgorithm,
|
|
45166
|
-
keyDataSalt,
|
|
45167
|
-
BLOCK_KEYS.dataIntegrityHmacValue,
|
|
45168
|
-
blockSize
|
|
45169
|
-
);
|
|
45170
|
-
const paddedHmacValue = new Uint8Array(Math.ceil(hmacValue.length / blockSize) * blockSize);
|
|
45171
|
-
paddedHmacValue.set(hmacValue);
|
|
45172
|
-
const encryptedHmacValue = await aesCbcEncryptNoPad(documentKey, hmacValueIV, paddedHmacValue);
|
|
45173
|
-
encInfo.dataIntegrity = {
|
|
45174
|
-
encryptedHmacKey,
|
|
45175
|
-
encryptedHmacValue
|
|
45176
|
-
};
|
|
45177
|
-
const xmlStr = buildAgileEncryptionInfoXml(
|
|
45178
|
-
encInfo.keyData,
|
|
45179
|
-
encInfo.passwordKeyEncryptor,
|
|
45180
|
-
encInfo.dataIntegrity
|
|
45181
|
-
);
|
|
45182
|
-
const encryptionInfoBytes = buildEncryptionInfoStream(xmlStr);
|
|
45183
|
-
const ole2Streams = /* @__PURE__ */ new Map();
|
|
45184
|
-
ole2Streams.set("EncryptionInfo", encryptionInfoBytes);
|
|
45185
|
-
ole2Streams.set("EncryptedPackage", encryptedPackage);
|
|
45186
|
-
return buildOle2(ole2Streams);
|
|
46055
|
+
return (await encryptOoxmlPackage(pptxBuffer, password, options)).buffer;
|
|
45187
46056
|
}
|
|
45188
|
-
|
|
45189
|
-
|
|
45190
|
-
const ole2 = parseOle2(encryptedBuffer);
|
|
45191
|
-
const encryptionInfoStream = ole2.getStream("EncryptionInfo");
|
|
45192
|
-
if (!encryptionInfoStream) {
|
|
45193
|
-
return false;
|
|
45194
|
-
}
|
|
45195
|
-
const info = parseEncryptionInfo(encryptionInfoStream);
|
|
45196
|
-
if ("isStandard" in info && info.isStandard) {
|
|
45197
|
-
const key3 = await verifyStandardPassword(info, password);
|
|
45198
|
-
return key3 !== null;
|
|
45199
|
-
}
|
|
45200
|
-
const agileInfo = info;
|
|
45201
|
-
const key2 = await verifyAgilePassword(agileInfo, password);
|
|
45202
|
-
return key2 !== null;
|
|
45203
|
-
} catch {
|
|
45204
|
-
return false;
|
|
45205
|
-
}
|
|
46057
|
+
function verifyPassword(encryptedBuffer, password) {
|
|
46058
|
+
return verifyOoxmlPackagePassword(encryptedBuffer, password);
|
|
45206
46059
|
}
|
|
45207
46060
|
var init_ooxml_crypto = __esm({
|
|
45208
46061
|
"src/pptx/core/utils/ooxml-crypto.ts"() {
|
|
45209
|
-
|
|
45210
|
-
|
|
45211
|
-
|
|
45212
|
-
|
|
45213
|
-
|
|
45214
|
-
|
|
45215
|
-
|
|
46062
|
+
init_crypto();
|
|
46063
|
+
init_errors();
|
|
46064
|
+
}
|
|
46065
|
+
});
|
|
46066
|
+
|
|
46067
|
+
// src/pptx/core/utils/ole2-parser.ts
|
|
46068
|
+
var init_ole2_parser = __esm({
|
|
46069
|
+
"src/pptx/core/utils/ole2-parser.ts"() {
|
|
46070
|
+
init_ole2_parser_types2();
|
|
46071
|
+
init_ole2_parser_read2();
|
|
46072
|
+
init_ole2_parser_write2();
|
|
45216
46073
|
}
|
|
45217
46074
|
});
|
|
45218
46075
|
|
|
45219
46076
|
// src/pptx/core/utils/digests/algorithm-names.ts
|
|
45220
|
-
function
|
|
46077
|
+
function normalizeDigestAlgorithmName2(name) {
|
|
45221
46078
|
const key2 = name.toUpperCase().replace(/[-_\s]/g, "");
|
|
45222
|
-
return
|
|
46079
|
+
return CANONICAL_BY_LOOKUP_KEY2[key2];
|
|
45223
46080
|
}
|
|
45224
|
-
var
|
|
45225
|
-
var
|
|
46081
|
+
var CANONICAL_BY_LOOKUP_KEY2, WEB_CRYPTO_ALGORITHMS;
|
|
46082
|
+
var init_algorithm_names2 = __esm({
|
|
45226
46083
|
"src/pptx/core/utils/digests/algorithm-names.ts"() {
|
|
45227
|
-
|
|
46084
|
+
CANONICAL_BY_LOOKUP_KEY2 = {
|
|
45228
46085
|
SHA1: "SHA-1",
|
|
45229
46086
|
SHA256: "SHA-256",
|
|
45230
46087
|
SHA384: "SHA-384",
|
|
@@ -45631,12 +46488,12 @@ function transform2(state, x) {
|
|
|
45631
46488
|
function md4(message) {
|
|
45632
46489
|
return mdStyleDigest(message, INITIAL_STATE, transform2);
|
|
45633
46490
|
}
|
|
45634
|
-
var INITIAL_STATE,
|
|
46491
|
+
var INITIAL_STATE, K22, K3, ROUND1, ROUND2, ROUND3;
|
|
45635
46492
|
var init_md4 = __esm({
|
|
45636
46493
|
"node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/utils/digests/md4.js"() {
|
|
45637
46494
|
init_bit_ops();
|
|
45638
46495
|
INITIAL_STATE = [1732584193, 4023233417, 2562383102, 271733878];
|
|
45639
|
-
|
|
46496
|
+
K22 = 1518500249;
|
|
45640
46497
|
K3 = 1859775393;
|
|
45641
46498
|
ROUND1 = [
|
|
45642
46499
|
[0, 3, 0],
|
|
@@ -45657,22 +46514,22 @@ var init_md4 = __esm({
|
|
|
45657
46514
|
[15, 19, 0]
|
|
45658
46515
|
];
|
|
45659
46516
|
ROUND2 = [
|
|
45660
|
-
[0, 3,
|
|
45661
|
-
[4, 5,
|
|
45662
|
-
[8, 9,
|
|
45663
|
-
[12, 13,
|
|
45664
|
-
[1, 3,
|
|
45665
|
-
[5, 5,
|
|
45666
|
-
[9, 9,
|
|
45667
|
-
[13, 13,
|
|
45668
|
-
[2, 3,
|
|
45669
|
-
[6, 5,
|
|
45670
|
-
[10, 9,
|
|
45671
|
-
[14, 13,
|
|
45672
|
-
[3, 3,
|
|
45673
|
-
[7, 5,
|
|
45674
|
-
[11, 9,
|
|
45675
|
-
[15, 13,
|
|
46517
|
+
[0, 3, K22],
|
|
46518
|
+
[4, 5, K22],
|
|
46519
|
+
[8, 9, K22],
|
|
46520
|
+
[12, 13, K22],
|
|
46521
|
+
[1, 3, K22],
|
|
46522
|
+
[5, 5, K22],
|
|
46523
|
+
[9, 9, K22],
|
|
46524
|
+
[13, 13, K22],
|
|
46525
|
+
[2, 3, K22],
|
|
46526
|
+
[6, 5, K22],
|
|
46527
|
+
[10, 9, K22],
|
|
46528
|
+
[14, 13, K22],
|
|
46529
|
+
[3, 3, K22],
|
|
46530
|
+
[7, 5, K22],
|
|
46531
|
+
[11, 9, K22],
|
|
46532
|
+
[15, 13, K22]
|
|
45676
46533
|
];
|
|
45677
46534
|
ROUND3 = [
|
|
45678
46535
|
[0, 3, K3],
|
|
@@ -46592,9 +47449,9 @@ async function digest(algorithm, data) {
|
|
|
46592
47449
|
throw new Error(`Unsupported digest algorithm: ${algorithm}`);
|
|
46593
47450
|
}
|
|
46594
47451
|
var PURE_DIGESTS;
|
|
46595
|
-
var
|
|
47452
|
+
var init_digest3 = __esm({
|
|
46596
47453
|
"src/pptx/core/utils/digests/digest.ts"() {
|
|
46597
|
-
|
|
47454
|
+
init_algorithm_names2();
|
|
46598
47455
|
init_md2();
|
|
46599
47456
|
init_md42();
|
|
46600
47457
|
init_md5();
|
|
@@ -46615,8 +47472,8 @@ var init_digest = __esm({
|
|
|
46615
47472
|
// src/pptx/core/utils/digests/index.ts
|
|
46616
47473
|
var init_digests = __esm({
|
|
46617
47474
|
"src/pptx/core/utils/digests/index.ts"() {
|
|
46618
|
-
|
|
46619
|
-
|
|
47475
|
+
init_algorithm_names2();
|
|
47476
|
+
init_digest3();
|
|
46620
47477
|
}
|
|
46621
47478
|
});
|
|
46622
47479
|
|
|
@@ -46711,10 +47568,10 @@ var init_modify_verifier_codec = __esm({
|
|
|
46711
47568
|
// src/pptx/core/utils/modify-verifier.ts
|
|
46712
47569
|
function resolveModifyVerifierAlgorithmName(verifier) {
|
|
46713
47570
|
if (verifier.algorithmName) {
|
|
46714
|
-
return
|
|
47571
|
+
return normalizeDigestAlgorithmName2(verifier.algorithmName);
|
|
46715
47572
|
}
|
|
46716
47573
|
if (verifier.algIdExt) {
|
|
46717
|
-
return
|
|
47574
|
+
return normalizeDigestAlgorithmName2(verifier.algIdExt);
|
|
46718
47575
|
}
|
|
46719
47576
|
if (verifier.cryptAlgorithmSid !== void 0) {
|
|
46720
47577
|
return CRYPT_ALGORITHM_SID_NAMES[verifier.cryptAlgorithmSid];
|
|
@@ -46734,7 +47591,7 @@ async function verifyModifyPassword(verifier, password) {
|
|
|
46734
47591
|
}
|
|
46735
47592
|
async function createModifyVerifier(password, options) {
|
|
46736
47593
|
const requestedAlgorithm = options?.algorithmName ?? "SHA-512";
|
|
46737
|
-
const algorithm =
|
|
47594
|
+
const algorithm = normalizeDigestAlgorithmName2(requestedAlgorithm);
|
|
46738
47595
|
if (!algorithm) {
|
|
46739
47596
|
throw new Error(`Unsupported modify-verifier hash algorithm: ${requestedAlgorithm}`);
|
|
46740
47597
|
}
|
|
@@ -46752,7 +47609,7 @@ async function createModifyVerifier(password, options) {
|
|
|
46752
47609
|
}
|
|
46753
47610
|
async function createSaltlessModifyVerifierForTesting(password, options) {
|
|
46754
47611
|
const requestedAlgorithm = options?.algorithmName ?? "SHA-512";
|
|
46755
|
-
const algorithm =
|
|
47612
|
+
const algorithm = normalizeDigestAlgorithmName2(requestedAlgorithm);
|
|
46756
47613
|
if (!algorithm) {
|
|
46757
47614
|
throw new Error(`Unsupported modify-verifier hash algorithm: ${requestedAlgorithm}`);
|
|
46758
47615
|
}
|
|
@@ -46784,373 +47641,44 @@ var init_modify_verifier = __esm({
|
|
|
46784
47641
|
});
|
|
46785
47642
|
|
|
46786
47643
|
// src/pptx/core/utils/signature-detection.ts
|
|
46787
|
-
function detectDigitalSignatures(zipEntryPaths) {
|
|
46788
|
-
const sigPaths = zipEntryPaths.filter(
|
|
46789
|
-
(p) => p.startsWith(SIGNATURE_PREFIX) && p.endsWith(".xml")
|
|
46790
|
-
);
|
|
46791
|
-
return {
|
|
46792
|
-
hasSignatures: sigPaths.length > 0,
|
|
46793
|
-
signatureCount: sigPaths.length,
|
|
46794
|
-
signaturePaths: sigPaths
|
|
46795
|
-
};
|
|
46796
|
-
}
|
|
46797
|
-
function getSignaturePathsToStrip(zipEntryPaths) {
|
|
46798
|
-
return zipEntryPaths.filter((p) => p.startsWith(SIGNATURE_PREFIX));
|
|
46799
|
-
}
|
|
46800
|
-
function findByLocalName(parent, localName29) {
|
|
46801
|
-
if (!parent) {
|
|
46802
|
-
return void 0;
|
|
46803
|
-
}
|
|
46804
|
-
if (parent[localName29] !== void 0 && typeof parent[localName29] === "object") {
|
|
46805
|
-
return parent[localName29];
|
|
46806
|
-
}
|
|
46807
|
-
for (const key2 of Object.keys(parent)) {
|
|
46808
|
-
const parts = key2.split(":");
|
|
46809
|
-
if (parts[parts.length - 1] === localName29 && typeof parent[key2] === "object") {
|
|
46810
|
-
return parent[key2];
|
|
46811
|
-
}
|
|
46812
|
-
}
|
|
46813
|
-
return void 0;
|
|
46814
|
-
}
|
|
46815
|
-
function findScalarByLocalName(parent, localName29) {
|
|
46816
|
-
if (!parent) {
|
|
46817
|
-
return void 0;
|
|
46818
|
-
}
|
|
46819
|
-
if (parent[localName29] !== void 0) {
|
|
46820
|
-
const v = parent[localName29];
|
|
46821
|
-
if (typeof v === "string") {
|
|
46822
|
-
return v;
|
|
46823
|
-
}
|
|
46824
|
-
if (typeof v === "number" || typeof v === "boolean") {
|
|
46825
|
-
return String(v);
|
|
46826
|
-
}
|
|
46827
|
-
if (typeof v === "object" && v !== null && "#text" in v) {
|
|
46828
|
-
return String(v["#text"]);
|
|
46829
|
-
}
|
|
46830
|
-
}
|
|
46831
|
-
for (const key2 of Object.keys(parent)) {
|
|
46832
|
-
const parts = key2.split(":");
|
|
46833
|
-
if (parts[parts.length - 1] === localName29) {
|
|
46834
|
-
const v = parent[key2];
|
|
46835
|
-
if (typeof v === "string") {
|
|
46836
|
-
return v;
|
|
46837
|
-
}
|
|
46838
|
-
if (typeof v === "number" || typeof v === "boolean") {
|
|
46839
|
-
return String(v);
|
|
46840
|
-
}
|
|
46841
|
-
if (typeof v === "object" && v !== null && "#text" in v) {
|
|
46842
|
-
return String(v["#text"]);
|
|
46843
|
-
}
|
|
46844
|
-
}
|
|
46845
|
-
}
|
|
46846
|
-
return void 0;
|
|
46847
|
-
}
|
|
46848
|
-
function findAllByLocalName(parent, localName29) {
|
|
46849
|
-
if (!parent) {
|
|
46850
|
-
return [];
|
|
46851
|
-
}
|
|
46852
|
-
for (const key2 of Object.keys(parent)) {
|
|
46853
|
-
const parts = key2.split(":");
|
|
46854
|
-
if (parts[parts.length - 1] === localName29) {
|
|
46855
|
-
const v = parent[key2];
|
|
46856
|
-
if (Array.isArray(v)) {
|
|
46857
|
-
return v;
|
|
46858
|
-
}
|
|
46859
|
-
if (typeof v === "object" && v !== null) {
|
|
46860
|
-
return [v];
|
|
46861
|
-
}
|
|
46862
|
-
}
|
|
46863
|
-
}
|
|
46864
|
-
return [];
|
|
46865
|
-
}
|
|
46866
|
-
function parseSignatureXml(signatureXml, signaturePath) {
|
|
46867
|
-
const signature = findByLocalName(signatureXml, "Signature");
|
|
46868
|
-
const signedInfo = findByLocalName(signature, "SignedInfo");
|
|
46869
|
-
const sigMethodNode = findByLocalName(signedInfo, "SignatureMethod");
|
|
46870
|
-
const signatureMethod = sigMethodNode?.["@_Algorithm"];
|
|
46871
|
-
const signatureValue = findScalarByLocalName(signature, "SignatureValue")?.replace(/\s+/g, "");
|
|
46872
|
-
const references = [];
|
|
46873
|
-
const refNodes = findAllByLocalName(signedInfo, "Reference");
|
|
46874
|
-
for (const ref of refNodes) {
|
|
46875
|
-
const uri = String(ref["@_URI"] || "");
|
|
46876
|
-
const dmNode = findByLocalName(ref, "DigestMethod");
|
|
46877
|
-
const digestMethod2 = dmNode?.["@_Algorithm"];
|
|
46878
|
-
const digestValue = findScalarByLocalName(ref, "DigestValue")?.replace(/\s+/g, "");
|
|
46879
|
-
references.push({ uri, digestMethod: digestMethod2, digestValue });
|
|
46880
|
-
}
|
|
46881
|
-
const digestMethod = references[0]?.digestMethod;
|
|
46882
|
-
const keyInfo = findByLocalName(signature, "KeyInfo");
|
|
46883
|
-
const x509Data = findByLocalName(keyInfo, "X509Data");
|
|
46884
|
-
let certificate;
|
|
46885
|
-
if (x509Data) {
|
|
46886
|
-
const certBase64 = findScalarByLocalName(x509Data, "X509Certificate")?.replace(/\s+/g, "");
|
|
46887
|
-
if (certBase64) {
|
|
46888
|
-
const issuerSerial = findByLocalName(x509Data, "X509IssuerSerial");
|
|
46889
|
-
const issuer = findScalarByLocalName(issuerSerial, "X509IssuerName");
|
|
46890
|
-
const serialNumber = findScalarByLocalName(issuerSerial, "X509SerialNumber");
|
|
46891
|
-
const subject = findScalarByLocalName(x509Data, "X509SubjectName");
|
|
46892
|
-
certificate = {
|
|
46893
|
-
certificateBase64: certBase64,
|
|
46894
|
-
...issuer ? { issuer } : {},
|
|
46895
|
-
...subject ? { subject } : {},
|
|
46896
|
-
...serialNumber ? { serialNumber } : {}
|
|
46897
|
-
};
|
|
46898
|
-
}
|
|
46899
|
-
}
|
|
46900
|
-
let status = "unverified";
|
|
46901
|
-
if (certificate?.validTo) {
|
|
46902
|
-
const expiry = new Date(certificate.validTo);
|
|
46903
|
-
if (expiry < /* @__PURE__ */ new Date()) {
|
|
46904
|
-
status = "expired";
|
|
46905
|
-
}
|
|
46906
|
-
}
|
|
46907
|
-
return {
|
|
46908
|
-
signaturePath,
|
|
46909
|
-
signatureMethod,
|
|
46910
|
-
digestMethod,
|
|
46911
|
-
signatureValue,
|
|
46912
|
-
certificate,
|
|
46913
|
-
status,
|
|
46914
|
-
references
|
|
46915
|
-
};
|
|
46916
|
-
}
|
|
46917
|
-
async function verifySignatureDigests(signature, getPartContent) {
|
|
46918
|
-
if (!signature.references.length) {
|
|
46919
|
-
return "unverified";
|
|
46920
|
-
}
|
|
46921
|
-
if (typeof globalThis.crypto?.subtle === "undefined") {
|
|
46922
|
-
return "unverified";
|
|
46923
|
-
}
|
|
46924
|
-
for (const ref of signature.references) {
|
|
46925
|
-
if (!ref.digestValue || !ref.uri) {
|
|
46926
|
-
continue;
|
|
46927
|
-
}
|
|
46928
|
-
const algo = ref.digestMethod?.toLowerCase() || "";
|
|
46929
|
-
let hashAlgo;
|
|
46930
|
-
if (algo.includes("sha256") || algo.includes("sha-256")) {
|
|
46931
|
-
hashAlgo = "SHA-256";
|
|
46932
|
-
} else if (algo.includes("sha512") || algo.includes("sha-512")) {
|
|
46933
|
-
hashAlgo = "SHA-512";
|
|
46934
|
-
} else if (algo.includes("sha1") || algo.includes("sha-1")) {
|
|
46935
|
-
hashAlgo = "SHA-1";
|
|
46936
|
-
} else {
|
|
46937
|
-
continue;
|
|
46938
|
-
}
|
|
46939
|
-
const content = await getPartContent(ref.uri);
|
|
46940
|
-
if (!content) {
|
|
46941
|
-
continue;
|
|
46942
|
-
}
|
|
46943
|
-
try {
|
|
46944
|
-
const digest2 = await crypto.subtle.digest(hashAlgo, content);
|
|
46945
|
-
const digestBase64 = arrayBufferToBase64(digest2);
|
|
46946
|
-
if (digestBase64 !== ref.digestValue) {
|
|
46947
|
-
return "invalid";
|
|
46948
|
-
}
|
|
46949
|
-
} catch {
|
|
46950
|
-
return "unverified";
|
|
46951
|
-
}
|
|
46952
|
-
}
|
|
46953
|
-
return signature.certificate ? "valid" : "unknownCA";
|
|
46954
|
-
}
|
|
46955
|
-
function arrayBufferToBase64(buffer) {
|
|
46956
|
-
const bytes = new Uint8Array(buffer);
|
|
46957
|
-
let binary = "";
|
|
46958
|
-
for (let i2 = 0; i2 < bytes.byteLength; i2++) {
|
|
46959
|
-
binary += String.fromCharCode(bytes[i2]);
|
|
46960
|
-
}
|
|
46961
|
-
return btoa(binary);
|
|
46962
|
-
}
|
|
46963
|
-
var SIGNATURE_PREFIX;
|
|
46964
47644
|
var init_signature_detection = __esm({
|
|
46965
47645
|
"src/pptx/core/utils/signature-detection.ts"() {
|
|
46966
|
-
|
|
47646
|
+
init_detection();
|
|
46967
47647
|
}
|
|
46968
47648
|
});
|
|
46969
47649
|
|
|
46970
47650
|
// src/pptx/core/utils/signature-constants.ts
|
|
46971
|
-
var DIGITAL_SIGNATURE_ORIGIN_REL_TYPE, DIGITAL_SIGNATURE_REL_TYPE, PPTX_VIEWER_MANIFEST_NS, XMLDSIG_NS, OPC_RELATIONSHIP_TRANSFORM, XML_TRANSFORM_ENVELOPED_SIGNATURE, SUPPORTED_XML_CANON_TRANSFORMS, ENTERPRISE_TRUST_ROOTS_FILE_ENV, ENTERPRISE_TRUST_ROOTS_PEM_ENV, ENTERPRISE_REQUIRE_REVOCATION_ENV, ENTERPRISE_FAIL_ON_REVOCATION_UNKNOWN_ENV, ENTERPRISE_REQUIRE_TIMESTAMP_ENV, DIGEST_ALGORITHM_TO_HASH, DIGEST_ALGORITHM_TO_WEB_CRYPTO;
|
|
46972
47651
|
var init_signature_constants = __esm({
|
|
46973
47652
|
"src/pptx/core/utils/signature-constants.ts"() {
|
|
46974
|
-
|
|
46975
|
-
DIGITAL_SIGNATURE_REL_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/signature";
|
|
46976
|
-
PPTX_VIEWER_MANIFEST_NS = "urn:pptx-viewer:ooxml-signature:v1";
|
|
46977
|
-
XMLDSIG_NS = "http://www.w3.org/2000/09/xmldsig#";
|
|
46978
|
-
OPC_RELATIONSHIP_TRANSFORM = "http://schemas.openxmlformats.org/package/2006/RelationshipTransform";
|
|
46979
|
-
XML_TRANSFORM_ENVELOPED_SIGNATURE = "http://www.w3.org/2000/09/xmldsig#enveloped-signature";
|
|
46980
|
-
SUPPORTED_XML_CANON_TRANSFORMS = /* @__PURE__ */ new Set([
|
|
46981
|
-
"http://www.w3.org/TR/2001/REC-xml-c14n-20010315",
|
|
46982
|
-
"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments",
|
|
46983
|
-
"http://www.w3.org/2001/10/xml-exc-c14n#",
|
|
46984
|
-
"http://www.w3.org/2001/10/xml-exc-c14n#WithComments",
|
|
46985
|
-
XML_TRANSFORM_ENVELOPED_SIGNATURE
|
|
46986
|
-
]);
|
|
46987
|
-
ENTERPRISE_TRUST_ROOTS_FILE_ENV = "PPTX_VIEWER_TRUST_ROOTS_FILE";
|
|
46988
|
-
ENTERPRISE_TRUST_ROOTS_PEM_ENV = "PPTX_VIEWER_TRUST_ROOTS_PEM";
|
|
46989
|
-
ENTERPRISE_REQUIRE_REVOCATION_ENV = "PPTX_VIEWER_REQUIRE_REVOCATION_CHECK";
|
|
46990
|
-
ENTERPRISE_FAIL_ON_REVOCATION_UNKNOWN_ENV = "PPTX_VIEWER_FAIL_ON_REVOCATION_UNKNOWN";
|
|
46991
|
-
ENTERPRISE_REQUIRE_TIMESTAMP_ENV = "PPTX_VIEWER_REQUIRE_TIMESTAMP";
|
|
46992
|
-
DIGEST_ALGORITHM_TO_HASH = {
|
|
46993
|
-
"http://www.w3.org/2000/09/xmldsig#sha1": "sha1",
|
|
46994
|
-
"http://www.w3.org/2001/04/xmlenc#sha256": "sha256",
|
|
46995
|
-
"http://www.w3.org/2001/04/xmlenc#sha384": "sha384",
|
|
46996
|
-
"http://www.w3.org/2001/04/xmlenc#sha512": "sha512"
|
|
46997
|
-
};
|
|
46998
|
-
DIGEST_ALGORITHM_TO_WEB_CRYPTO = {
|
|
46999
|
-
"http://www.w3.org/2000/09/xmldsig#sha1": "SHA-1",
|
|
47000
|
-
"http://www.w3.org/2001/04/xmlenc#sha256": "SHA-256",
|
|
47001
|
-
"http://www.w3.org/2001/04/xmlenc#sha384": "SHA-384",
|
|
47002
|
-
"http://www.w3.org/2001/04/xmlenc#sha512": "SHA-512"
|
|
47003
|
-
};
|
|
47653
|
+
init_constants3();
|
|
47004
47654
|
}
|
|
47005
47655
|
});
|
|
47006
47656
|
|
|
47007
47657
|
// src/pptx/core/utils/signature-xml-utils.ts
|
|
47008
|
-
function escapeXmlAttr(value) {
|
|
47009
|
-
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
47010
|
-
}
|
|
47011
|
-
function escapeXmlText(value) {
|
|
47012
|
-
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
47013
|
-
}
|
|
47014
|
-
function isValidBase64(value) {
|
|
47015
|
-
return typeof value === "string" && value.length > 0 && /^[A-Za-z0-9+/=\s]+$/.test(value);
|
|
47016
|
-
}
|
|
47017
|
-
function extractTagAttribute(xml, tagName, attributeName) {
|
|
47018
|
-
const pattern = new RegExp(
|
|
47019
|
-
`<${tagName}\\b[^>]*\\b${attributeName}="(?<attributeValue>[^"]+)"`,
|
|
47020
|
-
"i"
|
|
47021
|
-
);
|
|
47022
|
-
const match = xml.match(pattern);
|
|
47023
|
-
return match?.groups?.["attributeValue"]?.trim();
|
|
47024
|
-
}
|
|
47025
|
-
function extractFirstTagText(xml, localName29) {
|
|
47026
|
-
const pattern = new RegExp(
|
|
47027
|
-
`<([\\w.-]+:)?${localName29}\\b[^>]*>([\\s\\S]*?)<\\/([\\w.-]+:)?${localName29}>`,
|
|
47028
|
-
"i"
|
|
47029
|
-
);
|
|
47030
|
-
const match = xml.match(pattern);
|
|
47031
|
-
return match?.[2]?.replace(/\s+/g, "").trim() || void 0;
|
|
47032
|
-
}
|
|
47033
|
-
function extractAllTagText(xml, localName29) {
|
|
47034
|
-
const result = [];
|
|
47035
|
-
const regex = new RegExp(
|
|
47036
|
-
`<([\\w.-]+:)?${localName29}\\b[^>]*>([\\s\\S]*?)<\\/([\\w.-]+:)?${localName29}>`,
|
|
47037
|
-
"gi"
|
|
47038
|
-
);
|
|
47039
|
-
let match = regex.exec(xml);
|
|
47040
|
-
while (match) {
|
|
47041
|
-
const value = match[2]?.replace(/\s+/g, "").trim();
|
|
47042
|
-
if (value) {
|
|
47043
|
-
result.push(value);
|
|
47044
|
-
}
|
|
47045
|
-
match = regex.exec(xml);
|
|
47046
|
-
}
|
|
47047
|
-
return result;
|
|
47048
|
-
}
|
|
47049
47658
|
var init_signature_xml_utils = __esm({
|
|
47050
47659
|
"src/pptx/core/utils/signature-xml-utils.ts"() {
|
|
47660
|
+
init_xml_utils2();
|
|
47051
47661
|
}
|
|
47052
47662
|
});
|
|
47053
47663
|
|
|
47054
47664
|
// src/pptx/core/utils/signature-reference-utils.ts
|
|
47055
|
-
function normalizePartPath(partPath) {
|
|
47056
|
-
return partPath.replace(/\\/g, "/").replace(/^\/+/, "");
|
|
47057
|
-
}
|
|
47058
|
-
function resolveReferenceUriToPart(uri) {
|
|
47059
|
-
const trimmed = uri.trim();
|
|
47060
|
-
if (trimmed.length === 0 || trimmed.startsWith("#")) {
|
|
47061
|
-
return void 0;
|
|
47062
|
-
}
|
|
47063
|
-
const decoded = decodeURIComponent(trimmed);
|
|
47064
|
-
return normalizePartPath(decoded.startsWith("/") ? decoded.slice(1) : decoded);
|
|
47065
|
-
}
|
|
47066
47665
|
var init_signature_reference_utils = __esm({
|
|
47067
47666
|
"src/pptx/core/utils/signature-reference-utils.ts"() {
|
|
47667
|
+
init_reference_utils();
|
|
47068
47668
|
}
|
|
47069
47669
|
});
|
|
47070
47670
|
|
|
47071
47671
|
// src/pptx/core/utils/signature-digest.ts
|
|
47072
|
-
async function computeDigestBase64(content, digestAlgorithmUri) {
|
|
47073
|
-
const webCryptoAlgo = DIGEST_ALGORITHM_TO_WEB_CRYPTO[digestAlgorithmUri];
|
|
47074
|
-
if (!webCryptoAlgo) {
|
|
47075
|
-
return void 0;
|
|
47076
|
-
}
|
|
47077
|
-
if (typeof globalThis.crypto?.subtle === "undefined") {
|
|
47078
|
-
return void 0;
|
|
47079
|
-
}
|
|
47080
|
-
const buf = new ArrayBuffer(content.byteLength);
|
|
47081
|
-
new Uint8Array(buf).set(content);
|
|
47082
|
-
const digest2 = await globalThis.crypto.subtle.digest(webCryptoAlgo, buf);
|
|
47083
|
-
return uint8ArrayToBase64(new Uint8Array(digest2));
|
|
47084
|
-
}
|
|
47085
|
-
function uint8ArrayToBase64(bytes) {
|
|
47086
|
-
let binary = "";
|
|
47087
|
-
for (let i2 = 0; i2 < bytes.byteLength; i2++) {
|
|
47088
|
-
binary += String.fromCharCode(bytes[i2]);
|
|
47089
|
-
}
|
|
47090
|
-
return btoa(binary);
|
|
47091
|
-
}
|
|
47092
47672
|
var init_signature_digest = __esm({
|
|
47093
47673
|
"src/pptx/core/utils/signature-digest.ts"() {
|
|
47094
|
-
|
|
47674
|
+
init_digest();
|
|
47095
47675
|
}
|
|
47096
47676
|
});
|
|
47097
47677
|
|
|
47098
47678
|
// src/pptx/core/utils/signature-inspection-status.ts
|
|
47099
|
-
function computeDetailStatus(detail, policy) {
|
|
47100
|
-
const hasDigestMismatch = detail.referenceChecks.some(
|
|
47101
|
-
(check) => check.digestStatus === "mismatch"
|
|
47102
|
-
);
|
|
47103
|
-
const hasMissingPart = detail.missingPartReferences.length > 0;
|
|
47104
|
-
const hasVerifiedDigest = detail.referenceChecks.some(
|
|
47105
|
-
(check) => check.digestStatus === "verified"
|
|
47106
|
-
);
|
|
47107
|
-
const revocationUnknown = detail.certificateRevocationStatus === "unknown" || detail.certificateRevocationStatus === "not-checked" || detail.certificateRevocationStatus === "error";
|
|
47108
|
-
const timestampMissingOrUntrusted = detail.timestampAuthorityStatus === "not-present" || detail.timestampAuthorityStatus === "not-checked" || detail.timestampAuthorityStatus === "error" || detail.timestampAuthorityStatus === "untrusted";
|
|
47109
|
-
if (detail.signatureValueStatus === "invalid") {
|
|
47110
|
-
return "signature-invalid";
|
|
47111
|
-
}
|
|
47112
|
-
if (hasMissingPart) {
|
|
47113
|
-
return "reference-missing";
|
|
47114
|
-
}
|
|
47115
|
-
if (hasDigestMismatch) {
|
|
47116
|
-
return "digest-mismatch";
|
|
47117
|
-
}
|
|
47118
|
-
if (detail.certificateRevocationStatus === "revoked") {
|
|
47119
|
-
return "certificate-revoked";
|
|
47120
|
-
}
|
|
47121
|
-
if (policy.requireRevocationCheck && (policy.failOnRevocationUnknown ? revocationUnknown : detail.certificateRevocationStatus !== "good")) {
|
|
47122
|
-
return "certificate-untrusted";
|
|
47123
|
-
}
|
|
47124
|
-
if (detail.timestampAuthorityStatus === "invalid") {
|
|
47125
|
-
return "timestamp-invalid";
|
|
47126
|
-
}
|
|
47127
|
-
if (policy.requireTimestamp && timestampMissingOrUntrusted) {
|
|
47128
|
-
return "timestamp-untrusted";
|
|
47129
|
-
}
|
|
47130
|
-
if (detail.timestampAuthorityStatus === "untrusted") {
|
|
47131
|
-
return "timestamp-untrusted";
|
|
47132
|
-
}
|
|
47133
|
-
if (detail.certificateTrustStatus === "untrusted" && detail.signatureValueStatus === "verified") {
|
|
47134
|
-
return "certificate-untrusted";
|
|
47135
|
-
}
|
|
47136
|
-
if (hasVerifiedDigest && detail.signatureValueStatus === "verified") {
|
|
47137
|
-
return "verified";
|
|
47138
|
-
}
|
|
47139
|
-
return "structural-only";
|
|
47140
|
-
}
|
|
47141
|
-
function computeVerificationStatus(details) {
|
|
47142
|
-
const hasInvalidSignature = details.some((detail) => detail.status === "signature-invalid");
|
|
47143
|
-
const hasMissing = details.some((detail) => detail.status === "reference-missing");
|
|
47144
|
-
const hasMismatch = details.some((detail) => detail.status === "digest-mismatch");
|
|
47145
|
-
const hasUntrusted = details.some((detail) => detail.status === "certificate-untrusted");
|
|
47146
|
-
const hasRevoked = details.some((detail) => detail.status === "certificate-revoked");
|
|
47147
|
-
const hasTimestampInvalid = details.some((detail) => detail.status === "timestamp-invalid");
|
|
47148
|
-
const hasTimestampUntrusted = details.some((detail) => detail.status === "timestamp-untrusted");
|
|
47149
|
-
const allVerified = details.every((detail) => detail.status === "verified");
|
|
47150
|
-
return hasInvalidSignature ? "signature-invalid" : hasRevoked ? "certificate-revoked" : hasTimestampInvalid ? "timestamp-invalid" : hasTimestampUntrusted ? "timestamp-untrusted" : hasMissing ? "reference-missing" : hasMismatch ? "digest-mismatch" : allVerified ? "verified-trusted" : hasUntrusted ? "verified-untrusted" : "present-not-verified";
|
|
47151
|
-
}
|
|
47152
47679
|
var init_signature_inspection_status = __esm({
|
|
47153
47680
|
"src/pptx/core/utils/signature-inspection-status.ts"() {
|
|
47681
|
+
init_inspection_status();
|
|
47154
47682
|
}
|
|
47155
47683
|
});
|
|
47156
47684
|
|
|
@@ -47509,11 +48037,11 @@ function parseSeriesErrBars(seriesNode, xmlLookup, extractPointValues, colorPars
|
|
|
47509
48037
|
return result;
|
|
47510
48038
|
}).filter((e) => e !== void 0);
|
|
47511
48039
|
}
|
|
47512
|
-
function parseLineStyle(
|
|
47513
|
-
if (!
|
|
48040
|
+
function parseLineStyle(container2, elementName, xmlLookup, colorParser) {
|
|
48041
|
+
if (!container2) {
|
|
47514
48042
|
return void 0;
|
|
47515
48043
|
}
|
|
47516
|
-
const lineNode = xmlLookup.getChildByLocalName(
|
|
48044
|
+
const lineNode = xmlLookup.getChildByLocalName(container2, elementName);
|
|
47517
48045
|
if (!lineNode) {
|
|
47518
48046
|
return void 0;
|
|
47519
48047
|
}
|
|
@@ -48136,7 +48664,7 @@ function parseChartUniqueId(node, localName29) {
|
|
|
48136
48664
|
const val = uniqueIdNode?.["@_val"];
|
|
48137
48665
|
return typeof val === "string" && val.length > 0 ? val : void 0;
|
|
48138
48666
|
}
|
|
48139
|
-
function
|
|
48667
|
+
function randomBytes2(length) {
|
|
48140
48668
|
const cryptoObj = typeof crypto === "undefined" ? void 0 : crypto;
|
|
48141
48669
|
if (cryptoObj && typeof cryptoObj.getRandomValues === "function") {
|
|
48142
48670
|
return cryptoObj.getRandomValues(new Uint8Array(length));
|
|
@@ -48148,7 +48676,7 @@ function randomBytes(length) {
|
|
|
48148
48676
|
return bytes;
|
|
48149
48677
|
}
|
|
48150
48678
|
function randomHex(length) {
|
|
48151
|
-
const bytes =
|
|
48679
|
+
const bytes = randomBytes2(Math.ceil(length / 2));
|
|
48152
48680
|
let out = "";
|
|
48153
48681
|
for (const b of bytes) {
|
|
48154
48682
|
out += b.toString(16).padStart(2, "0");
|
|
@@ -48157,7 +48685,7 @@ function randomHex(length) {
|
|
|
48157
48685
|
}
|
|
48158
48686
|
function generateChartUniqueId() {
|
|
48159
48687
|
const cryptoObj = typeof crypto === "undefined" ? void 0 : crypto;
|
|
48160
|
-
const variantNibble = (8 +
|
|
48688
|
+
const variantNibble = (8 + randomBytes2(1)[0] % 4).toString(16);
|
|
48161
48689
|
const uuid = cryptoObj && typeof cryptoObj.randomUUID === "function" ? cryptoObj.randomUUID() : `${randomHex(8)}-${randomHex(4)}-4${randomHex(3)}-${variantNibble}${randomHex(3)}-${randomHex(12)}`;
|
|
48162
48690
|
return `{${uuid.toUpperCase()}}`;
|
|
48163
48691
|
}
|
|
@@ -52596,10 +53124,10 @@ function parseVmlGroup(node, idPrefix, index) {
|
|
|
52596
53124
|
return null;
|
|
52597
53125
|
}
|
|
52598
53126
|
}
|
|
52599
|
-
function parseVmlElements(
|
|
53127
|
+
function parseVmlElements(container2, idPrefix = "") {
|
|
52600
53128
|
const elements2 = [];
|
|
52601
53129
|
for (const tag of VML_SHAPE_TAGS) {
|
|
52602
|
-
const nodes =
|
|
53130
|
+
const nodes = container2[tag];
|
|
52603
53131
|
if (!nodes) {
|
|
52604
53132
|
continue;
|
|
52605
53133
|
}
|
|
@@ -52699,8 +53227,8 @@ function diagnoseSelection(ac) {
|
|
|
52699
53227
|
}
|
|
52700
53228
|
return void 0;
|
|
52701
53229
|
}
|
|
52702
|
-
function unwrapAlternateContent(
|
|
52703
|
-
const altContents = ensureArray3(
|
|
53230
|
+
function unwrapAlternateContent(container2) {
|
|
53231
|
+
const altContents = ensureArray3(container2["mc:AlternateContent"]);
|
|
52704
53232
|
if (altContents.length === 0) {
|
|
52705
53233
|
return [];
|
|
52706
53234
|
}
|
|
@@ -52720,7 +53248,7 @@ function unwrapAlternateContent(container) {
|
|
|
52720
53248
|
for (const tag of SHAPE_TREE_ELEMENT_TAGS) {
|
|
52721
53249
|
const children15 = ensureArray3(branch[tag]);
|
|
52722
53250
|
if (children15.length > 0) {
|
|
52723
|
-
|
|
53251
|
+
container2[tag] = [...ensureArray3(container2[tag]), ...children15];
|
|
52724
53252
|
for (const child27 of children15) {
|
|
52725
53253
|
block.childRefs.push({ tag, node: child27 });
|
|
52726
53254
|
}
|
|
@@ -52730,11 +53258,11 @@ function unwrapAlternateContent(container) {
|
|
|
52730
53258
|
blocks.push(block);
|
|
52731
53259
|
}
|
|
52732
53260
|
}
|
|
52733
|
-
delete
|
|
53261
|
+
delete container2["mc:AlternateContent"];
|
|
52734
53262
|
return blocks;
|
|
52735
53263
|
}
|
|
52736
|
-
function reapplyAlternateContentToTree(
|
|
52737
|
-
let working =
|
|
53264
|
+
function reapplyAlternateContentToTree(container2, blockByNode) {
|
|
53265
|
+
let working = container2;
|
|
52738
53266
|
const groups = ensureArray3(working["p:grpSp"]);
|
|
52739
53267
|
if (groups.length > 0) {
|
|
52740
53268
|
let groupsChanged = false;
|
|
@@ -53629,16 +54157,16 @@ function applyActiveXControlsToSlide(slideXml3, controls) {
|
|
|
53629
54157
|
return;
|
|
53630
54158
|
}
|
|
53631
54159
|
const nodes = controls.map(buildActiveXControlNode);
|
|
53632
|
-
const
|
|
54160
|
+
const container2 = cSld["p:controls"] ?? {};
|
|
53633
54161
|
const isNewContainer = cSld["p:controls"] === void 0;
|
|
53634
|
-
|
|
54162
|
+
container2["p:control"] = nodes.length === 1 ? nodes[0] : nodes;
|
|
53635
54163
|
if (isNewContainer && cSld["p:extLst"] !== void 0) {
|
|
53636
54164
|
const extLst = cSld["p:extLst"];
|
|
53637
54165
|
delete cSld["p:extLst"];
|
|
53638
|
-
cSld["p:controls"] =
|
|
54166
|
+
cSld["p:controls"] = container2;
|
|
53639
54167
|
cSld["p:extLst"] = extLst;
|
|
53640
54168
|
} else {
|
|
53641
|
-
cSld["p:controls"] =
|
|
54169
|
+
cSld["p:controls"] = container2;
|
|
53642
54170
|
}
|
|
53643
54171
|
}
|
|
53644
54172
|
var init_activex_serializer = __esm({
|
|
@@ -60156,12 +60684,12 @@ var init_effect_dag_primitives = __esm({
|
|
|
60156
60684
|
});
|
|
60157
60685
|
|
|
60158
60686
|
// src/pptx/core/core/builders/effect-dag-serializer.ts
|
|
60159
|
-
function serializeEffectDagContainerNode(
|
|
60160
|
-
const xml = { "@_type":
|
|
60161
|
-
if (
|
|
60162
|
-
xml["@_name"] =
|
|
60687
|
+
function serializeEffectDagContainerNode(container2) {
|
|
60688
|
+
const xml = { "@_type": container2.type };
|
|
60689
|
+
if (container2.name) {
|
|
60690
|
+
xml["@_name"] = container2.name;
|
|
60163
60691
|
}
|
|
60164
|
-
for (const child27 of
|
|
60692
|
+
for (const child27 of container2.children) {
|
|
60165
60693
|
appendChild2(xml, child27);
|
|
60166
60694
|
}
|
|
60167
60695
|
return xml;
|
|
@@ -60227,24 +60755,24 @@ function parseEffectDagContainer(node) {
|
|
|
60227
60755
|
const type = VALID_CONTAINER_TYPES.has(typeAttr) ? typeAttr : "sib";
|
|
60228
60756
|
const nameAttr = String(xml["@_name"] ?? "").trim();
|
|
60229
60757
|
const children15 = parseChildren(xml);
|
|
60230
|
-
const
|
|
60758
|
+
const container2 = {
|
|
60231
60759
|
kind: "cont",
|
|
60232
60760
|
type,
|
|
60233
60761
|
children: children15
|
|
60234
60762
|
};
|
|
60235
60763
|
if (nameAttr) {
|
|
60236
|
-
|
|
60764
|
+
container2.name = nameAttr;
|
|
60237
60765
|
}
|
|
60238
|
-
return
|
|
60766
|
+
return container2;
|
|
60239
60767
|
}
|
|
60240
60768
|
function buildEffectDagTreeFromXml(effectDagXml) {
|
|
60241
60769
|
return parseEffectDagContainer(effectDagXml);
|
|
60242
60770
|
}
|
|
60243
|
-
function serializeEffectDagContainer(
|
|
60244
|
-
if (!
|
|
60771
|
+
function serializeEffectDagContainer(container2) {
|
|
60772
|
+
if (!container2) {
|
|
60245
60773
|
return void 0;
|
|
60246
60774
|
}
|
|
60247
|
-
return serializeEffectDagContainerNode(
|
|
60775
|
+
return serializeEffectDagContainerNode(container2);
|
|
60248
60776
|
}
|
|
60249
60777
|
function parseChildren(xml) {
|
|
60250
60778
|
const children15 = [];
|
|
@@ -60310,7 +60838,7 @@ function parseBlend(value) {
|
|
|
60310
60838
|
const modeAttr = String(xml["@_blend"] ?? "").trim().toLowerCase();
|
|
60311
60839
|
const mode = VALID_BLEND_MODES.has(modeAttr) ? modeAttr : "over";
|
|
60312
60840
|
const contNode = childByLocalName2(xml, "cont");
|
|
60313
|
-
const
|
|
60841
|
+
const container2 = parseEffectDagContainer(Array.isArray(contNode) ? contNode[0] : contNode) ?? {
|
|
60314
60842
|
kind: "cont",
|
|
60315
60843
|
type: "sib",
|
|
60316
60844
|
children: []
|
|
@@ -60318,7 +60846,7 @@ function parseBlend(value) {
|
|
|
60318
60846
|
return {
|
|
60319
60847
|
kind: "blend",
|
|
60320
60848
|
mode,
|
|
60321
|
-
container
|
|
60849
|
+
container: container2
|
|
60322
60850
|
};
|
|
60323
60851
|
}
|
|
60324
60852
|
function parseXfrm(value) {
|
|
@@ -62115,13 +62643,13 @@ function boolValue2(node) {
|
|
|
62115
62643
|
const value = node["@_val"];
|
|
62116
62644
|
return value !== "0" && value !== "false";
|
|
62117
62645
|
}
|
|
62118
|
-
function parseBubbleChartOptions(
|
|
62119
|
-
if (!
|
|
62646
|
+
function parseBubbleChartOptions(container2, localName29) {
|
|
62647
|
+
if (!container2) {
|
|
62120
62648
|
return void 0;
|
|
62121
62649
|
}
|
|
62122
62650
|
const node = (name) => {
|
|
62123
|
-
const key2 = findKey11(
|
|
62124
|
-
return key2 ?
|
|
62651
|
+
const key2 = findKey11(container2, name, localName29);
|
|
62652
|
+
return key2 ? container2[key2] : void 0;
|
|
62125
62653
|
};
|
|
62126
62654
|
const options = {};
|
|
62127
62655
|
const bubble3D = boolValue2(node("bubble3D"));
|
|
@@ -62148,33 +62676,33 @@ function parseBubbleChartOptions(container, localName29) {
|
|
|
62148
62676
|
}
|
|
62149
62677
|
return Object.keys(options).length > 0 ? options : void 0;
|
|
62150
62678
|
}
|
|
62151
|
-
function insertOrdered2(
|
|
62152
|
-
const existingKey = findKey11(
|
|
62679
|
+
function insertOrdered2(container2, name, value, localName29) {
|
|
62680
|
+
const existingKey = findKey11(container2, name, localName29);
|
|
62153
62681
|
if (existingKey) {
|
|
62154
|
-
|
|
62682
|
+
container2[existingKey] = { ...container2[existingKey], ...value };
|
|
62155
62683
|
return;
|
|
62156
62684
|
}
|
|
62157
|
-
const entries = Object.entries(
|
|
62685
|
+
const entries = Object.entries(container2);
|
|
62158
62686
|
const targetRank = ORDER2.indexOf(name);
|
|
62159
62687
|
const index = entries.findIndex(([key2]) => {
|
|
62160
62688
|
const rank = ORDER2.indexOf(localName29(key2));
|
|
62161
62689
|
return rank >= 0 && rank > targetRank;
|
|
62162
62690
|
});
|
|
62163
62691
|
entries.splice(index < 0 ? entries.length : index, 0, [`c:${name}`, value]);
|
|
62164
|
-
for (const key2 of Object.keys(
|
|
62165
|
-
delete
|
|
62692
|
+
for (const key2 of Object.keys(container2)) {
|
|
62693
|
+
delete container2[key2];
|
|
62166
62694
|
}
|
|
62167
62695
|
for (const [key2, child27] of entries) {
|
|
62168
|
-
|
|
62696
|
+
container2[key2] = child27;
|
|
62169
62697
|
}
|
|
62170
62698
|
}
|
|
62171
|
-
function applyBubbleChartOptions(
|
|
62699
|
+
function applyBubbleChartOptions(container2, options, localName29) {
|
|
62172
62700
|
if (options.bubble3D !== void 0) {
|
|
62173
|
-
insertOrdered2(
|
|
62701
|
+
insertOrdered2(container2, "bubble3D", { "@_val": options.bubble3D ? "1" : "0" }, localName29);
|
|
62174
62702
|
}
|
|
62175
62703
|
if (options.bubbleScale !== void 0) {
|
|
62176
62704
|
insertOrdered2(
|
|
62177
|
-
|
|
62705
|
+
container2,
|
|
62178
62706
|
"bubbleScale",
|
|
62179
62707
|
{
|
|
62180
62708
|
"@_val": chartPercentUnionValue(options.bubbleScale, {
|
|
@@ -62188,14 +62716,14 @@ function applyBubbleChartOptions(container, options, localName29) {
|
|
|
62188
62716
|
}
|
|
62189
62717
|
if (options.showNegativeBubbles !== void 0) {
|
|
62190
62718
|
insertOrdered2(
|
|
62191
|
-
|
|
62719
|
+
container2,
|
|
62192
62720
|
"showNegBubbles",
|
|
62193
62721
|
{ "@_val": options.showNegativeBubbles ? "1" : "0" },
|
|
62194
62722
|
localName29
|
|
62195
62723
|
);
|
|
62196
62724
|
}
|
|
62197
62725
|
if (options.sizeRepresents !== void 0) {
|
|
62198
|
-
insertOrdered2(
|
|
62726
|
+
insertOrdered2(container2, "sizeRepresents", { "@_val": options.sizeRepresents }, localName29);
|
|
62199
62727
|
}
|
|
62200
62728
|
}
|
|
62201
62729
|
var ORDER2;
|
|
@@ -62561,12 +63089,12 @@ var init_chart_up_down_bars = __esm({
|
|
|
62561
63089
|
});
|
|
62562
63090
|
|
|
62563
63091
|
// src/pptx/core/utils/drawing-media-reference.ts
|
|
62564
|
-
function parseDrawingMediaReference(
|
|
62565
|
-
if (!
|
|
63092
|
+
function parseDrawingMediaReference(container2, externalRelIds) {
|
|
63093
|
+
if (!container2) {
|
|
62566
63094
|
return void 0;
|
|
62567
63095
|
}
|
|
62568
63096
|
for (const kind of MEDIA_REFERENCE_NAMES) {
|
|
62569
|
-
const node = child15(
|
|
63097
|
+
const node = child15(container2, kind);
|
|
62570
63098
|
if (!node) {
|
|
62571
63099
|
continue;
|
|
62572
63100
|
}
|
|
@@ -62590,15 +63118,15 @@ function parseDrawingMediaReference(container, externalRelIds) {
|
|
|
62590
63118
|
}
|
|
62591
63119
|
return void 0;
|
|
62592
63120
|
}
|
|
62593
|
-
function applyDrawingMediaReference(
|
|
63121
|
+
function applyDrawingMediaReference(container2, element, relationshipId2) {
|
|
62594
63122
|
const kind = element.mediaReferenceKind;
|
|
62595
63123
|
if (!kind) {
|
|
62596
63124
|
return;
|
|
62597
63125
|
}
|
|
62598
|
-
const targetKey = Object.keys(
|
|
62599
|
-
for (const key2 of Object.keys(
|
|
63126
|
+
const targetKey = Object.keys(container2).find((key2) => localName14(key2) === kind);
|
|
63127
|
+
for (const key2 of Object.keys(container2)) {
|
|
62600
63128
|
if (MEDIA_REFERENCE_NAMES.includes(localName14(key2))) {
|
|
62601
|
-
delete
|
|
63129
|
+
delete container2[key2];
|
|
62602
63130
|
}
|
|
62603
63131
|
}
|
|
62604
63132
|
const original = element.rawMediaReferenceXml ? { ...element.rawMediaReferenceXml } : {};
|
|
@@ -62615,7 +63143,7 @@ function applyDrawingMediaReference(container, element, relationshipId2) {
|
|
|
62615
63143
|
if (extKey) {
|
|
62616
63144
|
original[extKey] = extension;
|
|
62617
63145
|
}
|
|
62618
|
-
|
|
63146
|
+
container2[targetKey ?? "a:audioCd"] = original;
|
|
62619
63147
|
return;
|
|
62620
63148
|
}
|
|
62621
63149
|
if (kind === "wavAudioFile") {
|
|
@@ -62635,7 +63163,7 @@ function applyDrawingMediaReference(container, element, relationshipId2) {
|
|
|
62635
63163
|
setAttribute4(original, "contentType", element.mediaReferenceContentType);
|
|
62636
63164
|
}
|
|
62637
63165
|
}
|
|
62638
|
-
|
|
63166
|
+
container2[targetKey ?? `a:${kind}`] = original;
|
|
62639
63167
|
}
|
|
62640
63168
|
function parseAudioCdPosition(value) {
|
|
62641
63169
|
if (!value || typeof value !== "object") {
|
|
@@ -67905,10 +68433,10 @@ function applyPresentationDefaultTextStyle(presentation, levels) {
|
|
|
67905
68433
|
PRESENTATION_BEFORE_DEFAULT_TEXT_STYLE
|
|
67906
68434
|
);
|
|
67907
68435
|
}
|
|
67908
|
-
function insertBeforeKeys(
|
|
68436
|
+
function insertBeforeKeys(container2, key2, value, before) {
|
|
67909
68437
|
const rebuilt = {};
|
|
67910
68438
|
let inserted = false;
|
|
67911
|
-
for (const [childKey3, childValue] of Object.entries(
|
|
68439
|
+
for (const [childKey3, childValue] of Object.entries(container2)) {
|
|
67912
68440
|
if (childKey3 === key2) {
|
|
67913
68441
|
continue;
|
|
67914
68442
|
}
|
|
@@ -67921,10 +68449,10 @@ function insertBeforeKeys(container, key2, value, before) {
|
|
|
67921
68449
|
if (!inserted) {
|
|
67922
68450
|
rebuilt[key2] = value;
|
|
67923
68451
|
}
|
|
67924
|
-
for (const existingKey of Object.keys(
|
|
67925
|
-
delete
|
|
68452
|
+
for (const existingKey of Object.keys(container2)) {
|
|
68453
|
+
delete container2[existingKey];
|
|
67926
68454
|
}
|
|
67927
|
-
Object.assign(
|
|
68455
|
+
Object.assign(container2, rebuilt);
|
|
67928
68456
|
}
|
|
67929
68457
|
var LEVEL_KEY_ORDER, SLDMASTER_BEFORE_TXSTYLES, TX_STYLES_CATEGORY_ORDER, PRESENTATION_BEFORE_DEFAULT_TEXT_STYLE;
|
|
67930
68458
|
var init_master_text_style_writer = __esm({
|
|
@@ -73951,8 +74479,8 @@ function asNode(value) {
|
|
|
73951
74479
|
}
|
|
73952
74480
|
function parseShapeLocksFromNode(shape, spec) {
|
|
73953
74481
|
const nv = asNode(shape?.[spec.nvKey]);
|
|
73954
|
-
const
|
|
73955
|
-
return parseShapeLockNode(asNode(
|
|
74482
|
+
const container2 = asNode(nv?.[spec.cNvKey]);
|
|
74483
|
+
return parseShapeLockNode(asNode(container2?.[spec.lockTag]), spec);
|
|
73956
74484
|
}
|
|
73957
74485
|
function resolveLockContainerNode(shape, spec, create) {
|
|
73958
74486
|
const nv = asNode(shape[spec.nvKey]);
|
|
@@ -76888,8 +77416,8 @@ function findCNvPr(shape) {
|
|
|
76888
77416
|
return void 0;
|
|
76889
77417
|
}
|
|
76890
77418
|
for (const key2 of NV_CONTAINERS) {
|
|
76891
|
-
const
|
|
76892
|
-
const cNvPr =
|
|
77419
|
+
const container2 = shape[key2];
|
|
77420
|
+
const cNvPr = container2?.["p:cNvPr"];
|
|
76893
77421
|
if (cNvPr) {
|
|
76894
77422
|
return cNvPr;
|
|
76895
77423
|
}
|
|
@@ -77135,8 +77663,8 @@ async function loadLegacyVmlDrawings(zip, parser, slidePath, relsPath2) {
|
|
|
77135
77663
|
continue;
|
|
77136
77664
|
}
|
|
77137
77665
|
const parsed = parser.parse(vmlXml);
|
|
77138
|
-
const
|
|
77139
|
-
const shapes = parseVmlElements(
|
|
77666
|
+
const container2 = parsed["xml"] ?? parsed;
|
|
77667
|
+
const shapes = parseVmlElements(container2, `vml-${drawingIndex}-`);
|
|
77140
77668
|
results.push(...shapes);
|
|
77141
77669
|
drawingIndex++;
|
|
77142
77670
|
}
|
|
@@ -80494,12 +81022,12 @@ function collectInteractiveSequences(node, found) {
|
|
|
80494
81022
|
);
|
|
80495
81023
|
}
|
|
80496
81024
|
containers.push(...ensureArray11(node["p:par"]), ...ensureArray11(node["p:seq"]));
|
|
80497
|
-
for (const
|
|
80498
|
-
if (isInteractiveSequence(
|
|
80499
|
-
found.push(
|
|
81025
|
+
for (const container2 of containers) {
|
|
81026
|
+
if (isInteractiveSequence(container2)) {
|
|
81027
|
+
found.push(container2);
|
|
80500
81028
|
continue;
|
|
80501
81029
|
}
|
|
80502
|
-
collectInteractiveSequences(
|
|
81030
|
+
collectInteractiveSequences(container2, found);
|
|
80503
81031
|
}
|
|
80504
81032
|
}
|
|
80505
81033
|
function parseInteractiveSequences(rootPar, animations, walk3) {
|
|
@@ -80600,16 +81128,16 @@ function collectMediaNodes(node, animations) {
|
|
|
80600
81128
|
const cTn = node["p:cTn"];
|
|
80601
81129
|
const childTnList = cTn?.["p:childTnLst"];
|
|
80602
81130
|
if (childTnList) {
|
|
80603
|
-
for (const
|
|
80604
|
-
const children15 = ensureArray11(childTnList[
|
|
81131
|
+
for (const container2 of ["p:par", "p:seq", "p:excl"]) {
|
|
81132
|
+
const children15 = ensureArray11(childTnList[container2]);
|
|
80605
81133
|
for (const child27 of children15) {
|
|
80606
81134
|
collectMediaNodes(child27, animations);
|
|
80607
81135
|
}
|
|
80608
81136
|
}
|
|
80609
81137
|
collectMediaNodes(childTnList, animations);
|
|
80610
81138
|
}
|
|
80611
|
-
for (const
|
|
80612
|
-
const children15 = ensureArray11(node[
|
|
81139
|
+
for (const container2 of ["p:par", "p:seq", "p:excl", "p:tnLst"]) {
|
|
81140
|
+
const children15 = ensureArray11(node[container2]);
|
|
80613
81141
|
for (const child27 of children15) {
|
|
80614
81142
|
collectMediaNodes(child27, animations);
|
|
80615
81143
|
}
|
|
@@ -101737,7 +102265,7 @@ var init_layout_switch_placeholder_prompts = __esm({
|
|
|
101737
102265
|
|
|
101738
102266
|
// src/pptx/core/core/types.ts
|
|
101739
102267
|
var DEFAULT_MAX_UNCOMPRESSED_BYTES, MAX_ZIP_ENTRY_COUNT, ZipBombError;
|
|
101740
|
-
var
|
|
102268
|
+
var init_types4 = __esm({
|
|
101741
102269
|
"src/pptx/core/core/types.ts"() {
|
|
101742
102270
|
DEFAULT_MAX_UNCOMPRESSED_BYTES = 500 * 1024 * 1024;
|
|
101743
102271
|
MAX_ZIP_ENTRY_COUNT = 65536;
|
|
@@ -102544,12 +103072,12 @@ function readCachedValues(refContainer, xmlLookup) {
|
|
|
102544
103072
|
}
|
|
102545
103073
|
return out;
|
|
102546
103074
|
}
|
|
102547
|
-
function readRefOrLiteral(
|
|
102548
|
-
const ref = xmlLookup.getChildByLocalName(
|
|
103075
|
+
function readRefOrLiteral(container2, xmlLookup) {
|
|
103076
|
+
const ref = xmlLookup.getChildByLocalName(container2, "strRef") ?? xmlLookup.getChildByLocalName(container2, "numRef");
|
|
102549
103077
|
if (ref) {
|
|
102550
103078
|
return readCachedValues(ref, xmlLookup);
|
|
102551
103079
|
}
|
|
102552
|
-
const literal2 = xmlLookup.getChildByLocalName(
|
|
103080
|
+
const literal2 = xmlLookup.getChildByLocalName(container2, "strLit") ?? xmlLookup.getChildByLocalName(container2, "numLit");
|
|
102553
103081
|
return literal2 ? readCachedValues({ "c:strCache": literal2 }, xmlLookup) : [];
|
|
102554
103082
|
}
|
|
102555
103083
|
function parseOneFilteredSeries(node, xmlLookup) {
|
|
@@ -102584,15 +103112,15 @@ function parseOneFilteredSeries(node, xmlLookup) {
|
|
|
102584
103112
|
}
|
|
102585
103113
|
return result;
|
|
102586
103114
|
}
|
|
102587
|
-
function findFilterExt(
|
|
102588
|
-
const extLst = xmlLookup.getChildByLocalName(
|
|
103115
|
+
function findFilterExt(container2, xmlLookup) {
|
|
103116
|
+
const extLst = xmlLookup.getChildByLocalName(container2, "extLst");
|
|
102589
103117
|
if (!extLst) {
|
|
102590
103118
|
return void 0;
|
|
102591
103119
|
}
|
|
102592
103120
|
return xmlLookup.getChildrenArrayByLocalName(extLst, "ext").find((ext) => ext["@_uri"] === CHART_FILTERED_SERIES_EXT_URI);
|
|
102593
103121
|
}
|
|
102594
|
-
function parseFilteredSeries(
|
|
102595
|
-
const ext = findFilterExt(
|
|
103122
|
+
function parseFilteredSeries(container2, xmlLookup) {
|
|
103123
|
+
const ext = findFilterExt(container2, xmlLookup);
|
|
102596
103124
|
if (!ext) {
|
|
102597
103125
|
return void 0;
|
|
102598
103126
|
}
|
|
@@ -102613,9 +103141,9 @@ function parseFilteredSeries(container, xmlLookup) {
|
|
|
102613
103141
|
}
|
|
102614
103142
|
return results.length > 0 ? results : void 0;
|
|
102615
103143
|
}
|
|
102616
|
-
function collectFilteredSeriesIndices(
|
|
103144
|
+
function collectFilteredSeriesIndices(container2, xmlLookup) {
|
|
102617
103145
|
const reserved = /* @__PURE__ */ new Set();
|
|
102618
|
-
for (const filtered of parseFilteredSeries(
|
|
103146
|
+
for (const filtered of parseFilteredSeries(container2, xmlLookup) ?? []) {
|
|
102619
103147
|
reserved.add(filtered.idx);
|
|
102620
103148
|
}
|
|
102621
103149
|
return reserved;
|
|
@@ -102660,8 +103188,8 @@ function readAxDataSource(cat, xmlLookup) {
|
|
|
102660
103188
|
const ref = xmlLookup.getChildByLocalName(cat, "strRef") ?? xmlLookup.getChildByLocalName(cat, "numRef");
|
|
102661
103189
|
return readCachedValues(ref, xmlLookup);
|
|
102662
103190
|
}
|
|
102663
|
-
function parseFilteredTitles(
|
|
102664
|
-
const ext = findFilterExt(
|
|
103191
|
+
function parseFilteredTitles(container2, xmlLookup) {
|
|
103192
|
+
const ext = findFilterExt(container2, xmlLookup);
|
|
102665
103193
|
if (!ext) {
|
|
102666
103194
|
return void 0;
|
|
102667
103195
|
}
|
|
@@ -103576,8 +104104,8 @@ var init_chart_protection2 = __esm({
|
|
|
103576
104104
|
});
|
|
103577
104105
|
|
|
103578
104106
|
// src/pptx/core/utils/chart-series-axis.ts
|
|
103579
|
-
function resolveChartContainerValueAxisId(
|
|
103580
|
-
const referencedIds2 = xmlLookup.getChildrenArrayByLocalName(
|
|
104107
|
+
function resolveChartContainerValueAxisId(container2, axes, xmlLookup) {
|
|
104108
|
+
const referencedIds2 = xmlLookup.getChildrenArrayByLocalName(container2, "axId").map((node) => Number.parseInt(String(node["@_val"]), 10)).filter(Number.isFinite);
|
|
103581
104109
|
for (let index = referencedIds2.length - 1; index >= 0; index--) {
|
|
103582
104110
|
const id = referencedIds2[index];
|
|
103583
104111
|
if (axes.some((axis) => axis.axisType === "valAx" && axis.axisId === id)) {
|
|
@@ -109130,10 +109658,10 @@ function buildOle10Native(label, sourcePath, data) {
|
|
|
109130
109658
|
return new ByteWriter().u32(body.length).bytes(body).toBytes();
|
|
109131
109659
|
}
|
|
109132
109660
|
function buildPackageStorage(label, sourcePath, data) {
|
|
109133
|
-
const
|
|
109134
|
-
|
|
109135
|
-
|
|
109136
|
-
return new Uint8Array(buildOle2(
|
|
109661
|
+
const streams2 = /* @__PURE__ */ new Map();
|
|
109662
|
+
streams2.set("CompObj", hexToBytes(COMP_OBJ_HEX));
|
|
109663
|
+
streams2.set("Ole10Native", buildOle10Native(label, sourcePath, data));
|
|
109664
|
+
return new Uint8Array(buildOle2(streams2, PACKAGE_ROOT_CLSID));
|
|
109137
109665
|
}
|
|
109138
109666
|
function buildExOleObjStg(storage) {
|
|
109139
109667
|
return record(RT.ExternalOleObjectStg, storage, 0, false, 0);
|
|
@@ -110020,8 +110548,8 @@ function buildDrawing(canvasRect, shapes, backgroundRgb, fonts, drawingId, hyper
|
|
|
110020
110548
|
const spgrData = new ByteWriter().bytes(buildCanvasPatriarch(allocator));
|
|
110021
110549
|
const background = backgroundRgb ? buildBackgroundShape(backgroundRgb, allocator) : void 0;
|
|
110022
110550
|
const prebuilt = prebuiltShapes?.(allocator) ?? [];
|
|
110023
|
-
for (const
|
|
110024
|
-
spgrData.bytes(
|
|
110551
|
+
for (const container2 of prebuilt) {
|
|
110552
|
+
spgrData.bytes(container2);
|
|
110025
110553
|
}
|
|
110026
110554
|
for (const shape of shapes) {
|
|
110027
110555
|
spgrData.bytes(buildAnyShapeContainer(shape, fonts, allocator, hyperlinks, oleEmbeds, mediaEmbeds));
|
|
@@ -110116,19 +110644,19 @@ function* iterateRecords(view, start, end) {
|
|
|
110116
110644
|
offset = rec.dataOffset + rec.recLen;
|
|
110117
110645
|
}
|
|
110118
110646
|
}
|
|
110119
|
-
function* iterateChildren(view,
|
|
110120
|
-
yield* iterateRecords(view,
|
|
110647
|
+
function* iterateChildren(view, container2) {
|
|
110648
|
+
yield* iterateRecords(view, container2.dataOffset, container2.dataOffset + container2.recLen);
|
|
110121
110649
|
}
|
|
110122
|
-
function findChild4(view,
|
|
110123
|
-
for (const child27 of iterateChildren(view,
|
|
110650
|
+
function findChild4(view, container2, recType, recInstance) {
|
|
110651
|
+
for (const child27 of iterateChildren(view, container2)) {
|
|
110124
110652
|
if (child27.recType === recType && (recInstance === void 0 || child27.recInstance === recInstance)) {
|
|
110125
110653
|
return child27;
|
|
110126
110654
|
}
|
|
110127
110655
|
}
|
|
110128
110656
|
return void 0;
|
|
110129
110657
|
}
|
|
110130
|
-
function findDescendant(view,
|
|
110131
|
-
for (const child27 of iterateChildren(view,
|
|
110658
|
+
function findDescendant(view, container2, recType, recInstance) {
|
|
110659
|
+
for (const child27 of iterateChildren(view, container2)) {
|
|
110132
110660
|
if (child27.recType === recType && (recInstance === void 0)) {
|
|
110133
110661
|
return child27;
|
|
110134
110662
|
}
|
|
@@ -110179,8 +110707,8 @@ function parseColorSchemeAtom(view, rec) {
|
|
|
110179
110707
|
}
|
|
110180
110708
|
return colors;
|
|
110181
110709
|
}
|
|
110182
|
-
function findSchemeColors(view,
|
|
110183
|
-
for (const child27 of iterateChildren(view,
|
|
110710
|
+
function findSchemeColors(view, container2) {
|
|
110711
|
+
for (const child27 of iterateChildren(view, container2)) {
|
|
110184
110712
|
if (child27.recType === RT.ColorSchemeAtom && child27.recInstance === 1) {
|
|
110185
110713
|
return parseColorSchemeAtom(view, child27);
|
|
110186
110714
|
}
|
|
@@ -110844,13 +111372,13 @@ async function buildPptFile(deck, options = {}) {
|
|
|
110844
111372
|
const encrypted = Boolean(options.password);
|
|
110845
111373
|
const finished = encrypted ? await finishEncrypted(layout, lastSlideId, options.password) : await finishUnencrypted(layout, lastSlideId);
|
|
110846
111374
|
const currentUser = buildCurrentUserStream(finished.offsetToCurrentEdit, encrypted);
|
|
110847
|
-
const
|
|
110848
|
-
|
|
110849
|
-
|
|
111375
|
+
const streams2 = /* @__PURE__ */ new Map();
|
|
111376
|
+
streams2.set("Current User", currentUser);
|
|
111377
|
+
streams2.set("PowerPoint Document", finished.documentBytes);
|
|
110850
111378
|
if (finished.picturesBytes && finished.picturesBytes.length > 0) {
|
|
110851
|
-
|
|
111379
|
+
streams2.set("Pictures", finished.picturesBytes);
|
|
110852
111380
|
}
|
|
110853
|
-
return new Uint8Array(buildOle2(
|
|
111381
|
+
return new Uint8Array(buildOle2(streams2, PPT_STORAGE_CLSID, 0));
|
|
110854
111382
|
}
|
|
110855
111383
|
var init_write_ppt = __esm({
|
|
110856
111384
|
"node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/write-ppt.js"() {
|
|
@@ -111749,20 +112277,20 @@ function buildRestoredRegionXml(region) {
|
|
|
111749
112277
|
}
|
|
111750
112278
|
function applyCommonSlideContainer(root, name, props) {
|
|
111751
112279
|
const key2 = findViewKey(root, name) ?? `p:${name}`;
|
|
111752
|
-
const
|
|
111753
|
-
const commonKey = findViewKey(
|
|
111754
|
-
|
|
111755
|
-
root[key2] =
|
|
112280
|
+
const container2 = { ...root[key2] ?? {} };
|
|
112281
|
+
const commonKey = findViewKey(container2, "cSldViewPr") ?? "p:cSldViewPr";
|
|
112282
|
+
container2[commonKey] = buildCommonSlideView(props, viewChild(container2, "cSldViewPr"));
|
|
112283
|
+
root[key2] = container2;
|
|
111756
112284
|
}
|
|
111757
112285
|
function applyCommonViewContainer(root, name, props) {
|
|
111758
112286
|
const key2 = findViewKey(root, name) ?? `p:${name}`;
|
|
111759
|
-
const
|
|
111760
|
-
const commonKey = findViewKey(
|
|
112287
|
+
const container2 = { ...root[key2] ?? {} };
|
|
112288
|
+
const commonKey = findViewKey(container2, "cViewPr") ?? "p:cViewPr";
|
|
111761
112289
|
const wrapper = buildCommonSlideView(props, {
|
|
111762
|
-
"p:cViewPr": viewChild(
|
|
112290
|
+
"p:cViewPr": viewChild(container2, "cViewPr") ?? {}
|
|
111763
112291
|
});
|
|
111764
|
-
|
|
111765
|
-
root[key2] =
|
|
112292
|
+
container2[commonKey] = viewChild(wrapper, "cViewPr");
|
|
112293
|
+
root[key2] = container2;
|
|
111766
112294
|
}
|
|
111767
112295
|
var init_pptx_view_props_helpers = __esm({
|
|
111768
112296
|
"src/pptx/core/core/runtime/pptx-view-props-helpers.ts"() {
|
|
@@ -112085,22 +112613,22 @@ function ordered3(existing, modeled, getLocalName2) {
|
|
|
112085
112613
|
});
|
|
112086
112614
|
return Object.fromEntries(entries);
|
|
112087
112615
|
}
|
|
112088
|
-
function insertAfterLastSeries(
|
|
112089
|
-
const keys = Object.keys(
|
|
112616
|
+
function insertAfterLastSeries(container2, dLbls, getLocalName2) {
|
|
112617
|
+
const keys = Object.keys(container2);
|
|
112090
112618
|
let lastSer = -1;
|
|
112091
112619
|
keys.forEach((k, i2) => {
|
|
112092
112620
|
if (getLocalName2(k) === "ser") {
|
|
112093
112621
|
lastSer = i2;
|
|
112094
112622
|
}
|
|
112095
112623
|
});
|
|
112096
|
-
const entries = keys.map((k) => [k,
|
|
112624
|
+
const entries = keys.map((k) => [k, container2[k]]);
|
|
112097
112625
|
const at2 = lastSer === -1 ? entries.length : lastSer + 1;
|
|
112098
112626
|
entries.splice(at2, 0, ["c:dLbls", dLbls]);
|
|
112099
112627
|
for (const k of keys) {
|
|
112100
|
-
delete
|
|
112628
|
+
delete container2[k];
|
|
112101
112629
|
}
|
|
112102
112630
|
for (const [k, v] of entries) {
|
|
112103
|
-
|
|
112631
|
+
container2[k] = v;
|
|
112104
112632
|
}
|
|
112105
112633
|
}
|
|
112106
112634
|
function buildDLbls(existing, opts, getLocalName2) {
|
|
@@ -112137,25 +112665,25 @@ function applyChartDataLabelsToXml(plotArea, style, getLocalName2) {
|
|
|
112137
112665
|
}
|
|
112138
112666
|
const chartTypeKeys = Object.keys(plotArea).filter((k) => getLocalName2(k).endsWith("Chart"));
|
|
112139
112667
|
for (const ctKey of chartTypeKeys) {
|
|
112140
|
-
const
|
|
112141
|
-
if (!
|
|
112668
|
+
const container2 = plotArea[ctKey];
|
|
112669
|
+
if (!container2 || typeof container2 !== "object") {
|
|
112142
112670
|
continue;
|
|
112143
112671
|
}
|
|
112144
|
-
const existingKey = findKey16(
|
|
112672
|
+
const existingKey = findKey16(container2, "dLbls", getLocalName2);
|
|
112145
112673
|
if (style.hasDataLabels === false) {
|
|
112146
|
-
const existing2 = existingKey ?
|
|
112674
|
+
const existing2 = existingKey ? container2[existingKey] : void 0;
|
|
112147
112675
|
const off = ordered3(existing2, { "c:delete": { "@_val": "1" } }, getLocalName2);
|
|
112148
112676
|
if (existingKey) {
|
|
112149
|
-
|
|
112677
|
+
container2[existingKey] = off;
|
|
112150
112678
|
} else {
|
|
112151
|
-
insertAfterLastSeries(
|
|
112679
|
+
insertAfterLastSeries(container2, off, getLocalName2);
|
|
112152
112680
|
}
|
|
112153
112681
|
continue;
|
|
112154
112682
|
}
|
|
112155
112683
|
const opts = style.dataLabels ?? {};
|
|
112156
112684
|
const anyFlag = opts.showValue || opts.showCategory || opts.showSeriesName || opts.showPercent || opts.showLegendKey || opts.showBubbleSize;
|
|
112157
112685
|
const effective = anyFlag ? opts : { ...opts, showValue: true };
|
|
112158
|
-
const existing = existingKey ?
|
|
112686
|
+
const existing = existingKey ? container2[existingKey] : void 0;
|
|
112159
112687
|
const built = buildDLbls(existing, effective, getLocalName2);
|
|
112160
112688
|
applyDataLabelsRangeToDLbls(
|
|
112161
112689
|
built,
|
|
@@ -112164,9 +112692,9 @@ function applyChartDataLabelsToXml(plotArea, style, getLocalName2) {
|
|
|
112164
112692
|
getLocalName2
|
|
112165
112693
|
);
|
|
112166
112694
|
if (existingKey) {
|
|
112167
|
-
|
|
112695
|
+
container2[existingKey] = built;
|
|
112168
112696
|
} else {
|
|
112169
|
-
insertAfterLastSeries(
|
|
112697
|
+
insertAfterLastSeries(container2, built, getLocalName2);
|
|
112170
112698
|
}
|
|
112171
112699
|
}
|
|
112172
112700
|
}
|
|
@@ -113161,54 +113689,54 @@ function axisFormatting(chartData, type, id, index = 0) {
|
|
|
113161
113689
|
return chartData.axes?.find((axis) => axis.axisId === id) ?? chartData.axes?.filter((axis) => axis.axisType === type)[index];
|
|
113162
113690
|
}
|
|
113163
113691
|
function buildChartTypeContainer(chartData, family) {
|
|
113164
|
-
const
|
|
113692
|
+
const container2 = {};
|
|
113165
113693
|
if (family === "bar") {
|
|
113166
|
-
|
|
113167
|
-
|
|
113694
|
+
container2["c:barDir"] = { "@_val": chartData.barDirection === "bar" ? "bar" : "col" };
|
|
113695
|
+
container2["c:grouping"] = {
|
|
113168
113696
|
"@_val": chartData.groupingStandard && (chartData.grouping ?? "clustered") === "clustered" ? "standard" : chartData.grouping ?? "clustered"
|
|
113169
113697
|
};
|
|
113170
|
-
|
|
113698
|
+
container2["c:varyColors"] = { "@_val": "0" };
|
|
113171
113699
|
} else if (family === "line" || family === "area") {
|
|
113172
|
-
|
|
113173
|
-
|
|
113700
|
+
container2["c:grouping"] = { "@_val": chartData.grouping ?? "standard" };
|
|
113701
|
+
container2["c:varyColors"] = { "@_val": "0" };
|
|
113174
113702
|
} else if (family === "radar") {
|
|
113175
|
-
|
|
113176
|
-
|
|
113703
|
+
container2["c:radarStyle"] = { "@_val": chartData.radarStyle ?? "marker" };
|
|
113704
|
+
container2["c:varyColors"] = { "@_val": "0" };
|
|
113177
113705
|
} else if (family === "scatter") {
|
|
113178
|
-
|
|
113179
|
-
|
|
113706
|
+
container2["c:scatterStyle"] = { "@_val": "lineMarker" };
|
|
113707
|
+
container2["c:varyColors"] = { "@_val": "0" };
|
|
113180
113708
|
} else if (family === "ofPie") {
|
|
113181
|
-
|
|
113182
|
-
|
|
113709
|
+
container2["c:ofPieType"] = { "@_val": "pie" };
|
|
113710
|
+
container2["c:varyColors"] = { "@_val": "1" };
|
|
113183
113711
|
} else if (family === "stock") ; else if (family === "surface") {
|
|
113184
|
-
|
|
113712
|
+
container2["c:wireframe"] = { "@_val": chartData.wireframe === false ? "0" : "1" };
|
|
113185
113713
|
} else {
|
|
113186
|
-
|
|
113714
|
+
container2["c:varyColors"] = { "@_val": family === "bubble" ? "0" : "1" };
|
|
113187
113715
|
}
|
|
113188
|
-
|
|
113716
|
+
container2["c:ser"] = chartData.series.map(
|
|
113189
113717
|
(s, i2) => buildSeries(family, s, i2, chartData.categories, chartData.dateCategories)
|
|
113190
113718
|
);
|
|
113191
113719
|
if (family === "bubble" && chartData.bubbleOptions) {
|
|
113192
|
-
applyBubbleChartOptions(
|
|
113720
|
+
applyBubbleChartOptions(container2, chartData.bubbleOptions, (key2) => key2.replace(/^.*:/u, ""));
|
|
113193
113721
|
}
|
|
113194
113722
|
if (family === "line" && chartData.upDownBars !== void 0) {
|
|
113195
|
-
applyChartUpDownBars(
|
|
113723
|
+
applyChartUpDownBars(container2, chartData.upDownBars, (key2) => key2.replace(/^.*:/u, ""));
|
|
113196
113724
|
}
|
|
113197
113725
|
if (family === "bar" || family === "ofPie") {
|
|
113198
|
-
|
|
113726
|
+
container2["c:gapWidth"] = { "@_val": "150" };
|
|
113199
113727
|
}
|
|
113200
113728
|
if (family === "bar" && chartData.chartType === "bar3D" && chartData.barShape) {
|
|
113201
|
-
|
|
113729
|
+
container2["c:shape"] = { "@_val": chartData.barShape };
|
|
113202
113730
|
}
|
|
113203
113731
|
if (family === "stock") {
|
|
113204
|
-
|
|
113732
|
+
container2["c:hiLowLines"] = {};
|
|
113205
113733
|
}
|
|
113206
113734
|
if (family === "bar" || family === "line" || family === "area" || family === "radar" || family === "scatter" || family === "bubble" || family === "stock" || family === "surface") {
|
|
113207
|
-
|
|
113735
|
+
container2["c:axId"] = [{ "@_val": String(CAT_AX_ID) }, { "@_val": String(VAL_AX_ID) }];
|
|
113208
113736
|
} else if (family === "doughnut") {
|
|
113209
|
-
|
|
113737
|
+
container2["c:holeSize"] = { "@_val": "50" };
|
|
113210
113738
|
}
|
|
113211
|
-
return
|
|
113739
|
+
return container2;
|
|
113212
113740
|
}
|
|
113213
113741
|
function buildPlotArea(chartData, tag, family) {
|
|
113214
113742
|
const plotArea = { "c:layout": {} };
|
|
@@ -113562,8 +114090,8 @@ async function writeCustomerDataScopes(zip, scopes, codec) {
|
|
|
113562
114090
|
continue;
|
|
113563
114091
|
}
|
|
113564
114092
|
const sourceData = codec.parse(sourceXml);
|
|
113565
|
-
const
|
|
113566
|
-
if (!
|
|
114093
|
+
const container2 = getContainer(sourceData, scope.location);
|
|
114094
|
+
if (!container2) {
|
|
113567
114095
|
continue;
|
|
113568
114096
|
}
|
|
113569
114097
|
const relsPath2 = relsForSourcePart(scope.sourcePartPath);
|
|
@@ -113598,9 +114126,9 @@ async function writeCustomerDataScopes(zip, scopes, codec) {
|
|
|
113598
114126
|
authoredEntries.push(rawEntry);
|
|
113599
114127
|
contentTypes2.set(path, entry.contentType);
|
|
113600
114128
|
}
|
|
113601
|
-
const existingList =
|
|
114129
|
+
const existingList = container2["p:custDataLst"] ?? {};
|
|
113602
114130
|
existingList["p:custData"] = authoredEntries;
|
|
113603
|
-
placeCustomerDataList(
|
|
114131
|
+
placeCustomerDataList(container2, existingList, scope.location);
|
|
113604
114132
|
relsRoot["Relationship"] = relationships2;
|
|
113605
114133
|
zip.file(relsPath2, codec.build(relsData));
|
|
113606
114134
|
zip.file(scope.sourcePartPath, codec.build(sourceData));
|
|
@@ -113650,11 +114178,11 @@ function upsertRelationship(relationships2, entry, target) {
|
|
|
113650
114178
|
function isCustomXmlRelationship(value) {
|
|
113651
114179
|
return String(value ?? "").endsWith("/relationships/customXml");
|
|
113652
114180
|
}
|
|
113653
|
-
function placeCustomerDataList(
|
|
114181
|
+
function placeCustomerDataList(container2, list2, location) {
|
|
113654
114182
|
const insertBefore3 = location === "presentation" ? /* @__PURE__ */ new Set(["p:kinsoku", "p:defaultTextStyle", "p:modifyVerifier", "p:extLst"]) : /* @__PURE__ */ new Set(["p:controls", "p:extLst"]);
|
|
113655
114183
|
const rebuilt = {};
|
|
113656
114184
|
let inserted = false;
|
|
113657
|
-
for (const [key2, value] of Object.entries(
|
|
114185
|
+
for (const [key2, value] of Object.entries(container2)) {
|
|
113658
114186
|
if (key2 === "p:custDataLst") {
|
|
113659
114187
|
continue;
|
|
113660
114188
|
}
|
|
@@ -113667,10 +114195,10 @@ function placeCustomerDataList(container, list2, location) {
|
|
|
113667
114195
|
if (!inserted) {
|
|
113668
114196
|
rebuilt["p:custDataLst"] = list2;
|
|
113669
114197
|
}
|
|
113670
|
-
for (const key2 of Object.keys(
|
|
113671
|
-
delete
|
|
114198
|
+
for (const key2 of Object.keys(container2)) {
|
|
114199
|
+
delete container2[key2];
|
|
113672
114200
|
}
|
|
113673
|
-
Object.assign(
|
|
114201
|
+
Object.assign(container2, rebuilt);
|
|
113674
114202
|
}
|
|
113675
114203
|
async function upsertContentTypes(zip, codec, contentTypes2) {
|
|
113676
114204
|
const xml = await zip.file("[Content_Types].xml")?.async("string");
|
|
@@ -113746,10 +114274,10 @@ function resolveTagsContainer(data) {
|
|
|
113746
114274
|
}
|
|
113747
114275
|
return void 0;
|
|
113748
114276
|
}
|
|
113749
|
-
function placeAtKey(
|
|
114277
|
+
function placeAtKey(container2, key2, value, insertBefore3) {
|
|
113750
114278
|
const rebuilt = {};
|
|
113751
114279
|
let inserted = false;
|
|
113752
|
-
for (const [childKey3, childValue] of Object.entries(
|
|
114280
|
+
for (const [childKey3, childValue] of Object.entries(container2)) {
|
|
113753
114281
|
if (childKey3 === key2) {
|
|
113754
114282
|
continue;
|
|
113755
114283
|
}
|
|
@@ -113762,10 +114290,10 @@ function placeAtKey(container, key2, value, insertBefore3) {
|
|
|
113762
114290
|
if (!inserted) {
|
|
113763
114291
|
rebuilt[key2] = value;
|
|
113764
114292
|
}
|
|
113765
|
-
for (const existingKey of Object.keys(
|
|
113766
|
-
delete
|
|
114293
|
+
for (const existingKey of Object.keys(container2)) {
|
|
114294
|
+
delete container2[existingKey];
|
|
113767
114295
|
}
|
|
113768
|
-
Object.assign(
|
|
114296
|
+
Object.assign(container2, rebuilt);
|
|
113769
114297
|
}
|
|
113770
114298
|
async function upsertTagsOwningElement(zip, codec, sourcePartPath, relationshipId2) {
|
|
113771
114299
|
const xml = await zip.file(sourcePartPath)?.async("string");
|
|
@@ -113777,10 +114305,10 @@ async function upsertTagsOwningElement(zip, codec, sourcePartPath, relationshipI
|
|
|
113777
114305
|
if (!resolved) {
|
|
113778
114306
|
return;
|
|
113779
114307
|
}
|
|
113780
|
-
const { container, insertBefore: insertBefore3 } = resolved;
|
|
113781
|
-
const list2 = { ...
|
|
114308
|
+
const { container: container2, insertBefore: insertBefore3 } = resolved;
|
|
114309
|
+
const list2 = { ...container2["p:custDataLst"] ?? {} };
|
|
113782
114310
|
list2["p:tags"] = { "@_r:id": relationshipId2 };
|
|
113783
|
-
placeAtKey(
|
|
114311
|
+
placeAtKey(container2, "p:custDataLst", list2, insertBefore3);
|
|
113784
114312
|
zip.file(sourcePartPath, codec.build(data));
|
|
113785
114313
|
}
|
|
113786
114314
|
async function removeTagsOwningElement(zip, codec, sourcePartPath) {
|
|
@@ -114297,21 +114825,21 @@ function normalizeGroupingNode(containerLocal, node) {
|
|
|
114297
114825
|
node["@_val"] = normalizeChartGroupingValue(containerLocal, value);
|
|
114298
114826
|
}
|
|
114299
114827
|
}
|
|
114300
|
-
function normalizeChartContainerChildren(
|
|
114828
|
+
function normalizeChartContainerChildren(container2, containerLocal, getLocalName2) {
|
|
114301
114829
|
if (!isKnownChartContainer(containerLocal)) {
|
|
114302
114830
|
return;
|
|
114303
114831
|
}
|
|
114304
|
-
for (const key2 of Object.keys(
|
|
114832
|
+
for (const key2 of Object.keys(container2)) {
|
|
114305
114833
|
if (key2.startsWith("@_") || key2 === "#text") {
|
|
114306
114834
|
continue;
|
|
114307
114835
|
}
|
|
114308
114836
|
const local = getLocalName2(key2);
|
|
114309
114837
|
if (!chartContainerAllows(containerLocal, local)) {
|
|
114310
|
-
delete
|
|
114838
|
+
delete container2[key2];
|
|
114311
114839
|
continue;
|
|
114312
114840
|
}
|
|
114313
114841
|
if (local === "grouping") {
|
|
114314
|
-
const node =
|
|
114842
|
+
const node = container2[key2];
|
|
114315
114843
|
if (node && typeof node === "object" && !Array.isArray(node)) {
|
|
114316
114844
|
normalizeGroupingNode(containerLocal, node);
|
|
114317
114845
|
}
|
|
@@ -114319,18 +114847,18 @@ function normalizeChartContainerChildren(container, containerLocal, getLocalName
|
|
|
114319
114847
|
}
|
|
114320
114848
|
const required = REQUIRED_LEADING_CHILD[containerLocal];
|
|
114321
114849
|
if (required) {
|
|
114322
|
-
const present = Object.keys(
|
|
114850
|
+
const present = Object.keys(container2).some((k) => getLocalName2(k) === required.local);
|
|
114323
114851
|
if (!present) {
|
|
114324
|
-
|
|
114852
|
+
container2[`c:${required.local}`] = { "@_val": required.val };
|
|
114325
114853
|
}
|
|
114326
114854
|
}
|
|
114327
114855
|
}
|
|
114328
|
-
function orderChartContainerChildren(
|
|
114856
|
+
function orderChartContainerChildren(container2, containerLocal, getLocalName2) {
|
|
114329
114857
|
const order = CHART_CONTAINER_CHILD_ORDER[containerLocal];
|
|
114330
114858
|
if (!order) {
|
|
114331
114859
|
return;
|
|
114332
114860
|
}
|
|
114333
|
-
const keys = Object.keys(
|
|
114861
|
+
const keys = Object.keys(container2).filter((k) => !k.startsWith("@_") && k !== "#text");
|
|
114334
114862
|
if (keys.some((k) => !order.includes(getLocalName2(k)))) {
|
|
114335
114863
|
return;
|
|
114336
114864
|
}
|
|
@@ -114340,12 +114868,12 @@ function orderChartContainerChildren(container, containerLocal, getLocalName2) {
|
|
|
114340
114868
|
if (sorted.every((k, i2) => k === keys[i2])) {
|
|
114341
114869
|
return;
|
|
114342
114870
|
}
|
|
114343
|
-
const saved = sorted.map((k) => [k,
|
|
114871
|
+
const saved = sorted.map((k) => [k, container2[k]]);
|
|
114344
114872
|
for (const k of keys) {
|
|
114345
|
-
delete
|
|
114873
|
+
delete container2[k];
|
|
114346
114874
|
}
|
|
114347
114875
|
for (const [k, v] of saved) {
|
|
114348
|
-
|
|
114876
|
+
container2[k] = v;
|
|
114349
114877
|
}
|
|
114350
114878
|
}
|
|
114351
114879
|
function renameXmlKeyInPlace(obj, oldKey, newKey) {
|
|
@@ -114366,12 +114894,12 @@ function referencedAxisIds(plotArea, getLocalName2) {
|
|
|
114366
114894
|
if (!getLocalName2(key2).endsWith("Chart")) {
|
|
114367
114895
|
continue;
|
|
114368
114896
|
}
|
|
114369
|
-
for (const
|
|
114370
|
-
for (const childKey3 of Object.keys(
|
|
114897
|
+
for (const container2 of toArray2(plotArea[key2])) {
|
|
114898
|
+
for (const childKey3 of Object.keys(container2)) {
|
|
114371
114899
|
if (getLocalName2(childKey3) !== "axId") {
|
|
114372
114900
|
continue;
|
|
114373
114901
|
}
|
|
114374
|
-
for (const axId of toArray2(
|
|
114902
|
+
for (const axId of toArray2(container2[childKey3])) {
|
|
114375
114903
|
const val = axId["@_val"];
|
|
114376
114904
|
if (val !== void 0) {
|
|
114377
114905
|
ids.add(String(val));
|
|
@@ -114422,8 +114950,8 @@ var init_chart_container_schema = __esm({
|
|
|
114422
114950
|
function findKey22(obj, local, getLocalName2) {
|
|
114423
114951
|
return Object.keys(obj).find((k) => getLocalName2(k) === local);
|
|
114424
114952
|
}
|
|
114425
|
-
function nonSeriesEntries(
|
|
114426
|
-
return Object.keys(
|
|
114953
|
+
function nonSeriesEntries(container2, getLocalName2) {
|
|
114954
|
+
return Object.keys(container2).filter((k) => getLocalName2(k) !== "ser").map((k) => [k, container2[k]]);
|
|
114427
114955
|
}
|
|
114428
114956
|
function ensureArray18(v) {
|
|
114429
114957
|
if (v === void 0) {
|
|
@@ -114439,9 +114967,9 @@ function consolidateComboContainersInXml(plotArea, getLocalName2) {
|
|
|
114439
114967
|
const primaryKey = containerKeys[0];
|
|
114440
114968
|
const containerChildren = /* @__PURE__ */ new Map();
|
|
114441
114969
|
for (const key2 of containerKeys) {
|
|
114442
|
-
const
|
|
114443
|
-
if (
|
|
114444
|
-
containerChildren.set(getLocalName2(key2), nonSeriesEntries(
|
|
114970
|
+
const container2 = plotArea[key2];
|
|
114971
|
+
if (container2) {
|
|
114972
|
+
containerChildren.set(getLocalName2(key2), nonSeriesEntries(container2, getLocalName2));
|
|
114445
114973
|
}
|
|
114446
114974
|
}
|
|
114447
114975
|
if (containerKeys.length === 1) {
|
|
@@ -114454,13 +114982,13 @@ function consolidateComboContainersInXml(plotArea, getLocalName2) {
|
|
|
114454
114982
|
const serKey = findKey22(primary, "ser", getLocalName2) ?? "c:ser";
|
|
114455
114983
|
const allSeries = [];
|
|
114456
114984
|
for (const key2 of containerKeys) {
|
|
114457
|
-
const
|
|
114458
|
-
if (!
|
|
114985
|
+
const container2 = plotArea[key2];
|
|
114986
|
+
if (!container2) {
|
|
114459
114987
|
continue;
|
|
114460
114988
|
}
|
|
114461
|
-
const containerSerKey = findKey22(
|
|
114989
|
+
const containerSerKey = findKey22(container2, "ser", getLocalName2);
|
|
114462
114990
|
if (containerSerKey) {
|
|
114463
|
-
allSeries.push(...ensureArray18(
|
|
114991
|
+
allSeries.push(...ensureArray18(container2[containerSerKey]));
|
|
114464
114992
|
}
|
|
114465
114993
|
if (key2 !== primaryKey) {
|
|
114466
114994
|
delete plotArea[key2];
|
|
@@ -114507,21 +115035,21 @@ function applyComboSeriesTypesToXml(plotArea, originalKey, series, chartLevelTyp
|
|
|
114507
115035
|
const at2 = keys.indexOf(originalKey);
|
|
114508
115036
|
const newEntries = [];
|
|
114509
115037
|
for (const local of groupOrder) {
|
|
114510
|
-
const
|
|
115038
|
+
const container2 = {};
|
|
114511
115039
|
for (const [k, v] of originalChildren?.get(local) ?? fallbackEntries) {
|
|
114512
|
-
|
|
115040
|
+
container2[k] = JSON.parse(JSON.stringify(v));
|
|
114513
115041
|
}
|
|
114514
115042
|
const grouped = groups.get(local);
|
|
114515
|
-
|
|
115043
|
+
container2[serKey] = grouped.length === 1 ? grouped[0] : grouped;
|
|
114516
115044
|
applyGroupAxisReferences(
|
|
114517
|
-
|
|
115045
|
+
container2,
|
|
114518
115046
|
series.filter((_item, index) => resolved[index] === local),
|
|
114519
115047
|
axes,
|
|
114520
115048
|
getLocalName2
|
|
114521
115049
|
);
|
|
114522
|
-
normalizeChartContainerChildren(
|
|
114523
|
-
orderChartContainerChildren(
|
|
114524
|
-
newEntries.push([`c:${local}`,
|
|
115050
|
+
normalizeChartContainerChildren(container2, local, getLocalName2);
|
|
115051
|
+
orderChartContainerChildren(container2, local, getLocalName2);
|
|
115052
|
+
newEntries.push([`c:${local}`, container2]);
|
|
114525
115053
|
}
|
|
114526
115054
|
entries.splice(at2, 1, ...newEntries);
|
|
114527
115055
|
for (const k of keys) {
|
|
@@ -114532,7 +115060,7 @@ function applyComboSeriesTypesToXml(plotArea, originalKey, series, chartLevelTyp
|
|
|
114532
115060
|
}
|
|
114533
115061
|
return true;
|
|
114534
115062
|
}
|
|
114535
|
-
function applyGroupAxisReferences(
|
|
115063
|
+
function applyGroupAxisReferences(container2, series, axes, getLocalName2) {
|
|
114536
115064
|
const axisIds = new Set(series.map((item) => item.axisId).filter((id) => id !== void 0));
|
|
114537
115065
|
if (axisIds.size !== 1) {
|
|
114538
115066
|
return;
|
|
@@ -114543,8 +115071,8 @@ function applyGroupAxisReferences(container, series, axes, getLocalName2) {
|
|
|
114543
115071
|
if (valueAxisId === void 0 || categoryAxisId === void 0) {
|
|
114544
115072
|
return;
|
|
114545
115073
|
}
|
|
114546
|
-
const key2 = findKey22(
|
|
114547
|
-
|
|
115074
|
+
const key2 = findKey22(container2, "axId", getLocalName2) ?? "c:axId";
|
|
115075
|
+
container2[key2] = [{ "@_val": String(categoryAxisId) }, { "@_val": String(valueAxisId) }];
|
|
114548
115076
|
}
|
|
114549
115077
|
var init_chart_combo_serializer = __esm({
|
|
114550
115078
|
"src/pptx/core/utils/chart-combo-serializer.ts"() {
|
|
@@ -114597,8 +115125,8 @@ function buildFilteredSerNode(entry, categories) {
|
|
|
114597
115125
|
}
|
|
114598
115126
|
return node;
|
|
114599
115127
|
}
|
|
114600
|
-
function filteredSeriesUnchanged(
|
|
114601
|
-
const existing = parseFilteredSeries(
|
|
115128
|
+
function filteredSeriesUnchanged(container2, filteredSeries, xmlLookup) {
|
|
115129
|
+
const existing = parseFilteredSeries(container2, xmlLookup);
|
|
114602
115130
|
if (!filteredSeries || filteredSeries.length === 0) {
|
|
114603
115131
|
return !existing || existing.length === 0;
|
|
114604
115132
|
}
|
|
@@ -114610,9 +115138,9 @@ function filteredSeriesUnchanged(container, filteredSeries, xmlLookup) {
|
|
|
114610
115138
|
return entry.idx === other.idx && entry.order === other.order && entry.name === other.name && entry.uniqueId === other.uniqueId && JSON.stringify(entry.values ?? null) === JSON.stringify(other.values ?? null) && JSON.stringify(entry.categories ?? null) === JSON.stringify(other.categories ?? null);
|
|
114611
115139
|
});
|
|
114612
115140
|
}
|
|
114613
|
-
function applyFilteredSeriesToXml(
|
|
114614
|
-
const extLstKey = findKey23(
|
|
114615
|
-
const extLst = { ...
|
|
115141
|
+
function applyFilteredSeriesToXml(container2, filteredSeries, categories, containerLocalName, getLocalName2) {
|
|
115142
|
+
const extLstKey = findKey23(container2, "extLst", getLocalName2) ?? "c:extLst";
|
|
115143
|
+
const extLst = { ...container2[extLstKey] ?? {} };
|
|
114616
115144
|
const extKey = findKey23(extLst, "ext", getLocalName2);
|
|
114617
115145
|
const exts = extKey ? Array.isArray(extLst[extKey]) ? [...extLst[extKey]] : [extLst[extKey]] : [];
|
|
114618
115146
|
const otherExts = exts.filter((ext) => ext["@_uri"] !== CHART_FILTERED_SERIES_EXT_URI);
|
|
@@ -114637,11 +115165,11 @@ function applyFilteredSeriesToXml(container, filteredSeries, categories, contain
|
|
|
114637
115165
|
);
|
|
114638
115166
|
const newExts = ownExtHasContent ? [...otherExts, ownExt] : otherExts;
|
|
114639
115167
|
if (newExts.length === 0) {
|
|
114640
|
-
delete
|
|
115168
|
+
delete container2[extLstKey];
|
|
114641
115169
|
return;
|
|
114642
115170
|
}
|
|
114643
115171
|
extLst[extKey ?? "c:ext"] = newExts.length === 1 ? newExts[0] : newExts;
|
|
114644
|
-
|
|
115172
|
+
container2[extLstKey] = extLst;
|
|
114645
115173
|
}
|
|
114646
115174
|
var init_chart_filtered_series_writer = __esm({
|
|
114647
115175
|
"src/pptx/core/utils/chart-filtered-series-writer.ts"() {
|
|
@@ -115443,11 +115971,11 @@ var init_chart_title_style_serializer = __esm({
|
|
|
115443
115971
|
};
|
|
115444
115972
|
}
|
|
115445
115973
|
});
|
|
115446
|
-
function collectChartWorkbookWrite(xmlLookupService,
|
|
115447
|
-
if (!
|
|
115974
|
+
function collectChartWorkbookWrite(xmlLookupService, container2, isNumeric, values) {
|
|
115975
|
+
if (!container2) {
|
|
115448
115976
|
return void 0;
|
|
115449
115977
|
}
|
|
115450
|
-
const refNode = xmlLookupService.getChildByLocalName(
|
|
115978
|
+
const refNode = xmlLookupService.getChildByLocalName(container2, isNumeric ? "numRef" : "strRef");
|
|
115451
115979
|
const formula = refNode ? xmlLookupService.getScalarChildByLocalName(refNode, "f") : void 0;
|
|
115452
115980
|
return formula ? { formula, isNumeric, values } : void 0;
|
|
115453
115981
|
}
|
|
@@ -116210,12 +116738,12 @@ function applyPicAltText(node, altText) {
|
|
|
116210
116738
|
}
|
|
116211
116739
|
function applyChildXfrmToRawNode(node, off, ext) {
|
|
116212
116740
|
const spPrKey = findChildKey2(node, "spPr");
|
|
116213
|
-
const
|
|
116214
|
-
const xfrmKey = findChildKey2(
|
|
116741
|
+
const container2 = spPrKey ? node[spPrKey] ?? node : node;
|
|
116742
|
+
const xfrmKey = findChildKey2(container2, "xfrm");
|
|
116215
116743
|
if (!xfrmKey) {
|
|
116216
116744
|
return;
|
|
116217
116745
|
}
|
|
116218
|
-
const xfrm =
|
|
116746
|
+
const xfrm = container2[xfrmKey];
|
|
116219
116747
|
const offKey = findChildKey2(xfrm, "off") ?? "a:off";
|
|
116220
116748
|
const extKey = findChildKey2(xfrm, "ext") ?? "a:ext";
|
|
116221
116749
|
xfrm[offKey] = { "@_x": String(Math.round(off.x)), "@_y": String(Math.round(off.y)) };
|
|
@@ -116223,13 +116751,13 @@ function applyChildXfrmToRawNode(node, off, ext) {
|
|
|
116223
116751
|
}
|
|
116224
116752
|
function applyRotationFlipToRawNode(node, rotation, flipH, flipV) {
|
|
116225
116753
|
const spPrKey = findChildKey2(node, "spPr");
|
|
116226
|
-
const
|
|
116227
|
-
const xfrmKey = findChildKey2(
|
|
116754
|
+
const container2 = spPrKey ? node[spPrKey] ?? node : node;
|
|
116755
|
+
const xfrmKey = findChildKey2(container2, "xfrm");
|
|
116228
116756
|
const hasAny = Boolean(rotation) || Boolean(flipH) || Boolean(flipV);
|
|
116229
116757
|
if (!xfrmKey && !hasAny) {
|
|
116230
116758
|
return;
|
|
116231
116759
|
}
|
|
116232
|
-
const xfrm = xfrmKey ?
|
|
116760
|
+
const xfrm = xfrmKey ? container2[xfrmKey] : {};
|
|
116233
116761
|
if (rotation) {
|
|
116234
116762
|
xfrm["@_rot"] = String(Math.round(rotation * 6e4));
|
|
116235
116763
|
} else {
|
|
@@ -116245,9 +116773,9 @@ function applyRotationFlipToRawNode(node, rotation, flipH, flipV) {
|
|
|
116245
116773
|
} else {
|
|
116246
116774
|
delete xfrm["@_flipV"];
|
|
116247
116775
|
}
|
|
116248
|
-
|
|
116776
|
+
container2[xfrmKey ?? "a:xfrm"] = xfrm;
|
|
116249
116777
|
if (spPrKey) {
|
|
116250
|
-
node[spPrKey] =
|
|
116778
|
+
node[spPrKey] = container2;
|
|
116251
116779
|
}
|
|
116252
116780
|
}
|
|
116253
116781
|
var init_chart_user_shapes_raw_patch = __esm({
|
|
@@ -116597,8 +117125,8 @@ var init_placeholder_remap = __esm({
|
|
|
116597
117125
|
|
|
116598
117126
|
// src/pptx/core/utils/placeholder-xml.ts
|
|
116599
117127
|
function findNonVisualProps(rawXml) {
|
|
116600
|
-
for (const
|
|
116601
|
-
const parent = rawXml[
|
|
117128
|
+
for (const container2 of ["p:nvSpPr", "p:nvPicPr", "p:nvGraphicFramePr"]) {
|
|
117129
|
+
const parent = rawXml[container2];
|
|
116602
117130
|
const nvPr = parent?.["p:nvPr"];
|
|
116603
117131
|
if (nvPr) {
|
|
116604
117132
|
return nvPr;
|
|
@@ -120425,9 +120953,9 @@ var init_PptxHandlerRuntimeElementActions = __esm({
|
|
|
120425
120953
|
}
|
|
120426
120954
|
return;
|
|
120427
120955
|
}
|
|
120428
|
-
const
|
|
120429
|
-
if (
|
|
120430
|
-
|
|
120956
|
+
const container2 = existing ?? resolveLockContainerNode(shape, spec, true);
|
|
120957
|
+
if (container2) {
|
|
120958
|
+
container2[spec.lockTag] = next;
|
|
120431
120959
|
}
|
|
120432
120960
|
}
|
|
120433
120961
|
};
|
|
@@ -120934,8 +121462,8 @@ var init_PptxHandlerRuntimeMediaTimingParsing = __esm({
|
|
|
120934
121462
|
if (cTn) {
|
|
120935
121463
|
const childTnLst = cTn["p:childTnLst"];
|
|
120936
121464
|
if (childTnLst) {
|
|
120937
|
-
for (const
|
|
120938
|
-
const children15 = this.ensureArray(childTnLst[
|
|
121465
|
+
for (const container2 of ["p:par", "p:seq", "p:excl"]) {
|
|
121466
|
+
const children15 = this.ensureArray(childTnLst[container2]);
|
|
120939
121467
|
for (const child27 of children15) {
|
|
120940
121468
|
this.walkMediaTimingTree(child27, result, slidePath);
|
|
120941
121469
|
}
|
|
@@ -120943,8 +121471,8 @@ var init_PptxHandlerRuntimeMediaTimingParsing = __esm({
|
|
|
120943
121471
|
this.walkMediaTimingTree(childTnLst, result, slidePath);
|
|
120944
121472
|
}
|
|
120945
121473
|
}
|
|
120946
|
-
for (const
|
|
120947
|
-
const children15 = this.ensureArray(node[
|
|
121474
|
+
for (const container2 of ["p:par", "p:seq", "p:excl", "p:tnLst"]) {
|
|
121475
|
+
const children15 = this.ensureArray(node[container2]);
|
|
120948
121476
|
for (const child27 of children15) {
|
|
120949
121477
|
this.walkMediaTimingTree(child27, result, slidePath);
|
|
120950
121478
|
}
|
|
@@ -122109,8 +122637,8 @@ var init_PptxHandlerRuntimePresentationProps = __esm({
|
|
|
122109
122637
|
* `<a:noFill/>` parses to the empty STRING, so presence - not truthiness -
|
|
122110
122638
|
* has to decide.
|
|
122111
122639
|
*/
|
|
122112
|
-
parseChartContainerFill(
|
|
122113
|
-
const shapeProperties = this.xmlLookupService.getChildByLocalName(
|
|
122640
|
+
parseChartContainerFill(container2) {
|
|
122641
|
+
const shapeProperties = this.xmlLookupService.getChildByLocalName(container2, "spPr");
|
|
122114
122642
|
if (!shapeProperties) {
|
|
122115
122643
|
return void 0;
|
|
122116
122644
|
}
|
|
@@ -128547,10 +129075,10 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
|
|
|
128547
129075
|
if (!local.endsWith("Chart")) {
|
|
128548
129076
|
continue;
|
|
128549
129077
|
}
|
|
128550
|
-
const
|
|
128551
|
-
if (
|
|
129078
|
+
const container2 = plotArea[key2];
|
|
129079
|
+
if (container2) {
|
|
128552
129080
|
orderChartContainerChildren(
|
|
128553
|
-
|
|
129081
|
+
container2,
|
|
128554
129082
|
local,
|
|
128555
129083
|
(k) => this.compatibilityService.getXmlLocalName(k)
|
|
128556
129084
|
);
|
|
@@ -128629,8 +129157,8 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
|
|
|
128629
129157
|
* when the container has no formula reference (e.g. a brand-new series
|
|
128630
129158
|
* built without one), so it is always safe to call.
|
|
128631
129159
|
*/
|
|
128632
|
-
pushChartWorkbookWrite(workbookWrites,
|
|
128633
|
-
const write = collectChartWorkbookWrite(this.xmlLookupService,
|
|
129160
|
+
pushChartWorkbookWrite(workbookWrites, container2, isNumeric, values) {
|
|
129161
|
+
const write = collectChartWorkbookWrite(this.xmlLookupService, container2, isNumeric, values);
|
|
128634
129162
|
if (write) {
|
|
128635
129163
|
workbookWrites.push(write);
|
|
128636
129164
|
}
|
|
@@ -128639,17 +129167,17 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
|
|
|
128639
129167
|
* Update the cached point values in a chart reference node
|
|
128640
129168
|
* (numRef/strRef or numLit/strLit).
|
|
128641
129169
|
*/
|
|
128642
|
-
updateChartCacheValues(
|
|
129170
|
+
updateChartCacheValues(container2, isNumeric, values) {
|
|
128643
129171
|
const refName = isNumeric ? "numRef" : "strRef";
|
|
128644
129172
|
const litName = isNumeric ? "numLit" : "strLit";
|
|
128645
129173
|
const cacheName = isNumeric ? "numCache" : "strCache";
|
|
128646
|
-
const refNode = this.xmlLookupService.getChildByLocalName(
|
|
129174
|
+
const refNode = this.xmlLookupService.getChildByLocalName(container2, refName) || this.xmlLookupService.getChildByLocalName(container2, litName);
|
|
128647
129175
|
if (!refNode) {
|
|
128648
|
-
const literalKey = Object.keys(
|
|
129176
|
+
const literalKey = Object.keys(container2).find(
|
|
128649
129177
|
(key2) => this.compatibilityService.getXmlLocalName(key2) === "v"
|
|
128650
129178
|
);
|
|
128651
129179
|
if (literalKey && values.length === 1) {
|
|
128652
|
-
|
|
129180
|
+
container2[literalKey] = values[0];
|
|
128653
129181
|
}
|
|
128654
129182
|
return;
|
|
128655
129183
|
}
|
|
@@ -135901,9 +136429,9 @@ function rememberTemplateSpTreePositions(runtime, partPath, spTree, positionOf)
|
|
|
135901
136429
|
}
|
|
135902
136430
|
byPart.set(partPath, positions);
|
|
135903
136431
|
}
|
|
135904
|
-
function withReplacedChild(
|
|
135905
|
-
const existing =
|
|
135906
|
-
const next = { ...
|
|
136432
|
+
function withReplacedChild(container2, tag, indexInType, replacement) {
|
|
136433
|
+
const existing = container2[tag];
|
|
136434
|
+
const next = { ...container2 };
|
|
135907
136435
|
if (Array.isArray(existing)) {
|
|
135908
136436
|
const siblings = [...existing];
|
|
135909
136437
|
siblings[indexInType] = replacement;
|
|
@@ -135913,8 +136441,8 @@ function withReplacedChild(container, tag, indexInType, replacement) {
|
|
|
135913
136441
|
}
|
|
135914
136442
|
return next;
|
|
135915
136443
|
}
|
|
135916
|
-
function orderContainer(
|
|
135917
|
-
let working =
|
|
136444
|
+
function orderContainer(container2, plan, getLocalName2) {
|
|
136445
|
+
let working = container2;
|
|
135918
136446
|
for (const entry of plan) {
|
|
135919
136447
|
if (entry.children.length === 0) {
|
|
135920
136448
|
continue;
|
|
@@ -140130,8 +140658,8 @@ function asRuns(value) {
|
|
|
140130
140658
|
function withSplit(authored, inherited) {
|
|
140131
140659
|
return { ...inherited, ...authored, authoredRunStyle: authored, inheritedRunStyle: inherited };
|
|
140132
140660
|
}
|
|
140133
|
-
function readRuns(
|
|
140134
|
-
const runs = asRuns(
|
|
140661
|
+
function readRuns(container2, extract) {
|
|
140662
|
+
const runs = asRuns(container2?.["a:r"]);
|
|
140135
140663
|
const text2 = runs.map((run) => run["a:t"] !== void 0 ? xmlText(run["a:t"]) ?? "" : "").join("");
|
|
140136
140664
|
const first = runs[0];
|
|
140137
140665
|
return {
|
|
@@ -141628,8 +142156,8 @@ var init_PptxHandlerRuntimeSpTreeParsing = __esm({
|
|
|
141628
142156
|
* so the save layer can re-emit the original `<mc:Choice>` /
|
|
141629
142157
|
* `<mc:Fallback>` shape on dirty save (CC-4).
|
|
141630
142158
|
*/
|
|
141631
|
-
unwrapAlternateContent(
|
|
141632
|
-
const blocks = unwrapAlternateContent(
|
|
142159
|
+
unwrapAlternateContent(container2) {
|
|
142160
|
+
const blocks = unwrapAlternateContent(container2);
|
|
141633
142161
|
for (const block of blocks) {
|
|
141634
142162
|
for (const ref of block.childRefs) {
|
|
141635
142163
|
this.alternateContentBlockByRawXml.set(ref.node, block);
|
|
@@ -146714,17 +147242,17 @@ var init_PptxHandlerRuntimeSmartArtParsing = __esm({
|
|
|
146714
147242
|
// src/pptx/core/core/runtime/smartart-drawing-blip.ts
|
|
146715
147243
|
function collectDrawingShapeNodes(root, getChildren) {
|
|
146716
147244
|
const out = [];
|
|
146717
|
-
const walk3 = (
|
|
146718
|
-
if (!
|
|
147245
|
+
const walk3 = (container2) => {
|
|
147246
|
+
if (!container2) {
|
|
146719
147247
|
return;
|
|
146720
147248
|
}
|
|
146721
|
-
for (const sp of getChildren(
|
|
147249
|
+
for (const sp of getChildren(container2, "sp")) {
|
|
146722
147250
|
out.push({ node: sp, isPic: false });
|
|
146723
147251
|
}
|
|
146724
|
-
for (const pic of getChildren(
|
|
147252
|
+
for (const pic of getChildren(container2, "pic")) {
|
|
146725
147253
|
out.push({ node: pic, isPic: true });
|
|
146726
147254
|
}
|
|
146727
|
-
for (const grp of getChildren(
|
|
147255
|
+
for (const grp of getChildren(container2, "grpSp")) {
|
|
146728
147256
|
walk3(grp);
|
|
146729
147257
|
}
|
|
146730
147258
|
};
|
|
@@ -148233,13 +148761,13 @@ var init_PptxHandlerRuntimeChartParsing = __esm({
|
|
|
148233
148761
|
let filteredSeriesTitle;
|
|
148234
148762
|
let filteredCategoryTitle;
|
|
148235
148763
|
for (const containerKey of containerKeys) {
|
|
148236
|
-
const
|
|
148237
|
-
const seriesList = this.xmlLookupService.getChildrenArrayByLocalName(
|
|
148238
|
-
const containerFilteredSeries = parseFilteredSeries(
|
|
148764
|
+
const container2 = plotArea[containerKey];
|
|
148765
|
+
const seriesList = this.xmlLookupService.getChildrenArrayByLocalName(container2, "ser");
|
|
148766
|
+
const containerFilteredSeries = parseFilteredSeries(container2, this.xmlLookupService);
|
|
148239
148767
|
if (containerFilteredSeries) {
|
|
148240
148768
|
filteredSeries = [...filteredSeries ?? [], ...containerFilteredSeries];
|
|
148241
148769
|
}
|
|
148242
|
-
const containerFilteredTitles = parseFilteredTitles(
|
|
148770
|
+
const containerFilteredTitles = parseFilteredTitles(container2, this.xmlLookupService);
|
|
148243
148771
|
if (containerFilteredTitles?.seriesTitle && filteredSeriesTitle === void 0) {
|
|
148244
148772
|
filteredSeriesTitle = containerFilteredTitles.seriesTitle;
|
|
148245
148773
|
}
|
|
@@ -148266,7 +148794,7 @@ var init_PptxHandlerRuntimeChartParsing = __esm({
|
|
|
148266
148794
|
this.compatibilityService.getXmlLocalName(containerKey)
|
|
148267
148795
|
);
|
|
148268
148796
|
const containerType = isCombo ? resolvedContainerType : void 0;
|
|
148269
|
-
const axisId = resolveChartContainerValueAxisId(
|
|
148797
|
+
const axisId = resolveChartContainerValueAxisId(container2, axes ?? [], this.xmlLookupService);
|
|
148270
148798
|
series.push(
|
|
148271
148799
|
...this.buildChartSeries(
|
|
148272
148800
|
seriesList,
|
|
@@ -148304,8 +148832,8 @@ var init_PptxHandlerRuntimeChartParsing = __esm({
|
|
|
148304
148832
|
* Read a numeric `@val` from a named child of a chart-type container.
|
|
148305
148833
|
* Returns `undefined` when the child or its `@val` is absent/non-finite.
|
|
148306
148834
|
*/
|
|
148307
|
-
parseChartNumberVal(
|
|
148308
|
-
const node = this.xmlLookupService.getChildByLocalName(
|
|
148835
|
+
parseChartNumberVal(container2, localName29) {
|
|
148836
|
+
const node = this.xmlLookupService.getChildByLocalName(container2, localName29);
|
|
148309
148837
|
const raw = node?.["@_val"];
|
|
148310
148838
|
if (raw === void 0 || raw === null || raw === "") {
|
|
148311
148839
|
return void 0;
|
|
@@ -148318,8 +148846,8 @@ var init_PptxHandlerRuntimeChartParsing = __esm({
|
|
|
148318
148846
|
* A present element with no `@val` follows the OOXML `CT_Boolean` default
|
|
148319
148847
|
* of `true`; `undefined` when the child is absent.
|
|
148320
148848
|
*/
|
|
148321
|
-
parseChartBoolVal(
|
|
148322
|
-
const node = this.xmlLookupService.getChildByLocalName(
|
|
148849
|
+
parseChartBoolVal(container2, localName29) {
|
|
148850
|
+
const node = this.xmlLookupService.getChildByLocalName(container2, localName29);
|
|
148323
148851
|
if (!node) {
|
|
148324
148852
|
return void 0;
|
|
148325
148853
|
}
|
|
@@ -148989,7 +149517,7 @@ var init_PptxHandlerRuntimeLoadSession = __esm({
|
|
|
148989
149517
|
init_ole_embedded_extract();
|
|
148990
149518
|
init_ole_utils();
|
|
148991
149519
|
init_signature_detection();
|
|
148992
|
-
|
|
149520
|
+
init_types4();
|
|
148993
149521
|
init_authored_slide_background();
|
|
148994
149522
|
init_bullet_picture_image_enrichment();
|
|
148995
149523
|
init_PptxHandlerRuntimeEmbeddedFonts();
|
|
@@ -150160,7 +150688,7 @@ var init_core = __esm({
|
|
|
150160
150688
|
init_PptxHandlerRuntime();
|
|
150161
150689
|
init_builders();
|
|
150162
150690
|
init_factories();
|
|
150163
|
-
|
|
150691
|
+
init_types4();
|
|
150164
150692
|
init_table_structural_ops();
|
|
150165
150693
|
init_table_style_defaults();
|
|
150166
150694
|
init_auto_number_sequence();
|
|
@@ -150568,14 +151096,14 @@ var init_text_atoms = __esm({
|
|
|
150568
151096
|
function readCString(view, rec) {
|
|
150569
151097
|
return decodeTextChars(view, rec.dataOffset, rec.recLen);
|
|
150570
151098
|
}
|
|
150571
|
-
function parseExHyperlinkContainer(view,
|
|
150572
|
-
const atom2 = findChild4(view,
|
|
151099
|
+
function parseExHyperlinkContainer(view, container2) {
|
|
151100
|
+
const atom2 = findChild4(view, container2, RT.ExternalHyperlinkAtom);
|
|
150573
151101
|
if (!atom2 || atom2.recLen < 4) {
|
|
150574
151102
|
return void 0;
|
|
150575
151103
|
}
|
|
150576
151104
|
const id = view.getUint32(atom2.dataOffset, true);
|
|
150577
151105
|
const strings2 = {};
|
|
150578
|
-
for (const child27 of iterateChildren(view,
|
|
151106
|
+
for (const child27 of iterateChildren(view, container2)) {
|
|
150579
151107
|
if (child27.recType !== RT.CString) {
|
|
150580
151108
|
continue;
|
|
150581
151109
|
}
|
|
@@ -150835,14 +151363,14 @@ var init_persist_directory2 = __esm({
|
|
|
150835
151363
|
function readCString2(view, rec) {
|
|
150836
151364
|
return decodeTextChars(view, rec.dataOffset, rec.recLen);
|
|
150837
151365
|
}
|
|
150838
|
-
function parseOleEmbedContainer(view,
|
|
150839
|
-
const atom2 = findChild4(view,
|
|
151366
|
+
function parseOleEmbedContainer(view, container2) {
|
|
151367
|
+
const atom2 = findChild4(view, container2, RT.ExternalOleObjectAtom);
|
|
150840
151368
|
if (!atom2 || atom2.recLen < 24) {
|
|
150841
151369
|
return void 0;
|
|
150842
151370
|
}
|
|
150843
151371
|
const exObjId = view.getUint32(atom2.dataOffset + 8, true);
|
|
150844
151372
|
const persistIdRef = view.getUint32(atom2.dataOffset + 16, true);
|
|
150845
|
-
const progIdRec = findChild4(view,
|
|
151373
|
+
const progIdRec = findChild4(view, container2, RT.CString, 2);
|
|
150846
151374
|
const progId = progIdRec ? readCString2(view, progIdRec) : void 0;
|
|
150847
151375
|
return { exObjId, ref: { persistIdRef, progId } };
|
|
150848
151376
|
}
|
|
@@ -151504,7 +152032,7 @@ function arrowType(value) {
|
|
|
151504
152032
|
return ARROW_MAP[value] ?? "triangle";
|
|
151505
152033
|
}
|
|
151506
152034
|
var OPT2, DASH_MAP, ARROW_MAP;
|
|
151507
|
-
var
|
|
152035
|
+
var init_properties2 = __esm({
|
|
151508
152036
|
"src/pptx/core/ppt/escher/properties.ts"() {
|
|
151509
152037
|
OPT2 = {
|
|
151510
152038
|
rotation: 4,
|
|
@@ -151663,14 +152191,14 @@ var init_shape_props = __esm({
|
|
|
151663
152191
|
init_color_scheme2();
|
|
151664
152192
|
init_record_types2();
|
|
151665
152193
|
init_geometry_map();
|
|
151666
|
-
|
|
152194
|
+
init_properties2();
|
|
151667
152195
|
GRADIENT_FILL_TYPES = /* @__PURE__ */ new Set([4, 5, 6, 7, 8]);
|
|
151668
152196
|
}
|
|
151669
152197
|
});
|
|
151670
152198
|
|
|
151671
152199
|
// src/pptx/core/ppt/escher/sp-container.ts
|
|
151672
|
-
function parseShape2(ctx,
|
|
151673
|
-
const fsp = findChild4(ctx.view,
|
|
152200
|
+
function parseShape2(ctx, container2) {
|
|
152201
|
+
const fsp = findChild4(ctx.view, container2, OA.FSP);
|
|
151674
152202
|
if (!fsp || fsp.recLen < 8) {
|
|
151675
152203
|
return void 0;
|
|
151676
152204
|
}
|
|
@@ -151679,10 +152207,10 @@ function parseShape2(ctx, container) {
|
|
|
151679
152207
|
if (flags & FSP_FLAG_DELETED) {
|
|
151680
152208
|
return void 0;
|
|
151681
152209
|
}
|
|
151682
|
-
const optRec = findChild4(ctx.view,
|
|
152210
|
+
const optRec = findChild4(ctx.view, container2, OA.FOPT);
|
|
151683
152211
|
const props = optRec ? parseProperties(ctx.view, ctx.data, optRec) : { values: /* @__PURE__ */ new Map(), complex: /* @__PURE__ */ new Map() };
|
|
151684
|
-
const anchorRec = findChild4(ctx.view,
|
|
151685
|
-
const childAnchorRec = findChild4(ctx.view,
|
|
152212
|
+
const anchorRec = findChild4(ctx.view, container2, OA.ClientAnchor);
|
|
152213
|
+
const childAnchorRec = findChild4(ctx.view, container2, OA.ChildAnchor);
|
|
151686
152214
|
const anchor = anchorRec ? readClientAnchor(ctx.view, anchorRec) : childAnchorRec ? readChildAnchor(ctx.view, childAnchorRec) : void 0;
|
|
151687
152215
|
const namePayload = props.complex.get(OPT2.wzName);
|
|
151688
152216
|
const name = namePayload ? decodeComplexString(namePayload) : void 0;
|
|
@@ -151690,7 +152218,7 @@ function parseShape2(ctx, container) {
|
|
|
151690
152218
|
const rotationDeg = rotationRaw !== void 0 ? rotationToDegrees(rotationRaw) : void 0;
|
|
151691
152219
|
const flipH = (flags & FSP_FLAG_FLIPH2) !== 0 ? true : void 0;
|
|
151692
152220
|
const flipV = (flags & FSP_FLAG_FLIPV2) !== 0 ? true : void 0;
|
|
151693
|
-
const clientData = findChild4(ctx.view,
|
|
152221
|
+
const clientData = findChild4(ctx.view, container2, OA.ClientData);
|
|
151694
152222
|
const actionClick = clientData ? resolveShapeInteractiveInfo(ctx.view, clientData, ctx.hyperlinkStrings) : void 0;
|
|
151695
152223
|
const pib = props.values.get(OPT2.pib);
|
|
151696
152224
|
if (pib !== void 0 && pib > 0) {
|
|
@@ -151744,7 +152272,7 @@ function parseShape2(ctx, container) {
|
|
|
151744
152272
|
shape.placeholderType = placeholderType;
|
|
151745
152273
|
}
|
|
151746
152274
|
}
|
|
151747
|
-
const clientTextbox2 = findChild4(ctx.view,
|
|
152275
|
+
const clientTextbox2 = findChild4(ctx.view, container2, OA.ClientTextbox);
|
|
151748
152276
|
if (clientTextbox2) {
|
|
151749
152277
|
const text2 = extractText(ctx, clientTextbox2);
|
|
151750
152278
|
if (text2 && text2.paragraphs.some((p) => p.runs.length > 0)) {
|
|
@@ -151756,11 +152284,11 @@ function parseShape2(ctx, container) {
|
|
|
151756
152284
|
}
|
|
151757
152285
|
return shape;
|
|
151758
152286
|
}
|
|
151759
|
-
function parseGroup(ctx,
|
|
152287
|
+
function parseGroup(ctx, container2) {
|
|
151760
152288
|
const children15 = [];
|
|
151761
152289
|
let groupShape;
|
|
151762
152290
|
let first = true;
|
|
151763
|
-
for (const child27 of iterateChildren(ctx.view,
|
|
152291
|
+
for (const child27 of iterateChildren(ctx.view, container2)) {
|
|
151764
152292
|
if (child27.recType === OA.SpContainer && first) {
|
|
151765
152293
|
groupShape = child27;
|
|
151766
152294
|
first = false;
|
|
@@ -151830,8 +152358,8 @@ function parseDrawing(ctx, dgContainer) {
|
|
|
151830
152358
|
}
|
|
151831
152359
|
return result;
|
|
151832
152360
|
}
|
|
151833
|
-
function extractBackground(ctx,
|
|
151834
|
-
const fsp = findChild4(ctx.view,
|
|
152361
|
+
function extractBackground(ctx, container2) {
|
|
152362
|
+
const fsp = findChild4(ctx.view, container2, OA.FSP);
|
|
151835
152363
|
if (!fsp || fsp.recLen < 8) {
|
|
151836
152364
|
return void 0;
|
|
151837
152365
|
}
|
|
@@ -151839,7 +152367,7 @@ function extractBackground(ctx, container) {
|
|
|
151839
152367
|
if ((flags & FSP_FLAG_BACKGROUND2) === 0 || (flags & FSP_FLAG_GROUP2) !== 0) {
|
|
151840
152368
|
return void 0;
|
|
151841
152369
|
}
|
|
151842
|
-
const optRec = findChild4(ctx.view,
|
|
152370
|
+
const optRec = findChild4(ctx.view, container2, OA.FOPT);
|
|
151843
152371
|
if (!optRec) {
|
|
151844
152372
|
return ctx.scheme[0];
|
|
151845
152373
|
}
|
|
@@ -151856,7 +152384,7 @@ var init_sp_container = __esm({
|
|
|
151856
152384
|
init_record_types2();
|
|
151857
152385
|
init_client_data_extract();
|
|
151858
152386
|
init_geometry_map();
|
|
151859
|
-
|
|
152387
|
+
init_properties2();
|
|
151860
152388
|
init_shape_props();
|
|
151861
152389
|
FSP_FLAG_GROUP2 = 1;
|
|
151862
152390
|
FSP_FLAG_DELETED = 8;
|
|
@@ -151867,22 +152395,22 @@ var init_sp_container = __esm({
|
|
|
151867
152395
|
});
|
|
151868
152396
|
|
|
151869
152397
|
// src/pptx/core/ppt/slide-parser.ts
|
|
151870
|
-
function parseSlideContainer(inputs,
|
|
152398
|
+
function parseSlideContainer(inputs, container2) {
|
|
151871
152399
|
const { view, data, fonts } = inputs;
|
|
151872
152400
|
let followMasterBackground = true;
|
|
151873
152401
|
let followMasterScheme = true;
|
|
151874
152402
|
let followMasterObjects = true;
|
|
151875
|
-
const slideAtom = findChild4(view,
|
|
152403
|
+
const slideAtom = findChild4(view, container2, RT.SlideAtom);
|
|
151876
152404
|
if (slideAtom && slideAtom.recLen >= 24) {
|
|
151877
152405
|
const flags = view.getUint16(slideAtom.dataOffset + 20, true);
|
|
151878
152406
|
followMasterObjects = (flags & SLIDE_FLAG_MASTER_OBJECTS2) !== 0;
|
|
151879
152407
|
followMasterScheme = (flags & SLIDE_FLAG_MASTER_SCHEME2) !== 0;
|
|
151880
152408
|
followMasterBackground = (flags & SLIDE_FLAG_MASTER_BACKGROUND2) !== 0;
|
|
151881
152409
|
}
|
|
151882
|
-
const ownScheme = findSchemeColors(view,
|
|
152410
|
+
const ownScheme = findSchemeColors(view, container2);
|
|
151883
152411
|
const scheme = followMasterScheme ? inputs.masterScheme : ownScheme ?? inputs.masterScheme;
|
|
151884
152412
|
const slide = { followMasterBackground, followMasterObjects, shapes: [] };
|
|
151885
|
-
const drawing = findChild4(view,
|
|
152413
|
+
const drawing = findChild4(view, container2, RT.Drawing);
|
|
151886
152414
|
if (drawing) {
|
|
151887
152415
|
const dgContainer = findDescendant(view, drawing, OA.DgContainer);
|
|
151888
152416
|
if (dgContainer) {
|
|
@@ -151905,12 +152433,12 @@ function parseSlideContainer(inputs, container) {
|
|
|
151905
152433
|
}
|
|
151906
152434
|
return slide;
|
|
151907
152435
|
}
|
|
151908
|
-
function parseMasterContainer(view, data, fonts, fallbackScheme,
|
|
151909
|
-
const scheme = findSchemeColors(view,
|
|
152436
|
+
function parseMasterContainer(view, data, fonts, fallbackScheme, container2, hyperlinkStrings, oleExObjIds) {
|
|
152437
|
+
const scheme = findSchemeColors(view, container2);
|
|
151910
152438
|
const active = scheme ?? fallbackScheme;
|
|
151911
152439
|
let backgroundRgb;
|
|
151912
152440
|
let shapes = [];
|
|
151913
|
-
const drawing = findChild4(view,
|
|
152441
|
+
const drawing = findChild4(view, container2, RT.Drawing);
|
|
151914
152442
|
if (drawing) {
|
|
151915
152443
|
const dgContainer = findDescendant(view, drawing, OA.DgContainer);
|
|
151916
152444
|
if (dgContainer) {
|
|
@@ -151930,7 +152458,7 @@ function parseMasterContainer(view, data, fonts, fallbackScheme, container, hype
|
|
|
151930
152458
|
);
|
|
151931
152459
|
}
|
|
151932
152460
|
}
|
|
151933
|
-
return { scheme, backgroundRgb, shapes, container };
|
|
152461
|
+
return { scheme, backgroundRgb, shapes, container: container2 };
|
|
151934
152462
|
}
|
|
151935
152463
|
var SLIDE_FLAG_MASTER_OBJECTS2, SLIDE_FLAG_MASTER_SCHEME2, SLIDE_FLAG_MASTER_BACKGROUND2;
|
|
151936
152464
|
var init_slide_parser = __esm({
|
|
@@ -152081,11 +152609,11 @@ function findBStore(view, docContainer) {
|
|
|
152081
152609
|
}
|
|
152082
152610
|
return findDescendant(view, drawingGroup, OA.BStoreContainer);
|
|
152083
152611
|
}
|
|
152084
|
-
async function parseDeck(
|
|
152085
|
-
const data =
|
|
152612
|
+
async function parseDeck(streams2) {
|
|
152613
|
+
const data = streams2.powerPointDocument;
|
|
152086
152614
|
const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
152087
|
-
const { currentEdit, directory } = buildPersistDirectory(view,
|
|
152088
|
-
if (currentEdit.encryptSessionPersistIdRef !== void 0 && currentEdit.encryptSessionPersistIdRef !== 0 && !
|
|
152615
|
+
const { currentEdit, directory } = buildPersistDirectory(view, streams2.offsetToCurrentEdit);
|
|
152616
|
+
if (currentEdit.encryptSessionPersistIdRef !== void 0 && currentEdit.encryptSessionPersistIdRef !== 0 && !streams2.decrypted) {
|
|
152089
152617
|
throw new EncryptedPptError();
|
|
152090
152618
|
}
|
|
152091
152619
|
const docOffset = directory.get(currentEdit.docPersistIdRef);
|
|
@@ -152172,7 +152700,7 @@ async function parseDeck(streams) {
|
|
|
152172
152700
|
}
|
|
152173
152701
|
const bstoreRec = findBStore(view, docContainer);
|
|
152174
152702
|
const pictures = await parsePictures(
|
|
152175
|
-
|
|
152703
|
+
streams2.pictures,
|
|
152176
152704
|
bstoreRec ? { view, rec: bstoreRec } : void 0
|
|
152177
152705
|
);
|
|
152178
152706
|
const usedExObjIds = /* @__PURE__ */ new Set();
|
|
@@ -152221,6 +152749,20 @@ var init_document_parser = __esm({
|
|
|
152221
152749
|
}
|
|
152222
152750
|
});
|
|
152223
152751
|
|
|
152752
|
+
// src/pptx/core/utils/ooxml-crypto-errors.ts
|
|
152753
|
+
var init_ooxml_crypto_errors = __esm({
|
|
152754
|
+
"src/pptx/core/utils/ooxml-crypto-errors.ts"() {
|
|
152755
|
+
init_errors();
|
|
152756
|
+
}
|
|
152757
|
+
});
|
|
152758
|
+
|
|
152759
|
+
// src/pptx/core/utils/ooxml-crypto-key-derivation.ts
|
|
152760
|
+
var init_ooxml_crypto_key_derivation = __esm({
|
|
152761
|
+
"src/pptx/core/utils/ooxml-crypto-key-derivation.ts"() {
|
|
152762
|
+
init_encryption_info();
|
|
152763
|
+
}
|
|
152764
|
+
});
|
|
152765
|
+
|
|
152224
152766
|
// src/pptx/core/ppt/rc4-cryptoapi-key.ts
|
|
152225
152767
|
var init_rc4_cryptoapi_key2 = __esm({
|
|
152226
152768
|
"src/pptx/core/ppt/rc4-cryptoapi-key.ts"() {
|
|
@@ -156409,9 +156951,9 @@ var MASTER_XMLNS = 'xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/ma
|
|
|
156409
156951
|
var FALLBACK_CLR_MAP = '<p:clrMap bg1="lt1" tx1="dk1" bg2="lt2" tx2="dk2" accent1="accent1" accent2="accent2" accent3="accent3" accent4="accent4" accent5="accent5" accent6="accent6" hlink="hlink" folHlink="folHlink"/>';
|
|
156410
156952
|
var FALLBACK_TX_STYLES = '<p:txStyles><p:titleStyle><a:lvl1pPr algn="l"><a:defRPr sz="4400" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mj-lt"/></a:defRPr></a:lvl1pPr></p:titleStyle><p:bodyStyle><a:lvl1pPr algn="l"><a:defRPr sz="3200" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/></a:defRPr></a:lvl1pPr></p:bodyStyle><p:otherStyle><a:defPPr><a:defRPr lang="en-US"/></a:defPPr></p:otherStyle></p:txStyles>';
|
|
156411
156953
|
function extractTag(xml, tag) {
|
|
156412
|
-
const
|
|
156413
|
-
if (
|
|
156414
|
-
return
|
|
156954
|
+
const container2 = xml.match(new RegExp(`<${tag}(?:\\s[^>]*)?>[^]*?</${tag}>`));
|
|
156955
|
+
if (container2) {
|
|
156956
|
+
return container2[0];
|
|
156415
156957
|
}
|
|
156416
156958
|
const selfClosed = xml.match(new RegExp(`<${tag}(?:\\s[^>]*)?/>`));
|
|
156417
156959
|
return selfClosed ? selfClosed[0] : "";
|
|
@@ -170494,12 +171036,12 @@ var SlideProcessor = class {
|
|
|
170494
171036
|
if (positionedCells.length === 0) {
|
|
170495
171037
|
return [];
|
|
170496
171038
|
}
|
|
170497
|
-
const
|
|
171039
|
+
const container2 = [
|
|
170498
171040
|
`<div style="position:relative;width:${displayW}px;height:${displayH}px;border:1px solid #e5e7eb;overflow:hidden;margin:0.5em 0">`,
|
|
170499
171041
|
...positionedCells,
|
|
170500
171042
|
"</div>"
|
|
170501
171043
|
].join("\n");
|
|
170502
|
-
return [
|
|
171044
|
+
return [container2];
|
|
170503
171045
|
}
|
|
170504
171046
|
/** Sorts elements into natural reading order (top-to-bottom, left-to-right). */
|
|
170505
171047
|
sortElementsByReadingOrder(elements2) {
|