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.
Files changed (286) hide show
  1. package/README.md +14 -13
  2. package/dist/crypto/aes-ecb.d.ts +13 -0
  3. package/dist/crypto/aes-ecb.d.ts.map +1 -0
  4. package/dist/crypto/decrypt.d.ts +63 -0
  5. package/dist/crypto/decrypt.d.ts.map +1 -0
  6. package/dist/crypto/detect.d.ts +56 -0
  7. package/dist/crypto/detect.d.ts.map +1 -0
  8. package/dist/crypto/encrypt.d.ts +27 -0
  9. package/dist/crypto/encrypt.d.ts.map +1 -0
  10. package/dist/crypto/encryption-info-write.d.ts +46 -0
  11. package/dist/crypto/encryption-info-write.d.ts.map +1 -0
  12. package/dist/crypto/encryption-info.d.ts +22 -0
  13. package/dist/crypto/encryption-info.d.ts.map +1 -0
  14. package/dist/crypto/errors.d.ts +39 -0
  15. package/dist/crypto/errors.d.ts.map +1 -0
  16. package/dist/crypto/index.cjs +1805 -0
  17. package/dist/crypto/index.d.ts +26 -0
  18. package/dist/crypto/index.d.ts.map +1 -0
  19. package/dist/crypto/index.mjs +1774 -0
  20. package/dist/crypto/key-derivation.d.ts +73 -0
  21. package/dist/crypto/key-derivation.d.ts.map +1 -0
  22. package/dist/crypto/types.d.ts +104 -0
  23. package/dist/crypto/types.d.ts.map +1 -0
  24. package/dist/docx/embedded.cjs +2 -0
  25. package/dist/docx/embedded.mjs +2 -0
  26. package/dist/docx/index.cjs +2 -0
  27. package/dist/docx/index.mjs +2 -0
  28. package/dist/docx/load/detect.d.ts +14 -2
  29. package/dist/docx/load/detect.d.ts.map +1 -1
  30. package/dist/docx/load/index.cjs +8995 -7728
  31. package/dist/docx/load/index.d.ts +3 -1
  32. package/dist/docx/load/index.d.ts.map +1 -1
  33. package/dist/docx/load/index.mjs +8990 -7729
  34. package/dist/docx/load/legacy-doc.d.ts.map +1 -1
  35. package/dist/index.cjs +749 -19
  36. package/dist/index.mjs +749 -19
  37. package/dist/opc/index.cjs +797 -1
  38. package/dist/opc/index.d.ts +2 -0
  39. package/dist/opc/index.d.ts.map +1 -1
  40. package/dist/opc/index.mjs +784 -3
  41. package/dist/opc/properties/app.d.ts +10 -0
  42. package/dist/opc/properties/app.d.ts.map +1 -0
  43. package/dist/opc/properties/core.d.ts +13 -0
  44. package/dist/opc/properties/core.d.ts.map +1 -0
  45. package/dist/opc/properties/custom.d.ts +15 -0
  46. package/dist/opc/properties/custom.d.ts.map +1 -0
  47. package/dist/opc/properties/index.d.ts +5 -0
  48. package/dist/opc/properties/index.d.ts.map +1 -0
  49. package/dist/opc/properties/types.d.ts +114 -0
  50. package/dist/opc/properties/types.d.ts.map +1 -0
  51. package/dist/opc/relationship-types.d.ts +1 -0
  52. package/dist/opc/relationship-types.d.ts.map +1 -1
  53. package/dist/opc/safe-href.d.ts +34 -0
  54. package/dist/opc/safe-href.d.ts.map +1 -1
  55. package/dist/opc/signature/constants.d.ts +42 -0
  56. package/dist/opc/signature/constants.d.ts.map +1 -0
  57. package/dist/opc/signature/detection.d.ts +97 -0
  58. package/dist/opc/signature/detection.d.ts.map +1 -0
  59. package/dist/opc/signature/digest.d.ts +16 -0
  60. package/dist/opc/signature/digest.d.ts.map +1 -0
  61. package/dist/opc/signature/index.d.ts +8 -0
  62. package/dist/opc/signature/index.d.ts.map +1 -0
  63. package/dist/opc/signature/inspection-status.d.ts +24 -0
  64. package/dist/opc/signature/inspection-status.d.ts.map +1 -0
  65. package/dist/opc/signature/reference-utils.d.ts +12 -0
  66. package/dist/opc/signature/reference-utils.d.ts.map +1 -0
  67. package/dist/opc/signature/types.d.ts +90 -0
  68. package/dist/opc/signature/types.d.ts.map +1 -0
  69. package/dist/opc/signature/xml-utils.d.ts +35 -0
  70. package/dist/opc/signature/xml-utils.d.ts.map +1 -0
  71. package/dist/pptx/chunks/{index-CojJtI77.d.ts → index-BWUBPGgv.d.ts} +9 -11
  72. package/dist/pptx/chunks/index-BWUBPGgv.d.ts.map +1 -0
  73. package/dist/pptx/chunks/{signature-inspection-status-Bh2oap7B.d.ts → inspection-status-B2E-jSpG.d.ts} +8 -8
  74. package/dist/pptx/chunks/inspection-status-B2E-jSpG.d.ts.map +1 -0
  75. package/dist/pptx/cli/index.cjs +1409 -895
  76. package/dist/pptx/cli/index.mjs +1409 -895
  77. package/dist/pptx/converter/index.d.ts +1 -1
  78. package/dist/pptx/index.cjs +1933 -1391
  79. package/dist/pptx/index.d.ts +20 -67
  80. package/dist/pptx/index.d.ts.map +1 -1
  81. package/dist/pptx/index.mjs +1933 -1391
  82. package/dist/pptx/signature-node/index.cjs +5 -5
  83. package/dist/pptx/signature-node/index.d.ts +1 -1
  84. package/dist/pptx/signature-node/index.mjs +5 -5
  85. package/dist/visio/edit-master-index.d.ts +10 -0
  86. package/dist/visio/edit-master-index.d.ts.map +1 -0
  87. package/dist/visio/edit-master-scope.d.ts +7 -0
  88. package/dist/visio/edit-master-scope.d.ts.map +1 -0
  89. package/dist/visio/edit-scope.d.ts.map +1 -1
  90. package/dist/visio/formula-arithmetic.d.ts +8 -0
  91. package/dist/visio/formula-arithmetic.d.ts.map +1 -0
  92. package/dist/visio/formula-evaluate.d.ts.map +1 -1
  93. package/dist/visio/formula-master.d.ts +13 -0
  94. package/dist/visio/formula-master.d.ts.map +1 -0
  95. package/dist/visio/formula-numeric-functions.d.ts +8 -0
  96. package/dist/visio/formula-numeric-functions.d.ts.map +1 -0
  97. package/dist/visio/formula.d.ts +1 -1
  98. package/dist/visio/formula.d.ts.map +1 -1
  99. package/dist/visio/index.cjs +540 -61
  100. package/dist/visio/index.mjs +540 -61
  101. package/dist/xlsx/edit/annotations.d.ts +5 -1
  102. package/dist/xlsx/edit/annotations.d.ts.map +1 -1
  103. package/dist/xlsx/edit/cell-values.d.ts +7 -2
  104. package/dist/xlsx/edit/cell-values.d.ts.map +1 -1
  105. package/dist/xlsx/edit/clipboard.d.ts.map +1 -1
  106. package/dist/xlsx/edit/doc-properties.d.ts +14 -0
  107. package/dist/xlsx/edit/doc-properties.d.ts.map +1 -0
  108. package/dist/xlsx/edit/fill-series.d.ts.map +1 -1
  109. package/dist/xlsx/edit/find.d.ts +2 -1
  110. package/dist/xlsx/edit/find.d.ts.map +1 -1
  111. package/dist/xlsx/edit/format-lines.d.ts +22 -0
  112. package/dist/xlsx/edit/format-lines.d.ts.map +1 -0
  113. package/dist/xlsx/edit/format.d.ts +2 -1
  114. package/dist/xlsx/edit/format.d.ts.map +1 -1
  115. package/dist/xlsx/edit/history-refs.d.ts +51 -0
  116. package/dist/xlsx/edit/history-refs.d.ts.map +1 -0
  117. package/dist/xlsx/edit/history.d.ts +40 -5
  118. package/dist/xlsx/edit/history.d.ts.map +1 -1
  119. package/dist/xlsx/edit/index.d.ts +3 -0
  120. package/dist/xlsx/edit/index.d.ts.map +1 -1
  121. package/dist/xlsx/edit/input-text.d.ts +13 -0
  122. package/dist/xlsx/edit/input-text.d.ts.map +1 -0
  123. package/dist/xlsx/edit/merge.d.ts +10 -2
  124. package/dist/xlsx/edit/merge.d.ts.map +1 -1
  125. package/dist/xlsx/edit/session.d.ts.map +1 -1
  126. package/dist/xlsx/edit/sheets.d.ts.map +1 -1
  127. package/dist/xlsx/edit/shift-formulas.d.ts +2 -1
  128. package/dist/xlsx/edit/shift-formulas.d.ts.map +1 -1
  129. package/dist/xlsx/edit/shift-preserved.d.ts +17 -0
  130. package/dist/xlsx/edit/shift-preserved.d.ts.map +1 -0
  131. package/dist/xlsx/edit/shift-sheet.d.ts +2 -2
  132. package/dist/xlsx/edit/shift-sheet.d.ts.map +1 -1
  133. package/dist/xlsx/edit/structure.d.ts.map +1 -1
  134. package/dist/xlsx/edit/types.d.ts +7 -0
  135. package/dist/xlsx/edit/types.d.ts.map +1 -1
  136. package/dist/xlsx/edit/validation-list.d.ts +24 -0
  137. package/dist/xlsx/edit/validation-list.d.ts.map +1 -0
  138. package/dist/xlsx/edit/validation.d.ts +2 -1
  139. package/dist/xlsx/edit/validation.d.ts.map +1 -1
  140. package/dist/xlsx/formula/area-index.d.ts +18 -0
  141. package/dist/xlsx/formula/area-index.d.ts.map +1 -0
  142. package/dist/xlsx/formula/array-context.d.ts.map +1 -1
  143. package/dist/xlsx/formula/ast.d.ts +5 -1
  144. package/dist/xlsx/formula/ast.d.ts.map +1 -1
  145. package/dist/xlsx/formula/call.d.ts.map +1 -1
  146. package/dist/xlsx/formula/coerce.d.ts.map +1 -1
  147. package/dist/xlsx/formula/context.d.ts +5 -0
  148. package/dist/xlsx/formula/context.d.ts.map +1 -1
  149. package/dist/xlsx/formula/date-serial.d.ts +11 -4
  150. package/dist/xlsx/formula/date-serial.d.ts.map +1 -1
  151. package/dist/xlsx/formula/engine-core.d.ts +6 -0
  152. package/dist/xlsx/formula/engine-core.d.ts.map +1 -1
  153. package/dist/xlsx/formula/engine-host.d.ts +35 -3
  154. package/dist/xlsx/formula/engine-host.d.ts.map +1 -1
  155. package/dist/xlsx/formula/engine-util.d.ts.map +1 -1
  156. package/dist/xlsx/formula/engine.d.ts.map +1 -1
  157. package/dist/xlsx/formula/evaluator.d.ts.map +1 -1
  158. package/dist/xlsx/formula/functions/array-shape.d.ts.map +1 -1
  159. package/dist/xlsx/formula/functions/array.d.ts.map +1 -1
  160. package/dist/xlsx/formula/functions/criteria-index.d.ts +12 -0
  161. package/dist/xlsx/formula/functions/criteria-index.d.ts.map +1 -0
  162. package/dist/xlsx/formula/functions/criteria.d.ts +24 -16
  163. package/dist/xlsx/formula/functions/criteria.d.ts.map +1 -1
  164. package/dist/xlsx/formula/functions/date-calc.d.ts +4 -0
  165. package/dist/xlsx/formula/functions/date-calc.d.ts.map +1 -1
  166. package/dist/xlsx/formula/functions/depreciation.d.ts.map +1 -1
  167. package/dist/xlsx/formula/functions/financial.d.ts.map +1 -1
  168. package/dist/xlsx/formula/functions/helpers.d.ts.map +1 -1
  169. package/dist/xlsx/formula/functions/logical.d.ts.map +1 -1
  170. package/dist/xlsx/formula/functions/lookup-core.d.ts +14 -2
  171. package/dist/xlsx/formula/functions/lookup-core.d.ts.map +1 -1
  172. package/dist/xlsx/formula/functions/lookup.d.ts.map +1 -1
  173. package/dist/xlsx/formula/functions/math-mod.d.ts +8 -0
  174. package/dist/xlsx/formula/functions/math-mod.d.ts.map +1 -0
  175. package/dist/xlsx/formula/functions/math-sum.d.ts.map +1 -1
  176. package/dist/xlsx/formula/functions/math.d.ts.map +1 -1
  177. package/dist/xlsx/formula/functions/statistical-count.d.ts.map +1 -1
  178. package/dist/xlsx/formula/functions/statistical.d.ts.map +1 -1
  179. package/dist/xlsx/formula/functions/stats-core.d.ts +6 -0
  180. package/dist/xlsx/formula/functions/stats-core.d.ts.map +1 -1
  181. package/dist/xlsx/formula/functions/text-case.d.ts +14 -0
  182. package/dist/xlsx/formula/functions/text-case.d.ts.map +1 -0
  183. package/dist/xlsx/formula/functions/text.d.ts.map +1 -1
  184. package/dist/xlsx/formula/functions/workdays.d.ts.map +1 -1
  185. package/dist/xlsx/formula/graph-index.d.ts +15 -0
  186. package/dist/xlsx/formula/graph-index.d.ts.map +1 -0
  187. package/dist/xlsx/formula/graph.d.ts +13 -18
  188. package/dist/xlsx/formula/graph.d.ts.map +1 -1
  189. package/dist/xlsx/formula/operators.d.ts +9 -0
  190. package/dist/xlsx/formula/operators.d.ts.map +1 -1
  191. package/dist/xlsx/formula/parser.d.ts +2 -0
  192. package/dist/xlsx/formula/parser.d.ts.map +1 -1
  193. package/dist/xlsx/formula/references.d.ts +4 -1
  194. package/dist/xlsx/formula/references.d.ts.map +1 -1
  195. package/dist/xlsx/formula/text-number.d.ts.map +1 -1
  196. package/dist/xlsx/formula/transform.d.ts.map +1 -1
  197. package/dist/xlsx/formula/values.d.ts +44 -3
  198. package/dist/xlsx/formula/values.d.ts.map +1 -1
  199. package/dist/xlsx/index.cjs +4698 -1322
  200. package/dist/xlsx/index.mjs +4688 -1323
  201. package/dist/xlsx/layout/anchors.d.ts +47 -0
  202. package/dist/xlsx/layout/anchors.d.ts.map +1 -0
  203. package/dist/xlsx/layout/cf-evaluator.d.ts +1 -2
  204. package/dist/xlsx/layout/cf-evaluator.d.ts.map +1 -1
  205. package/dist/xlsx/layout/cf-helpers.d.ts +8 -1
  206. package/dist/xlsx/layout/cf-helpers.d.ts.map +1 -1
  207. package/dist/xlsx/layout/index.d.ts +1 -0
  208. package/dist/xlsx/layout/index.d.ts.map +1 -1
  209. package/dist/xlsx/load/csv.d.ts +24 -3
  210. package/dist/xlsx/load/csv.d.ts.map +1 -1
  211. package/dist/xlsx/load/detect.d.ts +39 -7
  212. package/dist/xlsx/load/detect.d.ts.map +1 -1
  213. package/dist/xlsx/load/errors.d.ts +10 -0
  214. package/dist/xlsx/load/errors.d.ts.map +1 -0
  215. package/dist/xlsx/load/index.cjs +16220 -12163
  216. package/dist/xlsx/load/index.d.ts +5 -2
  217. package/dist/xlsx/load/index.d.ts.map +1 -1
  218. package/dist/xlsx/load/index.mjs +16213 -12164
  219. package/dist/xlsx/load/text-decode.d.ts +7 -0
  220. package/dist/xlsx/load/text-decode.d.ts.map +1 -0
  221. package/dist/xlsx/model.d.ts +121 -17
  222. package/dist/xlsx/model.d.ts.map +1 -1
  223. package/dist/xlsx/numfmt/date.d.ts +7 -0
  224. package/dist/xlsx/numfmt/date.d.ts.map +1 -1
  225. package/dist/xlsx/numfmt/format.d.ts.map +1 -1
  226. package/dist/xlsx/numfmt/fraction.d.ts +5 -1
  227. package/dist/xlsx/numfmt/fraction.d.ts.map +1 -1
  228. package/dist/xlsx/numfmt/input-date.d.ts.map +1 -1
  229. package/dist/xlsx/numfmt/input.d.ts.map +1 -1
  230. package/dist/xlsx/numfmt/number.d.ts.map +1 -1
  231. package/dist/xlsx/read/conditional.d.ts.map +1 -1
  232. package/dist/xlsx/read/drawing.d.ts +2 -2
  233. package/dist/xlsx/read/drawing.d.ts.map +1 -1
  234. package/dist/xlsx/read/load.d.ts.map +1 -1
  235. package/dist/xlsx/read/package.d.ts +18 -2
  236. package/dist/xlsx/read/package.d.ts.map +1 -1
  237. package/dist/xlsx/read/sheet-data.d.ts.map +1 -1
  238. package/dist/xlsx/read/sheet-props.d.ts +15 -1
  239. package/dist/xlsx/read/sheet-props.d.ts.map +1 -1
  240. package/dist/xlsx/read/smart-art.d.ts +12 -0
  241. package/dist/xlsx/read/smart-art.d.ts.map +1 -0
  242. package/dist/xlsx/read/styles.d.ts.map +1 -1
  243. package/dist/xlsx/read/workbook-part.d.ts +5 -2
  244. package/dist/xlsx/read/workbook-part.d.ts.map +1 -1
  245. package/dist/xlsx/read/worksheet.d.ts.map +1 -1
  246. package/dist/xlsx/write/attr-merge.d.ts +10 -0
  247. package/dist/xlsx/write/attr-merge.d.ts.map +1 -0
  248. package/dist/xlsx/write/carried-refs.d.ts +61 -0
  249. package/dist/xlsx/write/carried-refs.d.ts.map +1 -0
  250. package/dist/xlsx/write/comments.d.ts +12 -2
  251. package/dist/xlsx/write/comments.d.ts.map +1 -1
  252. package/dist/xlsx/write/conditional.d.ts.map +1 -1
  253. package/dist/xlsx/write/doc-props.d.ts +30 -0
  254. package/dist/xlsx/write/doc-props.d.ts.map +1 -0
  255. package/dist/xlsx/write/drawing.d.ts +5 -0
  256. package/dist/xlsx/write/drawing.d.ts.map +1 -1
  257. package/dist/xlsx/write/metadata.d.ts +23 -0
  258. package/dist/xlsx/write/metadata.d.ts.map +1 -0
  259. package/dist/xlsx/write/package-writer.d.ts +6 -0
  260. package/dist/xlsx/write/package-writer.d.ts.map +1 -1
  261. package/dist/xlsx/write/page-setup.d.ts +8 -0
  262. package/dist/xlsx/write/page-setup.d.ts.map +1 -0
  263. package/dist/xlsx/write/save.d.ts.map +1 -1
  264. package/dist/xlsx/write/sheet-data.d.ts +8 -0
  265. package/dist/xlsx/write/sheet-data.d.ts.map +1 -1
  266. package/dist/xlsx/write/sheet-parts.d.ts +6 -0
  267. package/dist/xlsx/write/sheet-parts.d.ts.map +1 -1
  268. package/dist/xlsx/write/sheet-props.d.ts +0 -6
  269. package/dist/xlsx/write/sheet-props.d.ts.map +1 -1
  270. package/dist/xlsx/write/styles.d.ts.map +1 -1
  271. package/dist/xlsx/write/table-patch.d.ts +12 -0
  272. package/dist/xlsx/write/table-patch.d.ts.map +1 -0
  273. package/dist/xlsx/write/tables.d.ts +9 -0
  274. package/dist/xlsx/write/tables.d.ts.map +1 -1
  275. package/dist/xlsx/write/vml-ids.d.ts +29 -0
  276. package/dist/xlsx/write/vml-ids.d.ts.map +1 -0
  277. package/dist/xlsx/write/workbook-part.d.ts +1 -4
  278. package/dist/xlsx/write/workbook-part.d.ts.map +1 -1
  279. package/dist/xlsx/write/worksheet.d.ts.map +1 -1
  280. package/dist/xml/index.cjs +4 -0
  281. package/dist/xml/index.mjs +4 -0
  282. package/dist/xml/namespaces.d.ts +4 -0
  283. package/dist/xml/namespaces.d.ts.map +1 -1
  284. package/package.json +6 -1
  285. package/dist/pptx/chunks/index-CojJtI77.d.ts.map +0 -1
  286. package/dist/pptx/chunks/signature-inspection-status-Bh2oap7B.d.ts.map +0 -1
@@ -14107,12 +14107,12 @@ var init_ole2_parser_write_serialize = __esm({
14107
14107
  });
14108
14108
 
14109
14109
  // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ole2-parser-write.js
