ooxml-core 1.27.1 → 1.28.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 (72) hide show
  1. package/dist/{PptxHandler-OIR3ZY4Q.mjs → PptxHandler-AFVUHNJO.mjs} +3 -3
  2. package/dist/PptxHandler-EZW4YAWL.mjs +4 -0
  3. package/dist/{PptxHandler-NHOKKZ4S.cjs → PptxHandler-WI23AJHM.cjs} +3 -3
  4. package/dist/{PresentationBuilder-RFTSZUPR.mjs → PresentationBuilder-DYEHCRHX.mjs} +2 -2
  5. package/dist/{PresentationBuilder-EX6DAE5X.cjs → PresentationBuilder-KUNPJTRL.cjs} +5 -5
  6. package/dist/{PresentationBuilder-X5WFSHLB.mjs → PresentationBuilder-WGTZPVOG.mjs} +3 -3
  7. package/dist/automation/index.cjs +16 -7
  8. package/dist/automation/index.mjs +16 -7
  9. package/dist/chart/index.cjs +16 -7
  10. package/dist/chart/index.mjs +16 -7
  11. package/dist/{chunk-36TR3PER.cjs → chunk-A2PC3CBO.cjs} +28 -7
  12. package/dist/{chunk-ZWTXVWMY.mjs → chunk-D7CAHL6J.mjs} +1 -1
  13. package/dist/{chunk-JJ37PCNR.mjs → chunk-EYCM7RVL.mjs} +28 -7
  14. package/dist/{chunk-DMJIDRJE.cjs → chunk-IQ7CB7BJ.cjs} +1771 -1319
  15. package/dist/{chunk-5NJPYCGO.mjs → chunk-LGSBK3BV.mjs} +258 -258
  16. package/dist/{chunk-I57SMSU6.mjs → chunk-LNPVKKR5.mjs} +28 -7
  17. package/dist/{chunk-GZ4DIXZZ.mjs → chunk-N5ROEHEQ.mjs} +699 -247
  18. package/dist/{chunk-QIMNQDON.mjs → chunk-RCEHCVLC.mjs} +1 -1
  19. package/dist/{chunk-BXZF7H5G.mjs → chunk-V33RUK4D.mjs} +5 -5
  20. package/dist/{chunk-5KJAQKZG.mjs → chunk-YNGMSNF4.mjs} +718 -246
  21. package/dist/docx/embedded.cjs +16 -7
  22. package/dist/docx/embedded.mjs +16 -7
  23. package/dist/docx/index.cjs +16 -7
  24. package/dist/docx/index.mjs +16 -7
  25. package/dist/docx/load/index.cjs +16 -7
  26. package/dist/docx/load/index.mjs +16 -7
  27. package/dist/index.cjs +16 -7
  28. package/dist/index.mjs +16 -7
  29. package/dist/opc/index.cjs +16 -7
  30. package/dist/opc/index.mjs +16 -7
  31. package/dist/opc/zip-limits.d.ts +8 -1
  32. package/dist/opc/zip-limits.d.ts.map +1 -1
  33. package/dist/pptx/automation/index.cjs +1009 -505
  34. package/dist/pptx/automation/index.d.ts +4 -4
  35. package/dist/pptx/automation/index.mjs +6 -6
  36. package/dist/pptx/chunks/{index-D8DNpc1X.d.ts → index-0slnMhMO.d.ts} +161 -12
  37. package/dist/pptx/chunks/index-0slnMhMO.d.ts.map +1 -0
  38. package/dist/pptx/chunks/{index-D4FnOx6x.d.ts → index-DP-R2qY1.d.ts} +3 -3
  39. package/dist/pptx/chunks/{index-D4FnOx6x.d.ts.map → index-DP-R2qY1.d.ts.map} +1 -1
  40. package/dist/pptx/chunks/{index-GWpMAY-f.d.ts → index-OQwOyNYK.d.ts} +4 -4
  41. package/dist/pptx/chunks/{index-GWpMAY-f.d.ts.map → index-OQwOyNYK.d.ts.map} +1 -1
  42. package/dist/pptx/chunks/{text-operations-CNfUj45U.d.ts → text-operations-dyvh8gyE.d.ts} +23 -1
  43. package/dist/pptx/chunks/{text-operations-CNfUj45U.d.ts.map → text-operations-dyvh8gyE.d.ts.map} +1 -1
  44. package/dist/pptx/cli/index.cjs +834 -333
  45. package/dist/pptx/cli/index.d.ts +1 -1
  46. package/dist/pptx/cli/index.mjs +5 -5
  47. package/dist/pptx/converter/index.d.ts +1 -1
  48. package/dist/pptx/converter/index.mjs +3 -3
  49. package/dist/pptx/editor/render/find-replace.cjs +14 -14
  50. package/dist/pptx/editor/render/find-replace.d.ts +2 -2
  51. package/dist/pptx/editor/render/find-replace.mjs +1 -1
  52. package/dist/pptx/editor/render/slide-operations.cjs +8 -8
  53. package/dist/pptx/editor/render/slide-operations.mjs +2 -2
  54. package/dist/pptx/index.cjs +1249 -726
  55. package/dist/pptx/index.d.ts +5 -5
  56. package/dist/pptx/index.mjs +6 -6
  57. package/dist/pptx/node/index.d.ts +1 -1
  58. package/dist/pptx/signature-node/index.cjs +28 -7
  59. package/dist/pptx/signature-node/index.mjs +2 -2
  60. package/dist/visio/index.cjs +14 -6
  61. package/dist/visio/index.mjs +14 -6
  62. package/dist/visio/ui/index.cjs +14 -6
  63. package/dist/visio/ui/index.mjs +14 -6
  64. package/dist/xlsx/index.cjs +14 -6
  65. package/dist/xlsx/index.mjs +14 -6
  66. package/dist/xlsx/load/index.cjs +14 -6
  67. package/dist/xlsx/load/index.mjs +14 -6
  68. package/dist/xlsx/ui/index.cjs +14 -6
  69. package/dist/xlsx/ui/index.mjs +14 -6
  70. package/package.json +5 -5
  71. package/dist/PptxHandler-TZJNIXPX.mjs +0 -4
  72. package/dist/pptx/chunks/index-D8DNpc1X.d.ts.map +0 -1
@@ -1,4 +1,4 @@
1
- import { openNestedZip, openPptxZip } from './chunk-JJ37PCNR.mjs';
1
+ import { openNestedZip, openPptxZip } from './chunk-EYCM7RVL.mjs';
2
2
  import { cloneTextStyle, cloneElement, cloneXmlObject, parseOrderedWhen } from './chunk-54S5A5PZ.mjs';
3
3
  import { themeColorRefToSolidFillWithOpacity, normalizeHexColor, parseDrawingFraction, toHex, scrgbLinearToSrgb8, applyDrawingColorTransforms, parseDrawingHueDegrees, parseDrawingPercent, hslToRgb, clampUnitInterval, parseOoxmlPercent, resolveThemeColorRef } from './chunk-KII4AAYH.mjs';
4
4
  import { XMLBuilder, XMLParser } from 'fast-xml-parser';
@@ -1859,6 +1859,262 @@ function serializeColorChoiceWithRef(ref, originalColorXml, currentResolvedHex,
1859
1859
  return serializeColorChoice(originalColorXml, currentResolvedHex, fallbackHex, opacity, options);
1860
1860
  }
1861
1861
 
1862
+ // pptx/core/utils/element-utils.ts
1863
+ function isTemplateElement(element) {
1864
+ return element.id.startsWith("layout-") || element.id.startsWith("master-");
1865
+ }
1866
+ function isEditableTextElement(element) {
1867
+ if (element.type !== "text" && element.type !== "shape") {
1868
+ return false;
1869
+ }
1870
+ return element.type === "text" || typeof element.text === "string" || (element.textSegments?.length ?? 0) > 0;
1871
+ }
1872
+ function getElementLabel(element) {
1873
+ if (element.type === "text") {
1874
+ return "Text";
1875
+ }
1876
+ if (element.type === "connector") {
1877
+ return "Connector";
1878
+ }
1879
+ if (element.type === "image" || element.type === "picture") {
1880
+ return "Image";
1881
+ }
1882
+ if (element.type === "chart") {
1883
+ return "Chart";
1884
+ }
1885
+ if (element.type === "table") {
1886
+ return "Table";
1887
+ }
1888
+ if (element.type === "smartArt") {
1889
+ return "SmartArt";
1890
+ }
1891
+ if (element.type === "ole") {
1892
+ return "Embedded Object";
1893
+ }
1894
+ if (element.type === "media") {
1895
+ return "Media";
1896
+ }
1897
+ return "Shape";
1898
+ }
1899
+ function shouldRenderFallbackLabel(element, isTextElement2) {
1900
+ if (isTextElement2) {
1901
+ return false;
1902
+ }
1903
+ if (element.type === "shape" || element.type === "connector") {
1904
+ return false;
1905
+ }
1906
+ if (element.type === "picture" || element.type === "image") {
1907
+ return false;
1908
+ }
1909
+ if (element.type === "table") {
1910
+ return false;
1911
+ }
1912
+ return element.type === "chart" || element.type === "smartArt" || element.type === "ole" || element.type === "media" || element.type === "unknown";
1913
+ }
1914
+ function getElementTextContent(element) {
1915
+ if (!hasTextProperties(element)) {
1916
+ return "";
1917
+ }
1918
+ if (typeof element.text === "string") {
1919
+ return element.text;
1920
+ }
1921
+ if (!element.textSegments || element.textSegments.length === 0) {
1922
+ return "";
1923
+ }
1924
+ return element.textSegments.map((segment) => String(segment.text || "")).join("");
1925
+ }
1926
+ function createUniformTextSegments(text, style) {
1927
+ return [
1928
+ {
1929
+ text,
1930
+ style: cloneTextStyle(style) || {}
1931
+ }
1932
+ ];
1933
+ }
1934
+ var nextEditorIdSequence = 0;
1935
+ function createEditorId(prefix) {
1936
+ const random = Math.random().toString(36).slice(2, 8).padEnd(6, "0");
1937
+ const sequence = (nextEditorIdSequence++).toString(36);
1938
+ return `${prefix}-${Date.now()}-${random}${sequence}`;
1939
+ }
1940
+ var DRAWING_OBJECT_ID_BASE = 1e5;
1941
+ var nextDrawingObjectId = DRAWING_OBJECT_ID_BASE;
1942
+ function createDrawingObjectId() {
1943
+ nextDrawingObjectId += 1;
1944
+ return nextDrawingObjectId;
1945
+ }
1946
+ function createArrayBufferCopy(bytes) {
1947
+ const copy2 = new Uint8Array(bytes.byteLength);
1948
+ copy2.set(bytes);
1949
+ return copy2.buffer;
1950
+ }
1951
+ function ensureArrayValue(value) {
1952
+ if (!value) {
1953
+ return [];
1954
+ }
1955
+ return Array.isArray(value) ? value : [value];
1956
+ }
1957
+ function formatCommentTimestamp(value) {
1958
+ const normalized = String(value || "").trim();
1959
+ if (normalized.length === 0) {
1960
+ return "";
1961
+ }
1962
+ const parsed = new Date(normalized);
1963
+ if (Number.isNaN(parsed.getTime())) {
1964
+ return "";
1965
+ }
1966
+ return parsed.toLocaleString(void 0, {
1967
+ month: "short",
1968
+ day: "numeric",
1969
+ hour: "2-digit",
1970
+ minute: "2-digit"
1971
+ });
1972
+ }
1973
+ function getCommentMarkerPosition(comment, index, width, height) {
1974
+ const fallbackX = 18 + index % 4 * 14;
1975
+ const fallbackY = 18 + Math.floor(index / 4) * 14;
1976
+ const rawX = typeof comment.x === "number" && Number.isFinite(comment.x) ? comment.x : fallbackX;
1977
+ const rawY = typeof comment.y === "number" && Number.isFinite(comment.y) ? comment.y : fallbackY;
1978
+ return {
1979
+ x: Math.min(Math.max(rawX, 8), Math.max(width - 8, 8)),
1980
+ y: Math.min(Math.max(rawY, 8), Math.max(height - 8, 8))
1981
+ };
1982
+ }
1983
+ async function readFileAsDataUrl(file) {
1984
+ return await new Promise((resolve, reject) => {
1985
+ const reader = new FileReader();
1986
+ reader.onload = () => {
1987
+ const result = reader.result;
1988
+ if (typeof result !== "string") {
1989
+ reject(new Error("Failed to read image file."));
1990
+ return;
1991
+ }
1992
+ resolve(result);
1993
+ };
1994
+ reader.onerror = () => {
1995
+ reject(new Error("Failed to read image file."));
1996
+ };
1997
+ reader.readAsDataURL(file);
1998
+ });
1999
+ }
2000
+
2001
+ // pptx/core/utils/group-ops.ts
2002
+ function isTemplateElementId(elementId) {
2003
+ return elementId.startsWith("layout-") || elementId.startsWith("master-");
2004
+ }
2005
+ function makeStoreAwareId(intoTemplate, sourceId) {
2006
+ if (!intoTemplate) {
2007
+ return createEditorId("el");
2008
+ }
2009
+ return sourceId.startsWith("master-") ? `master-${createEditorId("el")}` : `layout-${createEditorId("el")}`;
2010
+ }
2011
+ function reassignDescendantIds(element, mintId) {
2012
+ if (element.type !== "group") {
2013
+ return;
2014
+ }
2015
+ for (const child13 of element.children) {
2016
+ const next = mintId(child13);
2017
+ if (next !== void 0) {
2018
+ child13.id = next;
2019
+ }
2020
+ reassignDescendantIds(child13, mintId);
2021
+ }
2022
+ }
2023
+ function groupElements(elements3, ids, groupId) {
2024
+ const idSet = new Set(ids);
2025
+ const gathered = [];
2026
+ let insertionIndex = -1;
2027
+ for (let i2 = 0; i2 < elements3.length; i2++) {
2028
+ const el = elements3[i2];
2029
+ if (idSet.has(el.id)) {
2030
+ gathered.push(el);
2031
+ if (insertionIndex === -1) {
2032
+ insertionIndex = i2;
2033
+ }
2034
+ }
2035
+ }
2036
+ if (gathered.length < 2) {
2037
+ return { elements: [...elements3], groupId: null };
2038
+ }
2039
+ let minX = gathered[0].x;
2040
+ let minY = gathered[0].y;
2041
+ let maxX = gathered[0].x + gathered[0].width;
2042
+ let maxY = gathered[0].y + gathered[0].height;
2043
+ for (let i2 = 1; i2 < gathered.length; i2++) {
2044
+ const el = gathered[i2];
2045
+ if (el.x < minX) {
2046
+ minX = el.x;
2047
+ }
2048
+ if (el.y < minY) {
2049
+ minY = el.y;
2050
+ }
2051
+ const rx = el.x + el.width;
2052
+ const ry = el.y + el.height;
2053
+ if (rx > maxX) {
2054
+ maxX = rx;
2055
+ }
2056
+ if (ry > maxY) {
2057
+ maxY = ry;
2058
+ }
2059
+ }
2060
+ const children6 = gathered.map((el) => {
2061
+ const child13 = cloneElement(el);
2062
+ child13.x = el.x - minX;
2063
+ child13.y = el.y - minY;
2064
+ return child13;
2065
+ });
2066
+ const group = {
2067
+ type: "group",
2068
+ id: groupId,
2069
+ name: "Group",
2070
+ x: minX,
2071
+ y: minY,
2072
+ width: maxX - minX,
2073
+ height: maxY - minY,
2074
+ children: children6
2075
+ };
2076
+ const remaining = elements3.filter((el) => !idSet.has(el.id));
2077
+ let adjustedIndex = 0;
2078
+ for (let i2 = 0; i2 < insertionIndex; i2++) {
2079
+ if (!idSet.has(elements3[i2].id)) {
2080
+ adjustedIndex++;
2081
+ }
2082
+ }
2083
+ return {
2084
+ elements: [...remaining.slice(0, adjustedIndex), group, ...remaining.slice(adjustedIndex)],
2085
+ groupId
2086
+ };
2087
+ }
2088
+ function ungroupElements(elements3, groupId, childIds, options = {}) {
2089
+ const groupIndex = elements3.findIndex((el) => el.id === groupId);
2090
+ if (groupIndex === -1) {
2091
+ return { elements: [...elements3], childIds: [] };
2092
+ }
2093
+ const group = elements3[groupIndex];
2094
+ if (group.type !== "group") {
2095
+ return { elements: [...elements3], childIds: [] };
2096
+ }
2097
+ const intoTemplate = options.intoTemplate ?? isTemplateElementId(group.id);
2098
+ const usedChildIds = [];
2099
+ const expanded = group.children.map((child13, index) => {
2100
+ const newChildId = childIds[index] ?? child13.id;
2101
+ usedChildIds.push(newChildId);
2102
+ const promoted = cloneElement(child13);
2103
+ promoted.id = newChildId;
2104
+ promoted.x = child13.x + group.x;
2105
+ promoted.y = child13.y + group.y;
2106
+ reassignDescendantIds(
2107
+ promoted,
2108
+ (descendant) => isTemplateElementId(descendant.id) === intoTemplate ? void 0 : makeStoreAwareId(intoTemplate, newChildId)
2109
+ );
2110
+ return promoted;
2111
+ });
2112
+ return {
2113
+ elements: [...elements3.slice(0, groupIndex), ...expanded, ...elements3.slice(groupIndex + 1)],
2114
+ childIds: usedChildIds
2115
+ };
2116
+ }
2117
+
1862
2118
  // geometry/indexed.ts