14110
- function buildOle2(streams, rootClsid, miniStreamCutoff = 4096) {
14110
+ function buildOle2(streams2, rootClsid, miniStreamCutoff = 4096) {
14111
14111
  const sectorSize = 512;
14112
14112
  const miniSectorSize = 64;
14113
14113
  const regularStreams = [];
14114
14114
  const miniStreams = [];
14115
- for (const [name, data] of streams) {
14115
+ for (const [name, data] of streams2) {
14116
14116
  if (data.length < miniStreamCutoff) {
14117
14117
  miniStreams.push({ name, data });
14118
14118
  } else {
@@ -14336,32 +14336,32 @@ function replaceOleEmbedding(originalBytes, newPayloadBytes, options = {}) {
14336
14336
  const existing = ole.getStream(nativeStreamName);
14337
14337
  const decoded = decodeOle10Native(existing);
14338
14338
  const fileName = options.fileName ?? decoded?.fileName ?? "file.bin";
14339
- const streams = /* @__PURE__ */ new Map();
14339
+ const streams2 = /* @__PURE__ */ new Map();
14340
14340
  for (const entry of ole.entries) {
14341
14341
  if (entry.name === "Root Entry" || entry.name === nativeStreamName) {
14342
14342
  continue;
14343
14343
  }
14344
14344
  const data = ole.getStream(entry.name);
14345
14345
  if (data) {
14346
- streams.set(entry.name, data);
14346
+ streams2.set(entry.name, data);
14347
14347
  }
14348
14348
  }
14349
- streams.set(nativeStreamName, encodeOle10Native(fileName, newPayloadBytes));
14350
- return new Uint8Array(buildOle2(streams));
14349
+ streams2.set(nativeStreamName, encodeOle10Native(fileName, newPayloadBytes));
14350
+ return new Uint8Array(buildOle2(streams2));
14351
14351
  }
14352
14352
  if (ole.getStream(CONTENTS_STREAM2)) {
14353
- const streams = /* @__PURE__ */ new Map();
14353
+ const streams2 = /* @__PURE__ */ new Map();
14354
14354
  for (const entry of ole.entries) {
14355
14355
  if (entry.name === "Root Entry" || entry.name === CONTENTS_STREAM2) {
14356
14356
  continue;
14357
14357
  }
14358
14358
  const data = ole.getStream(entry.name);
14359
14359
  if (data) {
14360
- streams.set(entry.name, data);
14360
+ streams2.set(entry.name, data);
14361
14361
  }
14362
14362
  }
14363
- streams.set(CONTENTS_STREAM2, newPayloadBytes);
14364
- return new Uint8Array(buildOle2(streams));
14363
+ streams2.set(CONTENTS_STREAM2, newPayloadBytes);
14364
+ return new Uint8Array(buildOle2(streams2));
14365
14365
  }
14366
14366
  return newPayloadBytes;
14367
14367
  } catch {
@@ -27146,16 +27146,16 @@ var init_smartart_layout_interpreter_composite_slots = __esm({
27146
27146
 
27147
27147
  // src/pptx/core/utils/smartart-layout-interpreter-composite-iteration.ts
27148
27148
  function resolveIterationRect(dims, box, iteration, iterationCount) {
27149
- const container = resolveSlot(dims, box, 1, 1);
27149
+ const container2 = resolveSlot(dims, box, 1, 1);
27150
27150
  if (iterationCount <= 1) {
27151
- return container;
27151
+ return container2;
27152
27152
  }
27153
- if (container.width >= container.height) {
27154
- const width = container.width / iterationCount;
27155
- return { x: container.x + width * iteration, y: container.y, width, height: container.height };
27153
+ if (container2.width >= container2.height) {
27154
+ const width = container2.width / iterationCount;
27155
+ return { x: container2.x + width * iteration, y: container2.y, width, height: container2.height };
27156
27156
  }
27157
- const height = container.height / iterationCount;
27158
- return { x: container.x, y: container.y + height * iteration, width: container.width, height };
27157
+ const height = container2.height / iterationCount;
27158
+ return { x: container2.x, y: container2.y + height * iteration, width: container2.width, height };
27159
27159
  }
27160
27160
  var init_smartart_layout_interpreter_composite_iteration = __esm({
27161
27161
  "src/pptx/core/utils/smartart-layout-interpreter-composite-iteration.ts"() {
@@ -32095,9 +32095,9 @@ function findVarsContainer(node) {
32095
32095
  continue;
32096
32096
  }
32097
32097
  if (CONTAINER_LOCAL_NAMES.has(localNameOf3(key2))) {
32098
- const container = Array.isArray(value) ? value[0] : value;
32099
- if (container && typeof container === "object") {
32100
- return container;
32098
+ const container2 = Array.isArray(value) ? value[0] : value;
32099
+ if (container2 && typeof container2 === "object") {
32100
+ return container2;
32101
32101
  }
32102
32102
  }
32103
32103
  const nested = findVarsContainer(value);
@@ -32154,8 +32154,8 @@ function findNamedPresVars(node, presName) {
32154
32154
  }
32155
32155
  return void 0;
32156
32156
  }
32157
- function varValue(container, name) {
32158
- for (const [key2, value] of Object.entries(container)) {
32157
+ function varValue(container2, name) {
32158
+ for (const [key2, value] of Object.entries(container2)) {
32159
32159
  if (key2.startsWith("@_") || localNameOf3(key2) !== name) {
32160
32160
  continue;
32161
32161
  }
@@ -32168,27 +32168,27 @@ function varValue(container, name) {
32168
32168
  }
32169
32169
  return void 0;
32170
32170
  }
32171
- function boolValue(container, name) {
32172
- const raw = varValue(container, name);
32171
+ function boolValue(container2, name) {
32172
+ const raw = varValue(container2, name);
32173
32173
  if (raw === void 0) {
32174
32174
  return void 0;
32175
32175
  }
32176
32176
  const lower = raw.toLowerCase();
32177
32177
  return lower === "1" || lower === "true" || lower === "on";
32178
32178
  }
32179
- function intValue(container, name) {
32180
- const raw = varValue(container, name);
32179
+ function intValue(container2, name) {
32180
+ const raw = varValue(container2, name);
32181
32181
  if (raw === void 0) {
32182
32182
  return void 0;
32183
32183
  }
32184
32184
  const parsed = Number.parseInt(raw, 10);
32185
32185
  return Number.isFinite(parsed) ? parsed : void 0;
32186
32186
  }
32187
- function parseSmartArtPresLayoutVars(container) {
32188
- if (!container) {
32187
+ function parseSmartArtPresLayoutVars(container2) {
32188
+ if (!container2) {
32189
32189
  return void 0;
32190
32190
  }
32191
- const vars = findVarsContainer(container);
32191
+ const vars = findVarsContainer(container2);
32192
32192
  if (!vars) {
32193
32193
  return void 0;
32194
32194
  }
@@ -32229,7 +32229,7 @@ function parseSmartArtPresLayoutVars(container) {
32229
32229
  if (resizeHandles !== void 0) {
32230
32230
  result.resizeHandles = resizeHandles;
32231
32231
  }
32232
- const hierRootVars = findNamedPresVars(container, "hierRoot1");
32232
+ const hierRootVars = findNamedPresVars(container2, "hierRoot1");
32233
32233
  if (hierRootVars) {
32234
32234
  const rootHierBranch = varValue(hierRootVars, "hierBranch");
32235
32235
  if (rootHierBranch && HIER_BRANCHES.has(rootHierBranch)) {
@@ -32238,7 +32238,7 @@ function parseSmartArtPresLayoutVars(container) {
32238
32238
  result.hierarchyBranch = "init";
32239
32239
  }
32240
32240
  }
32241
- const rootTextVars = findNamedPresVars(container, "rootText1");
32241
+ const rootTextVars = findNamedPresVars(container2, "rootText1");
32242
32242
  if (rootTextVars) {
32243
32243
  const rootChMax = intValue(rootTextVars, "chMax");
32244
32244
  if (rootChMax !== void 0) {
@@ -32524,6 +32524,7 @@ var init_relationship_types = __esm({
32524
32524
  diagramDrawing: "http://schemas.microsoft.com/office/2007/relationships/diagramDrawing",
32525
32525
  coreProperties: "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",
32526
32526
  extendedProperties: `${BASE}/extended-properties`,
32527
+ customProperties: `${BASE}/custom-properties`,
32527
32528
  customXml: `${BASE}/customXml`,
32528
32529
  worksheet: `${BASE}/worksheet`,
32529
32530
  chartsheet: `${BASE}/chartsheet`,
@@ -32563,8 +32564,60 @@ var init_package = __esm({
32563
32564
  });
32564
32565
 
32565
32566
  // src/opc/safe-href.ts
32567
+ var OPEN_SCHEMES;
32566
32568
  var init_safe_href = __esm({
32567
32569
  "src/opc/safe-href.ts"() {
32570
+ OPEN_SCHEMES = /* @__PURE__ */ new Set(["http", "https", "mailto"]);
32571
+ /* @__PURE__ */ new Set([...OPEN_SCHEMES, "ftp", "file"]);
32572
+ }
32573
+ });
32574
+
32575
+ // src/opc/properties/types.ts
32576
+ var init_types3 = __esm({
32577
+ "src/opc/properties/types.ts"() {
32578
+ }
32579
+ });
32580
+
32581
+ // src/opc/properties/index.ts
32582
+ var init_properties = __esm({
32583
+ "src/opc/properties/index.ts"() {
32584
+ init_types3();
32585
+ }
32586
+ });
32587
+
32588
+ // src/opc/signature/detection.ts
32589
+ function detectDigitalSignatures(zipEntryPaths) {
32590
+ const sigPaths = zipEntryPaths.filter(
32591
+ (p) => p.startsWith(SIGNATURE_PREFIX) && p.endsWith(".xml")
32592
+ );
32593
+ return {
32594
+ hasSignatures: sigPaths.length > 0,
32595
+ signatureCount: sigPaths.length,
32596
+ signaturePaths: sigPaths
32597
+ };
32598
+ }
32599
+ function getSignaturePathsToStrip(zipEntryPaths) {
32600
+ return zipEntryPaths.filter((p) => p.startsWith(SIGNATURE_PREFIX));
32601
+ }
32602
+ var SIGNATURE_PART_PREFIX, SIGNATURE_PREFIX;
32603
+ var init_detection = __esm({
32604
+ "src/opc/signature/detection.ts"() {
32605
+ SIGNATURE_PART_PREFIX = "_xmlsignatures/";
32606
+ SIGNATURE_PREFIX = SIGNATURE_PART_PREFIX;
32607
+ }
32608
+ });
32609
+
32610
+ // src/opc/signature/constants.ts
32611
+ var DIGITAL_SIGNATURE_ORIGIN_REL_TYPE;
32612
+ var init_constants3 = __esm({
32613
+ "src/opc/signature/constants.ts"() {
32614
+ DIGITAL_SIGNATURE_ORIGIN_REL_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/origin";
32615
+ }
32616
+ });
32617
+
32618
+ // src/opc/signature/index.ts
32619
+ var init_signature = __esm({
32620
+ "src/opc/signature/index.ts"() {
32568
32621
  }
32569
32622
  });
32570
32623
 
@@ -32576,6 +32629,8 @@ var init_opc = __esm({
32576
32629
  init_content_types();
32577
32630
  init_package();
32578
32631
  init_safe_href();
32632
+ init_properties();
32633
+ init_signature();
32579
32634
  }
32580
32635
  });
32581
32636
 
@@ -33208,25 +33263,43 @@ var init_theme_override_utils = __esm({
33208
33263
  }
33209
33264
  });
33210
33265
 
33211
- // src/pptx/core/utils/encryption-detection.ts
33212
- function detectFileFormat(data) {
33213
- if (data.byteLength < 8) {
33214
- return { format: "unknown", encrypted: false };
33266
+ // src/crypto/detect.ts
33267
+ function toArrayBuffer(bytes) {
33268
+ if (bytes.byteOffset === 0 && bytes.byteLength === bytes.buffer.byteLength) {
33269
+ return bytes.buffer;
33215
33270
  }
33216
- const header = new Uint8Array(data, 0, 8);
33217
- if (OLE_MAGIC2.every((byte, i) => header[i] === byte)) {
33218
- return { format: "ole", encrypted: true };
33219
- }
33220
- if (header[0] === ZIP_MAGIC[0] && header[1] === ZIP_MAGIC[1]) {
33221
- return { format: "zip", encrypted: false };
33271
+ return bytes.slice().buffer;
33272
+ }
33273
+ function isCompoundFile(input) {
33274
+ const bytes = toBytes(input);
33275
+ return bytes.length >= 8 && OLE_MAGIC2.every((value, index) => bytes[index] === value);
33276
+ }
33277
+ function openEncryptedPackage(input) {
33278
+ const bytes = toBytes(input);
33279
+ if (!isCompoundFile(bytes)) return void 0;
33280
+ try {
33281
+ const file = parseOle2(toArrayBuffer(bytes));
33282
+ if (!file.entries.some((entry) => entry.name === "EncryptedPackage")) return void 0;
33283
+ const encryptionInfo = file.getStream("EncryptionInfo");
33284
+ const encryptedPackage = encryptionInfo && file.getStream("EncryptedPackage");
33285
+ return encryptionInfo && encryptedPackage ? { encryptionInfo, encryptedPackage } : void 0;
33286
+ } catch {
33287
+ return void 0;
33222
33288
  }
33289
+ }
33290
+ function detectFileFormat(data) {
33291
+ const bytes = toBytes(data);
33292
+ if (bytes.length < 8) return { format: "unknown", encrypted: false };
33293
+ if (isCompoundFile(bytes)) return { format: "ole", encrypted: true };
33294
+ if (bytes[0] === 80 && bytes[1] === 75) return { format: "zip", encrypted: false };
33223
33295
  return { format: "unknown", encrypted: false };
33224
33296
  }
33225
- var OLE_MAGIC2, ZIP_MAGIC, EncryptedFileError;
33226
- var init_encryption_detection = __esm({
33227
- "src/pptx/core/utils/encryption-detection.ts"() {
33228
- OLE_MAGIC2 = new Uint8Array([208, 207, 17, 224, 161, 177, 26, 225]);
33229
- ZIP_MAGIC = new Uint8Array([80, 75]);
33297
+ var OLE_MAGIC2, toBytes, EncryptedFileError;
33298
+ var init_detect = __esm({
33299
+ "src/crypto/detect.ts"() {
33300
+ init_ole2_parser_read();
33301
+ OLE_MAGIC2 = [208, 207, 17, 224, 161, 177, 26, 225];
33302
+ toBytes = (input) => input instanceof Uint8Array ? input : new Uint8Array(input);
33230
33303
  EncryptedFileError = class extends Error {
33231
33304
  isEncrypted = true;
33232
33305
  constructor(message) {
@@ -33237,31 +33310,10 @@ var init_encryption_detection = __esm({
33237
33310
  }
33238
33311
  });
33239
33312
 
33240
- // src/pptx/core/utils/ole2-parser.ts
33241
- var init_ole2_parser = __esm({
33242
- "src/pptx/core/utils/ole2-parser.ts"() {
33243
- init_ole2_parser_types2();
33244
- init_ole2_parser_read2();
33245
- init_ole2_parser_write2();
33246
- }
33247
- });
33248
-
33249
- // src/pptx/core/utils/ooxml-crypto-errors.ts
33250
- var IncorrectPasswordError, DataIntegrityError;
33251
- var init_ooxml_crypto_errors = __esm({
33252
- "src/pptx/core/utils/ooxml-crypto-errors.ts"() {
33253
- IncorrectPasswordError = class extends Error {
33254
- constructor(message = "The password is incorrect.") {
33255
- super(message);
33256
- this.name = "IncorrectPasswordError";
33257
- }
33258
- };
33259
- DataIntegrityError = class extends Error {
33260
- constructor(message = "Data integrity check failed. The encrypted file may be corrupted or tampered with.") {
33261
- super(message);
33262
- this.name = "DataIntegrityError";
33263
- }
33264
- };
33313
+ // src/pptx/core/utils/encryption-detection.ts
33314
+ var init_encryption_detection = __esm({
33315
+ "src/pptx/core/utils/encryption-detection.ts"() {
33316
+ init_detect();
33265
33317
  }
33266
33318
  });
33267
33319
 
@@ -33387,71 +33439,644 @@ var init_ooxml_crypto_primitives = __esm({
33387
33439
  }
33388
33440
  });
33389
33441
 
33390
- // src/pptx/core/utils/ooxml-crypto-primitives.ts
33391
- var init_ooxml_crypto_primitives2 = __esm({
33392
- "src/pptx/core/utils/ooxml-crypto-primitives.ts"() {
33442
+ // src/crypto/aes-ecb.ts
33443
+ async function aesEcbDecrypt(key2, data) {
33444
+ const plain = await aesCbcDecryptRaw(key2, new Uint8Array(BLOCK), data);
33445
+ for (let at2 = BLOCK; at2 < plain.length && at2 < data.length; at2++) {
33446
+ plain[at2] = plain[at2] ^ data[at2 - BLOCK];
33447
+ }
33448
+ return plain;
33449
+ }
33450
+ async function aesEcbEncrypt(key2, data) {
33451
+ const padded = new Uint8Array(Math.ceil(data.length / BLOCK) * BLOCK);
33452
+ padded.set(data);
33453
+ const subtle = getSubtle();
33454
+ const cryptoKey = await subtle.importKey("raw", key2, { name: "AES-CBC" }, false, [
33455
+ "encrypt"
33456
+ ]);
33457
+ const iv = new Uint8Array(BLOCK);
33458
+ const out = new Uint8Array(padded.length);
33459
+ for (let start = 0; start < padded.length; start += BLOCK * BATCH) {
33460
+ const end = Math.min(padded.length, start + BLOCK * BATCH);
33461
+ const jobs = [];
33462
+ for (let at2 = start; at2 < end; at2 += BLOCK) {
33463
+ const block = padded.slice(at2, at2 + BLOCK);
33464
+ jobs.push(
33465
+ subtle.encrypt({ name: "AES-CBC", iv }, cryptoKey, block).then((result) => {
33466
+ out.set(new Uint8Array(result, 0, BLOCK), at2);
33467
+ })
33468
+ );
33469
+ }
33470
+ await Promise.all(jobs);
33471
+ }
33472
+ return out;
33473
+ }
33474
+ var BLOCK, BATCH;
33475
+ var init_aes_ecb = __esm({
33476
+ "src/crypto/aes-ecb.ts"() {
33393
33477
  init_ooxml_crypto_primitives();
33478
+ BLOCK = 16;
33479
+ BATCH = 4096;
33394
33480
  }
33395
33481
  });
33396
33482
 
33397
- // src/pptx/core/utils/ooxml-crypto-key-derivation.ts
33398
- async function deriveAgileKey(password, salt, spinCount, hashAlgorithm, blockKey, keyBits, hashSize) {
33483
+ // src/crypto/errors.ts
33484
+ var IncorrectPasswordError, DataIntegrityError;
33485
+ var init_errors = __esm({
33486
+ "src/crypto/errors.ts"() {
33487
+ IncorrectPasswordError = class extends Error {
33488
+ code = "incorrect-password";
33489
+ constructor(message = "The password is incorrect.") {
33490
+ super(message);
33491
+ this.name = "IncorrectPasswordError";
33492
+ }
33493
+ };
33494
+ DataIntegrityError = class extends Error {
33495
+ code = "data-integrity";
33496
+ constructor(message = "Data integrity check failed. The encrypted file may be corrupted or tampered with.") {
33497
+ super(message);
33498
+ this.name = "DataIntegrityError";
33499
+ }
33500
+ };
33501
+ }
33502
+ });
33503
+
33504
+ // src/digest/algorithm-names.ts
33505
+ function normalizeDigestAlgorithmName(name) {
33506
+ const key2 = name.toUpperCase().replace(/[-_\s]/g, "");
33507
+ return Object.hasOwn(CANONICAL_BY_LOOKUP_KEY, key2) ? CANONICAL_BY_LOOKUP_KEY[key2] : void 0;
33508
+ }
33509
+ var CANONICAL_BY_LOOKUP_KEY;
33510
+ var init_algorithm_names = __esm({
33511
+ "src/digest/algorithm-names.ts"() {
33512
+ CANONICAL_BY_LOOKUP_KEY = {
33513
+ SHA1: "SHA-1",
33514
+ SHA256: "SHA-256",
33515
+ SHA384: "SHA-384",
33516
+ SHA512: "SHA-512",
33517
+ MD2: "MD2",
33518
+ MD4: "MD4",
33519
+ MD5: "MD5",
33520
+ RIPEMD128: "RIPEMD-128",
33521
+ RIPEMD160: "RIPEMD-160",
33522
+ WHIRLPOOL: "WHIRLPOOL"
33523
+ };
33524
+ }
33525
+ });
33526
+
33527
+ // src/digest/sha256.ts
33528
+ function compress(h, view, offset) {
33529
+ for (let i = 0; i < 16; i++) W[i] = view.getUint32(offset + i * 4);
33530
+ for (let i = 16; i < 64; i++) {
33531
+ const a2 = W[i - 15];
33532
+ const b2 = W[i - 2];
33533
+ const s0 = rotr(a2, 7) ^ rotr(a2, 18) ^ a2 >>> 3;
33534
+ const s1 = rotr(b2, 17) ^ rotr(b2, 19) ^ b2 >>> 10;
33535
+ W[i] = W[i - 16] + s0 + W[i - 7] + s1 >>> 0;
33536
+ }
33537
+ let a = h[0], b = h[1], c = h[2], d = h[3], e = h[4], f = h[5], g = h[6], k = h[7];
33538
+ for (let i = 0; i < 64; i++) {
33539
+ const S1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
33540
+ const ch = e & f ^ ~e & g;
33541
+ const t1 = k + S1 + ch + K[i] + W[i] >>> 0;
33542
+ const S0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22);
33543
+ const maj = a & b ^ a & c ^ b & c;
33544
+ const t2 = S0 + maj >>> 0;
33545
+ k = g;
33546
+ g = f;
33547
+ f = e;
33548
+ e = d + t1 >>> 0;
33549
+ d = c;
33550
+ c = b;
33551
+ b = a;
33552
+ a = t1 + t2 >>> 0;
33553
+ }
33554
+ h[0] = h[0] + a >>> 0;
33555
+ h[1] = h[1] + b >>> 0;
33556
+ h[2] = h[2] + c >>> 0;
33557
+ h[3] = h[3] + d >>> 0;
33558
+ h[4] = h[4] + e >>> 0;
33559
+ h[5] = h[5] + f >>> 0;
33560
+ h[6] = h[6] + g >>> 0;
33561
+ h[7] = h[7] + k >>> 0;
33562
+ }
33563
+ function pad64(data) {
33564
+ const padded = new Uint8Array(Math.ceil((data.length + 9) / 64) * 64);
33565
+ padded.set(data);
33566
+ padded[data.length] = 128;
33567
+ const bits = data.length * 8;
33568
+ const view = new DataView(padded.buffer);
33569
+ view.setUint32(padded.length - 8, Math.floor(bits / 4294967296));
33570
+ view.setUint32(padded.length - 4, bits >>> 0);
33571
+ return view;
33572
+ }
33573
+ function wordsOut(h) {
33574
+ const out = new Uint8Array(h.length * 4);
33575
+ const view = new DataView(out.buffer);
33576
+ for (let i = 0; i < h.length; i++) view.setUint32(i * 4, h[i]);
33577
+ return out;
33578
+ }
33579
+ function sha256(data) {
33580
+ const h = new Uint32Array(IV);
33581
+ const view = pad64(data);
33582
+ for (let offset = 0; offset < view.byteLength; offset += 64) compress(h, view, offset);
33583
+ return wordsOut(h);
33584
+ }
33585
+ var K, IV, W, rotr;
33586
+ var init_sha256 = __esm({
33587
+ "src/digest/sha256.ts"() {
33588
+ K = new Uint32Array([
33589
+ 1116352408,
33590
+ 1899447441,
33591
+ 3049323471,
33592
+ 3921009573,
33593
+ 961987163,
33594
+ 1508970993,
33595
+ 2453635748,
33596
+ 2870763221,
33597
+ 3624381080,
33598
+ 310598401,
33599
+ 607225278,
33600
+ 1426881987,
33601
+ 1925078388,
33602
+ 2162078206,
33603
+ 2614888103,
33604
+ 3248222580,
33605
+ 3835390401,
33606
+ 4022224774,
33607
+ 264347078,
33608
+ 604807628,
33609
+ 770255983,
33610
+ 1249150122,
33611
+ 1555081692,
33612
+ 1996064986,
33613
+ 2554220882,
33614
+ 2821834349,
33615
+ 2952996808,
33616
+ 3210313671,
33617
+ 3336571891,
33618
+ 3584528711,
33619
+ 113926993,
33620
+ 338241895,
33621
+ 666307205,
33622
+ 773529912,
33623
+ 1294757372,
33624
+ 1396182291,
33625
+ 1695183700,
33626
+ 1986661051,
33627
+ 2177026350,
33628
+ 2456956037,
33629
+ 2730485921,
33630
+ 2820302411,
33631
+ 3259730800,
33632
+ 3345764771,
33633
+ 3516065817,
33634
+ 3600352804,
33635
+ 4094571909,
33636
+ 275423344,
33637
+ 430227734,
33638
+ 506948616,
33639
+ 659060556,
33640
+ 883997877,
33641
+ 958139571,
33642
+ 1322822218,
33643
+ 1537002063,
33644
+ 1747873779,
33645
+ 1955562222,
33646
+ 2024104815,
33647
+ 2227730452,
33648
+ 2361852424,
33649
+ 2428436474,
33650
+ 2756734187,
33651
+ 3204031479,
33652
+ 3329325298
33653
+ ]);
33654
+ IV = [
33655
+ 1779033703,
33656
+ 3144134277,
33657
+ 1013904242,
33658
+ 2773480762,
33659
+ 1359893119,
33660
+ 2600822924,
33661
+ 528734635,
33662
+ 1541459225
33663
+ ];
33664
+ W = new Uint32Array(64);
33665
+ rotr = (x, n) => x >>> n | x << 32 - n;
33666
+ }
33667
+ });
33668
+
33669
+ // src/digest/sha1.ts
33670
+ function compress2(h, view, offset) {
33671
+ for (let i = 0; i < 16; i++) W2[i] = view.getUint32(offset + i * 4);
33672
+ for (let i = 16; i < 80; i++) W2[i] = rotl(W2[i - 3] ^ W2[i - 8] ^ W2[i - 14] ^ W2[i - 16], 1);
33673
+ let a = h[0], b = h[1], c = h[2], d = h[3], e = h[4];
33674
+ for (let i = 0; i < 80; i++) {
33675
+ let f;
33676
+ let k;
33677
+ if (i < 20) {
33678
+ f = b & c | ~b & d;
33679
+ k = 1518500249;
33680
+ } else if (i < 40) {
33681
+ f = b ^ c ^ d;
33682
+ k = 1859775393;
33683
+ } else if (i < 60) {
33684
+ f = b & c | b & d | c & d;
33685
+ k = 2400959708;
33686
+ } else {
33687
+ f = b ^ c ^ d;
33688
+ k = 3395469782;
33689
+ }
33690
+ const t = rotl(a, 5) + f + e + k + W2[i] >>> 0;
33691
+ e = d;
33692
+ d = c;
33693
+ c = rotl(b, 30) >>> 0;
33694
+ b = a;
33695
+ a = t;
33696
+ }
33697
+ h[0] = h[0] + a >>> 0;
33698
+ h[1] = h[1] + b >>> 0;
33699
+ h[2] = h[2] + c >>> 0;
33700
+ h[3] = h[3] + d >>> 0;
33701
+ h[4] = h[4] + e >>> 0;
33702
+ }
33703
+ function sha1(data) {
33704
+ const h = new Uint32Array([1732584193, 4023233417, 2562383102, 271733878, 3285377520]);
33705
+ const view = pad64(data);
33706
+ for (let offset = 0; offset < view.byteLength; offset += 64) compress2(h, view, offset);
33707
+ return wordsOut(h);
33708
+ }
33709
+ var W2, rotl;
33710
+ var init_sha1 = __esm({
33711
+ "src/digest/sha1.ts"() {
33712
+ init_sha256();
33713
+ W2 = new Uint32Array(80);
33714
+ rotl = (x, n) => x << n | x >>> 32 - n;
33715
+ }
33716
+ });
33717
+
33718
+ // src/digest/sha512.ts
33719
+ function compress3(h, data, offset) {
33720
+ for (let i = 0; i < 32; i++) {
33721
+ const o = offset + i * 4;
33722
+ W3[i] = (data[o] << 24 | data[o + 1] << 16 | data[o + 2] << 8 | data[o + 3]) >>> 0;
33723
+ }
33724
+ for (let i = 16; i < 80; i++) {
33725
+ const xh = W3[(i - 15) * 2];
33726
+ const xl = W3[(i - 15) * 2 + 1];
33727
+ const s0h = (xh >>> 1 | xl << 31) ^ (xh >>> 8 | xl << 24) ^ xh >>> 7;
33728
+ const s0l = (xl >>> 1 | xh << 31) ^ (xl >>> 8 | xh << 24) ^ (xl >>> 7 | xh << 25);
33729
+ const yh = W3[(i - 2) * 2];
33730
+ const yl = W3[(i - 2) * 2 + 1];
33731
+ const s1h = (yh >>> 19 | yl << 13) ^ (yl >>> 29 | yh << 3) ^ yh >>> 6;
33732
+ const s1l = (yl >>> 19 | yh << 13) ^ (yh >>> 29 | yl << 3) ^ (yl >>> 6 | yh << 26);
33733
+ let lo = (s0l >>> 0) + (s1l >>> 0) + W3[(i - 7) * 2 + 1] + W3[(i - 16) * 2 + 1];
33734
+ const hi = s0h + s1h + W3[(i - 7) * 2] + W3[(i - 16) * 2] + Math.floor(lo / 4294967296);
33735
+ lo >>>= 0;
33736
+ W3[i * 2] = hi >>> 0;
33737
+ W3[i * 2 + 1] = lo;
33738
+ }
33739
+ let ah = h[0], al = h[1], bh = h[2], bl = h[3], ch = h[4], cl = h[5], dh = h[6], dl = h[7];
33740
+ let eh = h[8], el = h[9], fh = h[10], fl = h[11], gh = h[12], gl = h[13], hh = h[14], hl = h[15];
33741
+ for (let i = 0; i < 80; i++) {
33742
+ const S1h = (eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (el >>> 9 | eh << 23);
33743
+ const S1l = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (eh >>> 9 | el << 23);
33744
+ const chh = eh & fh ^ ~eh & gh;
33745
+ const chl = el & fl ^ ~el & gl;
33746
+ let t1l = (hl >>> 0) + (S1l >>> 0) + (chl >>> 0) + K2[i * 2 + 1] + W3[i * 2 + 1];
33747
+ const t1h = hh + S1h + chh + K2[i * 2] + W3[i * 2] + Math.floor(t1l / 4294967296);
33748
+ t1l >>>= 0;
33749
+ const S0h = (ah >>> 28 | al << 4) ^ (al >>> 2 | ah << 30) ^ (al >>> 7 | ah << 25);
33750
+ const S0l = (al >>> 28 | ah << 4) ^ (ah >>> 2 | al << 30) ^ (ah >>> 7 | al << 25);
33751
+ const majh = ah & bh ^ ah & ch ^ bh & ch;
33752
+ const majl = al & bl ^ al & cl ^ bl & cl;
33753
+ let t2l = (S0l >>> 0) + (majl >>> 0);
33754
+ const t2h = S0h + majh + Math.floor(t2l / 4294967296);
33755
+ t2l >>>= 0;
33756
+ hh = gh;
33757
+ hl = gl;
33758
+ gh = fh;
33759
+ gl = fl;
33760
+ fh = eh;
33761
+ fl = el;
33762
+ let nl = (dl >>> 0) + t1l;
33763
+ eh = dh + t1h + Math.floor(nl / 4294967296) >>> 0;
33764
+ el = nl >>> 0;
33765
+ dh = ch;
33766
+ dl = cl;
33767
+ ch = bh;
33768
+ cl = bl;
33769
+ bh = ah;
33770
+ bl = al;
33771
+ nl = t1l + t2l;
33772
+ ah = t1h + t2h + Math.floor(nl / 4294967296) >>> 0;
33773
+ al = nl >>> 0;
33774
+ }
33775
+ const add = (i, xh, xl) => {
33776
+ const lo = (h[i + 1] >>> 0) + (xl >>> 0);
33777
+ h[i] = h[i] + xh + Math.floor(lo / 4294967296) >>> 0;
33778
+ h[i + 1] = lo >>> 0;
33779
+ };
33780
+ add(0, ah, al);
33781
+ add(2, bh, bl);
33782
+ add(4, ch, cl);
33783
+ add(6, dh, dl);
33784
+ add(8, eh, el);
33785
+ add(10, fh, fl);
33786
+ add(12, gh, gl);
33787
+ add(14, hh, hl);
33788
+ }
33789
+ function digest64(data, iv, bytes) {
33790
+ const h = new Uint32Array(iv);
33791
+ const padded = new Uint8Array(Math.ceil((data.length + 17) / 128) * 128);
33792
+ padded.set(data);
33793
+ padded[data.length] = 128;
33794
+ const bits = data.length * 8;
33795
+ const view = new DataView(padded.buffer);
33796
+ view.setUint32(padded.length - 8, Math.floor(bits / 4294967296));
33797
+ view.setUint32(padded.length - 4, bits >>> 0);
33798
+ for (let offset = 0; offset < padded.length; offset += 128) compress3(h, padded, offset);
33799
+ const out = new Uint8Array(bytes);
33800
+ const outView = new DataView(out.buffer);
33801
+ for (let i = 0; i < bytes / 4; i++) outView.setUint32(i * 4, h[i]);
33802
+ return out;
33803
+ }
33804
+ var K2, IV_512, IV_384, W3, sha512, sha384;
33805
+ var init_sha512 = __esm({
33806
+ "src/digest/sha512.ts"() {
33807
+ K2 = new Uint32Array([
33808
+ 1116352408,
33809
+ 3609767458,
33810
+ 1899447441,
33811
+ 602891725,
33812
+ 3049323471,
33813
+ 3964484399,
33814
+ 3921009573,
33815
+ 2173295548,
33816
+ 961987163,
33817
+ 4081628472,
33818
+ 1508970993,
33819
+ 3053834265,
33820
+ 2453635748,
33821
+ 2937671579,
33822
+ 2870763221,
33823
+ 3664609560,
33824
+ 3624381080,
33825
+ 2734883394,
33826
+ 310598401,
33827
+ 1164996542,
33828
+ 607225278,
33829
+ 1323610764,
33830
+ 1426881987,
33831
+ 3590304994,
33832
+ 1925078388,
33833
+ 4068182383,
33834
+ 2162078206,
33835
+ 991336113,
33836
+ 2614888103,
33837
+ 633803317,
33838
+ 3248222580,
33839
+ 3479774868,
33840
+ 3835390401,
33841
+ 2666613458,
33842
+ 4022224774,
33843
+ 944711139,
33844
+ 264347078,
33845
+ 2341262773,
33846
+ 604807628,
33847
+ 2007800933,
33848
+ 770255983,
33849
+ 1495990901,
33850
+ 1249150122,
33851
+ 1856431235,
33852
+ 1555081692,
33853
+ 3175218132,
33854
+ 1996064986,
33855
+ 2198950837,
33856
+ 2554220882,
33857
+ 3999719339,
33858
+ 2821834349,
33859
+ 766784016,
33860
+ 2952996808,
33861
+ 2566594879,
33862
+ 3210313671,
33863
+ 3203337956,
33864
+ 3336571891,
33865
+ 1034457026,
33866
+ 3584528711,
33867
+ 2466948901,
33868
+ 113926993,
33869
+ 3758326383,
33870
+ 338241895,
33871
+ 168717936,
33872
+ 666307205,
33873
+ 1188179964,
33874
+ 773529912,
33875
+ 1546045734,
33876
+ 1294757372,
33877
+ 1522805485,
33878
+ 1396182291,
33879
+ 2643833823,
33880
+ 1695183700,
33881
+ 2343527390,
33882
+ 1986661051,
33883
+ 1014477480,
33884
+ 2177026350,
33885
+ 1206759142,
33886
+ 2456956037,
33887
+ 344077627,
33888
+ 2730485921,
33889
+ 1290863460,
33890
+ 2820302411,
33891
+ 3158454273,
33892
+ 3259730800,
33893
+ 3505952657,
33894
+ 3345764771,
33895
+ 106217008,
33896
+ 3516065817,
33897
+ 3606008344,
33898
+ 3600352804,
33899
+ 1432725776,
33900
+ 4094571909,
33901
+ 1467031594,
33902
+ 275423344,
33903
+ 851169720,
33904
+ 430227734,
33905
+ 3100823752,
33906
+ 506948616,
33907
+ 1363258195,
33908
+ 659060556,
33909
+ 3750685593,
33910
+ 883997877,
33911
+ 3785050280,
33912
+ 958139571,
33913
+ 3318307427,
33914
+ 1322822218,
33915
+ 3812723403,
33916
+ 1537002063,
33917
+ 2003034995,
33918
+ 1747873779,
33919
+ 3602036899,
33920
+ 1955562222,
33921
+ 1575990012,
33922
+ 2024104815,
33923
+ 1125592928,
33924
+ 2227730452,
33925
+ 2716904306,
33926
+ 2361852424,
33927
+ 442776044,
33928
+ 2428436474,
33929
+ 593698344,
33930
+ 2756734187,
33931
+ 3733110249,
33932
+ 3204031479,
33933
+ 2999351573,
33934
+ 3329325298,
33935
+ 3815920427,
33936
+ 3391569614,
33937
+ 3928383900,
33938
+ 3515267271,
33939
+ 566280711,
33940
+ 3940187606,
33941
+ 3454069534,
33942
+ 4118630271,
33943
+ 4000239992,
33944
+ 116418474,
33945
+ 1914138554,
33946
+ 174292421,
33947
+ 2731055270,
33948
+ 289380356,
33949
+ 3203993006,
33950
+ 460393269,
33951
+ 320620315,
33952
+ 685471733,
33953
+ 587496836,
33954
+ 852142971,
33955
+ 1086792851,
33956
+ 1017036298,
33957
+ 365543100,
33958
+ 1126000580,
33959
+ 2618297676,
33960
+ 1288033470,
33961
+ 3409855158,
33962
+ 1501505948,
33963
+ 4234509866,
33964
+ 1607167915,
33965
+ 987167468,
33966
+ 1816402316,
33967
+ 1246189591
33968
+ ]);
33969
+ IV_512 = [
33970
+ 1779033703,
33971
+ 4089235720,
33972
+ 3144134277,
33973
+ 2227873595,
33974
+ 1013904242,
33975
+ 4271175723,
33976
+ 2773480762,
33977
+ 1595750129,
33978
+ 1359893119,
33979
+ 2917565137,
33980
+ 2600822924,
33981
+ 725511199,
33982
+ 528734635,
33983
+ 4215389547,
33984
+ 1541459225,
33985
+ 327033209
33986
+ ];
33987
+ IV_384 = [
33988
+ 3418070365,
33989
+ 3238371032,
33990
+ 1654270250,
33991
+ 914150663,
33992
+ 2438529370,
33993
+ 812702999,
33994
+ 355462360,
33995
+ 4144912697,
33996
+ 1731405415,
33997
+ 4290775857,
33998
+ 2394180231,
33999
+ 1750603025,
34000
+ 3675008525,
34001
+ 1694076839,
34002
+ 1203062813,
34003
+ 3204075428
34004
+ ];
34005
+ W3 = new Uint32Array(160);
34006
+ sha512 = (data) => digest64(data, IV_512, 64);
34007
+ sha384 = (data) => digest64(data, IV_384, 48);
34008
+ }
34009
+ });
34010
+
34011
+ // src/digest/digest.ts
34012
+ function digestFunction(name) {
34013
+ const canonical = normalizeDigestAlgorithmName(name);
34014
+ return canonical && canonical in DIGESTS ? DIGESTS[canonical] : void 0;
34015
+ }
34016
+ var DIGESTS;
34017
+ var init_digest = __esm({
34018
+ "src/digest/digest.ts"() {
34019
+ init_algorithm_names();
34020
+ init_sha1();
34021
+ init_sha256();
34022
+ init_sha512();
34023
+ DIGESTS = {
34024
+ "SHA-1": sha1,
34025
+ "SHA-256": sha256,
34026
+ "SHA-384": sha384,
34027
+ "SHA-512": sha512
34028
+ };
34029
+ }
34030
+ });
34031
+
34032
+ // src/crypto/key-derivation.ts
34033
+ async function spinPassword(password, salt, spinCount, hashAlgorithm) {
34034
+ if (!Number.isInteger(spinCount) || spinCount < 0 || spinCount > MAX_SPIN_COUNT) {
34035
+ throw new Error(`Unsupported encryption spin count: ${spinCount}.`);
34036
+ }
33399
34037
  const passwordBytes = encodePasswordUtf16LE(password);
34038
+ const digest = digestFunction(hashAlgorithm);
34039
+ if (digest) {
34040
+ let h2 = digest(concatArrays(salt, passwordBytes));
34041
+ const buffer = new Uint8Array(4 + h2.length);
34042
+ const view = new DataView(buffer.buffer);
34043
+ for (let i = 0; i < spinCount; i++) {
34044
+ view.setUint32(0, i, true);
34045
+ buffer.set(h2, 4);
34046
+ h2 = digest(buffer);
34047
+ }
34048
+ return h2;
34049
+ }
33400
34050
  let h = await hash(hashAlgorithm, concatArrays(salt, passwordBytes));
33401
34051
  for (let i = 0; i < spinCount; i++) {
33402
34052
  h = await hash(hashAlgorithm, concatArrays(uint32LE(i), h));
33403
34053
  }
33404
- h = await hash(hashAlgorithm, concatArrays(h, blockKey));
33405
- const cbRequiredKeyLength = keyBits / 8;
33406
- const cbHash = hashSize;
33407
- const ipad = 54;
33408
- const opad = 92;
33409
- if (cbHash >= cbRequiredKeyLength) {
33410
- return h.subarray(0, cbRequiredKeyLength);
33411
- }
33412
- const x1Input = new Uint8Array(64);
33413
- x1Input.fill(ipad);
33414
- for (let i = 0; i < h.length && i < 64; i++) {
33415
- x1Input[i] = h[i] ^ ipad;
33416
- }
33417
- const x1 = await hash(hashAlgorithm, x1Input);
33418
- const x2Input = new Uint8Array(64);
33419
- x2Input.fill(opad);
33420
- for (let i = 0; i < h.length && i < 64; i++) {
33421
- x2Input[i] = h[i] ^ opad;
33422
- }
33423
- const x2 = await hash(hashAlgorithm, x2Input);
33424
- const x3 = concatArrays(x1, x2);
33425
- return x3.subarray(0, cbRequiredKeyLength);
33426
- }
33427
- async function computeStandardKeyBase(password, salt) {
33428
- const passwordBytes = encodePasswordUtf16LE(password);
33429
- let h = await hash("SHA-1", concatArrays(salt, passwordBytes));
33430
- for (let i = 0; i < 5e4; i++) {
33431
- h = await hash("SHA-1", concatArrays(uint32LE(i), h));
33432
- }
33433
34054
  return h;
33434
34055
  }
34056
+ async function extendKey(h, hashAlgorithm, keyLength) {
34057
+ const pad = async (value) => {
34058
+ const input = new Uint8Array(64).fill(value);
34059
+ for (let i = 0; i < h.length && i < 64; i++) input[i] = h[i] ^ value;
34060
+ return hash(hashAlgorithm, input);
34061
+ };
34062
+ const x3 = concatArrays(await pad(54), await pad(92));
34063
+ return x3.subarray(0, keyLength);
34064
+ }
34065
+ function computeAgileKeyBase(password, salt, spinCount, hashAlgorithm) {
34066
+ return spinPassword(password, salt, spinCount, hashAlgorithm);
34067
+ }
34068
+ async function deriveAgileKeyFromBase(base, hashAlgorithm, blockKey, keyBits, hashSize) {
34069
+ const h = await hash(hashAlgorithm, concatArrays(base, blockKey));
34070
+ const keyLength = keyBits / 8;
34071
+ if (hashSize >= keyLength) return h.subarray(0, keyLength);
34072
+ return extendKey(h, hashAlgorithm, keyLength);
34073
+ }
34074
+ function computeStandardKeyBase(password, salt) {
34075
+ return spinPassword(password, salt, 5e4, "SHA-1");
34076
+ }
33435
34077
  async function deriveStandardKeyFromBase(base, keySize, blockNumber = 0) {
33436
34078
  const h = await hash("SHA-1", concatArrays(base, uint32LE(blockNumber)));
33437
- const cbRequiredKeyLength = keySize / 8;
33438
- if (h.length >= cbRequiredKeyLength) {
33439
- return h.subarray(0, cbRequiredKeyLength);
33440
- }
33441
- const x1Input = new Uint8Array(64);
33442
- x1Input.fill(54);
33443
- for (let i = 0; i < h.length && i < 64; i++) {
33444
- x1Input[i] = h[i] ^ 54;
33445
- }
33446
- const x1 = await hash("SHA-1", x1Input);
33447
- const x2Input = new Uint8Array(64);
33448
- x2Input.fill(92);
33449
- for (let i = 0; i < h.length && i < 64; i++) {
33450
- x2Input[i] = h[i] ^ 92;
33451
- }
33452
- const x2 = await hash("SHA-1", x2Input);
33453
- const x3 = concatArrays(x1, x2);
33454
- return x3.subarray(0, cbRequiredKeyLength);
34079
+ return extendKey(h, "SHA-1", keySize / 8);
33455
34080
  }
33456
34081
  async function deriveStandardKey(password, salt, keySize, _algIdHash, blockNumber = 0) {
33457
34082
  const base = await computeStandardKeyBase(password, salt);
@@ -33459,164 +34084,16 @@ async function deriveStandardKey(password, salt, keySize, _algIdHash, blockNumbe
33459
34084
  }
33460
34085
  async function generateIV(hashAlgorithm, salt, blockKey, blockSize) {
33461
34086
  const h = await hash(hashAlgorithm, concatArrays(salt, blockKey));
33462
- if (h.length >= blockSize) {
33463
- return h.subarray(0, blockSize);
33464
- }
33465
- const padded = new Uint8Array(blockSize);
33466
- padded.fill(54);
34087
+ if (h.length >= blockSize) return h.subarray(0, blockSize);
34088
+ const padded = new Uint8Array(blockSize).fill(54);
33467
34089
  padded.set(h);
33468
34090
  return padded;
33469
34091
  }
33470
- function parseEncryptionInfo(data) {
33471
- const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
33472
- const versionMajor = view.getUint16(0, true);
33473
- const versionMinor = view.getUint16(2, true);
33474
- if (versionMajor === 4 && versionMinor === 4) {
33475
- return parseAgileEncryptionInfo(data);
33476
- }
33477
- if ((versionMajor === 2 || versionMajor === 3 || versionMajor === 4) && versionMinor === 2) {
33478
- return parseStandardEncryptionInfo(data);
33479
- }
33480
- throw new Error(
33481
- `Unsupported encryption version: ${versionMajor}.${versionMinor}. Only Standard (2.2-4.2) and Agile (4.4) encryption are supported.`
33482
- );
33483
- }
33484
- function parseStandardEncryptionInfo(data) {
33485
- const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
33486
- const versionMajor = view.getUint16(0, true);
33487
- const versionMinor = view.getUint16(2, true);
33488
- const flags = view.getUint32(4, true);
33489
- const headerSize = view.getUint32(8, true);
33490
- const headerOffset = 12;
33491
- const hFlags = view.getUint32(headerOffset, true);
33492
- view.getUint32(headerOffset + 4, true);
33493
- const algId = view.getUint32(headerOffset + 8, true);
33494
- const algIdHash = view.getUint32(headerOffset + 12, true);
33495
- const keySize = view.getUint32(headerOffset + 16, true);
33496
- const providerType = view.getUint32(headerOffset + 20, true);
33497
- let cspName = "";
33498
- const cspOffset = headerOffset + 32;
33499
- const cspEnd = headerOffset + headerSize;
33500
- for (let i = cspOffset; i < cspEnd - 1; i += 2) {
33501
- const ch = view.getUint16(i, true);
33502
- if (ch === 0) {
33503
- break;
33504
- }
33505
- cspName += String.fromCharCode(ch);
33506
- }
33507
- const verifierOffset = 12 + headerSize;
33508
- const saltSize = view.getUint32(verifierOffset, true);
33509
- const salt = new Uint8Array(data.buffer, data.byteOffset + verifierOffset + 4, 16);
33510
- const encryptedVerifier = new Uint8Array(data.buffer, data.byteOffset + verifierOffset + 20, 16);
33511
- const verifierHashSize = view.getUint32(verifierOffset + 36, true);
33512
- const encryptedVerifierHashLength = algId === RC4_ALG_ID ? verifierHashSize : Math.ceil(verifierHashSize / 16) * 16;
33513
- const encryptedVerifierHash = new Uint8Array(
33514
- data.buffer,
33515
- data.byteOffset + verifierOffset + 40,
33516
- encryptedVerifierHashLength
33517
- );
33518
- return {
33519
- version: { major: versionMajor, minor: versionMinor },
33520
- isAgile: false,
33521
- isStandard: true,
33522
- flags,
33523
- headerSize,
33524
- header: {
33525
- flags: hFlags,
33526
- algId,
33527
- algIdHash,
33528
- keySize,
33529
- providerType,
33530
- cspName
33531
- },
33532
- verifier: {
33533
- saltSize,
33534
- salt: new Uint8Array(salt),
33535
- encryptedVerifier: new Uint8Array(encryptedVerifier),
33536
- verifierHashSize,
33537
- encryptedVerifierHash: new Uint8Array(encryptedVerifierHash)
33538
- }
33539
- };
33540
- }
33541
- function parseAgileEncryptionInfo(data) {
33542
- const xmlBytes = data.subarray(8);
33543
- const xmlStr = new TextDecoder("utf-8").decode(xmlBytes);
33544
- const getAttr = (xml, tag, attr4) => {
33545
- const tagRegex = new RegExp(`<[^>]*${tag}[^>]*>`, "i");
33546
- const tagMatch = xml.match(tagRegex);
33547
- if (!tagMatch) {
33548
- return "";
33549
- }
33550
- const attrRegex = new RegExp(`${attr4}="([^"]*)"`, "i");
33551
- const attrMatch = tagMatch[0].match(attrRegex);
33552
- return attrMatch ? attrMatch[1] : "";
33553
- };
33554
- const keyDataSaltSize = parseInt(getAttr(xmlStr, "keyData", "saltSize"), 10);
33555
- const keyDataBlockSize = parseInt(getAttr(xmlStr, "keyData", "blockSize"), 10);
33556
- const keyDataKeyBits = parseInt(getAttr(xmlStr, "keyData", "keyBits"), 10);
33557
- const keyDataHashSize = parseInt(getAttr(xmlStr, "keyData", "hashSize"), 10);
33558
- const keyDataCipherAlgorithm = getAttr(xmlStr, "keyData", "cipherAlgorithm");
33559
- const keyDataCipherChaining = getAttr(xmlStr, "keyData", "cipherChaining");
33560
- const keyDataHashAlgorithm = getAttr(xmlStr, "keyData", "hashAlgorithm");
33561
- const keyDataSaltValue = getAttr(xmlStr, "keyData", "saltValue");
33562
- const encryptedHmacKey = getAttr(xmlStr, "dataIntegrity", "encryptedHmacKey");
33563
- const encryptedHmacValue = getAttr(xmlStr, "dataIntegrity", "encryptedHmacValue");
33564
- const encKeyTag = xmlStr.match(/<[^>]*encryptedKey[^>]*>/i);
33565
- const encKeyStr = encKeyTag ? encKeyTag[0] : "";
33566
- const getEncKeyAttr = (attr4) => {
33567
- const regex = new RegExp(`${attr4}="([^"]*)"`, "i");
33568
- const match = encKeyStr.match(regex);
33569
- return match ? match[1] : "";
33570
- };
33571
- const pkeSaltSize = parseInt(getEncKeyAttr("saltSize"), 10);
33572
- const pkeBlockSize = parseInt(getEncKeyAttr("blockSize"), 10);
33573
- const pkeKeyBits = parseInt(getEncKeyAttr("keyBits"), 10);
33574
- const pkeHashSize = parseInt(getEncKeyAttr("hashSize"), 10);
33575
- const pkeCipherAlgorithm = getEncKeyAttr("cipherAlgorithm");
33576
- const pkeCipherChaining = getEncKeyAttr("cipherChaining");
33577
- const pkeHashAlgorithm = getEncKeyAttr("hashAlgorithm");
33578
- const pkeSaltValue = getEncKeyAttr("saltValue");
33579
- const pkeSpinCount = parseInt(getEncKeyAttr("spinCount"), 10);
33580
- const pkeEncryptedVerifierHashInput = getEncKeyAttr("encryptedVerifierHashInput");
33581
- const pkeEncryptedVerifierHashValue = getEncKeyAttr("encryptedVerifierHashValue");
33582
- const pkeEncryptedKeyValue = getEncKeyAttr("encryptedKeyValue");
33583
- return {
33584
- version: { major: 4, minor: 4 },
33585
- isAgile: true,
33586
- keyData: {
33587
- saltSize: keyDataSaltSize,
33588
- blockSize: keyDataBlockSize,
33589
- keyBits: keyDataKeyBits,
33590
- hashSize: keyDataHashSize,
33591
- cipherAlgorithm: keyDataCipherAlgorithm,
33592
- cipherChaining: keyDataCipherChaining,
33593
- hashAlgorithm: keyDataHashAlgorithm,
33594
- saltValue: base64Decode(keyDataSaltValue)
33595
- },
33596
- dataIntegrity: encryptedHmacKey ? {
33597
- encryptedHmacKey: base64Decode(encryptedHmacKey),
33598
- encryptedHmacValue: base64Decode(encryptedHmacValue)
33599
- } : void 0,
33600
- passwordKeyEncryptor: {
33601
- saltSize: pkeSaltSize,
33602
- blockSize: pkeBlockSize,
33603
- keyBits: pkeKeyBits,
33604
- hashSize: pkeHashSize,
33605
- cipherAlgorithm: pkeCipherAlgorithm,
33606
- cipherChaining: pkeCipherChaining,
33607
- hashAlgorithm: pkeHashAlgorithm,
33608
- saltValue: base64Decode(pkeSaltValue),
33609
- spinCount: pkeSpinCount,
33610
- encryptedVerifierHashInput: base64Decode(pkeEncryptedVerifierHashInput),
33611
- encryptedVerifierHashValue: base64Decode(pkeEncryptedVerifierHashValue),
33612
- encryptedKeyValue: base64Decode(pkeEncryptedKeyValue)
33613
- }
33614
- };
33615
- }
33616
- var BLOCK_KEYS, RC4_ALG_ID;
33617
- var init_ooxml_crypto_key_derivation = __esm({
33618
- "src/pptx/core/utils/ooxml-crypto-key-derivation.ts"() {
33619
- init_ooxml_crypto_primitives2();
34092
+ var BLOCK_KEYS, MAX_SPIN_COUNT;
34093
+ var init_key_derivation = __esm({
34094
+ "src/crypto/key-derivation.ts"() {
34095
+ init_ooxml_crypto_primitives();
34096
+ init_digest();
33620
34097
  BLOCK_KEYS = {
33621
34098
  verifierHashInput: new Uint8Array([254, 167, 210, 118, 59, 75, 158, 121]),
33622
34099
  verifierHashValue: new Uint8Array([215, 170, 15, 109, 48, 97, 52, 78]),
@@ -33624,64 +34101,35 @@ var init_ooxml_crypto_key_derivation = __esm({
33624
34101
  dataIntegrityHmacKey: new Uint8Array([95, 178, 173, 1, 12, 185, 225, 246]),
33625
34102
  dataIntegrityHmacValue: new Uint8Array([160, 103, 127, 2, 178, 44, 132, 51])
33626
34103
  };
33627
- RC4_ALG_ID = 26625;
34104
+ MAX_SPIN_COUNT = 1e7;
33628
34105
  }
33629
34106
  });
33630
34107
 
33631
- // src/pptx/core/utils/ooxml-crypto-decrypt.ts
34108
+ // src/crypto/decrypt.ts
33632
34109
  async function verifyAgilePassword(info, password) {
33633
34110
  const pke = info.passwordKeyEncryptor;
33634
- const verifierInputKey = await deriveAgileKey(
33635
- password,
33636
- pke.saltValue,
33637
- pke.spinCount,
33638
- pke.hashAlgorithm,
33639
- BLOCK_KEYS.verifierHashInput,
33640
- pke.keyBits,
33641
- pke.hashSize
33642
- );
34111
+ const base = await computeAgileKeyBase(password, pke.saltValue, pke.spinCount, pke.hashAlgorithm);
34112
+ const blockKey = (block) => deriveAgileKeyFromBase(base, pke.hashAlgorithm, block, pke.keyBits, pke.hashSize);
33643
34113
  const verifierHashInput = await aesCbcDecryptRaw(
33644
- verifierInputKey,
34114
+ await blockKey(BLOCK_KEYS.verifierHashInput),
33645
34115
  pke.saltValue,
33646
34116
  pke.encryptedVerifierHashInput
33647
34117
  );
33648
- const verifierHashKey = await deriveAgileKey(
33649
- password,
33650
- pke.saltValue,
33651
- pke.spinCount,
33652
- pke.hashAlgorithm,
33653
- BLOCK_KEYS.verifierHashValue,
33654
- pke.keyBits,
33655
- pke.hashSize
33656
- );
33657
34118
  const verifierHashValue = await aesCbcDecryptRaw(
33658
- verifierHashKey,
34119
+ await blockKey(BLOCK_KEYS.verifierHashValue),
33659
34120
  pke.saltValue,
33660
34121
  pke.encryptedVerifierHashValue
33661
34122
  );
33662
34123
  const computedHash = await hash(pke.hashAlgorithm, verifierHashInput.subarray(0, pke.saltSize));
33663
- const expectedHash = verifierHashValue.subarray(0, pke.hashSize);
33664
- const actualHash = computedHash.subarray(0, pke.hashSize);
33665
- let match = true;
33666
- for (let i = 0; i < pke.hashSize; i++) {
33667
- if (expectedHash[i] !== actualHash[i]) {
33668
- match = false;
33669
- break;
33670
- }
33671
- }
33672
- if (!match) {
33673
- return null;
33674
- }
33675
- const encKeyKey = await deriveAgileKey(
33676
- password,
34124
+ if (computedHash.length < pke.hashSize || verifierHashValue.length < pke.hashSize) return null;
34125
+ let difference = 0;
34126
+ for (let i = 0; i < pke.hashSize; i++) difference |= verifierHashValue[i] ^ computedHash[i];
34127
+ if (difference !== 0) return null;
34128
+ const decryptedKey = await aesCbcDecryptRaw(
34129
+ await blockKey(BLOCK_KEYS.encryptedKeyValue),
33677
34130
  pke.saltValue,
33678
- pke.spinCount,
33679
- pke.hashAlgorithm,
33680
- BLOCK_KEYS.encryptedKeyValue,
33681
- pke.keyBits,
33682
- pke.hashSize
34131
+ pke.encryptedKeyValue
33683
34132
  );
33684
- const decryptedKey = await aesCbcDecryptRaw(encKeyKey, pke.saltValue, pke.encryptedKeyValue);
33685
34133
  return decryptedKey.subarray(0, info.keyData.keyBits / 8);
33686
34134
  }
33687
34135
  async function verifyStandardPassword(info, password) {
@@ -33691,9 +34139,8 @@ async function verifyStandardPassword(info, password) {
33691
34139
  info.header.keySize,
33692
34140
  info.header.algIdHash
33693
34141
  );
33694
- const iv = new Uint8Array(16);
33695
- const decryptedVerifier = await aesCbcDecryptRaw(key2, iv, info.verifier.encryptedVerifier);
33696
- const decryptedHash = await aesCbcDecryptRaw(key2, iv, info.verifier.encryptedVerifierHash);
34142
+ const decryptedVerifier = await aesEcbDecrypt(key2, info.verifier.encryptedVerifier);
34143
+ const decryptedHash = await aesEcbDecrypt(key2, info.verifier.encryptedVerifierHash);
33697
34144
  const computedHash = await hash("SHA-1", decryptedVerifier);
33698
34145
  const hashSize = info.verifier.verifierHashSize;
33699
34146
  let match = true;
@@ -33783,46 +34230,19 @@ async function decryptStandardPackage(encryptedPackage, key2) {
33783
34230
  const sizeView = new DataView(encryptedPackage.buffer, encryptedPackage.byteOffset, 8);
33784
34231
  const originalSize = sizeView.getUint32(0, true);
33785
34232
  const encryptedData = encryptedPackage.subarray(8);
33786
- const iv = new Uint8Array(16);
33787
- const decrypted = await aesCbcDecryptRaw(key2, iv, encryptedData);
34233
+ const decrypted = await aesEcbDecrypt(key2, encryptedData);
33788
34234
  return decrypted.slice(0, originalSize).buffer;
33789
34235
  }
33790
- var init_ooxml_crypto_decrypt = __esm({
33791
- "src/pptx/core/utils/ooxml-crypto-decrypt.ts"() {
33792
- init_ooxml_crypto_errors();
33793
- init_ooxml_crypto_key_derivation();
33794
- init_ooxml_crypto_primitives2();
34236
+ var init_decrypt = __esm({
34237
+ "src/crypto/decrypt.ts"() {
34238
+ init_ooxml_crypto_primitives();
34239
+ init_aes_ecb();
34240
+ init_errors();
34241
+ init_key_derivation();
33795
34242
  }
33796
34243
  });
33797
34244
 
33798
- // src/pptx/core/utils/ooxml-crypto-encrypt.ts
33799
- async function encryptAgilePackage(packageData, key2, info) {
33800
- const keyData = info.keyData;
33801
- const segmentSize = 4096;
33802
- const paddedSize = Math.ceil(packageData.length / segmentSize) * segmentSize;
33803
- const paddedData = new Uint8Array(paddedSize);
33804
- paddedData.set(packageData);
33805
- const encrypted = new Uint8Array(8 + paddedSize);
33806
- const sizeView = new DataView(encrypted.buffer, 0, 8);
33807
- sizeView.setUint32(0, packageData.length, true);
33808
- sizeView.setUint32(4, 0, true);
33809
- const numSegments = Math.ceil(paddedSize / segmentSize);
33810
- for (let segment = 0; segment < numSegments; segment++) {
33811
- const segmentStart = segment * segmentSize;
33812
- const segmentEnd = segmentStart + segmentSize;
33813
- const segmentData = paddedData.subarray(segmentStart, segmentEnd);
33814
- const blockKeyBytes = uint32LE(segment);
33815
- const segmentIV = await generateIV(
33816
- keyData.hashAlgorithm,
33817
- keyData.saltValue,
33818
- blockKeyBytes,
33819
- keyData.blockSize
33820
- );
33821
- const encryptedSegment = await aesCbcEncryptNoPad(key2, segmentIV, segmentData);
33822
- encrypted.set(encryptedSegment, 8 + segmentStart);
33823
- }
33824
- return encrypted;
33825
- }
34245
+ // src/crypto/encryption-info-write.ts
33826
34246
  function buildAgileEncryptionInfoXml(keyData, pke, dataIntegrity) {
33827
34247
  const xmlNs = "http://schemas.microsoft.com/office/2006/encryption";
33828
34248
  const pNs = "http://schemas.microsoft.com/office/2006/keyEncryptor/password";
@@ -33839,20 +34259,6 @@ function buildEncryptionInfoStream(xmlString) {
33839
34259
  result.set(xmlBytes, 8);
33840
34260
  return result;
33841
34261
  }
33842
- async function encryptStandardPackage(packageData, key2) {
33843
- const blockSize = 16;
33844
- const paddedSize = Math.ceil(packageData.length / blockSize) * blockSize;
33845
- const paddedData = new Uint8Array(paddedSize);
33846
- paddedData.set(packageData);
33847
- const iv = new Uint8Array(blockSize);
33848
- const encryptedData = await aesCbcEncryptNoPad(key2, iv, paddedData);
33849
- const encrypted = new Uint8Array(8 + encryptedData.length);
33850
- const sizeView = new DataView(encrypted.buffer, 0, 8);
33851
- sizeView.setUint32(0, packageData.length, true);
33852
- sizeView.setUint32(4, 0, true);
33853
- encrypted.set(encryptedData, 8);
33854
- return encrypted;
33855
- }
33856
34262
  function buildStandardEncryptionInfoStream(keyBits, salt, encryptedVerifier, encryptedVerifierHash) {
33857
34263
  const algId = STANDARD_ALG_IDS[keyBits];
33858
34264
  if (!algId) {
@@ -33894,40 +34300,10 @@ function buildStandardEncryptionInfoStream(keyBits, salt, encryptedVerifier, enc
33894
34300
  data.set(encryptedVerifierHash.subarray(0, 32), v + 40);
33895
34301
  return data;
33896
34302
  }
33897
- async function encryptPptxStandard(pptxBuffer, password, options) {
33898
- const algorithm = options?.algorithm ?? "AES256";
33899
- const keyBits = algorithm === "AES128" ? 128 : 256;
33900
- const crypto2 = getCrypto();
33901
- const salt = new Uint8Array(16);
33902
- crypto2.getRandomValues(salt);
33903
- const key2 = await deriveStandardKey(password, salt, keyBits);
33904
- const verifier = new Uint8Array(16);
33905
- crypto2.getRandomValues(verifier);
33906
- const verifierHash = await hash("SHA-1", verifier);
33907
- const paddedVerifierHash = new Uint8Array(32);
33908
- paddedVerifierHash.set(verifierHash.subarray(0, 20));
33909
- const zeroIv = new Uint8Array(16);
33910
- const encryptedVerifier = await aesCbcEncryptNoPad(key2, zeroIv, verifier);
33911
- const encryptedVerifierHash = await aesCbcEncryptNoPad(key2, zeroIv, paddedVerifierHash);
33912
- const encryptionInfoBytes = buildStandardEncryptionInfoStream(
33913
- keyBits,
33914
- salt,
33915
- encryptedVerifier,
33916
- encryptedVerifierHash
33917
- );
33918
- const packageData = new Uint8Array(pptxBuffer);
33919
- const encryptedPackage = await encryptStandardPackage(packageData, key2);
33920
- const ole2Streams = /* @__PURE__ */ new Map();
33921
- ole2Streams.set("EncryptionInfo", encryptionInfoBytes);
33922
- ole2Streams.set("EncryptedPackage", encryptedPackage);
33923
- return buildOle2(ole2Streams);
33924
- }
33925
34303
  var STANDARD_ALG_IDS, STANDARD_ALG_ID_HASH_SHA1, STANDARD_PROVIDER_TYPE_RSA_AES, STANDARD_CSP_NAME, STANDARD_FLAGS;
33926
- var init_ooxml_crypto_encrypt = __esm({
33927
- "src/pptx/core/utils/ooxml-crypto-encrypt.ts"() {
33928
- init_ole2_parser();
33929
- init_ooxml_crypto_key_derivation();
33930
- init_ooxml_crypto_primitives2();
34304
+ var init_encryption_info_write = __esm({
34305
+ "src/crypto/encryption-info-write.ts"() {
34306
+ init_ooxml_crypto_primitives();
33931
34307
  STANDARD_ALG_IDS = {
33932
34308
  128: 26126,
33933
34309
  // CALG_AES_128
@@ -33943,178 +34319,317 @@ var init_ooxml_crypto_encrypt = __esm({
33943
34319
  }
33944
34320
  });
33945
34321
 
33946
- // src/pptx/core/utils/ooxml-crypto.ts
33947
- async function decryptPptx(encryptedBuffer, password) {
33948
- const ole2 = parseOle2(encryptedBuffer);
33949
- const encryptionInfoStream = ole2.getStream("EncryptionInfo");
33950
- if (!encryptionInfoStream) {
33951
- throw new Error(
33952
- "EncryptionInfo stream not found. The file may not be an encrypted OOXML package."
34322
+ // src/crypto/encrypt.ts
34323
+ function container(encryptionInfo, encryptedPackage) {
34324
+ const streams2 = /* @__PURE__ */ new Map();
34325
+ streams2.set("EncryptionInfo", encryptionInfo);
34326
+ streams2.set("EncryptedPackage", encryptedPackage);
34327
+ return new Uint8Array(buildOle2(streams2));
34328
+ }
34329
+ function randomBytes(size) {
34330
+ const bytes = new Uint8Array(size);
34331
+ getCrypto().getRandomValues(bytes);
34332
+ return bytes;
34333
+ }
34334
+ function padTo(data, blockSize) {
34335
+ const padded = new Uint8Array(Math.ceil(data.length / blockSize) * blockSize);
34336
+ padded.set(data);
34337
+ return padded;
34338
+ }
34339
+ function withSizePrefix(size, body) {
34340
+ const out = new Uint8Array(8 + body.length);
34341
+ const view = new DataView(out.buffer, 0, 8);
34342
+ view.setUint32(0, size % 4294967296, true);
34343
+ view.setUint32(4, Math.floor(size / 4294967296), true);
34344
+ out.set(body, 8);
34345
+ return out;
34346
+ }
34347
+ async function encryptAgilePackage(packageData, key2, info) {
34348
+ const { hashAlgorithm, saltValue, blockSize } = info.keyData;
34349
+ const padded = padTo(packageData, SEGMENT_SIZE);
34350
+ const encrypted = withSizePrefix(packageData.length, padded);
34351
+ for (let start = 0; start < padded.length; start += SEGMENT_SIZE) {
34352
+ const iv = await generateIV(
34353
+ hashAlgorithm,
34354
+ saltValue,
34355
+ uint32LE(start / SEGMENT_SIZE),
34356
+ blockSize
33953
34357
  );
34358
+ const segment = padded.subarray(start, start + SEGMENT_SIZE);
34359
+ encrypted.set(await aesCbcEncryptNoPad(key2, iv, segment), 8 + start);
33954
34360
  }
33955
- const encryptedPackage = ole2.getStream("EncryptedPackage");
33956
- if (!encryptedPackage) {
33957
- throw new Error("EncryptedPackage stream not found. The file may be corrupted.");
33958
- }
33959
- const info = parseEncryptionInfo(encryptionInfoStream);
33960
- if ("isStandard" in info && info.isStandard) {
33961
- const key3 = await verifyStandardPassword(info, password);
33962
- if (!key3) {
33963
- throw new IncorrectPasswordError();
33964
- }
33965
- return decryptStandardPackage(encryptedPackage, key3);
33966
- }
33967
- const agileInfo = info;
33968
- const key2 = await verifyAgilePassword(agileInfo, password);
33969
- if (!key2) {
33970
- throw new IncorrectPasswordError();
33971
- }
33972
- await verifyAgileDataIntegrity(agileInfo, key2, encryptedPackage);
33973
- return decryptAgilePackage(encryptedPackage, key2, agileInfo);
34361
+ return encrypted;
33974
34362
  }
33975
- async function encryptPptx(pptxBuffer, password, options) {
33976
- if (options?.encryptionScheme === "standard") {
33977
- return encryptPptxStandard(pptxBuffer, password, options);
33978
- }
33979
- const algorithm = options?.algorithm ?? "AES256";
33980
- const keyBits = algorithm === "AES128" ? 128 : 256;
33981
- const crypto2 = getCrypto();
33982
- const keyDataSalt = new Uint8Array(16);
33983
- crypto2.getRandomValues(keyDataSalt);
33984
- const pkeSalt = new Uint8Array(16);
33985
- crypto2.getRandomValues(pkeSalt);
33986
- const documentKey = new Uint8Array(keyBits / 8);
33987
- crypto2.getRandomValues(documentKey);
34363
+ async function encryptStandardPackage(packageData, key2) {
34364
+ const encryptedData = await aesEcbEncrypt(key2, packageData);
34365
+ return withSizePrefix(packageData.length, encryptedData);
34366
+ }
34367
+ async function encryptAgile(packageData, password, options = {}) {
34368
+ const keyBits = options.algorithm === "AES128" ? 128 : 256;
33988
34369
  const hashAlgorithm = "SHA-512";
33989
34370
  const hashSize = 64;
33990
34371
  const blockSize = 16;
33991
- const spinCount = options?.spinCount ?? 1e5;
33992
- const verifierHashInput = new Uint8Array(16);
33993
- crypto2.getRandomValues(verifierHashInput);
34372
+ const spinCount = options.spinCount ?? 1e5;
34373
+ const keyDataSalt = randomBytes(16);
34374
+ const pkeSalt = randomBytes(16);
34375
+ const documentKey = randomBytes(keyBits / 8);
34376
+ const verifierHashInput = randomBytes(16);
33994
34377
  const verifierHash = await hash(hashAlgorithm, verifierHashInput);
33995
- const verifierInputKey = await deriveAgileKey(
33996
- password,
33997
- pkeSalt,
33998
- spinCount,
33999
- hashAlgorithm,
34000
- BLOCK_KEYS.verifierHashInput,
34378
+ const base = await computeAgileKeyBase(password, pkeSalt, spinCount, hashAlgorithm);
34379
+ const encryptUnder = async (block, data) => {
34380
+ const key2 = await deriveAgileKeyFromBase(base, hashAlgorithm, block, keyBits, hashSize);
34381
+ return aesCbcEncryptNoPad(key2, pkeSalt, padTo(data, blockSize));
34382
+ };
34383
+ const passwordKeyEncryptor = {
34384
+ saltSize: 16,
34385
+ blockSize,
34001
34386
  keyBits,
34002
- hashSize
34003
- );
34004
- const paddedVerifierInput = new Uint8Array(
34005
- Math.ceil(verifierHashInput.length / blockSize) * blockSize
34006
- );
34007
- paddedVerifierInput.set(verifierHashInput);
34008
- const encryptedVerifierHashInput = await aesCbcEncryptNoPad(
34009
- verifierInputKey,
34010
- pkeSalt,
34011
- paddedVerifierInput
34012
- );
34013
- const verifierHashKey = await deriveAgileKey(
34014
- password,
34015
- pkeSalt,
34387
+ hashSize,
34388
+ cipherAlgorithm: "AES",
34389
+ cipherChaining: "ChainingModeCBC",
34390
+ hashAlgorithm,
34391
+ saltValue: pkeSalt,
34016
34392
  spinCount,
34393
+ encryptedVerifierHashInput: await encryptUnder(BLOCK_KEYS.verifierHashInput, verifierHashInput),
34394
+ encryptedVerifierHashValue: await encryptUnder(BLOCK_KEYS.verifierHashValue, verifierHash),
34395
+ encryptedKeyValue: await encryptUnder(BLOCK_KEYS.encryptedKeyValue, documentKey)
34396
+ };
34397
+ const keyData = {
34398
+ saltSize: 16,
34399
+ blockSize,
34400
+ keyBits,
34401
+ hashSize,
34402
+ cipherAlgorithm: "AES",
34403
+ cipherChaining: "ChainingModeCBC",
34017
34404
  hashAlgorithm,
34018
- BLOCK_KEYS.verifierHashValue,
34405
+ saltValue: keyDataSalt
34406
+ };
34407
+ const info = {
34408
+ keyData};
34409
+ const encryptedPackage = await encryptAgilePackage(packageData, documentKey, info);
34410
+ const hmacKey = randomBytes(hashSize);
34411
+ const hmacValue = await hmac(hashAlgorithm, hmacKey, encryptedPackage);
34412
+ const encryptIntegrity = async (block, data) => {
34413
+ const iv = await generateIV(hashAlgorithm, keyDataSalt, block, blockSize);
34414
+ return aesCbcEncryptNoPad(documentKey, iv, padTo(data, blockSize));
34415
+ };
34416
+ const dataIntegrity = {
34417
+ encryptedHmacKey: await encryptIntegrity(BLOCK_KEYS.dataIntegrityHmacKey, hmacKey),
34418
+ encryptedHmacValue: await encryptIntegrity(BLOCK_KEYS.dataIntegrityHmacValue, hmacValue)
34419
+ };
34420
+ const xml = buildAgileEncryptionInfoXml(keyData, passwordKeyEncryptor, dataIntegrity);
34421
+ return container(buildEncryptionInfoStream(xml), encryptedPackage);
34422
+ }
34423
+ async function encryptStandard(packageData, password, options = {}) {
34424
+ const keyBits = options.algorithm === "AES128" ? 128 : 256;
34425
+ const salt = randomBytes(16);
34426
+ const key2 = await deriveStandardKey(password, salt, keyBits);
34427
+ const verifier = randomBytes(16);
34428
+ const paddedVerifierHash = new Uint8Array(32);
34429
+ paddedVerifierHash.set((await hash("SHA-1", verifier)).subarray(0, 20));
34430
+ const encryptionInfo = buildStandardEncryptionInfoStream(
34019
34431
  keyBits,
34020
- hashSize
34432
+ salt,
34433
+ await aesEcbEncrypt(key2, verifier),
34434
+ await aesEcbEncrypt(key2, paddedVerifierHash)
34021
34435
  );
34022
- const paddedVerifierHash = new Uint8Array(Math.ceil(verifierHash.length / blockSize) * blockSize);
34023
- paddedVerifierHash.set(verifierHash);
34024
- const encryptedVerifierHashValue = await aesCbcEncryptNoPad(
34025
- verifierHashKey,
34026
- pkeSalt,
34027
- paddedVerifierHash
34436
+ return container(encryptionInfo, await encryptStandardPackage(packageData, key2));
34437
+ }
34438
+ var SEGMENT_SIZE;
34439
+ var init_encrypt = __esm({
34440
+ "src/crypto/encrypt.ts"() {
34441
+ init_ole2_parser_write();
34442
+ init_ooxml_crypto_primitives();
34443
+ init_aes_ecb();
34444
+ init_encryption_info_write();
34445
+ init_key_derivation();
34446
+ SEGMENT_SIZE = 4096;
34447
+ }
34448
+ });
34449
+
34450
+ // src/crypto/encryption-info.ts
34451
+ function parseEncryptionInfo(data) {
34452
+ if (data.byteLength < 8) throw new Error("The EncryptionInfo stream is truncated.");
34453
+ const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
34454
+ const versionMajor = view.getUint16(0, true);
34455
+ const versionMinor = view.getUint16(2, true);
34456
+ if (versionMajor === 4 && versionMinor === 4) return parseAgileEncryptionInfo(data);
34457
+ if ((versionMajor === 2 || versionMajor === 3 || versionMajor === 4) && versionMinor === 2) {
34458
+ return parseStandardEncryptionInfo(data);
34459
+ }
34460
+ throw new Error(
34461
+ `Unsupported encryption version: ${versionMajor}.${versionMinor}. Only Standard (2.2-4.2) and Agile (4.4) encryption are supported.`
34028
34462
  );
34029
- const encKeyKey = await deriveAgileKey(
34030
- password,
34031
- pkeSalt,
34032
- spinCount,
34033
- hashAlgorithm,
34034
- BLOCK_KEYS.encryptedKeyValue,
34035
- keyBits,
34036
- hashSize
34463
+ }
34464
+ function parseStandardEncryptionInfo(data) {
34465
+ const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
34466
+ const versionMajor = view.getUint16(0, true);
34467
+ const versionMinor = view.getUint16(2, true);
34468
+ const flags = view.getUint32(4, true);
34469
+ const headerSize = view.getUint32(8, true);
34470
+ const headerOffset = 12;
34471
+ const hFlags = view.getUint32(headerOffset, true);
34472
+ const algId = view.getUint32(headerOffset + 8, true);
34473
+ const algIdHash = view.getUint32(headerOffset + 12, true);
34474
+ const keySize = view.getUint32(headerOffset + 16, true);
34475
+ const providerType = view.getUint32(headerOffset + 20, true);
34476
+ let cspName = "";
34477
+ const cspEnd = headerOffset + headerSize;
34478
+ for (let i = headerOffset + 32; i < cspEnd - 1; i += 2) {
34479
+ const ch = view.getUint16(i, true);
34480
+ if (ch === 0) break;
34481
+ cspName += String.fromCharCode(ch);
34482
+ }
34483
+ const verifierOffset = 12 + headerSize;
34484
+ const saltSize = view.getUint32(verifierOffset, true);
34485
+ const salt = new Uint8Array(data.buffer, data.byteOffset + verifierOffset + 4, 16);
34486
+ const encryptedVerifier = new Uint8Array(data.buffer, data.byteOffset + verifierOffset + 20, 16);
34487
+ const verifierHashSize = view.getUint32(verifierOffset + 36, true);
34488
+ const encryptedVerifierHashLength = algId === RC4_ALG_ID ? verifierHashSize : Math.ceil(verifierHashSize / 16) * 16;
34489
+ const encryptedVerifierHash = new Uint8Array(
34490
+ data.buffer,
34491
+ data.byteOffset + verifierOffset + 40,
34492
+ encryptedVerifierHashLength
34037
34493
  );
34038
- const paddedDocumentKey = new Uint8Array(Math.ceil(documentKey.length / blockSize) * blockSize);
34039
- paddedDocumentKey.set(documentKey);
34040
- const encryptedKeyValue = await aesCbcEncryptNoPad(encKeyKey, pkeSalt, paddedDocumentKey);
34041
- const encInfo = {
34494
+ return {
34495
+ version: { major: versionMajor, minor: versionMinor },
34496
+ isAgile: false,
34497
+ isStandard: true,
34498
+ flags,
34499
+ headerSize,
34500
+ header: { flags: hFlags, algId, algIdHash, keySize, providerType, cspName },
34501
+ verifier: {
34502
+ saltSize,
34503
+ salt: new Uint8Array(salt),
34504
+ encryptedVerifier: new Uint8Array(encryptedVerifier),
34505
+ verifierHashSize,
34506
+ encryptedVerifierHash: new Uint8Array(encryptedVerifierHash)
34507
+ }
34508
+ };
34509
+ }
34510
+ function tagAttribute(xml, tag, attr4) {
34511
+ const tagMatch = xml.match(new RegExp(`<[^>]*${tag}[^>]*>`, "i"));
34512
+ if (!tagMatch) return "";
34513
+ const attrMatch = tagMatch[0].match(new RegExp(`\\b${attr4}="([^"]*)"`, "i"));
34514
+ return attrMatch?.[1] ?? "";
34515
+ }
34516
+ function parseAgileEncryptionInfo(data) {
34517
+ const xml = new TextDecoder("utf-8").decode(data.subarray(8));
34518
+ const keyData = (attr4) => tagAttribute(xml, "keyData", attr4);
34519
+ const integrity = (attr4) => tagAttribute(xml, "dataIntegrity", attr4);
34520
+ const pke = (attr4) => tagAttribute(xml, "encryptedKey", attr4);
34521
+ const int = (value) => parseInt(value, 10);
34522
+ const encryptedHmacKey = integrity("encryptedHmacKey");
34523
+ return {
34524
+ version: { major: 4, minor: 4 },
34525
+ isAgile: true,
34042
34526
  keyData: {
34043
- saltSize: 16,
34044
- blockSize,
34045
- keyBits,
34046
- hashSize,
34047
- cipherAlgorithm: "AES",
34048
- cipherChaining: "ChainingModeCBC",
34049
- hashAlgorithm,
34050
- saltValue: keyDataSalt
34051
- },
34052
- dataIntegrity: {
34053
- encryptedHmacKey: new Uint8Array(0),
34054
- // Will be filled after encryption
34055
- encryptedHmacValue: new Uint8Array(0)
34527
+ saltSize: int(keyData("saltSize")),
34528
+ blockSize: int(keyData("blockSize")),
34529
+ keyBits: int(keyData("keyBits")),
34530
+ hashSize: int(keyData("hashSize")),
34531
+ cipherAlgorithm: keyData("cipherAlgorithm"),
34532
+ cipherChaining: keyData("cipherChaining"),
34533
+ hashAlgorithm: keyData("hashAlgorithm"),
34534
+ saltValue: base64Decode(keyData("saltValue"))
34056
34535
  },
34536
+ ...encryptedHmacKey ? {
34537
+ dataIntegrity: {
34538
+ encryptedHmacKey: base64Decode(encryptedHmacKey),
34539
+ encryptedHmacValue: base64Decode(integrity("encryptedHmacValue"))
34540
+ }
34541
+ } : {},
34057
34542
  passwordKeyEncryptor: {
34058
- saltSize: 16,
34059
- blockSize,
34060
- keyBits,
34061
- hashSize,
34062
- cipherAlgorithm: "AES",
34063
- cipherChaining: "ChainingModeCBC",
34064
- hashAlgorithm,
34065
- saltValue: pkeSalt,
34066
- spinCount,
34067
- encryptedVerifierHashInput,
34068
- encryptedVerifierHashValue,
34069
- encryptedKeyValue
34543
+ saltSize: int(pke("saltSize")),
34544
+ blockSize: int(pke("blockSize")),
34545
+ keyBits: int(pke("keyBits")),
34546
+ hashSize: int(pke("hashSize")),
34547
+ cipherAlgorithm: pke("cipherAlgorithm"),
34548
+ cipherChaining: pke("cipherChaining"),
34549
+ hashAlgorithm: pke("hashAlgorithm"),
34550
+ saltValue: base64Decode(pke("saltValue")),
34551
+ spinCount: int(pke("spinCount")),
34552
+ encryptedVerifierHashInput: base64Decode(pke("encryptedVerifierHashInput")),
34553
+ encryptedVerifierHashValue: base64Decode(pke("encryptedVerifierHashValue")),
34554
+ encryptedKeyValue: base64Decode(pke("encryptedKeyValue"))
34070
34555
  }
34071
34556
  };
34072
- const packageData = new Uint8Array(pptxBuffer);
34073
- const encryptedPackage = await encryptAgilePackage(packageData, documentKey, encInfo);
34074
- const hmacKeyRandom = new Uint8Array(hashSize);
34075
- crypto2.getRandomValues(hmacKeyRandom);
34076
- const hmacValue = await hmac(hashAlgorithm, hmacKeyRandom, encryptedPackage);
34077
- const hmacKeyIV = await generateIV(
34078
- hashAlgorithm,
34079
- keyDataSalt,
34080
- BLOCK_KEYS.dataIntegrityHmacKey,
34081
- blockSize
34082
- );
34083
- const paddedHmacKey = new Uint8Array(Math.ceil(hmacKeyRandom.length / blockSize) * blockSize);
34084
- paddedHmacKey.set(hmacKeyRandom);
34085
- const encryptedHmacKey = await aesCbcEncryptNoPad(documentKey, hmacKeyIV, paddedHmacKey);
34086
- const hmacValueIV = await generateIV(
34087
- hashAlgorithm,
34088
- keyDataSalt,
34089
- BLOCK_KEYS.dataIntegrityHmacValue,
34090
- blockSize
34091
- );
34092
- const paddedHmacValue = new Uint8Array(Math.ceil(hmacValue.length / blockSize) * blockSize);
34093
- paddedHmacValue.set(hmacValue);
34094
- const encryptedHmacValue = await aesCbcEncryptNoPad(documentKey, hmacValueIV, paddedHmacValue);
34095
- encInfo.dataIntegrity = {
34096
- encryptedHmacKey,
34097
- encryptedHmacValue
34098
- };
34099
- const xmlStr = buildAgileEncryptionInfoXml(
34100
- encInfo.keyData,
34101
- encInfo.passwordKeyEncryptor,
34102
- encInfo.dataIntegrity
34103
- );
34104
- const encryptionInfoBytes = buildEncryptionInfoStream(xmlStr);
34105
- const ole2Streams = /* @__PURE__ */ new Map();
34106
- ole2Streams.set("EncryptionInfo", encryptionInfoBytes);
34107
- ole2Streams.set("EncryptedPackage", encryptedPackage);
34108
- return buildOle2(ole2Streams);
34557
+ }
34558
+ var RC4_ALG_ID;
34559
+ var init_encryption_info = __esm({
34560
+ "src/crypto/encryption-info.ts"() {
34561
+ init_ooxml_crypto_primitives();
34562
+ RC4_ALG_ID = 26625;
34563
+ }
34564
+ });
34565
+
34566
+ // src/crypto/index.ts
34567
+ function streams(bytes) {
34568
+ const opened = openEncryptedPackage(bytes);
34569
+ if (opened) return { info: opened.encryptionInfo, data: opened.encryptedPackage };
34570
+ const file = parseOle2(toArrayBuffer(bytes));
34571
+ if (!file.getStream("EncryptionInfo")) {
34572
+ throw new Error(
34573
+ "EncryptionInfo stream not found. The file may not be an encrypted OOXML package."
34574
+ );
34575
+ }
34576
+ throw new Error("EncryptedPackage stream not found. The file may be corrupted.");
34577
+ }
34578
+ async function decryptOoxmlPackage(input, password) {
34579
+ const { info: infoStream, data } = streams(toBytes(input));
34580
+ const info = parseEncryptionInfo(infoStream);
34581
+ if (isStandard(info)) {
34582
+ const key3 = await verifyStandardPassword(info, password);
34583
+ if (!key3) throw new IncorrectPasswordError();
34584
+ return new Uint8Array(await decryptStandardPackage(data, key3));
34585
+ }
34586
+ const key2 = await verifyAgilePassword(info, password);
34587
+ if (!key2) throw new IncorrectPasswordError();
34588
+ await verifyAgileDataIntegrity(info, key2, data);
34589
+ return new Uint8Array(await decryptAgilePackage(data, key2, info));
34590
+ }
34591
+ function encryptOoxmlPackage(input, password, options = {}) {
34592
+ const bytes = toBytes(input);
34593
+ return options.encryptionScheme === "standard" ? encryptStandard(bytes, password, options) : encryptAgile(bytes, password, options);
34594
+ }
34595
+ var isStandard;
34596
+ var init_crypto = __esm({
34597
+ "src/crypto/index.ts"() {
34598
+ init_ole2_parser_read();
34599
+ init_decrypt();
34600
+ init_detect();
34601
+ init_encrypt();
34602
+ init_encryption_info();
34603
+ init_errors();
34604
+ isStandard = (info) => "isStandard" in info && info.isStandard;
34605
+ }
34606
+ });
34607
+
34608
+ // src/pptx/core/utils/ooxml-crypto-primitives.ts
34609
+ var init_ooxml_crypto_primitives2 = __esm({
34610
+ "src/pptx/core/utils/ooxml-crypto-primitives.ts"() {
34611
+ init_ooxml_crypto_primitives();
34612
+ }
34613
+ });
34614
+
34615
+ // src/pptx/core/utils/ooxml-crypto.ts
34616
+ async function decryptPptx(encryptedBuffer, password) {
34617
+ return (await decryptOoxmlPackage(encryptedBuffer, password)).buffer;
34618
+ }
34619
+ async function encryptPptx(pptxBuffer, password, options) {
34620
+ return (await encryptOoxmlPackage(pptxBuffer, password, options)).buffer;
34109
34621
  }
34110
34622
  var init_ooxml_crypto = __esm({
34111
34623
  "src/pptx/core/utils/ooxml-crypto.ts"() {
34112
- init_ole2_parser();
34113
- init_ooxml_crypto_decrypt();
34114
- init_ooxml_crypto_encrypt();
34115
- init_ooxml_crypto_errors();
34116
- init_ooxml_crypto_key_derivation();
34117
- init_ooxml_crypto_primitives2();
34624
+ init_crypto();
34625
+ }
34626
+ });
34627
+
34628
+ // src/pptx/core/utils/ole2-parser.ts
34629
+ var init_ole2_parser = __esm({
34630
+ "src/pptx/core/utils/ole2-parser.ts"() {
34631
+ init_ole2_parser_types2();
34632
+ init_ole2_parser_read2();
34118
34633
  }
34119
34634
  });
34120
34635
 
@@ -34193,12 +34708,12 @@ function transform(state, x) {
34193
34708
  function md4(message) {
34194
34709
  return mdStyleDigest(message, INITIAL_STATE, transform);
34195
34710
  }
34196
- var INITIAL_STATE, K2, K3, ROUND1, ROUND2, ROUND3;
34711
+ var INITIAL_STATE, K22, K3, ROUND1, ROUND2, ROUND3;
34197
34712
  var init_md4 = __esm({
34198
34713
  "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/utils/digests/md4.js"() {
34199
34714
  init_bit_ops();
34200
34715
  INITIAL_STATE = [1732584193, 4023233417, 2562383102, 271733878];
34201
- K2 = 1518500249;
34716
+ K22 = 1518500249;
34202
34717
  K3 = 1859775393;
34203
34718
  ROUND1 = [
34204
34719
  [0, 3, 0],
@@ -34219,22 +34734,22 @@ var init_md4 = __esm({
34219
34734
  [15, 19, 0]
34220
34735
  ];
34221
34736
  ROUND2 = [
34222
- [0, 3, K2],
34223
- [4, 5, K2],
34224
- [8, 9, K2],
34225
- [12, 13, K2],
34226
- [1, 3, K2],
34227
- [5, 5, K2],
34228
- [9, 9, K2],
34229
- [13, 13, K2],
34230
- [2, 3, K2],
34231
- [6, 5, K2],
34232
- [10, 9, K2],
34233
- [14, 13, K2],
34234
- [3, 3, K2],
34235
- [7, 5, K2],
34236
- [11, 9, K2],
34237
- [15, 13, K2]
34737
+ [0, 3, K22],
34738
+ [4, 5, K22],
34739
+ [8, 9, K22],
34740
+ [12, 13, K22],
34741
+ [1, 3, K22],
34742
+ [5, 5, K22],
34743
+ [9, 9, K22],
34744
+ [13, 13, K22],
34745
+ [2, 3, K22],
34746
+ [6, 5, K22],
34747
+ [10, 9, K22],
34748
+ [14, 13, K22],
34749
+ [3, 3, K22],
34750
+ [7, 5, K22],
34751
+ [11, 9, K22],
34752
+ [15, 13, K22]
34238
34753
  ];
34239
34754
  ROUND3 = [
34240
34755
  [0, 3, K3],
@@ -34258,31 +34773,16 @@ var init_md4 = __esm({
34258
34773
  });
34259
34774
 
34260
34775
  // src/pptx/core/utils/signature-detection.ts
34261
- function detectDigitalSignatures(zipEntryPaths) {
34262
- const sigPaths = zipEntryPaths.filter(
34263
- (p) => p.startsWith(SIGNATURE_PREFIX) && p.endsWith(".xml")
34264
- );
34265
- return {
34266
- hasSignatures: sigPaths.length > 0,
34267
- signatureCount: sigPaths.length,
34268
- signaturePaths: sigPaths
34269
- };
34270
- }
34271
- function getSignaturePathsToStrip(zipEntryPaths) {
34272
- return zipEntryPaths.filter((p) => p.startsWith(SIGNATURE_PREFIX));
34273
- }
34274
- var SIGNATURE_PREFIX;
34275
34776
  var init_signature_detection = __esm({
34276
34777
  "src/pptx/core/utils/signature-detection.ts"() {
34277
- SIGNATURE_PREFIX = "_xmlsignatures/";
34778
+ init_detection();
34278
34779
  }
34279
34780
  });
34280
34781
 
34281
34782
  // src/pptx/core/utils/signature-constants.ts
34282
- var DIGITAL_SIGNATURE_ORIGIN_REL_TYPE;
34283
34783
  var init_signature_constants = __esm({
34284
34784
  "src/pptx/core/utils/signature-constants.ts"() {
34285
- DIGITAL_SIGNATURE_ORIGIN_REL_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/origin";
34785
+ init_constants3();
34286
34786
  }
34287
34787
  });
34288
34788
 
@@ -34672,11 +35172,11 @@ function parseSeriesErrBars(seriesNode, xmlLookup, extractPointValues, colorPars
34672
35172
  return result;
34673
35173
  }).filter((e) => e !== void 0);
34674
35174
  }
34675
- function parseLineStyle(container, elementName, xmlLookup, colorParser) {
34676
- if (!container) {
35175
+ function parseLineStyle(container2, elementName, xmlLookup, colorParser) {
35176
+ if (!container2) {
34677
35177
  return void 0;
34678
35178
  }
34679
- const lineNode = xmlLookup.getChildByLocalName(container, elementName);
35179
+ const lineNode = xmlLookup.getChildByLocalName(container2, elementName);
34680
35180
  if (!lineNode) {
34681
35181
  return void 0;
34682
35182
  }
@@ -34741,9 +35241,9 @@ function chartColorChoiceValue(authored, color2, resolveColor2, opacity2) {
34741
35241
  opacity2
34742
35242
  );
34743
35243
  }
34744
- function writeChartColorChoice(container, key2, color2, resolveColor2, opacity2) {
34745
- container[key2] = chartColorChoiceValue(
34746
- container[key2],
35244
+ function writeChartColorChoice(container2, key2, color2, resolveColor2, opacity2) {
35245
+ container2[key2] = chartColorChoiceValue(
35246
+ container2[key2],
34747
35247
  color2,
34748
35248
  resolveColor2,
34749
35249
  opacity2
@@ -35527,7 +36027,7 @@ function parseChartUniqueId(node, localName28) {
35527
36027
  const val = uniqueIdNode?.["@_val"];
35528
36028
  return typeof val === "string" && val.length > 0 ? val : void 0;
35529
36029
  }
35530
- function randomBytes(length) {
36030
+ function randomBytes2(length) {
35531
36031
  const cryptoObj = typeof crypto === "undefined" ? void 0 : crypto;
35532
36032
  if (cryptoObj && typeof cryptoObj.getRandomValues === "function") {
35533
36033
  return cryptoObj.getRandomValues(new Uint8Array(length));
@@ -35539,7 +36039,7 @@ function randomBytes(length) {
35539
36039
  return bytes;
35540
36040
  }
35541
36041
  function randomHex(length) {
35542
- const bytes = randomBytes(Math.ceil(length / 2));
36042
+ const bytes = randomBytes2(Math.ceil(length / 2));
35543
36043
  let out = "";
35544
36044
  for (const b of bytes) {
35545
36045
  out += b.toString(16).padStart(2, "0");
@@ -35548,7 +36048,7 @@ function randomHex(length) {
35548
36048
  }
35549
36049
  function generateChartUniqueId() {
35550
36050
  const cryptoObj = typeof crypto === "undefined" ? void 0 : crypto;
35551
- const variantNibble = (8 + randomBytes(1)[0] % 4).toString(16);
36051
+ const variantNibble = (8 + randomBytes2(1)[0] % 4).toString(16);
35552
36052
  const uuid = cryptoObj && typeof cryptoObj.randomUUID === "function" ? cryptoObj.randomUUID() : `${randomHex(8)}-${randomHex(4)}-4${randomHex(3)}-${variantNibble}${randomHex(3)}-${randomHex(12)}`;
35553
36053
  return `{${uuid.toUpperCase()}}`;
35554
36054
  }
@@ -39617,10 +40117,10 @@ function parseVmlGroup(node, idPrefix, index) {
39617
40117
  return null;
39618
40118
  }
39619
40119
  }
39620
- function parseVmlElements(container, idPrefix = "") {
40120
+ function parseVmlElements(container2, idPrefix = "") {
39621
40121
  const elements = [];
39622
40122
  for (const tag of VML_SHAPE_TAGS) {
39623
- const nodes = container[tag];
40123
+ const nodes = container2[tag];
39624
40124
  if (!nodes) {
39625
40125
  continue;
39626
40126
  }
@@ -39720,8 +40220,8 @@ function diagnoseSelection(ac) {
39720
40220
  }
39721
40221
  return void 0;
39722
40222
  }
39723
- function unwrapAlternateContent(container) {
39724
- const altContents = ensureArray3(container["mc:AlternateContent"]);
40223
+ function unwrapAlternateContent(container2) {
40224
+ const altContents = ensureArray3(container2["mc:AlternateContent"]);
39725
40225
  if (altContents.length === 0) {
39726
40226
  return [];
39727
40227
  }
@@ -39741,7 +40241,7 @@ function unwrapAlternateContent(container) {
39741
40241
  for (const tag of SHAPE_TREE_ELEMENT_TAGS) {
39742
40242
  const children14 = ensureArray3(branch[tag]);
39743
40243
  if (children14.length > 0) {
39744
- container[tag] = [...ensureArray3(container[tag]), ...children14];
40244
+ container2[tag] = [...ensureArray3(container2[tag]), ...children14];
39745
40245
  for (const child27 of children14) {
39746
40246
  block.childRefs.push({ tag, node: child27 });
39747
40247
  }
@@ -39751,11 +40251,11 @@ function unwrapAlternateContent(container) {
39751
40251
  blocks.push(block);
39752
40252
  }
39753
40253
  }
39754
- delete container["mc:AlternateContent"];
40254
+ delete container2["mc:AlternateContent"];
39755
40255
  return blocks;
39756
40256
  }
39757
- function reapplyAlternateContentToTree(container, blockByNode) {
39758
- let working = container;
40257
+ function reapplyAlternateContentToTree(container2, blockByNode) {
40258
+ let working = container2;
39759
40259
  const groups = ensureArray3(working["p:grpSp"]);
39760
40260
  if (groups.length > 0) {
39761
40261
  let groupsChanged = false;
@@ -40616,16 +41116,16 @@ function applyActiveXControlsToSlide(slideXml3, controls) {
40616
41116
  return;
40617
41117
  }
40618
41118
  const nodes = controls.map(buildActiveXControlNode);
40619
- const container = cSld["p:controls"] ?? {};
41119
+ const container2 = cSld["p:controls"] ?? {};
40620
41120
  const isNewContainer = cSld["p:controls"] === void 0;
40621
- container["p:control"] = nodes.length === 1 ? nodes[0] : nodes;
41121
+ container2["p:control"] = nodes.length === 1 ? nodes[0] : nodes;
40622
41122
  if (isNewContainer && cSld["p:extLst"] !== void 0) {
40623
41123
  const extLst = cSld["p:extLst"];
40624
41124
  delete cSld["p:extLst"];
40625
- cSld["p:controls"] = container;
41125
+ cSld["p:controls"] = container2;
40626
41126
  cSld["p:extLst"] = extLst;
40627
41127
  } else {
40628
- cSld["p:controls"] = container;
41128
+ cSld["p:controls"] = container2;
40629
41129
  }
40630
41130
  }
40631
41131
  var init_activex_serializer = __esm({
@@ -42896,12 +43396,12 @@ var init_effect_dag_primitives = __esm({
42896
43396
  });
42897
43397
 
42898
43398
  // src/pptx/core/core/builders/effect-dag-serializer.ts
42899
- function serializeEffectDagContainerNode(container) {
42900
- const xml = { "@_type": container.type };
42901
- if (container.name) {
42902
- xml["@_name"] = container.name;
43399
+ function serializeEffectDagContainerNode(container2) {
43400
+ const xml = { "@_type": container2.type };
43401
+ if (container2.name) {
43402
+ xml["@_name"] = container2.name;
42903
43403
  }
42904
- for (const child27 of container.children) {
43404
+ for (const child27 of container2.children) {
42905
43405
  appendChild2(xml, child27);
42906
43406
  }
42907
43407
  return xml;
@@ -42967,24 +43467,24 @@ function parseEffectDagContainer(node) {
42967
43467
  const type = VALID_CONTAINER_TYPES.has(typeAttr) ? typeAttr : "sib";
42968
43468
  const nameAttr = String(xml["@_name"] ?? "").trim();
42969
43469
  const children14 = parseChildren(xml);
42970
- const container = {
43470
+ const container2 = {
42971
43471
  kind: "cont",
42972
43472
  type,
42973
43473
  children: children14
42974
43474
  };
42975
43475
  if (nameAttr) {
42976
- container.name = nameAttr;
43476
+ container2.name = nameAttr;
42977
43477
  }
42978
- return container;
43478
+ return container2;
42979
43479
  }
42980
43480
  function buildEffectDagTreeFromXml(effectDagXml) {
42981
43481
  return parseEffectDagContainer(effectDagXml);
42982
43482
  }
42983
- function serializeEffectDagContainer(container) {
42984
- if (!container) {
43483
+ function serializeEffectDagContainer(container2) {
43484
+ if (!container2) {
42985
43485
  return void 0;
42986
43486
  }
42987
- return serializeEffectDagContainerNode(container);
43487
+ return serializeEffectDagContainerNode(container2);
42988
43488
  }
42989
43489
  function parseChildren(xml) {
42990
43490
  const children14 = [];
@@ -43050,7 +43550,7 @@ function parseBlend(value) {
43050
43550
  const modeAttr = String(xml["@_blend"] ?? "").trim().toLowerCase();
43051
43551
  const mode = VALID_BLEND_MODES.has(modeAttr) ? modeAttr : "over";
43052
43552
  const contNode = childByLocalName2(xml, "cont");
43053
- const container = parseEffectDagContainer(Array.isArray(contNode) ? contNode[0] : contNode) ?? {
43553
+ const container2 = parseEffectDagContainer(Array.isArray(contNode) ? contNode[0] : contNode) ?? {
43054
43554
  kind: "cont",
43055
43555
  type: "sib",
43056
43556
  children: []
@@ -43058,7 +43558,7 @@ function parseBlend(value) {
43058
43558
  return {
43059
43559
  kind: "blend",
43060
43560
  mode,
43061
- container
43561
+ container: container2
43062
43562
  };
43063
43563
  }
43064
43564
  function parseXfrm(value) {
@@ -44855,13 +45355,13 @@ function boolValue2(node) {
44855
45355
  const value = node["@_val"];
44856
45356
  return value !== "0" && value !== "false";
44857
45357
  }
44858
- function parseBubbleChartOptions(container, localName28) {
44859
- if (!container) {
45358
+ function parseBubbleChartOptions(container2, localName28) {
45359
+ if (!container2) {
44860
45360
  return void 0;
44861
45361
  }
44862
45362
  const node = (name) => {
44863
- const key2 = findKey11(container, name, localName28);
44864
- return key2 ? container[key2] : void 0;
45363
+ const key2 = findKey11(container2, name, localName28);
45364
+ return key2 ? container2[key2] : void 0;
44865
45365
  };
44866
45366
  const options = {};
44867
45367
  const bubble3D = boolValue2(node("bubble3D"));
@@ -44888,33 +45388,33 @@ function parseBubbleChartOptions(container, localName28) {
44888
45388
  }
44889
45389
  return Object.keys(options).length > 0 ? options : void 0;
44890
45390
  }
44891
- function insertOrdered2(container, name, value, localName28) {
44892
- const existingKey = findKey11(container, name, localName28);
45391
+ function insertOrdered2(container2, name, value, localName28) {
45392
+ const existingKey = findKey11(container2, name, localName28);
44893
45393
  if (existingKey) {
44894
- container[existingKey] = { ...container[existingKey], ...value };
45394
+ container2[existingKey] = { ...container2[existingKey], ...value };
44895
45395
  return;
44896
45396
  }
44897
- const entries = Object.entries(container);
45397
+ const entries = Object.entries(container2);
44898
45398
  const targetRank = ORDER2.indexOf(name);
44899
45399
  const index = entries.findIndex(([key2]) => {
44900
45400
  const rank = ORDER2.indexOf(localName28(key2));
44901
45401
  return rank >= 0 && rank > targetRank;
44902
45402
  });
44903
45403
  entries.splice(index < 0 ? entries.length : index, 0, [`c:${name}`, value]);
44904
- for (const key2 of Object.keys(container)) {
44905
- delete container[key2];
45404
+ for (const key2 of Object.keys(container2)) {
45405
+ delete container2[key2];
44906
45406
  }
44907
45407
  for (const [key2, child27] of entries) {
44908
- container[key2] = child27;
45408
+ container2[key2] = child27;
44909
45409
  }
44910
45410
  }
44911
- function applyBubbleChartOptions(container, options, localName28) {
45411
+ function applyBubbleChartOptions(container2, options, localName28) {
44912
45412
  if (options.bubble3D !== void 0) {
44913
- insertOrdered2(container, "bubble3D", { "@_val": options.bubble3D ? "1" : "0" }, localName28);
45413
+ insertOrdered2(container2, "bubble3D", { "@_val": options.bubble3D ? "1" : "0" }, localName28);
44914
45414
  }
44915
45415
  if (options.bubbleScale !== void 0) {
44916
45416
  insertOrdered2(
44917
- container,
45417
+ container2,
44918
45418
  "bubbleScale",
44919
45419
  {
44920
45420
  "@_val": chartPercentUnionValue(options.bubbleScale, {
@@ -44928,14 +45428,14 @@ function applyBubbleChartOptions(container, options, localName28) {
44928
45428
  }
44929
45429
  if (options.showNegativeBubbles !== void 0) {
44930
45430
  insertOrdered2(
44931
- container,
45431
+ container2,
44932
45432
  "showNegBubbles",
44933
45433
  { "@_val": options.showNegativeBubbles ? "1" : "0" },
44934
45434
  localName28
44935
45435
  );
44936
45436
  }
44937
45437
  if (options.sizeRepresents !== void 0) {
44938
- insertOrdered2(container, "sizeRepresents", { "@_val": options.sizeRepresents }, localName28);
45438
+ insertOrdered2(container2, "sizeRepresents", { "@_val": options.sizeRepresents }, localName28);
44939
45439
  }
44940
45440
  }
44941
45441
  var ORDER2;
@@ -45103,12 +45603,12 @@ var init_chart_up_down_bars = __esm({
45103
45603
  });
45104
45604
 
45105
45605
  // src/pptx/core/utils/drawing-media-reference.ts
45106
- function parseDrawingMediaReference(container, externalRelIds) {
45107
- if (!container) {
45606
+ function parseDrawingMediaReference(container2, externalRelIds) {
45607
+ if (!container2) {
45108
45608
  return void 0;
45109
45609
  }
45110
45610
  for (const kind of MEDIA_REFERENCE_NAMES) {
45111
- const node = child15(container, kind);
45611
+ const node = child15(container2, kind);
45112
45612
  if (!node) {
45113
45613
  continue;
45114
45614
  }
@@ -45132,15 +45632,15 @@ function parseDrawingMediaReference(container, externalRelIds) {
45132
45632
  }
45133
45633
  return void 0;
45134
45634
  }
45135
- function applyDrawingMediaReference(container, element, relationshipId2) {
45635
+ function applyDrawingMediaReference(container2, element, relationshipId2) {
45136
45636
  const kind = element.mediaReferenceKind;
45137
45637
  if (!kind) {
45138
45638
  return;
45139
45639
  }
45140
- const targetKey = Object.keys(container).find((key2) => localName13(key2) === kind);
45141
- for (const key2 of Object.keys(container)) {
45640
+ const targetKey = Object.keys(container2).find((key2) => localName13(key2) === kind);
45641
+ for (const key2 of Object.keys(container2)) {
45142
45642
  if (MEDIA_REFERENCE_NAMES.includes(localName13(key2))) {
45143
- delete container[key2];
45643
+ delete container2[key2];
45144
45644
  }
45145
45645
  }
45146
45646
  const original = element.rawMediaReferenceXml ? { ...element.rawMediaReferenceXml } : {};
@@ -45157,7 +45657,7 @@ function applyDrawingMediaReference(container, element, relationshipId2) {
45157
45657
  if (extKey) {
45158
45658
  original[extKey] = extension;
45159
45659
  }
45160
- container[targetKey ?? "a:audioCd"] = original;
45660
+ container2[targetKey ?? "a:audioCd"] = original;
45161
45661
  return;
45162
45662
  }
45163
45663
  if (kind === "wavAudioFile") {
@@ -45177,7 +45677,7 @@ function applyDrawingMediaReference(container, element, relationshipId2) {
45177
45677
  setAttribute4(original, "contentType", element.mediaReferenceContentType);
45178
45678
  }
45179
45679
  }
45180
- container[targetKey ?? `a:${kind}`] = original;
45680
+ container2[targetKey ?? `a:${kind}`] = original;
45181
45681
  }
45182
45682
  function parseAudioCdPosition(value) {
45183
45683
  if (!value || typeof value !== "object") {
@@ -50106,10 +50606,10 @@ function applyPresentationDefaultTextStyle(presentation, levels) {
50106
50606
  PRESENTATION_BEFORE_DEFAULT_TEXT_STYLE
50107
50607
  );
50108
50608
  }
50109
- function insertBeforeKeys(container, key2, value, before) {
50609
+ function insertBeforeKeys(container2, key2, value, before) {
50110
50610
  const rebuilt = {};
50111
50611
  let inserted = false;
50112
- for (const [childKey3, childValue] of Object.entries(container)) {
50612
+ for (const [childKey3, childValue] of Object.entries(container2)) {
50113
50613
  if (childKey3 === key2) {
50114
50614
  continue;
50115
50615
  }
@@ -50122,10 +50622,10 @@ function insertBeforeKeys(container, key2, value, before) {
50122
50622
  if (!inserted) {
50123
50623
  rebuilt[key2] = value;
50124
50624
  }
50125
- for (const existingKey of Object.keys(container)) {
50126
- delete container[existingKey];
50625
+ for (const existingKey of Object.keys(container2)) {
50626
+ delete container2[existingKey];
50127
50627
  }
50128
- Object.assign(container, rebuilt);
50628
+ Object.assign(container2, rebuilt);
50129
50629
  }
50130
50630
  var LEVEL_KEY_ORDER, SLDMASTER_BEFORE_TXSTYLES, TX_STYLES_CATEGORY_ORDER, PRESENTATION_BEFORE_DEFAULT_TEXT_STYLE;
50131
50631
  var init_master_text_style_writer = __esm({
@@ -56152,8 +56652,8 @@ function asNode(value) {
56152
56652
  }
56153
56653
  function parseShapeLocksFromNode(shape, spec) {
56154
56654
  const nv = asNode(shape?.[spec.nvKey]);
56155
- const container = asNode(nv?.[spec.cNvKey]);
56156
- return parseShapeLockNode(asNode(container?.[spec.lockTag]), spec);
56655
+ const container2 = asNode(nv?.[spec.cNvKey]);
56656
+ return parseShapeLockNode(asNode(container2?.[spec.lockTag]), spec);
56157
56657
  }
56158
56658
  function resolveLockContainerNode(shape, spec, create) {
56159
56659
  const nv = asNode(shape[spec.nvKey]);
@@ -59085,8 +59585,8 @@ function findCNvPr(shape) {
59085
59585
  return void 0;
59086
59586
  }
59087
59587
  for (const key2 of NV_CONTAINERS) {
59088
- const container = shape[key2];
59089
- const cNvPr = container?.["p:cNvPr"];
59588
+ const container2 = shape[key2];
59589
+ const cNvPr = container2?.["p:cNvPr"];
59090
59590
  if (cNvPr) {
59091
59591
  return cNvPr;
59092
59592
  }
@@ -59332,8 +59832,8 @@ async function loadLegacyVmlDrawings(zip, parser, slidePath, relsPath2) {
59332
59832
  continue;
59333
59833
  }
59334
59834
  const parsed = parser.parse(vmlXml);
59335
- const container = parsed["xml"] ?? parsed;
59336
- const shapes = parseVmlElements(container, `vml-${drawingIndex}-`);
59835
+ const container2 = parsed["xml"] ?? parsed;
59836
+ const shapes = parseVmlElements(container2, `vml-${drawingIndex}-`);
59337
59837
  results.push(...shapes);
59338
59838
  drawingIndex++;
59339
59839
  }
@@ -62544,12 +63044,12 @@ function collectInteractiveSequences(node, found) {
62544
63044
  );
62545
63045
  }
62546
63046
  containers.push(...ensureArray10(node["p:par"]), ...ensureArray10(node["p:seq"]));
62547
- for (const container of containers) {
62548
- if (isInteractiveSequence(container)) {
62549
- found.push(container);
63047
+ for (const container2 of containers) {
63048
+ if (isInteractiveSequence(container2)) {
63049
+ found.push(container2);
62550
63050
  continue;
62551
63051
  }
62552
- collectInteractiveSequences(container, found);
63052
+ collectInteractiveSequences(container2, found);
62553
63053
  }
62554
63054
  }
62555
63055
  function parseInteractiveSequences(rootPar, animations, walk3) {
@@ -62650,16 +63150,16 @@ function collectMediaNodes(node, animations) {
62650
63150
  const cTn = node["p:cTn"];
62651
63151
  const childTnList = cTn?.["p:childTnLst"];
62652
63152
  if (childTnList) {
62653
- for (const container of ["p:par", "p:seq", "p:excl"]) {
62654
- const children14 = ensureArray10(childTnList[container]);
63153
+ for (const container2 of ["p:par", "p:seq", "p:excl"]) {
63154
+ const children14 = ensureArray10(childTnList[container2]);
62655
63155
  for (const child27 of children14) {
62656
63156
  collectMediaNodes(child27, animations);
62657
63157
  }
62658
63158
  }
62659
63159
  collectMediaNodes(childTnList, animations);
62660
63160
  }
62661
- for (const container of ["p:par", "p:seq", "p:excl", "p:tnLst"]) {
62662
- const children14 = ensureArray10(node[container]);
63161
+ for (const container2 of ["p:par", "p:seq", "p:excl", "p:tnLst"]) {
63162
+ const children14 = ensureArray10(node[container2]);
62663
63163
  for (const child27 of children14) {
62664
63164
  collectMediaNodes(child27, animations);
62665
63165
  }
@@ -83670,7 +84170,7 @@ var init_layout_switch_placeholder_prompts = __esm({
83670
84170
 
83671
84171
  // src/pptx/core/core/types.ts
83672
84172
  var DEFAULT_MAX_UNCOMPRESSED_BYTES, MAX_ZIP_ENTRY_COUNT, ZipBombError;
83673
- var init_types3 = __esm({
84173
+ var init_types4 = __esm({
83674
84174
  "src/pptx/core/core/types.ts"() {
83675
84175
  DEFAULT_MAX_UNCOMPRESSED_BYTES = 500 * 1024 * 1024;
83676
84176
  MAX_ZIP_ENTRY_COUNT = 65536;
@@ -84477,12 +84977,12 @@ function readCachedValues(refContainer, xmlLookup) {
84477
84977
  }
84478
84978
  return out;
84479
84979
  }
84480
- function readRefOrLiteral(container, xmlLookup) {
84481
- const ref = xmlLookup.getChildByLocalName(container, "strRef") ?? xmlLookup.getChildByLocalName(container, "numRef");
84980
+ function readRefOrLiteral(container2, xmlLookup) {
84981
+ const ref = xmlLookup.getChildByLocalName(container2, "strRef") ?? xmlLookup.getChildByLocalName(container2, "numRef");
84482
84982
  if (ref) {
84483
84983
  return readCachedValues(ref, xmlLookup);
84484
84984
  }
84485
- const literal2 = xmlLookup.getChildByLocalName(container, "strLit") ?? xmlLookup.getChildByLocalName(container, "numLit");
84985
+ const literal2 = xmlLookup.getChildByLocalName(container2, "strLit") ?? xmlLookup.getChildByLocalName(container2, "numLit");
84486
84986
  return literal2 ? readCachedValues({ "c:strCache": literal2 }, xmlLookup) : [];
84487
84987
  }
84488
84988
  function parseOneFilteredSeries(node, xmlLookup) {
@@ -84517,15 +85017,15 @@ function parseOneFilteredSeries(node, xmlLookup) {
84517
85017
  }
84518
85018
  return result;
84519
85019
  }
84520
- function findFilterExt(container, xmlLookup) {
84521
- const extLst = xmlLookup.getChildByLocalName(container, "extLst");
85020
+ function findFilterExt(container2, xmlLookup) {
85021
+ const extLst = xmlLookup.getChildByLocalName(container2, "extLst");
84522
85022
  if (!extLst) {
84523
85023
  return void 0;
84524
85024
  }
84525
85025
  return xmlLookup.getChildrenArrayByLocalName(extLst, "ext").find((ext) => ext["@_uri"] === CHART_FILTERED_SERIES_EXT_URI);
84526
85026
  }
84527
- function parseFilteredSeries(container, xmlLookup) {
84528
- const ext = findFilterExt(container, xmlLookup);
85027
+ function parseFilteredSeries(container2, xmlLookup) {
85028
+ const ext = findFilterExt(container2, xmlLookup);
84529
85029
  if (!ext) {
84530
85030
  return void 0;
84531
85031
  }
@@ -84546,9 +85046,9 @@ function parseFilteredSeries(container, xmlLookup) {
84546
85046
  }
84547
85047
  return results.length > 0 ? results : void 0;
84548
85048
  }
84549
- function collectFilteredSeriesIndices(container, xmlLookup) {
85049
+ function collectFilteredSeriesIndices(container2, xmlLookup) {
84550
85050
  const reserved = /* @__PURE__ */ new Set();
84551
- for (const filtered of parseFilteredSeries(container, xmlLookup) ?? []) {
85051
+ for (const filtered of parseFilteredSeries(container2, xmlLookup) ?? []) {
84552
85052
  reserved.add(filtered.idx);
84553
85053
  }
84554
85054
  return reserved;
@@ -84593,8 +85093,8 @@ function readAxDataSource(cat, xmlLookup) {
84593
85093
  const ref = xmlLookup.getChildByLocalName(cat, "strRef") ?? xmlLookup.getChildByLocalName(cat, "numRef");
84594
85094
  return readCachedValues(ref, xmlLookup);
84595
85095
  }
84596
- function parseFilteredTitles(container, xmlLookup) {
84597
- const ext = findFilterExt(container, xmlLookup);
85096
+ function parseFilteredTitles(container2, xmlLookup) {
85097
+ const ext = findFilterExt(container2, xmlLookup);
84598
85098
  if (!ext) {
84599
85099
  return void 0;
84600
85100
  }
@@ -85509,8 +86009,8 @@ var init_chart_protection2 = __esm({
85509
86009
  });
85510
86010
 
85511
86011
  // src/pptx/core/utils/chart-series-axis.ts
85512
- function resolveChartContainerValueAxisId(container, axes, xmlLookup) {
85513
- const referencedIds = xmlLookup.getChildrenArrayByLocalName(container, "axId").map((node) => Number.parseInt(String(node["@_val"]), 10)).filter(Number.isFinite);
86012
+ function resolveChartContainerValueAxisId(container2, axes, xmlLookup) {
86013
+ const referencedIds = xmlLookup.getChildrenArrayByLocalName(container2, "axId").map((node) => Number.parseInt(String(node["@_val"]), 10)).filter(Number.isFinite);
85514
86014
  for (let index = referencedIds.length - 1; index >= 0; index--) {
85515
86015
  const id = referencedIds[index];
85516
86016
  if (axes.some((axis) => axis.axisType === "valAx" && axis.axisId === id)) {
@@ -91063,10 +91563,10 @@ function buildOle10Native(label, sourcePath, data) {
91063
91563
  return new ByteWriter().u32(body.length).bytes(body).toBytes();
91064
91564
  }
91065
91565
  function buildPackageStorage(label, sourcePath, data) {
91066
- const streams = /* @__PURE__ */ new Map();
91067
- streams.set("CompObj", hexToBytes(COMP_OBJ_HEX));
91068
- streams.set("Ole10Native", buildOle10Native(label, sourcePath, data));
91069
- return new Uint8Array(buildOle2(streams, PACKAGE_ROOT_CLSID));
91566
+ const streams2 = /* @__PURE__ */ new Map();
91567
+ streams2.set("CompObj", hexToBytes(COMP_OBJ_HEX));
91568
+ streams2.set("Ole10Native", buildOle10Native(label, sourcePath, data));
91569
+ return new Uint8Array(buildOle2(streams2, PACKAGE_ROOT_CLSID));
91070
91570
  }
91071
91571
  function buildExOleObjStg(storage) {
91072
91572
  return record(RT.ExternalOleObjectStg, storage, 0, false, 0);
@@ -91953,8 +92453,8 @@ function buildDrawing(canvasRect, shapes, backgroundRgb, fonts, drawingId, hyper
91953
92453
  const spgrData = new ByteWriter().bytes(buildCanvasPatriarch(allocator));
91954
92454
  const background = backgroundRgb ? buildBackgroundShape(backgroundRgb, allocator) : void 0;
91955
92455
  const prebuilt = prebuiltShapes?.(allocator) ?? [];
91956
- for (const container of prebuilt) {
91957
- spgrData.bytes(container);
92456
+ for (const container2 of prebuilt) {
92457
+ spgrData.bytes(container2);
91958
92458
  }
91959
92459
  for (const shape of shapes) {
91960
92460
  spgrData.bytes(buildAnyShapeContainer(shape, fonts, allocator, hyperlinks, oleEmbeds, mediaEmbeds));
@@ -92049,19 +92549,19 @@ function* iterateRecords(view, start, end) {
92049
92549
  offset = rec.dataOffset + rec.recLen;
92050
92550
  }
92051
92551
  }
92052
- function* iterateChildren(view, container) {
92053
- yield* iterateRecords(view, container.dataOffset, container.dataOffset + container.recLen);
92552
+ function* iterateChildren(view, container2) {
92553
+ yield* iterateRecords(view, container2.dataOffset, container2.dataOffset + container2.recLen);
92054
92554
  }
92055
- function findChild4(view, container, recType, recInstance) {
92056
- for (const child27 of iterateChildren(view, container)) {
92555
+ function findChild4(view, container2, recType, recInstance) {
92556
+ for (const child27 of iterateChildren(view, container2)) {
92057
92557
  if (child27.recType === recType && (recInstance === void 0 || child27.recInstance === recInstance)) {
92058
92558
  return child27;
92059
92559
  }
92060
92560
  }
92061
92561
  return void 0;
92062
92562
  }
92063
- function findDescendant(view, container, recType, recInstance) {
92064
- for (const child27 of iterateChildren(view, container)) {
92563
+ function findDescendant(view, container2, recType, recInstance) {
92564
+ for (const child27 of iterateChildren(view, container2)) {
92065
92565
  if (child27.recType === recType && (recInstance === void 0)) {
92066
92566
  return child27;
92067
92567
  }
@@ -92112,8 +92612,8 @@ function parseColorSchemeAtom(view, rec) {
92112
92612
  }
92113
92613
  return colors;
92114
92614
  }
92115
- function findSchemeColors(view, container) {
92116
- for (const child27 of iterateChildren(view, container)) {
92615
+ function findSchemeColors(view, container2) {
92616
+ for (const child27 of iterateChildren(view, container2)) {
92117
92617
  if (child27.recType === RT.ColorSchemeAtom && child27.recInstance === 1) {
92118
92618
  return parseColorSchemeAtom(view, child27);
92119
92619
  }
@@ -92777,13 +93277,13 @@ async function buildPptFile(deck, options = {}) {
92777
93277
  const encrypted = Boolean(options.password);
92778
93278
  const finished = encrypted ? await finishEncrypted(layout, lastSlideId, options.password) : await finishUnencrypted(layout, lastSlideId);
92779
93279
  const currentUser = buildCurrentUserStream(finished.offsetToCurrentEdit, encrypted);
92780
- const streams = /* @__PURE__ */ new Map();
92781
- streams.set("Current User", currentUser);
92782
- streams.set("PowerPoint Document", finished.documentBytes);
93280
+ const streams2 = /* @__PURE__ */ new Map();
93281
+ streams2.set("Current User", currentUser);
93282
+ streams2.set("PowerPoint Document", finished.documentBytes);
92783
93283
  if (finished.picturesBytes && finished.picturesBytes.length > 0) {
92784
- streams.set("Pictures", finished.picturesBytes);
93284
+ streams2.set("Pictures", finished.picturesBytes);
92785
93285
  }
92786
- return new Uint8Array(buildOle2(streams, PPT_STORAGE_CLSID, 0));
93286
+ return new Uint8Array(buildOle2(streams2, PPT_STORAGE_CLSID, 0));
92787
93287
  }
92788
93288
  var init_write_ppt = __esm({
92789
93289
  "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/write-ppt.js"() {
@@ -93682,20 +94182,20 @@ function buildRestoredRegionXml(region) {
93682
94182
  }
93683
94183
  function applyCommonSlideContainer(root, name, props) {
93684
94184
  const key2 = findViewKey(root, name) ?? `p:${name}`;
93685
- const container = { ...root[key2] ?? {} };
93686
- const commonKey = findViewKey(container, "cSldViewPr") ?? "p:cSldViewPr";
93687
- container[commonKey] = buildCommonSlideView(props, viewChild(container, "cSldViewPr"));
93688
- root[key2] = container;
94185
+ const container2 = { ...root[key2] ?? {} };
94186
+ const commonKey = findViewKey(container2, "cSldViewPr") ?? "p:cSldViewPr";
94187
+ container2[commonKey] = buildCommonSlideView(props, viewChild(container2, "cSldViewPr"));
94188
+ root[key2] = container2;
93689
94189
  }
93690
94190
  function applyCommonViewContainer(root, name, props) {
93691
94191
  const key2 = findViewKey(root, name) ?? `p:${name}`;
93692
- const container = { ...root[key2] ?? {} };
93693
- const commonKey = findViewKey(container, "cViewPr") ?? "p:cViewPr";
94192
+ const container2 = { ...root[key2] ?? {} };
94193
+ const commonKey = findViewKey(container2, "cViewPr") ?? "p:cViewPr";
93694
94194
  const wrapper = buildCommonSlideView(props, {
93695
- "p:cViewPr": viewChild(container, "cViewPr") ?? {}
94195
+ "p:cViewPr": viewChild(container2, "cViewPr") ?? {}
93696
94196
  });
93697
- container[commonKey] = viewChild(wrapper, "cViewPr");
93698
- root[key2] = container;
94197
+ container2[commonKey] = viewChild(wrapper, "cViewPr");
94198
+ root[key2] = container2;
93699
94199
  }
93700
94200
  var init_pptx_view_props_helpers = __esm({
93701
94201
  "src/pptx/core/core/runtime/pptx-view-props-helpers.ts"() {
@@ -94018,22 +94518,22 @@ function ordered3(existing, modeled, getLocalName2) {
94018
94518
  });
94019
94519
  return Object.fromEntries(entries);
94020
94520
  }
94021
- function insertAfterLastSeries(container, dLbls, getLocalName2) {
94022
- const keys = Object.keys(container);
94521
+ function insertAfterLastSeries(container2, dLbls, getLocalName2) {
94522
+ const keys = Object.keys(container2);
94023
94523
  let lastSer = -1;
94024
94524
  keys.forEach((k, i) => {
94025
94525
  if (getLocalName2(k) === "ser") {
94026
94526
  lastSer = i;
94027
94527
  }
94028
94528
  });
94029
- const entries = keys.map((k) => [k, container[k]]);
94529
+ const entries = keys.map((k) => [k, container2[k]]);
94030
94530
  const at2 = lastSer === -1 ? entries.length : lastSer + 1;
94031
94531
  entries.splice(at2, 0, ["c:dLbls", dLbls]);
94032
94532
  for (const k of keys) {
94033
- delete container[k];
94533
+ delete container2[k];
94034
94534
  }
94035
94535
  for (const [k, v] of entries) {
94036
- container[k] = v;
94536
+ container2[k] = v;
94037
94537
  }
94038
94538
  }
94039
94539
  function buildDLbls(existing, opts, getLocalName2) {
@@ -94070,25 +94570,25 @@ function applyChartDataLabelsToXml(plotArea, style, getLocalName2) {
94070
94570
  }
94071
94571
  const chartTypeKeys = Object.keys(plotArea).filter((k) => getLocalName2(k).endsWith("Chart"));
94072
94572
  for (const ctKey of chartTypeKeys) {
94073
- const container = plotArea[ctKey];
94074
- if (!container || typeof container !== "object") {
94573
+ const container2 = plotArea[ctKey];
94574
+ if (!container2 || typeof container2 !== "object") {
94075
94575
  continue;
94076
94576
  }
94077
- const existingKey = findKey16(container, "dLbls", getLocalName2);
94577
+ const existingKey = findKey16(container2, "dLbls", getLocalName2);
94078
94578
  if (style.hasDataLabels === false) {
94079
- const existing2 = existingKey ? container[existingKey] : void 0;
94579
+ const existing2 = existingKey ? container2[existingKey] : void 0;
94080
94580
  const off = ordered3(existing2, { "c:delete": { "@_val": "1" } }, getLocalName2);
94081
94581
  if (existingKey) {
94082
- container[existingKey] = off;
94582
+ container2[existingKey] = off;
94083
94583
  } else {
94084
- insertAfterLastSeries(container, off, getLocalName2);
94584
+ insertAfterLastSeries(container2, off, getLocalName2);
94085
94585
  }
94086
94586
  continue;
94087
94587
  }
94088
94588
  const opts = style.dataLabels ?? {};
94089
94589
  const anyFlag = opts.showValue || opts.showCategory || opts.showSeriesName || opts.showPercent || opts.showLegendKey || opts.showBubbleSize;
94090
94590
  const effective = anyFlag ? opts : { ...opts, showValue: true };
94091
- const existing = existingKey ? container[existingKey] : void 0;
94591
+ const existing = existingKey ? container2[existingKey] : void 0;
94092
94592
  const built = buildDLbls(existing, effective, getLocalName2);
94093
94593
  applyDataLabelsRangeToDLbls(
94094
94594
  built,
@@ -94097,9 +94597,9 @@ function applyChartDataLabelsToXml(plotArea, style, getLocalName2) {
94097
94597
  getLocalName2
94098
94598
  );
94099
94599
  if (existingKey) {
94100
- container[existingKey] = built;
94600
+ container2[existingKey] = built;
94101
94601
  } else {
94102
- insertAfterLastSeries(container, built, getLocalName2);
94602
+ insertAfterLastSeries(container2, built, getLocalName2);
94103
94603
  }
94104
94604
  }
94105
94605
  }
@@ -95094,54 +95594,54 @@ function axisFormatting(chartData, type, id, index = 0) {
95094
95594
  return chartData.axes?.find((axis) => axis.axisId === id) ?? chartData.axes?.filter((axis) => axis.axisType === type)[index];
95095
95595
  }
95096
95596
  function buildChartTypeContainer(chartData, family) {
95097
- const container = {};
95597
+ const container2 = {};
95098
95598
  if (family === "bar") {
95099
- container["c:barDir"] = { "@_val": chartData.barDirection === "bar" ? "bar" : "col" };
95100
- container["c:grouping"] = {
95599
+ container2["c:barDir"] = { "@_val": chartData.barDirection === "bar" ? "bar" : "col" };
95600
+ container2["c:grouping"] = {
95101
95601
  "@_val": chartData.groupingStandard && (chartData.grouping ?? "clustered") === "clustered" ? "standard" : chartData.grouping ?? "clustered"
95102
95602
  };
95103
- container["c:varyColors"] = { "@_val": "0" };
95603
+ container2["c:varyColors"] = { "@_val": "0" };
95104
95604
  } else if (family === "line" || family === "area") {
95105
- container["c:grouping"] = { "@_val": chartData.grouping ?? "standard" };
95106
- container["c:varyColors"] = { "@_val": "0" };
95605
+ container2["c:grouping"] = { "@_val": chartData.grouping ?? "standard" };
95606
+ container2["c:varyColors"] = { "@_val": "0" };
95107
95607
  } else if (family === "radar") {
95108
- container["c:radarStyle"] = { "@_val": chartData.radarStyle ?? "marker" };
95109
- container["c:varyColors"] = { "@_val": "0" };
95608
+ container2["c:radarStyle"] = { "@_val": chartData.radarStyle ?? "marker" };
95609
+ container2["c:varyColors"] = { "@_val": "0" };
95110
95610
  } else if (family === "scatter") {
95111
- container["c:scatterStyle"] = { "@_val": "lineMarker" };
95112
- container["c:varyColors"] = { "@_val": "0" };
95611
+ container2["c:scatterStyle"] = { "@_val": "lineMarker" };
95612
+ container2["c:varyColors"] = { "@_val": "0" };
95113
95613
  } else if (family === "ofPie") {
95114
- container["c:ofPieType"] = { "@_val": "pie" };
95115
- container["c:varyColors"] = { "@_val": "1" };
95614
+ container2["c:ofPieType"] = { "@_val": "pie" };
95615
+ container2["c:varyColors"] = { "@_val": "1" };
95116
95616
  } else if (family === "stock") ; else if (family === "surface") {
95117
- container["c:wireframe"] = { "@_val": chartData.wireframe === false ? "0" : "1" };
95617
+ container2["c:wireframe"] = { "@_val": chartData.wireframe === false ? "0" : "1" };
95118
95618
  } else {
95119
- container["c:varyColors"] = { "@_val": family === "bubble" ? "0" : "1" };
95619
+ container2["c:varyColors"] = { "@_val": family === "bubble" ? "0" : "1" };
95120
95620
  }
95121
- container["c:ser"] = chartData.series.map(
95621
+ container2["c:ser"] = chartData.series.map(
95122
95622
  (s, i) => buildSeries(family, s, i, chartData.categories, chartData.dateCategories)
95123
95623
  );
95124
95624
  if (family === "bubble" && chartData.bubbleOptions) {
95125
- applyBubbleChartOptions(container, chartData.bubbleOptions, (key2) => key2.replace(/^.*:/u, ""));
95625
+ applyBubbleChartOptions(container2, chartData.bubbleOptions, (key2) => key2.replace(/^.*:/u, ""));
95126
95626
  }
95127
95627
  if (family === "line" && chartData.upDownBars !== void 0) {
95128
- applyChartUpDownBars(container, chartData.upDownBars, (key2) => key2.replace(/^.*:/u, ""));
95628
+ applyChartUpDownBars(container2, chartData.upDownBars, (key2) => key2.replace(/^.*:/u, ""));
95129
95629
  }
95130
95630
  if (family === "bar" || family === "ofPie") {
95131
- container["c:gapWidth"] = { "@_val": "150" };
95631
+ container2["c:gapWidth"] = { "@_val": "150" };
95132
95632
  }
95133
95633
  if (family === "bar" && chartData.chartType === "bar3D" && chartData.barShape) {
95134
- container["c:shape"] = { "@_val": chartData.barShape };
95634
+ container2["c:shape"] = { "@_val": chartData.barShape };
95135
95635
  }
95136
95636
  if (family === "stock") {
95137
- container["c:hiLowLines"] = {};
95637
+ container2["c:hiLowLines"] = {};
95138
95638
  }
95139
95639
  if (family === "bar" || family === "line" || family === "area" || family === "radar" || family === "scatter" || family === "bubble" || family === "stock" || family === "surface") {
95140
- container["c:axId"] = [{ "@_val": String(CAT_AX_ID) }, { "@_val": String(VAL_AX_ID) }];
95640
+ container2["c:axId"] = [{ "@_val": String(CAT_AX_ID) }, { "@_val": String(VAL_AX_ID) }];
95141
95641
  } else if (family === "doughnut") {
95142
- container["c:holeSize"] = { "@_val": "50" };
95642
+ container2["c:holeSize"] = { "@_val": "50" };
95143
95643
  }
95144
- return container;
95644
+ return container2;
95145
95645
  }
95146
95646
  function buildPlotArea(chartData, tag, family) {
95147
95647
  const plotArea = { "c:layout": {} };
@@ -95495,8 +95995,8 @@ async function writeCustomerDataScopes(zip, scopes, codec) {
95495
95995
  continue;
95496
95996
  }
95497
95997
  const sourceData = codec.parse(sourceXml);
95498
- const container = getContainer(sourceData, scope.location);
95499
- if (!container) {
95998
+ const container2 = getContainer(sourceData, scope.location);
95999
+ if (!container2) {
95500
96000
  continue;
95501
96001
  }
95502
96002
  const relsPath2 = relsForSourcePart(scope.sourcePartPath);
@@ -95531,9 +96031,9 @@ async function writeCustomerDataScopes(zip, scopes, codec) {
95531
96031
  authoredEntries.push(rawEntry);
95532
96032
  contentTypes2.set(path2, entry.contentType);
95533
96033
  }
95534
- const existingList = container["p:custDataLst"] ?? {};
96034
+ const existingList = container2["p:custDataLst"] ?? {};
95535
96035
  existingList["p:custData"] = authoredEntries;
95536
- placeCustomerDataList(container, existingList, scope.location);
96036
+ placeCustomerDataList(container2, existingList, scope.location);
95537
96037
  relsRoot["Relationship"] = relationships2;
95538
96038
  zip.file(relsPath2, codec.build(relsData));
95539
96039
  zip.file(scope.sourcePartPath, codec.build(sourceData));
@@ -95583,11 +96083,11 @@ function upsertRelationship(relationships2, entry, target) {
95583
96083
  function isCustomXmlRelationship(value) {
95584
96084
  return String(value ?? "").endsWith("/relationships/customXml");
95585
96085
  }
95586
- function placeCustomerDataList(container, list2, location) {
96086
+ function placeCustomerDataList(container2, list2, location) {
95587
96087
  const insertBefore3 = location === "presentation" ? /* @__PURE__ */ new Set(["p:kinsoku", "p:defaultTextStyle", "p:modifyVerifier", "p:extLst"]) : /* @__PURE__ */ new Set(["p:controls", "p:extLst"]);
95588
96088
  const rebuilt = {};
95589
96089
  let inserted = false;
95590
- for (const [key2, value] of Object.entries(container)) {
96090
+ for (const [key2, value] of Object.entries(container2)) {
95591
96091
  if (key2 === "p:custDataLst") {
95592
96092
  continue;
95593
96093
  }
@@ -95600,10 +96100,10 @@ function placeCustomerDataList(container, list2, location) {
95600
96100
  if (!inserted) {
95601
96101
  rebuilt["p:custDataLst"] = list2;
95602
96102
  }
95603
- for (const key2 of Object.keys(container)) {
95604
- delete container[key2];
96103
+ for (const key2 of Object.keys(container2)) {
96104
+ delete container2[key2];
95605
96105
  }
95606
- Object.assign(container, rebuilt);
96106
+ Object.assign(container2, rebuilt);
95607
96107
  }
95608
96108
  async function upsertContentTypes(zip, codec, contentTypes2) {
95609
96109
  const xml = await zip.file("[Content_Types].xml")?.async("string");
@@ -95679,10 +96179,10 @@ function resolveTagsContainer(data) {
95679
96179
  }
95680
96180
  return void 0;
95681
96181
  }
95682
- function placeAtKey(container, key2, value, insertBefore3) {
96182
+ function placeAtKey(container2, key2, value, insertBefore3) {
95683
96183
  const rebuilt = {};
95684
96184
  let inserted = false;
95685
- for (const [childKey3, childValue] of Object.entries(container)) {
96185
+ for (const [childKey3, childValue] of Object.entries(container2)) {
95686
96186
  if (childKey3 === key2) {
95687
96187
  continue;
95688
96188
  }
@@ -95695,10 +96195,10 @@ function placeAtKey(container, key2, value, insertBefore3) {
95695
96195
  if (!inserted) {
95696
96196
  rebuilt[key2] = value;
95697
96197
  }
95698
- for (const existingKey of Object.keys(container)) {
95699
- delete container[existingKey];
96198
+ for (const existingKey of Object.keys(container2)) {
96199
+ delete container2[existingKey];
95700
96200
  }
95701
- Object.assign(container, rebuilt);
96201
+ Object.assign(container2, rebuilt);
95702
96202
  }
95703
96203
  async function upsertTagsOwningElement(zip, codec, sourcePartPath, relationshipId2) {
95704
96204
  const xml = await zip.file(sourcePartPath)?.async("string");
@@ -95710,10 +96210,10 @@ async function upsertTagsOwningElement(zip, codec, sourcePartPath, relationshipI
95710
96210
  if (!resolved) {
95711
96211
  return;
95712
96212
  }
95713
- const { container, insertBefore: insertBefore3 } = resolved;
95714
- const list2 = { ...container["p:custDataLst"] ?? {} };
96213
+ const { container: container2, insertBefore: insertBefore3 } = resolved;
96214
+ const list2 = { ...container2["p:custDataLst"] ?? {} };
95715
96215
  list2["p:tags"] = { "@_r:id": relationshipId2 };
95716
- placeAtKey(container, "p:custDataLst", list2, insertBefore3);
96216
+ placeAtKey(container2, "p:custDataLst", list2, insertBefore3);
95717
96217
  zip.file(sourcePartPath, codec.build(data));
95718
96218
  }
95719
96219
  async function removeTagsOwningElement(zip, codec, sourcePartPath) {
@@ -96230,21 +96730,21 @@ function normalizeGroupingNode(containerLocal, node) {
96230
96730
  node["@_val"] = normalizeChartGroupingValue(containerLocal, value);
96231
96731
  }
96232
96732
  }
96233
- function normalizeChartContainerChildren(container, containerLocal, getLocalName2) {
96733
+ function normalizeChartContainerChildren(container2, containerLocal, getLocalName2) {
96234
96734
  if (!isKnownChartContainer(containerLocal)) {
96235
96735
  return;
96236
96736
  }
96237
- for (const key2 of Object.keys(container)) {
96737
+ for (const key2 of Object.keys(container2)) {
96238
96738
  if (key2.startsWith("@_") || key2 === "#text") {
96239
96739
  continue;
96240
96740
  }
96241
96741
  const local = getLocalName2(key2);
96242
96742
  if (!chartContainerAllows(containerLocal, local)) {
96243
- delete container[key2];
96743
+ delete container2[key2];
96244
96744
  continue;
96245
96745
  }
96246
96746
  if (local === "grouping") {
96247
- const node = container[key2];
96747
+ const node = container2[key2];
96248
96748
  if (node && typeof node === "object" && !Array.isArray(node)) {
96249
96749
  normalizeGroupingNode(containerLocal, node);
96250
96750
  }
@@ -96252,18 +96752,18 @@ function normalizeChartContainerChildren(container, containerLocal, getLocalName
96252
96752
  }
96253
96753
  const required = REQUIRED_LEADING_CHILD[containerLocal];
96254
96754
  if (required) {
96255
- const present = Object.keys(container).some((k) => getLocalName2(k) === required.local);
96755
+ const present = Object.keys(container2).some((k) => getLocalName2(k) === required.local);
96256
96756
  if (!present) {
96257
- container[`c:${required.local}`] = { "@_val": required.val };
96757
+ container2[`c:${required.local}`] = { "@_val": required.val };
96258
96758
  }
96259
96759
  }
96260
96760
  }
96261
- function orderChartContainerChildren(container, containerLocal, getLocalName2) {
96761
+ function orderChartContainerChildren(container2, containerLocal, getLocalName2) {
96262
96762
  const order = CHART_CONTAINER_CHILD_ORDER[containerLocal];
96263
96763
  if (!order) {
96264
96764
  return;
96265
96765
  }
96266
- const keys = Object.keys(container).filter((k) => !k.startsWith("@_") && k !== "#text");
96766
+ const keys = Object.keys(container2).filter((k) => !k.startsWith("@_") && k !== "#text");
96267
96767
  if (keys.some((k) => !order.includes(getLocalName2(k)))) {
96268
96768
  return;
96269
96769
  }
@@ -96273,12 +96773,12 @@ function orderChartContainerChildren(container, containerLocal, getLocalName2) {
96273
96773
  if (sorted.every((k, i) => k === keys[i])) {
96274
96774
  return;
96275
96775
  }
96276
- const saved = sorted.map((k) => [k, container[k]]);
96776
+ const saved = sorted.map((k) => [k, container2[k]]);
96277
96777
  for (const k of keys) {
96278
- delete container[k];
96778
+ delete container2[k];
96279
96779
  }
96280
96780
  for (const [k, v] of saved) {
96281
- container[k] = v;
96781
+ container2[k] = v;
96282
96782
  }
96283
96783
  }
96284
96784
  function renameXmlKeyInPlace(obj, oldKey, newKey) {
@@ -96299,12 +96799,12 @@ function referencedAxisIds(plotArea, getLocalName2) {
96299
96799
  if (!getLocalName2(key2).endsWith("Chart")) {
96300
96800
  continue;
96301
96801
  }
96302
- for (const container of toArray2(plotArea[key2])) {
96303
- for (const childKey3 of Object.keys(container)) {
96802
+ for (const container2 of toArray2(plotArea[key2])) {
96803
+ for (const childKey3 of Object.keys(container2)) {
96304
96804
  if (getLocalName2(childKey3) !== "axId") {
96305
96805
  continue;
96306
96806
  }
96307
- for (const axId of toArray2(container[childKey3])) {
96807
+ for (const axId of toArray2(container2[childKey3])) {
96308
96808
  const val = axId["@_val"];
96309
96809
  if (val !== void 0) {
96310
96810
  ids.add(String(val));
@@ -96355,8 +96855,8 @@ var init_chart_container_schema = __esm({
96355
96855
  function findKey22(obj, local, getLocalName2) {
96356
96856
  return Object.keys(obj).find((k) => getLocalName2(k) === local);
96357
96857
  }
96358
- function nonSeriesEntries(container, getLocalName2) {
96359
- return Object.keys(container).filter((k) => getLocalName2(k) !== "ser").map((k) => [k, container[k]]);
96858
+ function nonSeriesEntries(container2, getLocalName2) {
96859
+ return Object.keys(container2).filter((k) => getLocalName2(k) !== "ser").map((k) => [k, container2[k]]);
96360
96860
  }
96361
96861
  function ensureArray17(v) {
96362
96862
  if (v === void 0) {
@@ -96372,9 +96872,9 @@ function consolidateComboContainersInXml(plotArea, getLocalName2) {
96372
96872
  const primaryKey = containerKeys[0];
96373
96873
  const containerChildren = /* @__PURE__ */ new Map();
96374
96874
  for (const key2 of containerKeys) {
96375
- const container = plotArea[key2];
96376
- if (container) {
96377
- containerChildren.set(getLocalName2(key2), nonSeriesEntries(container, getLocalName2));
96875
+ const container2 = plotArea[key2];
96876
+ if (container2) {
96877
+ containerChildren.set(getLocalName2(key2), nonSeriesEntries(container2, getLocalName2));
96378
96878
  }
96379
96879
  }
96380
96880
  if (containerKeys.length === 1) {
@@ -96387,13 +96887,13 @@ function consolidateComboContainersInXml(plotArea, getLocalName2) {
96387
96887
  const serKey = findKey22(primary, "ser", getLocalName2) ?? "c:ser";
96388
96888
  const allSeries = [];
96389
96889
  for (const key2 of containerKeys) {
96390
- const container = plotArea[key2];
96391
- if (!container) {
96890
+ const container2 = plotArea[key2];
96891
+ if (!container2) {
96392
96892
  continue;
96393
96893
  }
96394
- const containerSerKey = findKey22(container, "ser", getLocalName2);
96894
+ const containerSerKey = findKey22(container2, "ser", getLocalName2);
96395
96895
  if (containerSerKey) {
96396
- allSeries.push(...ensureArray17(container[containerSerKey]));
96896
+ allSeries.push(...ensureArray17(container2[containerSerKey]));
96397
96897
  }
96398
96898
  if (key2 !== primaryKey) {
96399
96899
  delete plotArea[key2];
@@ -96440,21 +96940,21 @@ function applyComboSeriesTypesToXml(plotArea, originalKey, series, chartLevelTyp
96440
96940
  const at2 = keys.indexOf(originalKey);
96441
96941
  const newEntries = [];
96442
96942
  for (const local of groupOrder) {
96443
- const container = {};
96943
+ const container2 = {};
96444
96944
  for (const [k, v] of originalChildren?.get(local) ?? fallbackEntries) {
96445
- container[k] = JSON.parse(JSON.stringify(v));
96945
+ container2[k] = JSON.parse(JSON.stringify(v));
96446
96946
  }
96447
96947
  const grouped = groups.get(local);
96448
- container[serKey] = grouped.length === 1 ? grouped[0] : grouped;
96948
+ container2[serKey] = grouped.length === 1 ? grouped[0] : grouped;
96449
96949
  applyGroupAxisReferences(
96450
- container,
96950
+ container2,
96451
96951
  series.filter((_item, index) => resolved[index] === local),
96452
96952
  axes,
96453
96953
  getLocalName2
96454
96954
  );
96455
- normalizeChartContainerChildren(container, local, getLocalName2);
96456
- orderChartContainerChildren(container, local, getLocalName2);
96457
- newEntries.push([`c:${local}`, container]);
96955
+ normalizeChartContainerChildren(container2, local, getLocalName2);
96956
+ orderChartContainerChildren(container2, local, getLocalName2);
96957
+ newEntries.push([`c:${local}`, container2]);
96458
96958
  }
96459
96959
  entries.splice(at2, 1, ...newEntries);
96460
96960
  for (const k of keys) {
@@ -96465,7 +96965,7 @@ function applyComboSeriesTypesToXml(plotArea, originalKey, series, chartLevelTyp
96465
96965
  }
96466
96966
  return true;
96467
96967
  }
96468
- function applyGroupAxisReferences(container, series, axes, getLocalName2) {
96968
+ function applyGroupAxisReferences(container2, series, axes, getLocalName2) {
96469
96969
  const axisIds = new Set(series.map((item) => item.axisId).filter((id) => id !== void 0));
96470
96970
  if (axisIds.size !== 1) {
96471
96971
  return;
@@ -96476,8 +96976,8 @@ function applyGroupAxisReferences(container, series, axes, getLocalName2) {
96476
96976
  if (valueAxisId === void 0 || categoryAxisId === void 0) {
96477
96977
  return;
96478
96978
  }
96479
- const key2 = findKey22(container, "axId", getLocalName2) ?? "c:axId";
96480
- container[key2] = [{ "@_val": String(categoryAxisId) }, { "@_val": String(valueAxisId) }];
96979
+ const key2 = findKey22(container2, "axId", getLocalName2) ?? "c:axId";
96980
+ container2[key2] = [{ "@_val": String(categoryAxisId) }, { "@_val": String(valueAxisId) }];
96481
96981
  }
96482
96982
  var init_chart_combo_serializer = __esm({
96483
96983
  "src/pptx/core/utils/chart-combo-serializer.ts"() {
@@ -96530,8 +97030,8 @@ function buildFilteredSerNode(entry, categories) {
96530
97030
  }
96531
97031
  return node;
96532
97032
  }
96533
- function filteredSeriesUnchanged(container, filteredSeries, xmlLookup) {
96534
- const existing = parseFilteredSeries(container, xmlLookup);
97033
+ function filteredSeriesUnchanged(container2, filteredSeries, xmlLookup) {
97034
+ const existing = parseFilteredSeries(container2, xmlLookup);
96535
97035
  if (!filteredSeries || filteredSeries.length === 0) {
96536
97036
  return !existing || existing.length === 0;
96537
97037
  }
@@ -96543,9 +97043,9 @@ function filteredSeriesUnchanged(container, filteredSeries, xmlLookup) {
96543
97043
  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);
96544
97044
  });
96545
97045
  }
96546
- function applyFilteredSeriesToXml(container, filteredSeries, categories, containerLocalName, getLocalName2) {
96547
- const extLstKey = findKey23(container, "extLst", getLocalName2) ?? "c:extLst";
96548
- const extLst = { ...container[extLstKey] ?? {} };
97046
+ function applyFilteredSeriesToXml(container2, filteredSeries, categories, containerLocalName, getLocalName2) {
97047
+ const extLstKey = findKey23(container2, "extLst", getLocalName2) ?? "c:extLst";
97048
+ const extLst = { ...container2[extLstKey] ?? {} };
96549
97049
  const extKey = findKey23(extLst, "ext", getLocalName2);
96550
97050
  const exts = extKey ? Array.isArray(extLst[extKey]) ? [...extLst[extKey]] : [extLst[extKey]] : [];
96551
97051
  const otherExts = exts.filter((ext) => ext["@_uri"] !== CHART_FILTERED_SERIES_EXT_URI);
@@ -96570,11 +97070,11 @@ function applyFilteredSeriesToXml(container, filteredSeries, categories, contain
96570
97070
  );
96571
97071
  const newExts = ownExtHasContent ? [...otherExts, ownExt] : otherExts;
96572
97072
  if (newExts.length === 0) {
96573
- delete container[extLstKey];
97073
+ delete container2[extLstKey];
96574
97074
  return;
96575
97075
  }
96576
97076
  extLst[extKey ?? "c:ext"] = newExts.length === 1 ? newExts[0] : newExts;
96577
- container[extLstKey] = extLst;
97077
+ container2[extLstKey] = extLst;
96578
97078
  }
96579
97079
  var init_chart_filtered_series_writer = __esm({
96580
97080
  "src/pptx/core/utils/chart-filtered-series-writer.ts"() {
@@ -97376,11 +97876,11 @@ var init_chart_title_style_serializer = __esm({
97376
97876
  };
97377
97877
  }
97378
97878
  });
97379
- function collectChartWorkbookWrite(xmlLookupService, container, isNumeric, values) {
97380
- if (!container) {
97879
+ function collectChartWorkbookWrite(xmlLookupService, container2, isNumeric, values) {
97880
+ if (!container2) {
97381
97881
  return void 0;
97382
97882
  }
97383
- const refNode = xmlLookupService.getChildByLocalName(container, isNumeric ? "numRef" : "strRef");
97883
+ const refNode = xmlLookupService.getChildByLocalName(container2, isNumeric ? "numRef" : "strRef");
97384
97884
  const formula = refNode ? xmlLookupService.getScalarChildByLocalName(refNode, "f") : void 0;
97385
97885
  return formula ? { formula, isNumeric, values } : void 0;
97386
97886
  }
@@ -98143,12 +98643,12 @@ function applyPicAltText(node, altText) {
98143
98643
  }
98144
98644
  function applyChildXfrmToRawNode(node, off, ext) {
98145
98645
  const spPrKey = findChildKey2(node, "spPr");
98146
- const container = spPrKey ? node[spPrKey] ?? node : node;
98147
- const xfrmKey = findChildKey2(container, "xfrm");
98646
+ const container2 = spPrKey ? node[spPrKey] ?? node : node;
98647
+ const xfrmKey = findChildKey2(container2, "xfrm");
98148
98648
  if (!xfrmKey) {
98149
98649
  return;
98150
98650
  }
98151
- const xfrm = container[xfrmKey];
98651
+ const xfrm = container2[xfrmKey];
98152
98652
  const offKey = findChildKey2(xfrm, "off") ?? "a:off";
98153
98653
  const extKey = findChildKey2(xfrm, "ext") ?? "a:ext";
98154
98654
  xfrm[offKey] = { "@_x": String(Math.round(off.x)), "@_y": String(Math.round(off.y)) };
@@ -98156,13 +98656,13 @@ function applyChildXfrmToRawNode(node, off, ext) {
98156
98656
  }
98157
98657
  function applyRotationFlipToRawNode(node, rotation, flipH, flipV) {
98158
98658
  const spPrKey = findChildKey2(node, "spPr");
98159
- const container = spPrKey ? node[spPrKey] ?? node : node;
98160
- const xfrmKey = findChildKey2(container, "xfrm");
98659
+ const container2 = spPrKey ? node[spPrKey] ?? node : node;
98660
+ const xfrmKey = findChildKey2(container2, "xfrm");
98161
98661
  const hasAny = Boolean(rotation) || Boolean(flipH) || Boolean(flipV);
98162
98662
  if (!xfrmKey && !hasAny) {
98163
98663
  return;
98164
98664
  }
98165
- const xfrm = xfrmKey ? container[xfrmKey] : {};
98665
+ const xfrm = xfrmKey ? container2[xfrmKey] : {};
98166
98666
  if (rotation) {
98167
98667
  xfrm["@_rot"] = String(Math.round(rotation * 6e4));
98168
98668
  } else {
@@ -98178,9 +98678,9 @@ function applyRotationFlipToRawNode(node, rotation, flipH, flipV) {
98178
98678
  } else {
98179
98679
  delete xfrm["@_flipV"];
98180
98680
  }
98181
- container[xfrmKey ?? "a:xfrm"] = xfrm;
98681
+ container2[xfrmKey ?? "a:xfrm"] = xfrm;
98182
98682
  if (spPrKey) {
98183
- node[spPrKey] = container;
98683
+ node[spPrKey] = container2;
98184
98684
  }
98185
98685
  }
98186
98686
  var init_chart_user_shapes_raw_patch = __esm({
@@ -98530,8 +99030,8 @@ var init_placeholder_remap = __esm({
98530
99030
 
98531
99031
  // src/pptx/core/utils/placeholder-xml.ts
98532
99032
  function findNonVisualProps(rawXml) {
98533
- for (const container of ["p:nvSpPr", "p:nvPicPr", "p:nvGraphicFramePr"]) {
98534
- const parent = rawXml[container];
99033
+ for (const container2 of ["p:nvSpPr", "p:nvPicPr", "p:nvGraphicFramePr"]) {
99034
+ const parent = rawXml[container2];
98535
99035
  const nvPr = parent?.["p:nvPr"];
98536
99036
  if (nvPr) {
98537
99037
  return nvPr;
@@ -101422,9 +101922,9 @@ var init_PptxHandlerRuntimeElementActions = __esm({
101422
101922
  }
101423
101923
  return;
101424
101924
  }
101425
- const container = existing ?? resolveLockContainerNode(shape, spec, true);
101426
- if (container) {
101427
- container[spec.lockTag] = next;
101925
+ const container2 = existing ?? resolveLockContainerNode(shape, spec, true);
101926
+ if (container2) {
101927
+ container2[spec.lockTag] = next;
101428
101928
  }
101429
101929
  }
101430
101930
  };
@@ -101931,8 +102431,8 @@ var init_PptxHandlerRuntimeMediaTimingParsing = __esm({
101931
102431
  if (cTn) {
101932
102432
  const childTnLst = cTn["p:childTnLst"];
101933
102433
  if (childTnLst) {
101934
- for (const container of ["p:par", "p:seq", "p:excl"]) {
101935
- const children14 = this.ensureArray(childTnLst[container]);
102434
+ for (const container2 of ["p:par", "p:seq", "p:excl"]) {
102435
+ const children14 = this.ensureArray(childTnLst[container2]);
101936
102436
  for (const child27 of children14) {
101937
102437
  this.walkMediaTimingTree(child27, result, slidePath);
101938
102438
  }
@@ -101940,8 +102440,8 @@ var init_PptxHandlerRuntimeMediaTimingParsing = __esm({
101940
102440
  this.walkMediaTimingTree(childTnLst, result, slidePath);
101941
102441
  }
101942
102442
  }
101943
- for (const container of ["p:par", "p:seq", "p:excl", "p:tnLst"]) {
101944
- const children14 = this.ensureArray(node[container]);
102443
+ for (const container2 of ["p:par", "p:seq", "p:excl", "p:tnLst"]) {
102444
+ const children14 = this.ensureArray(node[container2]);
101945
102445
  for (const child27 of children14) {
101946
102446
  this.walkMediaTimingTree(child27, result, slidePath);
101947
102447
  }
@@ -103106,8 +103606,8 @@ var init_PptxHandlerRuntimePresentationProps = __esm({
103106
103606
  * `<a:noFill/>` parses to the empty STRING, so presence - not truthiness -
103107
103607
  * has to decide.
103108
103608
  */
103109
- parseChartContainerFill(container) {
103110
- const shapeProperties = this.xmlLookupService.getChildByLocalName(container, "spPr");
103609
+ parseChartContainerFill(container2) {
103610
+ const shapeProperties = this.xmlLookupService.getChildByLocalName(container2, "spPr");
103111
103611
  if (!shapeProperties) {
103112
103612
  return void 0;
103113
103613
  }
@@ -109031,10 +109531,10 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
109031
109531
  if (!local.endsWith("Chart")) {
109032
109532
  continue;
109033
109533
  }
109034
- const container = plotArea[key2];
109035
- if (container) {
109534
+ const container2 = plotArea[key2];
109535
+ if (container2) {
109036
109536
  orderChartContainerChildren(
109037
- container,
109537
+ container2,
109038
109538
  local,
109039
109539
  (k) => this.compatibilityService.getXmlLocalName(k)
109040
109540
  );
@@ -109113,8 +109613,8 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
109113
109613
  * when the container has no formula reference (e.g. a brand-new series
109114
109614
  * built without one), so it is always safe to call.
109115
109615
  */
109116
- pushChartWorkbookWrite(workbookWrites, container, isNumeric, values) {
109117
- const write = collectChartWorkbookWrite(this.xmlLookupService, container, isNumeric, values);
109616
+ pushChartWorkbookWrite(workbookWrites, container2, isNumeric, values) {
109617
+ const write = collectChartWorkbookWrite(this.xmlLookupService, container2, isNumeric, values);
109118
109618
  if (write) {
109119
109619
  workbookWrites.push(write);
109120
109620
  }
@@ -109123,17 +109623,17 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
109123
109623
  * Update the cached point values in a chart reference node
109124
109624
  * (numRef/strRef or numLit/strLit).
109125
109625
  */
109126
- updateChartCacheValues(container, isNumeric, values) {
109626
+ updateChartCacheValues(container2, isNumeric, values) {
109127
109627
  const refName = isNumeric ? "numRef" : "strRef";
109128
109628
  const litName = isNumeric ? "numLit" : "strLit";
109129
109629
  const cacheName = isNumeric ? "numCache" : "strCache";
109130
- const refNode = this.xmlLookupService.getChildByLocalName(container, refName) || this.xmlLookupService.getChildByLocalName(container, litName);
109630
+ const refNode = this.xmlLookupService.getChildByLocalName(container2, refName) || this.xmlLookupService.getChildByLocalName(container2, litName);
109131
109631
  if (!refNode) {
109132
- const literalKey = Object.keys(container).find(
109632
+ const literalKey = Object.keys(container2).find(
109133
109633
  (key2) => this.compatibilityService.getXmlLocalName(key2) === "v"
109134
109634
  );
109135
109635
  if (literalKey && values.length === 1) {
109136
- container[literalKey] = values[0];
109636
+ container2[literalKey] = values[0];
109137
109637
  }
109138
109638
  return;
109139
109639
  }
@@ -116385,9 +116885,9 @@ function rememberTemplateSpTreePositions(runtime, partPath, spTree, positionOf)
116385
116885
  }
116386
116886
  byPart.set(partPath, positions);
116387
116887
  }
116388
- function withReplacedChild(container, tag, indexInType, replacement) {
116389
- const existing = container[tag];
116390
- const next = { ...container };
116888
+ function withReplacedChild(container2, tag, indexInType, replacement) {
116889
+ const existing = container2[tag];
116890
+ const next = { ...container2 };
116391
116891
  if (Array.isArray(existing)) {
116392
116892
  const siblings = [...existing];
116393
116893
  siblings[indexInType] = replacement;
@@ -116397,8 +116897,8 @@ function withReplacedChild(container, tag, indexInType, replacement) {
116397
116897
  }
116398
116898
  return next;
116399
116899
  }
116400
- function orderContainer(container, plan, getLocalName2) {
116401
- let working = container;
116900
+ function orderContainer(container2, plan, getLocalName2) {
116901
+ let working = container2;
116402
116902
  for (const entry of plan) {
116403
116903
  if (entry.children.length === 0) {
116404
116904
  continue;
@@ -120614,8 +121114,8 @@ function asRuns(value) {
120614
121114
  function withSplit(authored, inherited) {
120615
121115
  return { ...inherited, ...authored, authoredRunStyle: authored, inheritedRunStyle: inherited };
120616
121116
  }
120617
- function readRuns(container, extract) {
120618
- const runs = asRuns(container?.["a:r"]);
121117
+ function readRuns(container2, extract) {
121118
+ const runs = asRuns(container2?.["a:r"]);
120619
121119
  const text2 = runs.map((run) => run["a:t"] !== void 0 ? xmlText(run["a:t"]) ?? "" : "").join("");
120620
121120
  const first = runs[0];
120621
121121
  return {
@@ -122112,8 +122612,8 @@ var init_PptxHandlerRuntimeSpTreeParsing = __esm({
122112
122612
  * so the save layer can re-emit the original `<mc:Choice>` /
122113
122613
  * `<mc:Fallback>` shape on dirty save (CC-4).
122114
122614
  */
122115
- unwrapAlternateContent(container) {
122116
- const blocks = unwrapAlternateContent(container);
122615
+ unwrapAlternateContent(container2) {
122616
+ const blocks = unwrapAlternateContent(container2);
122117
122617
  for (const block of blocks) {
122118
122618
  for (const ref of block.childRefs) {
122119
122619
  this.alternateContentBlockByRawXml.set(ref.node, block);
@@ -127198,17 +127698,17 @@ var init_PptxHandlerRuntimeSmartArtParsing = __esm({
127198
127698
  // src/pptx/core/core/runtime/smartart-drawing-blip.ts
127199
127699
  function collectDrawingShapeNodes(root, getChildren) {
127200
127700
  const out = [];
127201
- const walk3 = (container) => {
127202
- if (!container) {
127701
+ const walk3 = (container2) => {
127702
+ if (!container2) {
127203
127703
  return;
127204
127704
  }
127205
- for (const sp of getChildren(container, "sp")) {
127705
+ for (const sp of getChildren(container2, "sp")) {
127206
127706
  out.push({ node: sp, isPic: false });
127207
127707
  }
127208
- for (const pic of getChildren(container, "pic")) {
127708
+ for (const pic of getChildren(container2, "pic")) {
127209
127709
  out.push({ node: pic, isPic: true });
127210
127710
  }
127211
- for (const grp of getChildren(container, "grpSp")) {
127711
+ for (const grp of getChildren(container2, "grpSp")) {
127212
127712
  walk3(grp);
127213
127713
  }
127214
127714
  };
@@ -128717,13 +129217,13 @@ var init_PptxHandlerRuntimeChartParsing = __esm({
128717
129217
  let filteredSeriesTitle;
128718
129218
  let filteredCategoryTitle;
128719
129219
  for (const containerKey of containerKeys) {
128720
- const container = plotArea[containerKey];
128721
- const seriesList = this.xmlLookupService.getChildrenArrayByLocalName(container, "ser");
128722
- const containerFilteredSeries = parseFilteredSeries(container, this.xmlLookupService);
129220
+ const container2 = plotArea[containerKey];
129221
+ const seriesList = this.xmlLookupService.getChildrenArrayByLocalName(container2, "ser");
129222
+ const containerFilteredSeries = parseFilteredSeries(container2, this.xmlLookupService);
128723
129223
  if (containerFilteredSeries) {
128724
129224
  filteredSeries = [...filteredSeries ?? [], ...containerFilteredSeries];
128725
129225
  }
128726
- const containerFilteredTitles = parseFilteredTitles(container, this.xmlLookupService);
129226
+ const containerFilteredTitles = parseFilteredTitles(container2, this.xmlLookupService);
128727
129227
  if (containerFilteredTitles?.seriesTitle && filteredSeriesTitle === void 0) {
128728
129228
  filteredSeriesTitle = containerFilteredTitles.seriesTitle;
128729
129229
  }
@@ -128750,7 +129250,7 @@ var init_PptxHandlerRuntimeChartParsing = __esm({
128750
129250
  this.compatibilityService.getXmlLocalName(containerKey)
128751
129251
  );
128752
129252
  const containerType = isCombo ? resolvedContainerType : void 0;
128753
- const axisId = resolveChartContainerValueAxisId(container, axes ?? [], this.xmlLookupService);
129253
+ const axisId = resolveChartContainerValueAxisId(container2, axes ?? [], this.xmlLookupService);
128754
129254
  series.push(
128755
129255
  ...this.buildChartSeries(
128756
129256
  seriesList,
@@ -128788,8 +129288,8 @@ var init_PptxHandlerRuntimeChartParsing = __esm({
128788
129288
  * Read a numeric `@val` from a named child of a chart-type container.
128789
129289
  * Returns `undefined` when the child or its `@val` is absent/non-finite.
128790
129290
  */
128791
- parseChartNumberVal(container, localName28) {
128792
- const node = this.xmlLookupService.getChildByLocalName(container, localName28);
129291
+ parseChartNumberVal(container2, localName28) {
129292
+ const node = this.xmlLookupService.getChildByLocalName(container2, localName28);
128793
129293
  const raw = node?.["@_val"];
128794
129294
  if (raw === void 0 || raw === null || raw === "") {
128795
129295
  return void 0;
@@ -128802,8 +129302,8 @@ var init_PptxHandlerRuntimeChartParsing = __esm({
128802
129302
  * A present element with no `@val` follows the OOXML `CT_Boolean` default
128803
129303
  * of `true`; `undefined` when the child is absent.
128804
129304
  */
128805
- parseChartBoolVal(container, localName28) {
128806
- const node = this.xmlLookupService.getChildByLocalName(container, localName28);
129305
+ parseChartBoolVal(container2, localName28) {
129306
+ const node = this.xmlLookupService.getChildByLocalName(container2, localName28);
128807
129307
  if (!node) {
128808
129308
  return void 0;
128809
129309
  }
@@ -129473,7 +129973,7 @@ var init_PptxHandlerRuntimeLoadSession = __esm({
129473
129973
  init_ole_embedded_extract();
129474
129974
  init_ole_utils();
129475
129975
  init_signature_detection();
129476
- init_types3();
129976
+ init_types4();
129477
129977
  init_authored_slide_background();
129478
129978
  init_bullet_picture_image_enrichment();
129479
129979
  init_PptxHandlerRuntimeEmbeddedFonts();
@@ -130985,14 +131485,14 @@ var init_text_atoms = __esm({
130985
131485
  function readCString(view, rec) {
130986
131486
  return decodeTextChars(view, rec.dataOffset, rec.recLen);
130987
131487
  }
130988
- function parseExHyperlinkContainer(view, container) {
130989
- const atom2 = findChild4(view, container, RT.ExternalHyperlinkAtom);
131488
+ function parseExHyperlinkContainer(view, container2) {
131489
+ const atom2 = findChild4(view, container2, RT.ExternalHyperlinkAtom);
130990
131490
  if (!atom2 || atom2.recLen < 4) {
130991
131491
  return void 0;
130992
131492
  }
130993
131493
  const id = view.getUint32(atom2.dataOffset, true);
130994
131494
  const strings2 = {};
130995
- for (const child27 of iterateChildren(view, container)) {
131495
+ for (const child27 of iterateChildren(view, container2)) {
130996
131496
  if (child27.recType !== RT.CString) {
130997
131497
  continue;
130998
131498
  }
@@ -131252,14 +131752,14 @@ var init_persist_directory2 = __esm({
131252
131752
  function readCString2(view, rec) {
131253
131753
  return decodeTextChars(view, rec.dataOffset, rec.recLen);
131254
131754
  }
131255
- function parseOleEmbedContainer(view, container) {
131256
- const atom2 = findChild4(view, container, RT.ExternalOleObjectAtom);
131755
+ function parseOleEmbedContainer(view, container2) {
131756
+ const atom2 = findChild4(view, container2, RT.ExternalOleObjectAtom);
131257
131757
  if (!atom2 || atom2.recLen < 24) {
131258
131758
  return void 0;
131259
131759
  }
131260
131760
  const exObjId = view.getUint32(atom2.dataOffset + 8, true);
131261
131761
  const persistIdRef = view.getUint32(atom2.dataOffset + 16, true);
131262
- const progIdRec = findChild4(view, container, RT.CString, 2);
131762
+ const progIdRec = findChild4(view, container2, RT.CString, 2);
131263
131763
  const progId = progIdRec ? readCString2(view, progIdRec) : void 0;
131264
131764
  return { exObjId, ref: { persistIdRef, progId } };
131265
131765
  }
@@ -131921,7 +132421,7 @@ function arrowType(value) {
131921
132421
  return ARROW_MAP[value] ?? "triangle";
131922
132422
  }
131923
132423
  var OPT2, DASH_MAP, ARROW_MAP;
131924
- var init_properties = __esm({
132424
+ var init_properties2 = __esm({
131925
132425
  "src/pptx/core/ppt/escher/properties.ts"() {
131926
132426
  OPT2 = {
131927
132427
  rotation: 4,
@@ -132080,14 +132580,14 @@ var init_shape_props = __esm({
132080
132580
  init_color_scheme2();
132081
132581
  init_record_types2();
132082
132582
  init_geometry_map();
132083
- init_properties();
132583
+ init_properties2();
132084
132584
  GRADIENT_FILL_TYPES = /* @__PURE__ */ new Set([4, 5, 6, 7, 8]);
132085
132585
  }
132086
132586
  });
132087
132587
 
132088
132588
  // src/pptx/core/ppt/escher/sp-container.ts
132089
- function parseShape2(ctx, container) {
132090
- const fsp = findChild4(ctx.view, container, OA.FSP);
132589
+ function parseShape2(ctx, container2) {
132590
+ const fsp = findChild4(ctx.view, container2, OA.FSP);
132091
132591
  if (!fsp || fsp.recLen < 8) {
132092
132592
  return void 0;
132093
132593
  }
@@ -132096,10 +132596,10 @@ function parseShape2(ctx, container) {
132096
132596
  if (flags & FSP_FLAG_DELETED) {
132097
132597
  return void 0;
132098
132598
  }
132099
- const optRec = findChild4(ctx.view, container, OA.FOPT);
132599
+ const optRec = findChild4(ctx.view, container2, OA.FOPT);
132100
132600
  const props = optRec ? parseProperties(ctx.view, ctx.data, optRec) : { values: /* @__PURE__ */ new Map(), complex: /* @__PURE__ */ new Map() };
132101
- const anchorRec = findChild4(ctx.view, container, OA.ClientAnchor);
132102
- const childAnchorRec = findChild4(ctx.view, container, OA.ChildAnchor);
132601
+ const anchorRec = findChild4(ctx.view, container2, OA.ClientAnchor);
132602
+ const childAnchorRec = findChild4(ctx.view, container2, OA.ChildAnchor);
132103
132603
  const anchor = anchorRec ? readClientAnchor(ctx.view, anchorRec) : childAnchorRec ? readChildAnchor(ctx.view, childAnchorRec) : void 0;
132104
132604
  const namePayload = props.complex.get(OPT2.wzName);
132105
132605
  const name = namePayload ? decodeComplexString(namePayload) : void 0;
@@ -132107,7 +132607,7 @@ function parseShape2(ctx, container) {
132107
132607
  const rotationDeg = rotationRaw !== void 0 ? rotationToDegrees(rotationRaw) : void 0;
132108
132608
  const flipH = (flags & FSP_FLAG_FLIPH2) !== 0 ? true : void 0;
132109
132609
  const flipV = (flags & FSP_FLAG_FLIPV2) !== 0 ? true : void 0;
132110
- const clientData = findChild4(ctx.view, container, OA.ClientData);
132610
+ const clientData = findChild4(ctx.view, container2, OA.ClientData);
132111
132611
  const actionClick = clientData ? resolveShapeInteractiveInfo(ctx.view, clientData, ctx.hyperlinkStrings) : void 0;
132112
132612
  const pib = props.values.get(OPT2.pib);
132113
132613
  if (pib !== void 0 && pib > 0) {
@@ -132161,7 +132661,7 @@ function parseShape2(ctx, container) {
132161
132661
  shape.placeholderType = placeholderType;
132162
132662
  }
132163
132663
  }
132164
- const clientTextbox2 = findChild4(ctx.view, container, OA.ClientTextbox);
132664
+ const clientTextbox2 = findChild4(ctx.view, container2, OA.ClientTextbox);
132165
132665
  if (clientTextbox2) {
132166
132666
  const text2 = extractText(ctx, clientTextbox2);
132167
132667
  if (text2 && text2.paragraphs.some((p) => p.runs.length > 0)) {
@@ -132173,11 +132673,11 @@ function parseShape2(ctx, container) {
132173
132673
  }
132174
132674
  return shape;
132175
132675
  }
132176
- function parseGroup(ctx, container) {
132676
+ function parseGroup(ctx, container2) {
132177
132677
  const children14 = [];
132178
132678
  let groupShape;
132179
132679
  let first = true;
132180
- for (const child27 of iterateChildren(ctx.view, container)) {
132680
+ for (const child27 of iterateChildren(ctx.view, container2)) {
132181
132681
  if (child27.recType === OA.SpContainer && first) {
132182
132682
  groupShape = child27;
132183
132683
  first = false;
@@ -132247,8 +132747,8 @@ function parseDrawing(ctx, dgContainer) {
132247
132747
  }
132248
132748
  return result;
132249
132749
  }
132250
- function extractBackground(ctx, container) {
132251
- const fsp = findChild4(ctx.view, container, OA.FSP);
132750
+ function extractBackground(ctx, container2) {
132751
+ const fsp = findChild4(ctx.view, container2, OA.FSP);
132252
132752
  if (!fsp || fsp.recLen < 8) {
132253
132753
  return void 0;
132254
132754
  }
@@ -132256,7 +132756,7 @@ function extractBackground(ctx, container) {
132256
132756
  if ((flags & FSP_FLAG_BACKGROUND2) === 0 || (flags & FSP_FLAG_GROUP2) !== 0) {
132257
132757
  return void 0;
132258
132758
  }
132259
- const optRec = findChild4(ctx.view, container, OA.FOPT);
132759
+ const optRec = findChild4(ctx.view, container2, OA.FOPT);
132260
132760
  if (!optRec) {
132261
132761
  return ctx.scheme[0];
132262
132762
  }
@@ -132273,7 +132773,7 @@ var init_sp_container = __esm({
132273
132773
  init_record_types2();
132274
132774
  init_client_data_extract();
132275
132775
  init_geometry_map();
132276
- init_properties();
132776
+ init_properties2();
132277
132777
  init_shape_props();
132278
132778
  FSP_FLAG_GROUP2 = 1;
132279
132779
  FSP_FLAG_DELETED = 8;
@@ -132284,22 +132784,22 @@ var init_sp_container = __esm({
132284
132784
  });
132285
132785
 
132286
132786
  // src/pptx/core/ppt/slide-parser.ts
132287
- function parseSlideContainer(inputs, container) {
132787
+ function parseSlideContainer(inputs, container2) {
132288
132788
  const { view, data, fonts } = inputs;
132289
132789
  let followMasterBackground = true;
132290
132790
  let followMasterScheme = true;
132291
132791
  let followMasterObjects = true;
132292
- const slideAtom = findChild4(view, container, RT.SlideAtom);
132792
+ const slideAtom = findChild4(view, container2, RT.SlideAtom);
132293
132793
  if (slideAtom && slideAtom.recLen >= 24) {
132294
132794
  const flags = view.getUint16(slideAtom.dataOffset + 20, true);
132295
132795
  followMasterObjects = (flags & SLIDE_FLAG_MASTER_OBJECTS2) !== 0;
132296
132796
  followMasterScheme = (flags & SLIDE_FLAG_MASTER_SCHEME2) !== 0;
132297
132797
  followMasterBackground = (flags & SLIDE_FLAG_MASTER_BACKGROUND2) !== 0;
132298
132798
  }
132299
- const ownScheme = findSchemeColors(view, container);
132799
+ const ownScheme = findSchemeColors(view, container2);
132300
132800
  const scheme = followMasterScheme ? inputs.masterScheme : ownScheme ?? inputs.masterScheme;
132301
132801
  const slide = { followMasterBackground, followMasterObjects, shapes: [] };
132302
- const drawing = findChild4(view, container, RT.Drawing);
132802
+ const drawing = findChild4(view, container2, RT.Drawing);
132303
132803
  if (drawing) {
132304
132804
  const dgContainer = findDescendant(view, drawing, OA.DgContainer);
132305
132805
  if (dgContainer) {
@@ -132322,12 +132822,12 @@ function parseSlideContainer(inputs, container) {
132322
132822
  }
132323
132823
  return slide;
132324
132824
  }
132325
- function parseMasterContainer(view, data, fonts, fallbackScheme, container, hyperlinkStrings, oleExObjIds) {
132326
- const scheme = findSchemeColors(view, container);
132825
+ function parseMasterContainer(view, data, fonts, fallbackScheme, container2, hyperlinkStrings, oleExObjIds) {
132826
+ const scheme = findSchemeColors(view, container2);
132327
132827
  const active = scheme ?? fallbackScheme;
132328
132828
  let backgroundRgb;
132329
132829
  let shapes = [];
132330
- const drawing = findChild4(view, container, RT.Drawing);
132830
+ const drawing = findChild4(view, container2, RT.Drawing);
132331
132831
  if (drawing) {
132332
132832
  const dgContainer = findDescendant(view, drawing, OA.DgContainer);
132333
132833
  if (dgContainer) {
@@ -132347,7 +132847,7 @@ function parseMasterContainer(view, data, fonts, fallbackScheme, container, hype
132347
132847
  );
132348
132848
  }
132349
132849
  }
132350
- return { scheme, backgroundRgb, shapes, container };
132850
+ return { scheme, backgroundRgb, shapes, container: container2 };
132351
132851
  }
132352
132852
  var SLIDE_FLAG_MASTER_OBJECTS2, SLIDE_FLAG_MASTER_SCHEME2, SLIDE_FLAG_MASTER_BACKGROUND2;
132353
132853
  var init_slide_parser = __esm({
@@ -132498,11 +132998,11 @@ function findBStore(view, docContainer) {
132498
132998
  }
132499
132999
  return findDescendant(view, drawingGroup, OA.BStoreContainer);
132500
133000
  }
132501
- async function parseDeck(streams) {
132502
- const data = streams.powerPointDocument;
133001
+ async function parseDeck(streams2) {
133002
+ const data = streams2.powerPointDocument;
132503
133003
  const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
132504
- const { currentEdit, directory } = buildPersistDirectory(view, streams.offsetToCurrentEdit);
132505
- if (currentEdit.encryptSessionPersistIdRef !== void 0 && currentEdit.encryptSessionPersistIdRef !== 0 && !streams.decrypted) {
133004
+ const { currentEdit, directory } = buildPersistDirectory(view, streams2.offsetToCurrentEdit);
133005
+ if (currentEdit.encryptSessionPersistIdRef !== void 0 && currentEdit.encryptSessionPersistIdRef !== 0 && !streams2.decrypted) {
132506
133006
  throw new EncryptedPptError();
132507
133007
  }
132508
133008
  const docOffset = directory.get(currentEdit.docPersistIdRef);
@@ -132589,7 +133089,7 @@ async function parseDeck(streams) {
132589
133089
  }
132590
133090
  const bstoreRec = findBStore(view, docContainer);
132591
133091
  const pictures = await parsePictures(
132592
- streams.pictures,
133092
+ streams2.pictures,
132593
133093
  bstoreRec ? { view, rec: bstoreRec } : void 0
132594
133094
  );
132595
133095
  const usedExObjIds = /* @__PURE__ */ new Set();
@@ -132638,6 +133138,20 @@ var init_document_parser = __esm({
132638
133138
  }
132639
133139
  });
132640
133140
 
133141
+ // src/pptx/core/utils/ooxml-crypto-errors.ts
133142
+ var init_ooxml_crypto_errors = __esm({
133143
+ "src/pptx/core/utils/ooxml-crypto-errors.ts"() {
133144
+ init_errors();
133145
+ }
133146
+ });
133147
+
133148
+ // src/pptx/core/utils/ooxml-crypto-key-derivation.ts
133149
+ var init_ooxml_crypto_key_derivation = __esm({
133150
+ "src/pptx/core/utils/ooxml-crypto-key-derivation.ts"() {
133151
+ init_encryption_info();
133152
+ }
133153
+ });
133154
+
132641
133155
  // src/pptx/core/ppt/rc4-cryptoapi-key.ts
132642
133156
  var init_rc4_cryptoapi_key2 = __esm({
132643
133157
  "src/pptx/core/ppt/rc4-cryptoapi-key.ts"() {
@@ -136385,12 +136899,12 @@ var SlideProcessor = class {
136385
136899
  if (positionedCells.length === 0) {
136386
136900
  return [];
136387
136901
  }
136388
- const container = [
136902
+ const container2 = [
136389
136903
  `<div style="position:relative;width:${displayW}px;height:${displayH}px;border:1px solid #e5e7eb;overflow:hidden;margin:0.5em 0">`,
136390
136904
  ...positionedCells,
136391
136905
  "</div>"
136392
136906
  ].join("\n");
136393
- return [container];
136907
+ return [container2];
136394
136908
  }
136395
136909
  /** Sorts elements into natural reading order (top-to-bottom, left-to-right). */
136396
136910
  sortElementsByReadingOrder(elements) {