1863
2119
  function at(items, index) {
1864
2120
  const value = items[index];
@@ -15961,262 +16217,6 @@ function getPresetConnectionSites(prst, width, height, adjustments) {
15961
16217
  }));
15962
16218
  }
15963
16219
 
15964
- // pptx/core/utils/element-utils.ts
15965
- function isTemplateElement(element) {
15966
- return element.id.startsWith("layout-") || element.id.startsWith("master-");
15967
- }
15968
- function isEditableTextElement(element) {
15969
- if (element.type !== "text" && element.type !== "shape") {
15970
- return false;
15971
- }
15972
- return element.type === "text" || typeof element.text === "string" || (element.textSegments?.length ?? 0) > 0;
15973
- }
15974
- function getElementLabel(element) {
15975
- if (element.type === "text") {
15976
- return "Text";
15977
- }
15978
- if (element.type === "connector") {
15979
- return "Connector";
15980
- }
15981
- if (element.type === "image" || element.type === "picture") {
15982
- return "Image";
15983
- }
15984
- if (element.type === "chart") {
15985
- return "Chart";
15986
- }
15987
- if (element.type === "table") {
15988
- return "Table";
15989
- }
15990
- if (element.type === "smartArt") {
15991
- return "SmartArt";
15992
- }
15993
- if (element.type === "ole") {
15994
- return "Embedded Object";
15995
- }
15996
- if (element.type === "media") {
15997
- return "Media";
15998
- }
15999
- return "Shape";
16000
- }
16001
- function shouldRenderFallbackLabel(element, isTextElement2) {
16002
- if (isTextElement2) {
16003
- return false;
16004
- }
16005
- if (element.type === "shape" || element.type === "connector") {
16006
- return false;
16007
- }
16008
- if (element.type === "picture" || element.type === "image") {
16009
- return false;
16010
- }
16011
- if (element.type === "table") {
16012
- return false;
16013
- }
16014
- return element.type === "chart" || element.type === "smartArt" || element.type === "ole" || element.type === "media" || element.type === "unknown";
16015
- }
16016
- function getElementTextContent(element) {
16017
- if (!hasTextProperties(element)) {
16018
- return "";
16019
- }
16020
- if (typeof element.text === "string") {
16021
- return element.text;
16022
- }
16023
- if (!element.textSegments || element.textSegments.length === 0) {
16024
- return "";
16025
- }
16026
- return element.textSegments.map((segment) => String(segment.text || "")).join("");
16027
- }
16028
- function createUniformTextSegments(text, style) {
16029
- return [
16030
- {
16031
- text,
16032
- style: cloneTextStyle(style) || {}
16033
- }
16034
- ];
16035
- }
16036
- var nextEditorIdSequence = 0;
16037
- function createEditorId(prefix) {
16038
- const random = Math.random().toString(36).slice(2, 8).padEnd(6, "0");
16039
- const sequence = (nextEditorIdSequence++).toString(36);
16040
- return `${prefix}-${Date.now()}-${random}${sequence}`;
16041
- }
16042
- var DRAWING_OBJECT_ID_BASE = 1e5;
16043
- var nextDrawingObjectId = DRAWING_OBJECT_ID_BASE;
16044
- function createDrawingObjectId() {
16045
- nextDrawingObjectId += 1;
16046
- return nextDrawingObjectId;
16047
- }
16048
- function createArrayBufferCopy(bytes) {
16049
- const copy2 = new Uint8Array(bytes.byteLength);
16050
- copy2.set(bytes);
16051
- return copy2.buffer;
16052
- }
16053
- function ensureArrayValue(value) {
16054
- if (!value) {
16055
- return [];
16056
- }
16057
- return Array.isArray(value) ? value : [value];
16058
- }
16059
- function formatCommentTimestamp(value) {
16060
- const normalized = String(value || "").trim();
16061
- if (normalized.length === 0) {
16062
- return "";
16063
- }
16064
- const parsed = new Date(normalized);
16065
- if (Number.isNaN(parsed.getTime())) {
16066
- return "";
16067
- }
16068
- return parsed.toLocaleString(void 0, {
16069
- month: "short",
16070
- day: "numeric",
16071
- hour: "2-digit",
16072
- minute: "2-digit"
16073
- });
16074
- }
16075
- function getCommentMarkerPosition(comment, index, width, height) {
16076
- const fallbackX = 18 + index % 4 * 14;
16077
- const fallbackY = 18 + Math.floor(index / 4) * 14;
16078
- const rawX = typeof comment.x === "number" && Number.isFinite(comment.x) ? comment.x : fallbackX;
16079
- const rawY = typeof comment.y === "number" && Number.isFinite(comment.y) ? comment.y : fallbackY;
16080
- return {
16081
- x: Math.min(Math.max(rawX, 8), Math.max(width - 8, 8)),
16082
- y: Math.min(Math.max(rawY, 8), Math.max(height - 8, 8))
16083
- };
16084
- }
16085
- async function readFileAsDataUrl(file) {
16086
- return await new Promise((resolve, reject) => {
16087
- const reader = new FileReader();
16088
- reader.onload = () => {
16089
- const result = reader.result;
16090
- if (typeof result !== "string") {
16091
- reject(new Error("Failed to read image file."));
16092
- return;
16093
- }
16094
- resolve(result);
16095
- };
16096
- reader.onerror = () => {
16097
- reject(new Error("Failed to read image file."));
16098
- };
16099
- reader.readAsDataURL(file);
16100
- });
16101
- }
16102
-
16103
- // pptx/core/utils/group-ops.ts
16104
- function isTemplateElementId(elementId) {
16105
- return elementId.startsWith("layout-") || elementId.startsWith("master-");
16106
- }
16107
- function makeStoreAwareId(intoTemplate, sourceId) {
16108
- if (!intoTemplate) {
16109
- return createEditorId("el");
16110
- }
16111
- return sourceId.startsWith("master-") ? `master-${createEditorId("el")}` : `layout-${createEditorId("el")}`;
16112
- }
16113
- function reassignDescendantIds(element, mintId) {
16114
- if (element.type !== "group") {
16115
- return;
16116
- }
16117
- for (const child13 of element.children) {
16118
- const next = mintId(child13);
16119
- if (next !== void 0) {
16120
- child13.id = next;
16121
- }
16122
- reassignDescendantIds(child13, mintId);
16123
- }
16124
- }
16125
- function groupElements(elements3, ids, groupId) {
16126
- const idSet = new Set(ids);
16127
- const gathered = [];
16128
- let insertionIndex = -1;
16129
- for (let i2 = 0; i2 < elements3.length; i2++) {
16130
- const el = elements3[i2];
16131
- if (idSet.has(el.id)) {
16132
- gathered.push(el);
16133
- if (insertionIndex === -1) {
16134
- insertionIndex = i2;
16135
- }
16136
- }
16137
- }
16138
- if (gathered.length < 2) {
16139
- return { elements: [...elements3], groupId: null };
16140
- }
16141
- let minX = gathered[0].x;
16142
- let minY = gathered[0].y;
16143
- let maxX = gathered[0].x + gathered[0].width;
16144
- let maxY = gathered[0].y + gathered[0].height;
16145
- for (let i2 = 1; i2 < gathered.length; i2++) {
16146
- const el = gathered[i2];
16147
- if (el.x < minX) {
16148
- minX = el.x;
16149
- }
16150
- if (el.y < minY) {
16151
- minY = el.y;
16152
- }
16153
- const rx = el.x + el.width;
16154
- const ry = el.y + el.height;
16155
- if (rx > maxX) {
16156
- maxX = rx;
16157
- }
16158
- if (ry > maxY) {
16159
- maxY = ry;
16160
- }
16161
- }
16162
- const children6 = gathered.map((el) => {
16163
- const child13 = cloneElement(el);
16164
- child13.x = el.x - minX;
16165
- child13.y = el.y - minY;
16166
- return child13;
16167
- });
16168
- const group = {
16169
- type: "group",
16170
- id: groupId,
16171
- name: "Group",
16172
- x: minX,
16173
- y: minY,
16174
- width: maxX - minX,
16175
- height: maxY - minY,
16176
- children: children6
16177
- };
16178
- const remaining = elements3.filter((el) => !idSet.has(el.id));
16179
- let adjustedIndex = 0;
16180
- for (let i2 = 0; i2 < insertionIndex; i2++) {
16181
- if (!idSet.has(elements3[i2].id)) {
16182
- adjustedIndex++;
16183
- }
16184
- }
16185
- return {
16186
- elements: [...remaining.slice(0, adjustedIndex), group, ...remaining.slice(adjustedIndex)],
16187
- groupId
16188
- };
16189
- }
16190
- function ungroupElements(elements3, groupId, childIds, options = {}) {
16191
- const groupIndex = elements3.findIndex((el) => el.id === groupId);
16192
- if (groupIndex === -1) {
16193
- return { elements: [...elements3], childIds: [] };
16194
- }
16195
- const group = elements3[groupIndex];
16196
- if (group.type !== "group") {
16197
- return { elements: [...elements3], childIds: [] };
16198
- }
16199
- const intoTemplate = options.intoTemplate ?? isTemplateElementId(group.id);
16200
- const usedChildIds = [];
16201
- const expanded = group.children.map((child13, index) => {
16202
- const newChildId = childIds[index] ?? child13.id;
16203
- usedChildIds.push(newChildId);
16204
- const promoted = cloneElement(child13);
16205
- promoted.id = newChildId;
16206
- promoted.x = child13.x + group.x;
16207
- promoted.y = child13.y + group.y;
16208
- reassignDescendantIds(
16209
- promoted,
16210
- (descendant) => isTemplateElementId(descendant.id) === intoTemplate ? void 0 : makeStoreAwareId(intoTemplate, newChildId)
16211
- );
16212
- return promoted;
16213
- });
16214
- return {
16215
- elements: [...elements3.slice(0, groupIndex), ...expanded, ...elements3.slice(groupIndex + 1)],
16216
- childIds: usedChildIds
16217
- };
16218
- }
16219
-
16220
16220
  // pptx/core/utils/presentation-collections.ts
16221
16221
  var SECTION_EXTENSION_URI = "{521415D9-36F7-43E2-AB2F-B90AF26B5E84}";
16222
16222
  function remapReferenceList(references, mapping, removed) {
@@ -21977,7 +21977,7 @@ function findTextBearingElementById(elements3, elementId) {
21977
21977
  }
21978
21978
  async function loadNestedDeck(pptxBytes) {
21979
21979
  try {
21980
- const { PptxHandler } = await import('./PptxHandler-OIR3ZY4Q.mjs');
21980
+ const { PptxHandler } = await import('./PptxHandler-AFVUHNJO.mjs');
21981
21981
  const handler = new PptxHandler();
21982
21982
  const data = await handler.load(pptxBytes.buffer.slice(0));
21983
21983
  return { handler, slides: data.slides };
@@ -2844,11 +2844,14 @@ var ZipLimitError = class extends Error {
2844
2844
  limit;
2845
2845
  /** The check that failed (absent when the error was built without one). */
2846
2846
  kind;
2847
+ /** The observed value, when known (a lower bound for a size found while inflating). */
2848
+ actual;
2847
2849
  constructor(message, details) {
2848
2850
  super(message);
2849
2851
  this.name = "ZipLimitError";
2850
2852
  this.limit = details.limit;
2851
2853
  this.kind = details.kind;
2854
+ this.actual = details.actual;
2852
2855
  }
2853
2856
  };
2854
2857
  var mib = (bytes) => Math.round(bytes / 1048576);
@@ -2871,7 +2874,7 @@ function resolveLimits(limits) {
2871
2874
  maxEntryBytes: limits.maxEntryBytes ?? DEFAULT_ZIP_LIMITS.maxEntryBytes,
2872
2875
  maxTotalBytes: limits.maxTotalBytes ?? DEFAULT_ZIP_LIMITS.maxTotalBytes,
2873
2876
  label: limits.label ?? "ZIP",
2874
- fail: (message, limit, kind) => create ? create(message, { limit, kind }) : new ZipLimitError(message, { limit, kind })
2877
+ fail: (message, limit, kind, actual) => create ? create(message, { limit, kind, actual }) : new ZipLimitError(message, { limit, kind, actual })
2875
2878
  };
2876
2879
  }
2877
2880
  async function inflateEntryGuarded(entry, alreadyRead, limits) {
@@ -2926,7 +2929,8 @@ async function* streamEntryGuarded(entry, alreadyRead, limits) {
2926
2929
  r.fail(
2927
2930
  `${r.label} part ${entry.name} inflates past its declared size`,
2928
2931
  r.maxEntryBytes,
2929
- size > declared ? "declaredSize" : "maxEntryBytes"
2932
+ size > declared ? "declaredSize" : "maxEntryBytes",
2933
+ size
2930
2934
  )
2931
2935
  );
2932
2936
  if (alreadyRead + size > r.maxTotalBytes)
@@ -2934,7 +2938,8 @@ async function* streamEntryGuarded(entry, alreadyRead, limits) {
2934
2938
  r.fail(
2935
2939
  `${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
2936
2940
  r.maxTotalBytes,
2937
- "maxTotalBytes"
2941
+ "maxTotalBytes",
2942
+ alreadyRead + size
2938
2943
  )
2939
2944
  );
2940
2945
  queue.push(chunk2);
@@ -2981,7 +2986,8 @@ function guardZip(zip, limits = {}) {
2981
2986
  throw r.fail(
2982
2987
  `${r.label} package exceeds the ${r.maxEntries.toLocaleString("en-US")} part limit`,
2983
2988
  r.maxEntries,
2984
- "maxEntries"
2989
+ "maxEntries",
2990
+ entries.length
2985
2991
  );
2986
2992
  let declared = 0;
2987
2993
  for (const entry of entries) {
@@ -2994,7 +3000,8 @@ function guardZip(zip, limits = {}) {
2994
3000
  throw r.fail(
2995
3001
  `${r.label} part ${entry.name} exceeds the uncompressed part size limit`,
2996
3002
  r.maxEntryBytes,
2997
- "maxEntryBytes"
3003
+ "maxEntryBytes",
3004
+ size
2998
3005
  );
2999
3006
  declared += size;
3000
3007
  }
@@ -3002,7 +3009,8 @@ function guardZip(zip, limits = {}) {
3002
3009
  throw r.fail(
3003
3010
  `${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
3004
3011
  r.maxTotalBytes,
3005
- "maxTotalBytes"
3012
+ "maxTotalBytes",
3013
+ declared
3006
3014
  );
3007
3015
  const produced = /* @__PURE__ */ new Map();
3008
3016
  let total = 0;
@@ -3041,7 +3049,8 @@ async function openZip(input, limits = {}) {
3041
3049
  throw r.fail(
3042
3050
  `${r.label} package exceeds the ${mib(maxInput)} MiB compressed input limit`,
3043
3051
  maxInput,
3044
- "maxInputBytes"
3052
+ "maxInputBytes",
3053
+ bytes.byteLength
3045
3054
  );
3046
3055
  return guardZip(await JSZip.loadAsync(bytes), limits);
3047
3056
  }
@@ -3051,15 +3060,27 @@ var DEFAULT_MAX_UNCOMPRESSED_BYTES = 500 * 1024 * 1024;
3051
3060
  var MAX_ZIP_ENTRY_COUNT = 65536;
3052
3061
  var ZipBombError = class extends Error {
3053
3062
  code = "ZIP_BOMB";
3063
+ /** Inflated bytes declared or read when a size limit failed (a lower bound while streaming). */
3054
3064
  uncompressedBytes;
3065
+ /** The value of the limit that failed. */
3055
3066
  limit;
3067
+ /** Number of archive entries, when the entry-count limit failed. */
3056
3068
  entryCount;
3069
+ /**
3070
+ * The `PptxLoadLimits` field behind this error (`maxUncompressedBytes` or
3071
+ * `maxEntries`); `undefined` for a forged size or an unsafe part name.
3072
+ */
3073
+ loadLimit;
3074
+ /** The observed value for {@link loadLimit}, when known. */
3075
+ actual;
3057
3076
  constructor(message, details) {
3058
3077
  super(message);
3059
3078
  this.name = "ZipBombError";
3060
3079
  this.uncompressedBytes = details.uncompressedBytes;
3061
3080
  this.limit = details.limit;
3062
3081
  this.entryCount = details.entryCount;
3082
+ this.loadLimit = details.loadLimit;
3083
+ this.actual = details.actual;
3063
3084
  }
3064
3085
  };
3065
3086