pptx-react-viewer 3.12.0 → 3.13.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 (135) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/{AiChatPanel-TXCDQDHD.js → AiChatPanel-E53JJRZX.js} +24 -24
  3. package/dist/AiChatPanel-E53JJRZX.js.br +0 -0
  4. package/dist/AiChatPanel-E53JJRZX.js.gz +0 -0
  5. package/dist/{AiChatPanel-SCA4RLFI.mjs → AiChatPanel-JTXC5WWH.mjs} +3 -3
  6. package/dist/AiChatPanel-JTXC5WWH.mjs.br +0 -0
  7. package/dist/AiChatPanel-JTXC5WWH.mjs.gz +0 -0
  8. package/dist/{Area3DChartScene-YAK6W2J5.js → Area3DChartScene-J7G54OH4.js} +2 -2
  9. package/dist/{Area3DChartScene-YAK6W2J5.js.br → Area3DChartScene-J7G54OH4.js.br} +0 -0
  10. package/dist/Area3DChartScene-J7G54OH4.js.gz +0 -0
  11. package/dist/{Area3DChartScene-NSV5AIMM.mjs → Area3DChartScene-JQ2VU73H.mjs} +1 -1
  12. package/dist/Area3DChartScene-JQ2VU73H.mjs.br +0 -0
  13. package/dist/Area3DChartScene-JQ2VU73H.mjs.gz +0 -0
  14. package/dist/{Bar3DChartScene-DFJ7XK3Q.mjs → Bar3DChartScene-5HC7LYBH.mjs} +1 -1
  15. package/dist/Bar3DChartScene-5HC7LYBH.mjs.br +0 -0
  16. package/dist/Bar3DChartScene-5HC7LYBH.mjs.gz +0 -0
  17. package/dist/{Bar3DChartScene-WNBEX3TN.js → Bar3DChartScene-JV3A2P6O.js} +2 -2
  18. package/dist/{Bar3DChartScene-WNBEX3TN.js.br → Bar3DChartScene-JV3A2P6O.js.br} +0 -0
  19. package/dist/Bar3DChartScene-JV3A2P6O.js.gz +0 -0
  20. package/dist/{Line3DChartScene-TK6RPGET.mjs → Line3DChartScene-4ZAOOU7U.mjs} +1 -1
  21. package/dist/Line3DChartScene-4ZAOOU7U.mjs.br +0 -0
  22. package/dist/Line3DChartScene-4ZAOOU7U.mjs.gz +0 -0
  23. package/dist/{Line3DChartScene-PXA6WAQG.js → Line3DChartScene-7SN7TVKQ.js} +2 -2
  24. package/dist/{Line3DChartScene-PXA6WAQG.js.br → Line3DChartScene-7SN7TVKQ.js.br} +0 -0
  25. package/dist/Line3DChartScene-7SN7TVKQ.js.gz +0 -0
  26. package/dist/{Model3DScene-FJQOUWCV.js → Model3DScene-GQANXXQD.js} +2 -2
  27. package/dist/Model3DScene-GQANXXQD.js.br +0 -0
  28. package/dist/Model3DScene-GQANXXQD.js.gz +0 -0
  29. package/dist/{Model3DScene-7FZSQ3SP.mjs → Model3DScene-GWIBUQ2U.mjs} +1 -1
  30. package/dist/Model3DScene-GWIBUQ2U.mjs.br +0 -0
  31. package/dist/Model3DScene-GWIBUQ2U.mjs.gz +0 -0
  32. package/dist/{PieChart3DScene-P25IGVT6.js → PieChart3DScene-QPFDRMEA.js} +2 -2
  33. package/dist/{PieChart3DScene-P25IGVT6.js.br → PieChart3DScene-QPFDRMEA.js.br} +0 -0
  34. package/dist/PieChart3DScene-QPFDRMEA.js.gz +0 -0
  35. package/dist/{PieChart3DScene-KKZTAIFB.mjs → PieChart3DScene-RDTOLFTD.mjs} +1 -1
  36. package/dist/PieChart3DScene-RDTOLFTD.mjs.br +0 -0
  37. package/dist/PieChart3DScene-RDTOLFTD.mjs.gz +0 -0
  38. package/dist/{SurfaceChart3DScene-LWJCERTR.mjs → SurfaceChart3DScene-5JQCRWA5.mjs} +1 -1
  39. package/dist/SurfaceChart3DScene-5JQCRWA5.mjs.br +0 -0
  40. package/dist/SurfaceChart3DScene-5JQCRWA5.mjs.gz +0 -0
  41. package/dist/{SurfaceChart3DScene-36MT6QAK.js → SurfaceChart3DScene-JLYGC7QU.js} +2 -2
  42. package/dist/{SurfaceChart3DScene-36MT6QAK.js.br → SurfaceChart3DScene-JLYGC7QU.js.br} +0 -0
  43. package/dist/SurfaceChart3DScene-JLYGC7QU.js.gz +0 -0
  44. package/dist/{chunk-45AVHO7M.js → chunk-G2Z7QULX.js} +5 -5
  45. package/dist/chunk-G2Z7QULX.js.br +0 -0
  46. package/dist/chunk-G2Z7QULX.js.gz +0 -0
  47. package/dist/{chunk-AARQTIMN.js → chunk-H3GHGSGW.js} +533 -483
  48. package/dist/chunk-H3GHGSGW.js.br +0 -0
  49. package/dist/chunk-H3GHGSGW.js.gz +0 -0
  50. package/dist/{chunk-2FSNTJVI.mjs → chunk-HB7DJENT.mjs} +1 -1
  51. package/dist/chunk-HB7DJENT.mjs.br +0 -0
  52. package/dist/chunk-HB7DJENT.mjs.gz +0 -0
  53. package/dist/{chunk-O27KNZLJ.js → chunk-IVCYND7A.js} +169 -169
  54. package/dist/chunk-IVCYND7A.js.br +0 -0
  55. package/dist/chunk-IVCYND7A.js.gz +0 -0
  56. package/dist/{chunk-WRHPPTYF.mjs → chunk-M7SNS3DQ.mjs} +103 -53
  57. package/dist/chunk-M7SNS3DQ.mjs.br +0 -0
  58. package/dist/chunk-M7SNS3DQ.mjs.gz +0 -0
  59. package/dist/{chunk-ZOEKVSSU.mjs → chunk-PKHTTHA2.mjs} +12 -12
  60. package/dist/chunk-PKHTTHA2.mjs.br +0 -0
  61. package/dist/chunk-PKHTTHA2.mjs.gz +0 -0
  62. package/dist/{chunk-C2BDHCL2.mjs → chunk-TS2DHMBS.mjs} +3443 -403
  63. package/dist/chunk-TS2DHMBS.mjs.br +0 -0
  64. package/dist/chunk-TS2DHMBS.mjs.gz +0 -0
  65. package/dist/{chunk-3WK4AE52.js → chunk-TWUAZRCG.js} +3450 -403
  66. package/dist/chunk-TWUAZRCG.js.br +0 -0
  67. package/dist/chunk-TWUAZRCG.js.gz +0 -0
  68. package/dist/{chunk-T7MY5L3O.js → chunk-UGVPKJSU.js} +1260 -1260
  69. package/dist/chunk-UGVPKJSU.js.br +0 -0
  70. package/dist/chunk-UGVPKJSU.js.gz +0 -0
  71. package/dist/{chunk-HXDNYDRJ.mjs → chunk-Y3SA5H5H.mjs} +4 -4
  72. package/dist/chunk-Y3SA5H5H.mjs.br +0 -0
  73. package/dist/chunk-Y3SA5H5H.mjs.gz +0 -0
  74. package/dist/index.js +45 -45
  75. package/dist/index.js.br +0 -0
  76. package/dist/index.js.gz +0 -0
  77. package/dist/index.mjs +5 -5
  78. package/dist/index.mjs.br +0 -0
  79. package/dist/index.mjs.gz +0 -0
  80. package/dist/internals.js +78 -78
  81. package/dist/internals.js.br +0 -0
  82. package/dist/internals.js.gz +0 -0
  83. package/dist/internals.mjs +3 -3
  84. package/dist/internals.mjs.br +0 -0
  85. package/dist/internals.mjs.gz +0 -0
  86. package/dist/viewer/index.js +26 -26
  87. package/dist/viewer/index.js.br +0 -0
  88. package/dist/viewer/index.js.gz +0 -0
  89. package/dist/viewer/index.mjs +5 -5
  90. package/dist/viewer/index.mjs.br +0 -0
  91. package/dist/viewer/index.mjs.gz +0 -0
  92. package/package.json +1 -1
  93. package/dist/AiChatPanel-SCA4RLFI.mjs.br +0 -0
  94. package/dist/AiChatPanel-SCA4RLFI.mjs.gz +0 -0
  95. package/dist/AiChatPanel-TXCDQDHD.js.br +0 -0
  96. package/dist/AiChatPanel-TXCDQDHD.js.gz +0 -0
  97. package/dist/Area3DChartScene-NSV5AIMM.mjs.br +0 -0
  98. package/dist/Area3DChartScene-NSV5AIMM.mjs.gz +0 -0
  99. package/dist/Area3DChartScene-YAK6W2J5.js.gz +0 -0
  100. package/dist/Bar3DChartScene-DFJ7XK3Q.mjs.br +0 -0
  101. package/dist/Bar3DChartScene-DFJ7XK3Q.mjs.gz +0 -0
  102. package/dist/Bar3DChartScene-WNBEX3TN.js.gz +0 -0
  103. package/dist/Line3DChartScene-PXA6WAQG.js.gz +0 -0
  104. package/dist/Line3DChartScene-TK6RPGET.mjs.br +0 -0
  105. package/dist/Line3DChartScene-TK6RPGET.mjs.gz +0 -0
  106. package/dist/Model3DScene-7FZSQ3SP.mjs.br +0 -0
  107. package/dist/Model3DScene-7FZSQ3SP.mjs.gz +0 -0
  108. package/dist/Model3DScene-FJQOUWCV.js.br +0 -0
  109. package/dist/Model3DScene-FJQOUWCV.js.gz +0 -0
  110. package/dist/PieChart3DScene-KKZTAIFB.mjs.br +0 -0
  111. package/dist/PieChart3DScene-KKZTAIFB.mjs.gz +0 -0
  112. package/dist/PieChart3DScene-P25IGVT6.js.gz +0 -0
  113. package/dist/SurfaceChart3DScene-36MT6QAK.js.gz +0 -0
  114. package/dist/SurfaceChart3DScene-LWJCERTR.mjs.br +0 -0
  115. package/dist/SurfaceChart3DScene-LWJCERTR.mjs.gz +0 -0
  116. package/dist/chunk-2FSNTJVI.mjs.br +0 -0
  117. package/dist/chunk-2FSNTJVI.mjs.gz +0 -0
  118. package/dist/chunk-3WK4AE52.js.br +0 -0
  119. package/dist/chunk-3WK4AE52.js.gz +0 -0
  120. package/dist/chunk-45AVHO7M.js.br +0 -0
  121. package/dist/chunk-45AVHO7M.js.gz +0 -0
  122. package/dist/chunk-AARQTIMN.js.br +0 -0
  123. package/dist/chunk-AARQTIMN.js.gz +0 -0
  124. package/dist/chunk-C2BDHCL2.mjs.br +0 -0
  125. package/dist/chunk-C2BDHCL2.mjs.gz +0 -0
  126. package/dist/chunk-HXDNYDRJ.mjs.br +0 -0
  127. package/dist/chunk-HXDNYDRJ.mjs.gz +0 -0
  128. package/dist/chunk-O27KNZLJ.js.br +0 -0
  129. package/dist/chunk-O27KNZLJ.js.gz +0 -0
  130. package/dist/chunk-T7MY5L3O.js.br +0 -0
  131. package/dist/chunk-T7MY5L3O.js.gz +0 -0
  132. package/dist/chunk-WRHPPTYF.mjs.br +0 -0
  133. package/dist/chunk-WRHPPTYF.mjs.gz +0 -0
  134. package/dist/chunk-ZOEKVSSU.mjs.br +0 -0
  135. package/dist/chunk-ZOEKVSSU.mjs.gz +0 -0
@@ -5496,8 +5496,8 @@ function read255Short(s) {
5496
5496
  }
5497
5497
  return value * sign;
5498
5498
  }
5499
- function unpackCVT(table, sIn) {
5500
- sIn.seekAbsolute(table.offset);
5499
+ function unpackCVT(table2, sIn) {
5500
+ sIn.seekAbsolute(table2.offset);
5501
5501
  const numEntries = sIn.readU16();
5502
5502
  const out = new Stream(null, 0);
5503
5503
  out.reserve(numEntries * 2);
@@ -5517,8 +5517,8 @@ function unpackCVT(table, sIn) {
5517
5517
  lastValue = toInt16(lastValue + val2);
5518
5518
  out.writeS16(lastValue);
5519
5519
  }
5520
- table.buf = out.toUint8Array();
5521
- table.bufSize = table.buf.length;
5520
+ table2.buf = out.toUint8Array();
5521
+ table2.bufSize = table2.buf.length;
5522
5522
  }
5523
5523
  function decodePushInstructions(sIn, sOut, pushCount) {
5524
5524
  if (pushCount === 0) {
@@ -5856,13 +5856,13 @@ function populateGlyfAndLoca(glyf, loca, headData, maxpData, streams) {
5856
5856
  loca.buf = locaStream.toUint8Array();
5857
5857
  loca.bufSize = loca.buf.length;
5858
5858
  }
5859
- function parseHead(table) {
5860
- const s = new Stream(table.buf, table.bufSize);
5859
+ function parseHead(table2) {
5860
+ const s = new Stream(table2.buf, table2.bufSize);
5861
5861
  s.seekAbsolute(50);
5862
5862
  return { indexToLocFormat: s.readS16() };
5863
5863
  }
5864
- function parseMaxp(table) {
5865
- const s = new Stream(table.buf, table.bufSize);
5864
+ function parseMaxp(table2) {
5865
+ const s = new Stream(table2.buf, table2.bufSize);
5866
5866
  const version = s.readU32();
5867
5867
  const numGlyphs = s.readU16();
5868
5868
  let maxPoints = 0;
@@ -5916,7 +5916,7 @@ function parseCTF(streams, options) {
5916
5916
  s0.seekRelative(4);
5917
5917
  const offset = s0.readU32();
5918
5918
  const size = s0.readU32();
5919
- const table = {
5919
+ const table2 = {
5920
5920
  tag,
5921
5921
  offset,
5922
5922
  bufSize: size,
@@ -5924,7 +5924,7 @@ function parseCTF(streams, options) {
5924
5924
  checksum: 0
5925
5925
  };
5926
5926
  const idx = tables.length;
5927
- tables.push(table);
5927
+ tables.push(table2);
5928
5928
  if (tag === "glyf") {
5929
5929
  glyfIdx = idx;
5930
5930
  } else if (tag === "loca") {
@@ -5938,31 +5938,31 @@ function parseCTF(streams, options) {
5938
5938
  } else ;
5939
5939
  }
5940
5940
  for (let i2 = 0; i2 < tables.length; i2++) {
5941
- const table = tables[i2];
5942
- if (table.tag === "glyf" || table.tag === "loca") {
5941
+ const table2 = tables[i2];
5942
+ if (table2.tag === "glyf" || table2.tag === "loca") {
5943
5943
  continue;
5944
5944
  }
5945
- if (table.tag === "cvt ") {
5946
- unpackCVT(table, s0);
5945
+ if (table2.tag === "cvt ") {
5946
+ unpackCVT(table2, s0);
5947
5947
  continue;
5948
5948
  }
5949
- s0.seekAbsolute(table.offset);
5950
- const buf = new Uint8Array(table.bufSize);
5951
- for (let b = 0; b < table.bufSize; b++) {
5949
+ s0.seekAbsolute(table2.offset);
5950
+ const buf = new Uint8Array(table2.bufSize);
5951
+ for (let b = 0; b < table2.bufSize; b++) {
5952
5952
  buf[b] = s0.readU8();
5953
5953
  }
5954
- table.buf = buf;
5955
- if (table.tag === "head") {
5956
- if (table.bufSize < 12) {
5954
+ table2.buf = buf;
5955
+ if (table2.tag === "head") {
5956
+ if (table2.bufSize < 12) {
5957
5957
  throw new EotError(
5958
5958
  "MALFORMED_HEAD_TABLE",
5959
- `head table too small: ${table.bufSize} bytes (need at least 12)`
5959
+ `head table too small: ${table2.bufSize} bytes (need at least 12)`
5960
5960
  );
5961
5961
  }
5962
- table.buf[8] = 0;
5963
- table.buf[9] = 0;
5964
- table.buf[10] = 0;
5965
- table.buf[11] = 0;
5962
+ table2.buf[8] = 0;
5963
+ table2.buf[9] = 0;
5964
+ table2.buf[10] = 0;
5965
+ table2.buf[11] = 0;
5966
5966
  }
5967
5967
  }
5968
5968
  if (maxpIdx < 0) {
@@ -6478,21 +6478,21 @@ function writeOffsetTable(ctr, out) {
6478
6478
  out.writeU16(rangeShift);
6479
6479
  }
6480
6480
  function writeTableDirectory(ctr, out) {
6481
- for (const table of ctr.tables) {
6482
- out.writeU8(table.tag.charCodeAt(0));
6483
- out.writeU8(table.tag.charCodeAt(1));
6484
- out.writeU8(table.tag.charCodeAt(2));
6485
- out.writeU8(table.tag.charCodeAt(3));
6486
- out.writeU32(table.checksum);
6487
- out.writeU32(table.offset);
6488
- out.writeU32(table.bufSize);
6489
- }
6490
- }
6491
- function writeTableCheckingSum(table, out) {
6492
- table.offset = out.pos;
6481
+ for (const table2 of ctr.tables) {
6482
+ out.writeU8(table2.tag.charCodeAt(0));
6483
+ out.writeU8(table2.tag.charCodeAt(1));
6484
+ out.writeU8(table2.tag.charCodeAt(2));
6485
+ out.writeU8(table2.tag.charCodeAt(3));
6486
+ out.writeU32(table2.checksum);
6487
+ out.writeU32(table2.offset);
6488
+ out.writeU32(table2.bufSize);
6489
+ }
6490
+ }
6491
+ function writeTableCheckingSum(table2, out) {
6492
+ table2.offset = out.pos;
6493
6493
  let checksum = 0;
6494
- const data = table.buf;
6495
- const len = table.bufSize;
6494
+ const data = table2.buf;
6495
+ const len = table2.bufSize;
6496
6496
  const fullWords = Math.floor(len / 4);
6497
6497
  const remainder = len % 4;
6498
6498
  for (let i2 = 0; i2 < fullWords; i2++) {
@@ -6510,7 +6510,7 @@ function writeTableCheckingSum(table, out) {
6510
6510
  checksum = checksum + word >>> 0;
6511
6511
  out.writeU32(word);
6512
6512
  }
6513
- table.checksum = checksum;
6513
+ table2.checksum = checksum;
6514
6514
  }
6515
6515
  function getTableDirectorySize(ctr) {
6516
6516
  return 16 * ctr.tables.length;
@@ -6519,8 +6519,8 @@ function getRequiredSize(ctr) {
6519
6519
  const offsetTableSize = 12;
6520
6520
  const dirSize = getTableDirectorySize(ctr);
6521
6521
  let tableDataSize = 0;
6522
- for (const table of ctr.tables) {
6523
- tableDataSize += Math.ceil(table.bufSize / 4) * 4;
6522
+ for (const table2 of ctr.tables) {
6523
+ tableDataSize += Math.ceil(table2.bufSize / 4) * 4;
6524
6524
  }
6525
6525
  return offsetTableSize + dirSize + tableDataSize;
6526
6526
  }
@@ -6532,14 +6532,14 @@ function dumpContainer(ctr) {
6532
6532
  const dirSize = getTableDirectorySize(ctr);
6533
6533
  out.pos += dirSize;
6534
6534
  let totalChecksum = 0;
6535
- for (const table of ctr.tables) {
6536
- writeTableCheckingSum(table, out);
6537
- totalChecksum = totalChecksum + table.checksum >>> 0;
6535
+ for (const table2 of ctr.tables) {
6536
+ writeTableCheckingSum(table2, out);
6537
+ totalChecksum = totalChecksum + table2.checksum >>> 0;
6538
6538
  }
6539
6539
  let headTable;
6540
- for (const table of ctr.tables) {
6541
- if (table.tag === "head") {
6542
- headTable = table;
6540
+ for (const table2 of ctr.tables) {
6541
+ if (table2.tag === "head") {
6542
+ headTable = table2;
6543
6543
  break;
6544
6544
  }
6545
6545
  }
@@ -16539,8 +16539,8 @@ function gd14(name, formula) {
16539
16539
  const parts = formula.trim().split(/\s+/);
16540
16540
  return { name, formula, args: parts.slice(1) };
16541
16541
  }
16542
- function parseGdTable(table) {
16543
- return table.trim().split(/[\n;]/).filter((entry2) => entry2.length > 0).map((entry2) => {
16542
+ function parseGdTable(table2) {
16543
+ return table2.trim().split(/[\n;]/).filter((entry2) => entry2.length > 0).map((entry2) => {
16544
16544
  const sep = entry2.indexOf("|");
16545
16545
  return gd14(entry2.slice(0, sep), entry2.slice(sep + 1));
16546
16546
  });
@@ -28572,21 +28572,21 @@ function parseBteTable(tableStream, at) {
28572
28572
  }
28573
28573
  return { fcs, pns };
28574
28574
  }
28575
- function buildBteTableBytes(table) {
28576
- const n = table.pns.length;
28575
+ function buildBteTableBytes(table2) {
28576
+ const n = table2.pns.length;
28577
28577
  const bytes = new Uint8Array((n + 1) * 4 + n * 4);
28578
28578
  const view = new DataView(bytes.buffer);
28579
28579
  for (let i2 = 0; i2 <= n; i2++) {
28580
- view.setInt32(i2 * 4, table.fcs[i2], true);
28580
+ view.setInt32(i2 * 4, table2.fcs[i2], true);
28581
28581
  }
28582
28582
  for (let i2 = 0; i2 < n; i2++) {
28583
- view.setUint32((n + 1) * 4 + i2 * 4, table.pns[i2], true);
28583
+ view.setUint32((n + 1) * 4 + i2 * 4, table2.pns[i2], true);
28584
28584
  }
28585
28585
  return bytes;
28586
28586
  }
28587
- function findBteRangeIndex(table, fc) {
28588
- for (let i2 = 0; i2 < table.pns.length; i2++) {
28589
- if (fc >= table.fcs[i2] && fc < table.fcs[i2 + 1]) {
28587
+ function findBteRangeIndex(table2, fc) {
28588
+ for (let i2 = 0; i2 < table2.pns.length; i2++) {
28589
+ if (fc >= table2.fcs[i2] && fc < table2.fcs[i2 + 1]) {
28590
28590
  return i2;
28591
28591
  }
28592
28592
  }
@@ -29257,15 +29257,15 @@ var PNG_SIGNATURE;
29257
29257
  var init_png_encoder = __esm({
29258
29258
  "src/core/utils/png-encoder.ts"() {
29259
29259
  CRC_TABLE = (() => {
29260
- const table = new Uint32Array(256);
29260
+ const table2 = new Uint32Array(256);
29261
29261
  for (let n = 0; n < 256; n++) {
29262
29262
  let c = n;
29263
29263
  for (let k = 0; k < 8; k++) {
29264
29264
  c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
29265
29265
  }
29266
- table[n] = c >>> 0;
29266
+ table2[n] = c >>> 0;
29267
29267
  }
29268
- return table;
29268
+ return table2;
29269
29269
  })();
29270
29270
  PNG_SIGNATURE = new Uint8Array([137, 80, 78, 71, 13, 10, 26, 10]);
29271
29271
  }
@@ -32936,6 +32936,63 @@ var init_smartart_layout_interpreter_axis_count = __esm({
32936
32936
  init_smartart_layout_interpreter_axis_hop();
32937
32937
  }
32938
32938
  });
32939
+ function depthFromAnchor(node, anchorId, byId) {
32940
+ let depth = 0;
32941
+ let current = node;
32942
+ const seen = /* @__PURE__ */ new Set();
32943
+ while (current) {
32944
+ if (current.id === anchorId) {
32945
+ return depth;
32946
+ }
32947
+ if (seen.has(current.id)) {
32948
+ return void 0;
32949
+ }
32950
+ seen.add(current.id);
32951
+ current = current.parentId ? byId.get(current.parentId) : void 0;
32952
+ depth += 1;
32953
+ }
32954
+ return void 0;
32955
+ }
32956
+ function resolveAxisMaxDepth(nodes, axis, pointTypes, start, count, anchor) {
32957
+ if (anchor.length === 0) {
32958
+ return void 0;
32959
+ }
32960
+ const byId = new Map(nodes.map((n) => [n.id, n]));
32961
+ let max = 0;
32962
+ for (const anchorPoint of anchor) {
32963
+ const resolved = resolveAxisNodes(nodes, axis, pointTypes, start, count, [anchorPoint]);
32964
+ if (resolved === void 0) {
32965
+ return void 0;
32966
+ }
32967
+ for (const point of resolved) {
32968
+ const depth = depthFromAnchor(point, anchorPoint.id, byId);
32969
+ if (depth !== void 0 && depth > max) {
32970
+ max = depth;
32971
+ }
32972
+ }
32973
+ }
32974
+ return max;
32975
+ }
32976
+ var init_smartart_layout_interpreter_axis_depth = __esm({
32977
+ "src/core/utils/smartart-layout-interpreter-axis-depth.ts"() {
32978
+ init_smartart_layout_interpreter_axis_count();
32979
+ }
32980
+ });
32981
+ function resolvePresentationOf(node, flat) {
32982
+ const candidates = node.presentationOfCandidates;
32983
+ if (!candidates || candidates.length === 0) {
32984
+ return node.presentationOf;
32985
+ }
32986
+ const winner = candidates.find(
32987
+ (candidate) => candidate.guard.every((guard) => evaluateWhen(guard, flat.length, { nodes: flat }) !== false)
32988
+ );
32989
+ return winner?.presentationOf ?? node.presentationOf;
32990
+ }
32991
+ var init_smartart_layout_interpreter_presof_choose = __esm({
32992
+ "src/core/utils/smartart-layout-interpreter-presof-choose.ts"() {
32993
+ init_smartart_layout_interpreter_when();
32994
+ }
32995
+ });
32939
32996
  function toNumber(value) {
32940
32997
  const parsed = Number(value);
32941
32998
  return Number.isFinite(parsed) ? parsed : void 0;
@@ -33038,11 +33095,24 @@ function evaluateWhen(when, nodeCount, context) {
33038
33095
  return threshold === void 0 ? void 0 : compareNumeric(context.depth, when.operator, threshold);
33039
33096
  }
33040
33097
  case "maxDepth": {
33041
- if (context.maxDepth === void 0) {
33098
+ const threshold = toNumber(when.value);
33099
+ if (threshold === void 0) {
33042
33100
  return void 0;
33043
33101
  }
33044
- const threshold = toNumber(when.value);
33045
- return threshold === void 0 ? void 0 : compareNumeric(context.maxDepth, when.operator, threshold);
33102
+ if (when.axis !== void 0 && context.anchor && context.nodes) {
33103
+ const axisDepth = resolveAxisMaxDepth(
33104
+ context.nodes,
33105
+ when.axis,
33106
+ when.pointTypes,
33107
+ when.start,
33108
+ when.count,
33109
+ context.anchor
33110
+ );
33111
+ if (axisDepth !== void 0) {
33112
+ return compareNumeric(axisDepth, when.operator, threshold);
33113
+ }
33114
+ }
33115
+ return context.maxDepth === void 0 ? void 0 : compareNumeric(context.maxDepth, when.operator, threshold);
33046
33116
  }
33047
33117
  case "var":
33048
33118
  return context.presLayoutVars ? evaluateVar(when, context.presLayoutVars) : void 0;
@@ -33050,21 +33120,13 @@ function evaluateWhen(when, nodeCount, context) {
33050
33120
  return void 0;
33051
33121
  }
33052
33122
  }
33053
- function resolvePresentationOf(node, flat) {
33054
- const candidates = node.presentationOfCandidates;
33055
- if (!candidates || candidates.length === 0) {
33056
- return node.presentationOf;
33057
- }
33058
- const winner = candidates.find(
33059
- (candidate) => candidate.guard.every((guard) => evaluateWhen(guard, flat.length, { nodes: flat }) !== false)
33060
- );
33061
- return winner?.presentationOf ?? node.presentationOf;
33062
- }
33063
33123
  var VAR_LOOKUP;
33064
33124
  var VAR_DEFAULT;
33065
33125
  var init_smartart_layout_interpreter_when = __esm({
33066
33126
  "src/core/utils/smartart-layout-interpreter-when.ts"() {
33067
33127
  init_smartart_layout_interpreter_axis_count();
33128
+ init_smartart_layout_interpreter_axis_depth();
33129
+ init_smartart_layout_interpreter_presof_choose();
33068
33130
  VAR_LOOKUP = {
33069
33131
  dir: (v) => v.direction,
33070
33132
  hierBranch: (v) => v.hierarchyBranch,
@@ -33154,6 +33216,23 @@ function hasStructuralDescendant(node) {
33154
33216
  (child262) => STRUCTURAL_ALG_TYPES.has(child262.algorithm?.type ?? "") && !isContinuationForEach(child262) || hasStructuralDescendant(child262)
33155
33217
  );
33156
33218
  }
33219
+ function hasRepeatedTemplateStructuralDescendant(node) {
33220
+ return (node.children ?? []).some((child262) => {
33221
+ if (STRUCTURAL_ALG_TYPES.has(child262.algorithm?.type ?? "") && !isContinuationForEach(child262) && child262.forEachOrigin?.axis?.includes("ch") && child262.forEachOrigin?.pointTypes?.includes("node")) {
33222
+ return true;
33223
+ }
33224
+ return hasRepeatedTemplateStructuralDescendant(child262);
33225
+ });
33226
+ }
33227
+ function distinctMappedSlotCount(node) {
33228
+ const names = /* @__PURE__ */ new Set();
33229
+ for (const constraint of node.allConstraints ?? node.constraints ?? []) {
33230
+ if (constraint.for === "ch" && constraint.forName) {
33231
+ names.add(constraint.forName);
33232
+ }
33233
+ }
33234
+ return names.size;
33235
+ }
33157
33236
  function mapsSlots(node) {
33158
33237
  const declaredByArranger = (node.allConstraints ?? node.constraints ?? []).some(
33159
33238
  (constraint) => constraint.for === "ch" && SLOT_CONSTRAINTS.has(constraint.type)
@@ -33188,7 +33267,14 @@ var STRUCTURAL_ALG_TYPES;
33188
33267
  var init_smartart_layout_interpreter_composite_detect = __esm({
33189
33268
  "src/core/utils/smartart-layout-interpreter-composite-detect.ts"() {
33190
33269
  SLOT_CONSTRAINTS = /* @__PURE__ */ new Set(["l", "t", "w", "h", "ctrX", "ctrY"]);
33191
- STRUCTURAL_ALG_TYPES = /* @__PURE__ */ new Set(["lin", "cycle", "pyra", "snake", "hierRoot", "hierChild"]);
33270
+ STRUCTURAL_ALG_TYPES = /* @__PURE__ */ new Set([
33271
+ "lin",
33272
+ "cycle",
33273
+ "pyra",
33274
+ "snake",
33275
+ "hierRoot",
33276
+ "hierChild"
33277
+ ]);
33192
33278
  }
33193
33279
  });
33194
33280
  function findStructuralAlgDepth(raw, crossedNames, nodeCount, context) {
@@ -33721,8 +33807,13 @@ function discoverArrangement(definition, nodeCount, presLayoutVars, flatNodes) {
33721
33807
  return;
33722
33808
  }
33723
33809
  if (kind === "composite") {
33724
- if (!compositeSlot && !itemTemplates.has(node) && !hasStructuralDescendant(node) && mapsSlots(node)) {
33810
+ const multiSlot = distinctMappedSlotCount(node) >= 2;
33811
+ const repeatedTemplateDescendant = hasRepeatedTemplateStructuralDescendant(node);
33812
+ if (!compositeSlot && !itemTemplates.has(node) && (!hasStructuralDescendant(node) || multiSlot && repeatedTemplateDescendant) && mapsSlots(node)) {
33725
33813
  compositeSlot = node;
33814
+ if (multiSlot && repeatedTemplateDescendant) {
33815
+ blockedSubtreeRoots.push(node);
33816
+ }
33726
33817
  }
33727
33818
  return;
33728
33819
  }
@@ -35215,21 +35306,21 @@ var init_smartart_layout_item_font_role = __esm({
35215
35306
  DECORATIVE_FONT_ALGORITHM_TYPES = /* @__PURE__ */ new Set(["sp", "composite", "conn"]);
35216
35307
  }
35217
35308
  });
35218
- function measureTextWidth(text22, fontSize, table) {
35309
+ function measureTextWidth(text22, fontSize, table2) {
35219
35310
  let widthPx = 0;
35220
35311
  for (const ch of text22) {
35221
35312
  const code = ch.codePointAt(0) ?? 0;
35222
- const unitsPerEm = table.advances[code] ?? table.averageAdvance;
35313
+ const unitsPerEm = table2.advances[code] ?? table2.averageAdvance;
35223
35314
  const rawPx = unitsPerEm / 1e3 * fontSize;
35224
35315
  widthPx += Math.round(rawPx * ADVANCE_STEPS_PER_PX) / ADVANCE_STEPS_PER_PX;
35225
35316
  }
35226
35317
  return widthPx;
35227
35318
  }
35228
- function greedyWrap(text22, maxWidth, fontSize, table) {
35319
+ function greedyWrap(text22, maxWidth, fontSize, table2) {
35229
35320
  if (maxWidth <= 0) {
35230
35321
  return { lines: Number.POSITIVE_INFINITY, widestLineWidth: 0 };
35231
35322
  }
35232
- const spaceWidth = measureTextWidth(" ", fontSize, table);
35323
+ const spaceWidth = measureTextWidth(" ", fontSize, table2);
35233
35324
  let lines = 0;
35234
35325
  let widestLineWidth = 0;
35235
35326
  for (const paragraph of text22.split("\n")) {
@@ -35241,7 +35332,7 @@ function greedyWrap(text22, maxWidth, fontSize, table) {
35241
35332
  let lineWidth = 0;
35242
35333
  let paragraphLines = 1;
35243
35334
  for (const word of words) {
35244
- const wordWidth = measureTextWidth(word, fontSize, table);
35335
+ const wordWidth = measureTextWidth(word, fontSize, table2);
35245
35336
  const extended = lineWidth === 0 ? wordWidth : lineWidth + spaceWidth + wordWidth;
35246
35337
  if (extended > maxWidth && lineWidth > 0) {
35247
35338
  widestLineWidth = Math.max(widestLineWidth, lineWidth);
@@ -35256,30 +35347,30 @@ function greedyWrap(text22, maxWidth, fontSize, table) {
35256
35347
  }
35257
35348
  return { lines: Math.max(1, lines), widestLineWidth };
35258
35349
  }
35259
- function wrappedLineCount(text22, maxWidth, fontSize, table) {
35260
- return greedyWrap(text22, maxWidth, fontSize, table).lines;
35350
+ function wrappedLineCount(text22, maxWidth, fontSize, table2) {
35351
+ return greedyWrap(text22, maxWidth, fontSize, table2).lines;
35261
35352
  }
35262
- function wrappedWidestLineWidth(text22, maxWidth, fontSize, table) {
35263
- return greedyWrap(text22, maxWidth, fontSize, table).widestLineWidth;
35353
+ function wrappedWidestLineWidth(text22, maxWidth, fontSize, table2) {
35354
+ return greedyWrap(text22, maxWidth, fontSize, table2).widestLineWidth;
35264
35355
  }
35265
- function fitsAt(text22, maxWidth, maxHeight, size, table, lineSpacingFactor) {
35266
- return wrappedLineCount(text22, maxWidth, size, table) * size * table.lineHeightRatio * lineSpacingFactor <= maxHeight;
35356
+ function fitsAt(text22, maxWidth, maxHeight, size, table2, lineSpacingFactor) {
35357
+ return wrappedLineCount(text22, maxWidth, size, table2) * size * table2.lineHeightRatio * lineSpacingFactor <= maxHeight;
35267
35358
  }
35268
- function fitWrappedFontSize(text22, maxWidth, maxHeight, ceiling, floor, table = DEFAULT_FONT_ADVANCE_TABLE, lineSpacingFactor = SMARTART_LINE_SPACING_FACTOR) {
35359
+ function fitWrappedFontSize(text22, maxWidth, maxHeight, ceiling, floor, table2 = DEFAULT_FONT_ADVANCE_TABLE, lineSpacingFactor = SMARTART_LINE_SPACING_FACTOR) {
35269
35360
  if (text22.trim().length === 0 || maxWidth <= 0 || maxHeight <= 0) {
35270
35361
  return ceiling;
35271
35362
  }
35272
- if (fitsAt(text22, maxWidth, maxHeight, ceiling, table, lineSpacingFactor)) {
35363
+ if (fitsAt(text22, maxWidth, maxHeight, ceiling, table2, lineSpacingFactor)) {
35273
35364
  return ceiling;
35274
35365
  }
35275
- if (!fitsAt(text22, maxWidth, maxHeight, floor, table, lineSpacingFactor)) {
35366
+ if (!fitsAt(text22, maxWidth, maxHeight, floor, table2, lineSpacingFactor)) {
35276
35367
  return floor;
35277
35368
  }
35278
35369
  let lo = floor;
35279
35370
  let hi = ceiling;
35280
35371
  for (let i2 = 0; i2 < BINARY_SEARCH_ITERATIONS; i2++) {
35281
35372
  const mid = (lo + hi) / 2;
35282
- if (fitsAt(text22, maxWidth, maxHeight, mid, table, lineSpacingFactor)) {
35373
+ if (fitsAt(text22, maxWidth, maxHeight, mid, table2, lineSpacingFactor)) {
35283
35374
  lo = mid;
35284
35375
  } else {
35285
35376
  hi = mid;
@@ -35301,15 +35392,15 @@ var init_smartart_text_wrap_fit = __esm({
35301
35392
  function resolveFontTable(fontName) {
35302
35393
  return FONT_ADVANCE_TABLES[fontName ?? "Calibri"] ?? DEFAULT_FONT_ADVANCE_TABLE;
35303
35394
  }
35304
- function itemMarginsPx(index, role, table) {
35395
+ function itemMarginsPx(index, role, table2) {
35305
35396
  const left = resolveConstraint(index, role, "lMarg");
35306
35397
  const right = resolveConstraint(index, role, "rMarg");
35307
35398
  const top = resolveConstraint(index, role, "tMarg");
35308
35399
  const bottom = resolveConstraint(index, role, "bMarg");
35309
- const leftPt = typeof left === "number" ? left : table.marginLeftPt;
35310
- const rightPt = typeof right === "number" ? right : table.marginRightPt;
35311
- const topPt = typeof top === "number" ? top : table.marginTopPt;
35312
- const bottomPt = typeof bottom === "number" ? bottom : table.marginBottomPt;
35400
+ const leftPt = typeof left === "number" ? left : table2.marginLeftPt;
35401
+ const rightPt = typeof right === "number" ? right : table2.marginRightPt;
35402
+ const topPt = typeof top === "number" ? top : table2.marginTopPt;
35403
+ const bottomPt = typeof bottom === "number" ? bottom : table2.marginBottomPt;
35313
35404
  return {
35314
35405
  horizontal: (leftPt + rightPt) * POINTS_TO_PIXELS3,
35315
35406
  vertical: (topPt + bottomPt) * POINTS_TO_PIXELS3
@@ -35353,8 +35444,8 @@ function fitSharedFontSize(bounds, index, items, fontName, naturalAspect) {
35353
35444
  if (items.length === 0) {
35354
35445
  return snapToWholePoint(ceilingPx);
35355
35446
  }
35356
- const table = resolveFontTable(fontName);
35357
- const fixedMargins = itemMarginsPx(index, role, table);
35447
+ const table2 = resolveFontTable(fontName);
35448
+ const fixedMargins = itemMarginsPx(index, role, table2);
35358
35449
  const proportional = proportionalMarginFraction(index, role);
35359
35450
  const lineSpacingFactor = SMARTART_LINE_SPACING_FACTOR;
35360
35451
  const fitAtMarginBasis = (marginBasisPx) => {
@@ -35373,7 +35464,7 @@ function fitSharedFontSize(bounds, index, items, fontName, naturalAspect) {
35373
35464
  availableHeight,
35374
35465
  ceilingPx,
35375
35466
  floorPx,
35376
- table,
35467
+ table2,
35377
35468
  lineSpacingFactor
35378
35469
  );
35379
35470
  shared2 = Math.min(shared2, fit);
@@ -35410,15 +35501,15 @@ function isMainAxisContentSized(index, arrangerRole, itemRole, mainAxisType) {
35410
35501
  const raw = firstConstraintDeclaredBy(index, itemRole, mainAxisType, arrangerRole);
35411
35502
  return raw !== void 0 && raw.value === Number.POSITIVE_INFINITY && !hasReference(raw);
35412
35503
  }
35413
- function resolveContentSizedExtents(texts, crossExtentPx, fontSizePx2, table, lineSpacingFactor, fontRole, index, cornerInsetPx, usableMain, gap) {
35504
+ function resolveContentSizedExtents(texts, crossExtentPx, fontSizePx2, table2, lineSpacingFactor, fontRole, index, cornerInsetPx, usableMain, gap) {
35414
35505
  const margins = proportionalMarginFraction(index, fontRole);
35415
- const marginVerticalPx = margins ? margins.vertical * fontSizePx2 : itemMarginsPx(index, fontRole, table).vertical;
35506
+ const marginVerticalPx = margins ? margins.vertical * fontSizePx2 : itemMarginsPx(index, fontRole, table2).vertical;
35416
35507
  const availWidthPx = Math.max(1, crossExtentPx - 2 * cornerInsetPx);
35417
35508
  const natural = texts.map((text22) => {
35418
- const lines = Math.max(1, wrappedLineCount(text22, availWidthPx, fontSizePx2, table));
35509
+ const lines = Math.max(1, wrappedLineCount(text22, availWidthPx, fontSizePx2, table2));
35419
35510
  return Math.max(
35420
35511
  12,
35421
- lines * fontSizePx2 * table.lineHeightRatio * lineSpacingFactor + marginVerticalPx + 2 * cornerInsetPx
35512
+ lines * fontSizePx2 * table2.lineHeightRatio * lineSpacingFactor + marginVerticalPx + 2 * cornerInsetPx
35422
35513
  );
35423
35514
  });
35424
35515
  const n = natural.length;
@@ -36167,16 +36258,16 @@ function paragraphBlockPx(lines, sizePx2, ratio, lineSpacingFactor, spcAftFactor
36167
36258
  const content = lines * sizePx2 * ratio * lineSpacingFactor;
36168
36259
  return isLastParagraph ? content : content + spcAftFactor * sizePx2 * ratio;
36169
36260
  }
36170
- function itemFits(item, availWidthPx, availHeightPx, rootPx, descendantPx, table, lineSpacingFactor) {
36261
+ function itemFits(item, availWidthPx, availHeightPx, rootPx, descendantPx, table2, lineSpacingFactor) {
36171
36262
  const hasDescendants = item.descendantTexts.length > 0;
36172
- if (wrappedWidestLineWidth(item.rootText, availWidthPx, rootPx, table) > availWidthPx) {
36263
+ if (wrappedWidestLineWidth(item.rootText, availWidthPx, rootPx, table2) > availWidthPx) {
36173
36264
  return false;
36174
36265
  }
36175
- const rootLines = wrappedLineCount(item.rootText, availWidthPx, rootPx, table);
36266
+ const rootLines = wrappedLineCount(item.rootText, availWidthPx, rootPx, table2);
36176
36267
  let totalPx = paragraphBlockPx(
36177
36268
  rootLines,
36178
36269
  rootPx,
36179
- table.lineHeightRatio,
36270
+ table2.lineHeightRatio,
36180
36271
  lineSpacingFactor,
36181
36272
  ROOT_SPCAFT_FACTOR,
36182
36273
  !hasDescendants || item.separateDescendantBox === true
@@ -36186,14 +36277,14 @@ function itemFits(item, availWidthPx, availHeightPx, rootPx, descendantPx, table
36186
36277
  for (let i2 = 0; i2 < item.descendantTexts.length; i2++) {
36187
36278
  const isLast = i2 === item.descendantTexts.length - 1;
36188
36279
  const text22 = item.descendantTexts[i2];
36189
- if (wrappedWidestLineWidth(text22, descendantWidthPx, descendantPx, table) > descendantWidthPx) {
36280
+ if (wrappedWidestLineWidth(text22, descendantWidthPx, descendantPx, table2) > descendantWidthPx) {
36190
36281
  return false;
36191
36282
  }
36192
- const lines = wrappedLineCount(text22, descendantWidthPx, descendantPx, table);
36283
+ const lines = wrappedLineCount(text22, descendantWidthPx, descendantPx, table2);
36193
36284
  totalPx += paragraphBlockPx(
36194
36285
  lines,
36195
36286
  descendantPx,
36196
- table.lineHeightRatio,
36287
+ table2.lineHeightRatio,
36197
36288
  lineSpacingFactor,
36198
36289
  DESCENDANT_SPCAFT_FACTOR,
36199
36290
  isLast
@@ -36225,8 +36316,8 @@ function resolveTieredItemFontSize(plan, index, items, fontName, naturalAspect,
36225
36316
  if (items.length === 0) {
36226
36317
  return { rootSizePx: ceilingPx, descendantSizePx: ceilingPx * SMARTART_DESCENDANT_FONT_SCALE };
36227
36318
  }
36228
- const table = resolveFontTable(fontName);
36229
- const fixedMargins = itemMarginsPx(index, role, table);
36319
+ const table2 = resolveFontTable(fontName);
36320
+ const fixedMargins = itemMarginsPx(index, role, table2);
36230
36321
  const proportional = proportionalMarginFraction(index, role);
36231
36322
  const lineSpacingFactor = SMARTART_LINE_SPACING_FACTOR;
36232
36323
  const fitsAtMarginBasis = (rootPx2, marginBasisPx) => {
@@ -36246,7 +36337,7 @@ function resolveTieredItemFontSize(plan, index, items, fontName, naturalAspect,
36246
36337
  availHeightPx,
36247
36338
  rootPx2,
36248
36339
  descendantPx,
36249
- table,
36340
+ table2,
36250
36341
  lineSpacingFactor
36251
36342
  );
36252
36343
  if (!fits) {
@@ -36304,6 +36395,152 @@ var init_smartart_layout_item_font_tier = __esm({
36304
36395
  PX_PER_PT2 = 96 / 72;
36305
36396
  }
36306
36397
  });
36398
+ function algTypeOf(node, nodeCount, presLayoutVars) {
36399
+ return node.algorithm?.type ?? chooseAlgType(node, nodeCount, { presLayoutVars: presLayoutVars ?? {} });
36400
+ }
36401
+ function findRowChild(node, presLayoutVars) {
36402
+ return (node.children ?? []).find((child262) => {
36403
+ if (child262.algorithm?.type === "sp") {
36404
+ return false;
36405
+ }
36406
+ if (algTypeOf(child262, 2, presLayoutVars) !== "lin") {
36407
+ return false;
36408
+ }
36409
+ return (child262.children ?? []).some(
36410
+ (grandchild) => grandchild.forEachOrigin?.axis?.includes("ch") && grandchild.forEachOrigin?.pointTypes?.includes("node")
36411
+ );
36412
+ });
36413
+ }
36414
+ function isRecursiveTableItemTemplate(node, presLayoutVars) {
36415
+ if (!node.forEachOrigin?.axis?.includes("ch") || !node.forEachOrigin?.pointTypes?.includes("node")) {
36416
+ return false;
36417
+ }
36418
+ if (algTypeOf(node, 2, presLayoutVars) !== "lin") {
36419
+ return false;
36420
+ }
36421
+ const hasLabel = (node.children ?? []).some(
36422
+ (child262) => child262.algorithm?.type === "tx" && child262.presentationOf?.axis?.includes("self")
36423
+ );
36424
+ return hasLabel && findRowChild(node, presLayoutVars) !== void 0;
36425
+ }
36426
+ function resolvedLinDir(node, nodeCount, presLayoutVars, fallback) {
36427
+ const alg = node.algorithm ?? chooseAlgorithm(node, nodeCount, { presLayoutVars: presLayoutVars ?? {} });
36428
+ return alg?.parameters?.find((p) => p.type === "linDir")?.value ?? fallback;
36429
+ }
36430
+ function arrangeRecursiveTable(plan, nodes, box, palette, style, elementId, index, childrenOf, fontName, presLayoutVars) {
36431
+ const ctx = styleContext(style);
36432
+ const { width: w, height: h2 } = box;
36433
+ const reversed = resolvedLinDir(plan.node, nodes.length, presLayoutVars, "fromT") === "fromB";
36434
+ const rowChild = findRowChild(plan.node, presLayoutVars);
36435
+ const colReversed = rowChild ? resolvedLinDir(rowChild, nodes.length, presLayoutVars, "fromL") === "fromR" : false;
36436
+ const byId = new Map(nodes.map((n) => [n.id, n]));
36437
+ const childrenIn = (n) => (childrenOf.get(n.id) ?? []).filter((c) => byId.has(c.id));
36438
+ const childIds = /* @__PURE__ */ new Set();
36439
+ for (const n of nodes) {
36440
+ for (const c of childrenIn(n)) {
36441
+ childIds.add(c.id);
36442
+ }
36443
+ }
36444
+ const roots = nodes.filter((n) => !childIds.has(n.id));
36445
+ const depthOf = /* @__PURE__ */ new Map();
36446
+ let maxDepth = 0;
36447
+ const depthStack = roots.map((r) => ({
36448
+ node: r,
36449
+ depth: 0
36450
+ }));
36451
+ while (depthStack.length > 0) {
36452
+ const { node, depth } = depthStack.pop();
36453
+ depthOf.set(node.id, depth);
36454
+ maxDepth = Math.max(maxDepth, depth);
36455
+ for (const c of childrenIn(node)) {
36456
+ depthStack.push({ node: c, depth: depth + 1 });
36457
+ }
36458
+ }
36459
+ const generations = maxDepth + 1;
36460
+ const rowDenom = generations + Math.max(0, generations - 1) * DEFAULT_GAP_RATIO;
36461
+ const rowHeight = h2 / rowDenom;
36462
+ const rowGap = DEFAULT_GAP_RATIO * rowHeight;
36463
+ const rowY = (depth) => (reversed ? generations - 1 - depth : depth) * (rowHeight + rowGap);
36464
+ const splitAcross = (items, x, width) => {
36465
+ const n = items.length;
36466
+ if (n === 0) {
36467
+ return [];
36468
+ }
36469
+ const denom = n + Math.max(0, n - 1) * DEFAULT_GAP_RATIO;
36470
+ const colWidth = width / denom;
36471
+ const colGap = DEFAULT_GAP_RATIO * colWidth;
36472
+ const ordered4 = colReversed ? [...items].reverse() : items;
36473
+ const out = [];
36474
+ let cursor = x;
36475
+ for (const item of ordered4) {
36476
+ out.push([item, cursor, colWidth]);
36477
+ cursor += colWidth + colGap;
36478
+ }
36479
+ return out;
36480
+ };
36481
+ const placed = [];
36482
+ const place = (node, x, width) => {
36483
+ placed.push({ node, x, width });
36484
+ const kids = childrenIn(node);
36485
+ for (const [child262, childX, childWidth] of splitAcross(kids, x, width)) {
36486
+ place(child262, childX, childWidth);
36487
+ }
36488
+ };
36489
+ for (const [root, rootX, rootWidth] of splitAcross(roots, 0, w)) {
36490
+ place(root, rootX, rootWidth);
36491
+ }
36492
+ const itemShape = findCompositeItemShape(plan.node);
36493
+ const { rootSizePx: fontSizeOverride, descendantSizePx } = resolveTieredItemFontSize(
36494
+ plan,
36495
+ index,
36496
+ placed.map(({ node, width }) => ({
36497
+ rootText: node.text,
36498
+ descendantTexts: [],
36499
+ width,
36500
+ height: rowHeight,
36501
+ separateDescendantBox: false
36502
+ })),
36503
+ fontName,
36504
+ void 0
36505
+ );
36506
+ const renderedNodes = placed.map(
36507
+ ({ node, x, width }, i2) => presetBoxNode({
36508
+ key: `${elementId}-lintbl-${node.id}-${i2}`,
36509
+ x,
36510
+ y: rowY(depthOf.get(node.id) ?? 0),
36511
+ width,
36512
+ height: rowHeight,
36513
+ node,
36514
+ index: i2,
36515
+ total: placed.length,
36516
+ palette,
36517
+ style,
36518
+ ctx,
36519
+ shape: itemShape,
36520
+ fallbackKind: "rect",
36521
+ fontSizeOverride,
36522
+ descendantFontSize: descendantSizePx
36523
+ })
36524
+ );
36525
+ return {
36526
+ nodes: renderedNodes,
36527
+ connectors: [],
36528
+ shadowFilter: ctx.shadow,
36529
+ viewBox: `0 0 ${w} ${h2}`,
36530
+ family: "list"
36531
+ };
36532
+ }
36533
+ var DEFAULT_GAP_RATIO;
36534
+ var init_smartart_layout_interpreter_linear_table = __esm({
36535
+ "src/core/utils/smartart-layout-interpreter-linear-table.ts"() {
36536
+ init_smartart_layout_interpreter_choose_algorithm();
36537
+ init_smartart_layout_interpreter_preset_node();
36538
+ init_smartart_layout_interpreter_render();
36539
+ init_smartart_layout_item_font_tier();
36540
+ init_smartart_layout_shape_preset();
36541
+ DEFAULT_GAP_RATIO = 0.25;
36542
+ }
36543
+ });
36307
36544
  function snakeGridDims(plan, n, w, h2, flowDir) {
36308
36545
  const bkpt = algorithmParam(plan.node, "bkpt");
36309
36546
  const fixedVal = findConstraint(plan.node.constraints, "bkPtFixedVal")?.value;
@@ -36460,6 +36697,20 @@ var init_smartart_layout_interpreter_snake = __esm({
36460
36697
  }
36461
36698
  });
36462
36699
  function arrangeLinear(plan, flow, nodes, box, palette, style, elementId, index = EMPTY_CONSTRAINT_INDEX, childrenOf, fontName, presLayoutVars) {
36700
+ if (childrenOf && isRecursiveTableItemTemplate(plan.node, presLayoutVars)) {
36701
+ return arrangeRecursiveTable(
36702
+ plan,
36703
+ nodes,
36704
+ box,
36705
+ palette,
36706
+ style,
36707
+ elementId,
36708
+ index,
36709
+ childrenOf,
36710
+ fontName,
36711
+ presLayoutVars
36712
+ );
36713
+ }
36463
36714
  const { width: w, height: h2 } = box;
36464
36715
  const ctx = styleContext(style);
36465
36716
  const constraints = plan.node.constraints;
@@ -36570,6 +36821,7 @@ var init_smartart_layout_interpreter_linear = __esm({
36570
36821
  init_smartart_layout_interpreter_linear_item_aspect();
36571
36822
  init_smartart_layout_interpreter_linear_main_axis();
36572
36823
  init_smartart_layout_interpreter_linear_shared();
36824
+ init_smartart_layout_interpreter_linear_table();
36573
36825
  init_smartart_layout_interpreter_model();
36574
36826
  init_smartart_layout_interpreter_preset_node();
36575
36827
  init_smartart_layout_interpreter_render();
@@ -36690,20 +36942,23 @@ function isCrossRoleReference(constraint) {
36690
36942
  return (constraint.referenceFor === "ch" || constraint.referenceFor === "des") && Boolean(constraint.referenceForName);
36691
36943
  }
36692
36944
  function dimDeclaredBy(role, type, declaringRole, box, index) {
36693
- const declared = firstConstraintDeclaredBy(index, role, type, declaringRole);
36694
- if (!declared) {
36695
- return void 0;
36696
- }
36697
- const resolved = resolveConstraintDeclaredBy(index, role, type, declaringRole);
36698
- if (typeof resolved !== "number" || !Number.isFinite(resolved)) {
36699
- return void 0;
36700
- }
36701
- const extent = axisExtent(declared.referenceType, box, defaultExtent(type, box));
36702
- if (resolved >= 0 && resolved <= 1) {
36703
- return { px: resolved * extent };
36704
- }
36705
- if (resolved > 1) {
36706
- return { abs: resolved };
36945
+ const chain = typeof declaringRole === "string" ? [declaringRole] : declaringRole;
36946
+ for (const candidateRole of chain) {
36947
+ const declared = firstConstraintDeclaredBy(index, role, type, candidateRole);
36948
+ if (!declared) {
36949
+ continue;
36950
+ }
36951
+ const resolved = resolveConstraintDeclaredBy(index, role, type, candidateRole);
36952
+ if (typeof resolved !== "number" || !Number.isFinite(resolved)) {
36953
+ continue;
36954
+ }
36955
+ const extent = axisExtent(declared.referenceType, box, defaultExtent(type, box));
36956
+ if (resolved >= 0 && resolved <= 1) {
36957
+ return { px: resolved * extent };
36958
+ }
36959
+ if (resolved > 1) {
36960
+ return { abs: resolved };
36961
+ }
36707
36962
  }
36708
36963
  return void 0;
36709
36964
  }
@@ -36735,6 +36990,13 @@ function dimOf(constraints, type, box, index, role, declaringRole) {
36735
36990
  }
36736
36991
  return void 0;
36737
36992
  }
36993
+ var init_smartart_layout_interpreter_composite_slot_dim = __esm({
36994
+ "src/core/utils/smartart-layout-interpreter-composite-slot-dim.ts"() {
36995
+ init_smartart_constraint_declared_by();
36996
+ init_smartart_constraint_solver();
36997
+ init_smartart_layout_interpreter_model();
36998
+ }
36999
+ });
36738
37000
  function isPositioned(dims) {
36739
37001
  return dims.l !== void 0 || dims.t !== void 0 || dims.w !== void 0 || dims.h !== void 0 || dims.ctrX !== void 0 || dims.ctrY !== void 0;
36740
37002
  }
@@ -36823,9 +37085,8 @@ function resolveSlot(dims, box, absX, absY) {
36823
37085
  }
36824
37086
  var init_smartart_layout_interpreter_composite_slots = __esm({
36825
37087
  "src/core/utils/smartart-layout-interpreter-composite-slots.ts"() {
36826
- init_smartart_constraint_declared_by();
36827
37088
  init_smartart_constraint_solver();
36828
- init_smartart_layout_interpreter_model();
37089
+ init_smartart_layout_interpreter_composite_slot_dim();
36829
37090
  }
36830
37091
  });
36831
37092
  function childAxisSpec(template, childCount) {
@@ -36946,6 +37207,23 @@ function resolveAnchoredContentPerAnchor(node, flat) {
36946
37207
  }
36947
37208
  return groups;
36948
37209
  }
37210
+ function resolveAnchoredContentPerAnchorFrom(node, flat, origin) {
37211
+ const presOf = resolvePresentationOf(node, flat);
37212
+ if (!presOf?.axis || presOf.axis.length === 0 || !origin.axis || origin.axis.length === 0) {
37213
+ return [];
37214
+ }
37215
+ const anchors = resolveAxisNodes(flat, origin.axis, origin.pointTypes, origin.start, origin.count) ?? [];
37216
+ const anchorCount = anchors.length;
37217
+ const presOfAxis = presOf.axis;
37218
+ const groups = [];
37219
+ anchors.forEach((anchor, anchorIndex) => {
37220
+ const content = resolveAxisNodes(flat, presOfAxis, presOf.pointTypes, presOf.start, presOf.count, [anchor]) ?? [];
37221
+ if (content.length > 0) {
37222
+ groups.push({ content, anchorIndex, anchorCount });
37223
+ }
37224
+ });
37225
+ return groups;
37226
+ }
36949
37227
  var init_smartart_layout_interpreter_composite_anchor = __esm({
36950
37228
  "src/core/utils/smartart-layout-interpreter-composite-anchor.ts"() {
36951
37229
  init_smartart_layout_interpreter_axis_count();
@@ -36955,8 +37233,10 @@ var init_smartart_layout_interpreter_composite_anchor = __esm({
36955
37233
  function winningOrdinalFor(guardsByOrdinal, nodeCount, flat) {
36956
37234
  const ordinals = [...guardsByOrdinal.keys()].sort((a, b) => a - b);
36957
37235
  for (const ordinal of ordinals) {
36958
- const guard = guardsByOrdinal.get(ordinal);
36959
- const allows = !guard || evaluateWhen(guard, nodeCount, { nodes: flat }) !== false;
37236
+ const entry2 = guardsByOrdinal.get(ordinal);
37237
+ const origin = entry2?.forEachOrigin;
37238
+ const anchor = origin?.axis && origin.axis.length > 0 ? resolveAxisNodes(flat, origin.axis, origin.pointTypes, origin.start, origin.count) : void 0;
37239
+ const allows = !entry2?.guard || evaluateWhen(entry2.guard, nodeCount, { nodes: flat, anchor }) !== false;
36960
37240
  if (allows) {
36961
37241
  return ordinal;
36962
37242
  }
@@ -36976,7 +37256,7 @@ function selectFirstMatchChildren(children12, flat) {
36976
37256
  guardsByGroup.set(entry2.id, byOrdinal);
36977
37257
  }
36978
37258
  if (!byOrdinal.has(entry2.ordinal)) {
36979
- byOrdinal.set(entry2.ordinal, entry2.guard);
37259
+ byOrdinal.set(entry2.ordinal, { guard: entry2.guard, forEachOrigin: child262.forEachOrigin });
36980
37260
  }
36981
37261
  }
36982
37262
  }
@@ -36994,9 +37274,149 @@ function selectFirstMatchChildren(children12, flat) {
36994
37274
  }
36995
37275
  var init_smartart_layout_interpreter_composite_choose_groups = __esm({
36996
37276
  "src/core/utils/smartart-layout-interpreter-composite-choose-groups.ts"() {
37277
+ init_smartart_layout_interpreter_axis_count();
36997
37278
  init_smartart_layout_interpreter_when();
36998
37279
  }
36999
37280
  });
37281
+ function resolveOwnAnchor(node, flat) {
37282
+ const origin = node.forEachOrigin;
37283
+ if (!origin?.axis || origin.axis.length === 0) {
37284
+ return void 0;
37285
+ }
37286
+ return resolveAxisNodes(flat, origin.axis, origin.pointTypes, origin.start, origin.count);
37287
+ }
37288
+ function guardAllows(node, flat, iterationPosition) {
37289
+ if (!node.chooseGuard) {
37290
+ return true;
37291
+ }
37292
+ const anchor = resolveOwnAnchor(node, flat);
37293
+ return node.chooseGuard.every(
37294
+ (guard) => evaluateWhen(guard, flat.length, {
37295
+ nodes: flat,
37296
+ anchor,
37297
+ position: iterationPosition?.position,
37298
+ total: iterationPosition?.total
37299
+ }) !== false
37300
+ );
37301
+ }
37302
+ function collectRawCandidates(node, flat, declaringRole, out = [], inheritedOrigin, ancestorChain = []) {
37303
+ const hasPresOf = (node.presentationOf?.axis?.length ?? 0) > 0 || (node.presentationOfCandidates?.length ?? 0) > 0;
37304
+ if (hasPresOf) {
37305
+ const ownOrigin = (node.forEachOrigin?.axis?.length ?? 0) > 0 ? node.forEachOrigin : void 0;
37306
+ if (!ownOrigin && inheritedOrigin) {
37307
+ const declaringRoleChain = ancestorChain.length > 0 ? [declaringRole, ...ancestorChain] : void 0;
37308
+ for (const { content, anchorIndex, anchorCount } of resolveAnchoredContentPerAnchorFrom(
37309
+ node,
37310
+ flat,
37311
+ inheritedOrigin
37312
+ )) {
37313
+ const iterationPosition2 = anchorCount > 1 ? { position: anchorIndex + 1, total: anchorCount } : void 0;
37314
+ if (!guardAllows(node, flat, iterationPosition2)) {
37315
+ continue;
37316
+ }
37317
+ out.push({
37318
+ node,
37319
+ declaringRole,
37320
+ declaringRoleChain,
37321
+ content,
37322
+ iteration: anchorIndex,
37323
+ iterationCount: anchorCount
37324
+ });
37325
+ }
37326
+ return out;
37327
+ }
37328
+ const groups = resolveAnchoredContentPerAnchor(node, flat);
37329
+ const iterationPosition = (iteration) => groups.length > 1 ? { position: iteration + 1, total: groups.length } : void 0;
37330
+ groups.forEach((content, iteration) => {
37331
+ if (!guardAllows(node, flat, iterationPosition(iteration))) {
37332
+ return;
37333
+ }
37334
+ out.push({ node, declaringRole, content, iteration, iterationCount: groups.length });
37335
+ });
37336
+ return out;
37337
+ }
37338
+ if (!guardAllows(node, flat, void 0)) {
37339
+ return out;
37340
+ }
37341
+ const nextRole = roleOf(node);
37342
+ const nextAncestorChain = nextRole === declaringRole ? ancestorChain : [declaringRole, ...ancestorChain];
37343
+ const ownTemplateOrigin = node.algorithm?.type && STRUCTURAL_ALG_TYPES.has(node.algorithm.type) && node.forEachOrigin?.axis?.includes("ch") && node.forEachOrigin?.pointTypes?.includes("node") ? node.forEachOrigin : void 0;
37344
+ const effectiveOrigin = ownTemplateOrigin ?? inheritedOrigin;
37345
+ for (const child262 of selectFirstMatchChildren(node.children ?? [], flat)) {
37346
+ collectRawCandidates(child262, flat, nextRole, out, effectiveOrigin, nextAncestorChain);
37347
+ }
37348
+ return out;
37349
+ }
37350
+ var init_smartart_layout_interpreter_composite_candidates = __esm({
37351
+ "src/core/utils/smartart-layout-interpreter-composite-candidates.ts"() {
37352
+ init_smartart_constraint_solver();
37353
+ init_smartart_layout_interpreter_axis_count();
37354
+ init_smartart_layout_interpreter_composite_anchor();
37355
+ init_smartart_layout_interpreter_composite_choose_groups();
37356
+ init_smartart_layout_interpreter_composite_detect();
37357
+ init_smartart_layout_interpreter_when();
37358
+ }
37359
+ });
37360
+ function resolveSharedFontFit(fontCtx, fontRoleNode, items) {
37361
+ if (items.length === 0) {
37362
+ return void 0;
37363
+ }
37364
+ return resolveTieredItemFontSize(
37365
+ fontCtx.plan,
37366
+ fontCtx.index,
37367
+ items,
37368
+ fontCtx.fontName,
37369
+ void 0,
37370
+ 0,
37371
+ fontRoleNode
37372
+ );
37373
+ }
37374
+ function resolveFontFitFromPairs(fontCtx, fontRoleNode, pairs3) {
37375
+ if (!fontCtx) {
37376
+ return void 0;
37377
+ }
37378
+ return resolveSharedFontFit(
37379
+ fontCtx,
37380
+ fontRoleNode,
37381
+ pairs3.map((pair) => ({
37382
+ rootText: pair.node.text,
37383
+ descendantTexts: pair.desSlot?.content.map((entry2) => entry2.text) ?? [],
37384
+ width: pair.selfRect.width,
37385
+ height: pair.selfRect.height
37386
+ }))
37387
+ );
37388
+ }
37389
+ function resolveFitByDeclaringRole(fontCtx, slots) {
37390
+ const byRole = /* @__PURE__ */ new Map();
37391
+ for (const slot of slots) {
37392
+ const group2 = byRole.get(slot.declaringRole);
37393
+ if (group2) {
37394
+ group2.push(slot);
37395
+ } else {
37396
+ byRole.set(slot.declaringRole, [slot]);
37397
+ }
37398
+ }
37399
+ const fitByRole = /* @__PURE__ */ new Map();
37400
+ for (const [role, group2] of byRole) {
37401
+ const fit = resolveSharedFontFit(
37402
+ fontCtx,
37403
+ group2[0]?.node,
37404
+ group2.map(({ content, rect: rect22 }) => ({
37405
+ rootText: content[0]?.text ?? "",
37406
+ descendantTexts: content.slice(1).map((entry2) => entry2.text),
37407
+ width: rect22.width,
37408
+ height: rect22.height
37409
+ }))
37410
+ );
37411
+ fitByRole.set(role, fit);
37412
+ }
37413
+ return fitByRole;
37414
+ }
37415
+ var init_smartart_layout_interpreter_composite_fontfit = __esm({
37416
+ "src/core/utils/smartart-layout-interpreter-composite-fontfit.ts"() {
37417
+ init_smartart_layout_item_font_tier();
37418
+ }
37419
+ });
37000
37420
  function resolveIterationRect(dims, box, iteration, iterationCount) {
37001
37421
  const container = resolveSlot(dims, box, 1, 1);
37002
37422
  if (iterationCount <= 1) {
@@ -37036,7 +37456,12 @@ function resolveGroupedSlots(candidates, box, index) {
37036
37456
  return aIsSp - bIsSp;
37037
37457
  });
37038
37458
  for (const candidate of ordered4) {
37039
- const [slotted] = readSlots([candidate.node], box, index, candidate.declaringRole);
37459
+ const [slotted] = readSlots(
37460
+ [candidate.node],
37461
+ box,
37462
+ index,
37463
+ candidate.declaringRoleChain ?? candidate.declaringRole
37464
+ );
37040
37465
  if (slotted) {
37041
37466
  const rect22 = resolveIterationRect(
37042
37467
  slotted.dims,
@@ -37044,7 +37469,12 @@ function resolveGroupedSlots(candidates, box, index) {
37044
37469
  candidate.iteration,
37045
37470
  candidate.iterationCount
37046
37471
  );
37047
- out.push({ rect: rect22, content: candidate.content, node: candidate.node });
37472
+ out.push({
37473
+ rect: rect22,
37474
+ content: candidate.content,
37475
+ node: candidate.node,
37476
+ declaringRole: candidate.declaringRole
37477
+ });
37048
37478
  break;
37049
37479
  }
37050
37480
  }
@@ -37057,51 +37487,19 @@ var init_smartart_layout_interpreter_composite_group_slots = __esm({
37057
37487
  init_smartart_layout_interpreter_composite_slots();
37058
37488
  }
37059
37489
  });
37060
- function guardAllows(node, flat, iterationPosition) {
37061
- if (!node.chooseGuard) {
37062
- return true;
37063
- }
37064
- return node.chooseGuard.every(
37065
- (guard) => evaluateWhen(guard, flat.length, {
37066
- nodes: flat,
37067
- position: iterationPosition?.position,
37068
- total: iterationPosition?.total
37069
- }) !== false
37070
- );
37071
- }
37072
- function collectRawCandidates(node, flat, declaringRole, out = []) {
37073
- const hasPresOf = (node.presentationOf?.axis?.length ?? 0) > 0 || (node.presentationOfCandidates?.length ?? 0) > 0;
37074
- if (hasPresOf) {
37075
- const groups = resolveAnchoredContentPerAnchor(node, flat);
37076
- const iterationPosition = (iteration) => groups.length > 1 ? { position: iteration + 1, total: groups.length } : void 0;
37077
- groups.forEach((content, iteration) => {
37078
- if (!guardAllows(node, flat, iterationPosition(iteration))) {
37079
- return;
37080
- }
37081
- out.push({ node, declaringRole, content, iteration, iterationCount: groups.length });
37082
- });
37083
- return out;
37084
- }
37085
- if (!guardAllows(node, flat, void 0)) {
37086
- return out;
37087
- }
37088
- const nextRole = roleOf(node);
37089
- for (const child262 of selectFirstMatchChildren(node.children ?? [], flat)) {
37090
- collectRawCandidates(child262, flat, nextRole, out);
37091
- }
37092
- return out;
37093
- }
37094
37490
  function collectChooseAwareSlots(node, flat, box, index, declaringRole) {
37095
37491
  const candidates = collectRawCandidates(node, flat, declaringRole);
37096
37492
  return resolveGroupedSlots(candidates, box, index);
37097
37493
  }
37098
- function arrangeByChooseAwareSlots(root, flat, box, index, ctx) {
37494
+ function arrangeByChooseAwareSlots(root, flat, box, index, ctx, fontCtx) {
37099
37495
  const slots = collectChooseAwareSlots(root, flat, box, index, roleOf(root));
37100
37496
  if (slots.length === 0) {
37101
37497
  return void 0;
37102
37498
  }
37103
- return slots.map(({ rect: rect22, content, node: layoutNode }, i2) => {
37499
+ const fitByRole = fontCtx ? resolveFitByDeclaringRole(fontCtx, slots) : /* @__PURE__ */ new Map();
37500
+ return slots.map(({ rect: rect22, content, node: layoutNode, declaringRole }, i2) => {
37104
37501
  const first = content[0];
37502
+ const fit = fitByRole.get(declaringRole);
37105
37503
  const rendered = {
37106
37504
  ...presetBoxNode({
37107
37505
  key: `${ctx.elementId}-comp-choose-${first.id}-${i2}`,
@@ -37114,6 +37512,8 @@ function arrangeByChooseAwareSlots(root, flat, box, index, ctx) {
37114
37512
  total: slots.length,
37115
37513
  palette: ctx.palette,
37116
37514
  style: ctx.style,
37515
+ fontSizeOverride: fit?.rootSizePx,
37516
+ descendantFontSize: fit?.descendantSizePx,
37117
37517
  ctx: ctx.ctx,
37118
37518
  shape: findCompositeItemShape(layoutNode),
37119
37519
  fallbackKind: "rect"
@@ -37126,48 +37526,13 @@ function arrangeByChooseAwareSlots(root, flat, box, index, ctx) {
37126
37526
  var init_smartart_layout_interpreter_composite_choose = __esm({
37127
37527
  "src/core/utils/smartart-layout-interpreter-composite-choose.ts"() {
37128
37528
  init_smartart_constraint_solver();
37129
- init_smartart_layout_interpreter_composite_anchor();
37130
- init_smartart_layout_interpreter_composite_choose_groups();
37529
+ init_smartart_layout_interpreter_composite_candidates();
37530
+ init_smartart_layout_interpreter_composite_fontfit();
37131
37531
  init_smartart_layout_interpreter_composite_group_slots();
37132
37532
  init_smartart_layout_interpreter_preset_node();
37133
- init_smartart_layout_interpreter_when();
37134
37533
  init_smartart_layout_shape_preset();
37135
37534
  }
37136
37535
  });
37137
- function resolveSharedFontFit(fontCtx, fontRoleNode, items) {
37138
- if (items.length === 0) {
37139
- return void 0;
37140
- }
37141
- return resolveTieredItemFontSize(
37142
- fontCtx.plan,
37143
- fontCtx.index,
37144
- items,
37145
- fontCtx.fontName,
37146
- void 0,
37147
- 0,
37148
- fontRoleNode
37149
- );
37150
- }
37151
- function resolveFontFitFromPairs(fontCtx, fontRoleNode, pairs3) {
37152
- if (!fontCtx) {
37153
- return void 0;
37154
- }
37155
- return resolveSharedFontFit(
37156
- fontCtx,
37157
- fontRoleNode,
37158
- pairs3.map((pair) => ({
37159
- rootText: pair.node.text,
37160
- descendantTexts: pair.desSlot?.content.map((entry2) => entry2.text) ?? [],
37161
- width: pair.selfRect.width,
37162
- height: pair.selfRect.height
37163
- }))
37164
- );
37165
- }
37166
- var init_smartart_layout_interpreter_composite_fontfit = __esm({
37167
- "src/core/utils/smartart-layout-interpreter-composite-fontfit.ts"() {
37168
- init_smartart_layout_item_font_tier();
37169
- }
37170
- });
37171
37536
  function forEachBoundSlots(slotted) {
37172
37537
  return slotted.filter((slot) => {
37173
37538
  const axis = slot.node.presentationOf?.axis;
@@ -37452,7 +37817,7 @@ function arrangeComposite(plan, nodes, box, palette, style, elementId, index = E
37452
37817
  childrenOf,
37453
37818
  ctx,
37454
37819
  fontCtx
37455
- ) ?? arrangeByChooseAwareSlots(plan.node, flat, box, index, ctx) ?? arrangeByOrder(slotted, nodes, box, absX, absY, ctx, fontCtx);
37820
+ ) ?? arrangeByChooseAwareSlots(plan.node, flat, box, index, ctx, fontCtx) ?? arrangeByOrder(slotted, nodes, box, absX, absY, ctx, fontCtx);
37456
37821
  return {
37457
37822
  nodes: renderedNodes,
37458
37823
  connectors: [],
@@ -37972,7 +38337,7 @@ function arrangePyramid(plan, nodes, box, palette, style, elementId, index = EMP
37972
38337
  index,
37973
38338
  roleOf(plan.node),
37974
38339
  ["sibSp", "sp"],
37975
- DEFAULT_GAP_RATIO
38340
+ DEFAULT_GAP_RATIO2
37976
38341
  );
37977
38342
  const usableH = h2 - DEFAULT_INSET * 2;
37978
38343
  const bandH = n > 0 ? usableH / (n + Math.max(0, n - 1) * gapRatio) : usableH;
@@ -38044,7 +38409,7 @@ function arrangePyramid(plan, nodes, box, palette, style, elementId, index = EMP
38044
38409
  family: "pyramid"
38045
38410
  };
38046
38411
  }
38047
- var DEFAULT_GAP_RATIO;
38412
+ var DEFAULT_GAP_RATIO2;
38048
38413
  var DEFAULT_INSET;
38049
38414
  var init_smartart_layout_interpreter_pyramid = __esm({
38050
38415
  "src/core/utils/smartart-layout-interpreter-pyramid.ts"() {
@@ -38054,7 +38419,7 @@ var init_smartart_layout_interpreter_pyramid = __esm({
38054
38419
  init_smartart_layout_interpreter_model();
38055
38420
  init_smartart_layout_interpreter_render();
38056
38421
  init_smartart_layout_item_font_tier();
38057
- DEFAULT_GAP_RATIO = 0;
38422
+ DEFAULT_GAP_RATIO2 = 0;
38058
38423
  DEFAULT_INSET = 0;
38059
38424
  }
38060
38425
  });
@@ -38236,26 +38601,67 @@ var init_smartart_hierarchy_pitch = __esm({
38236
38601
  GENERATION_MARGIN_RATIO = 0.1675;
38237
38602
  }
38238
38603
  });
38239
- function findHierarchyItemNode(node) {
38604
+ function collectTxShapeNodes(node, out, seen) {
38240
38605
  if (!node) {
38241
- return void 0;
38606
+ return;
38242
38607
  }
38243
38608
  if (node.algorithm?.type === "tx" && node.shape) {
38244
- return node;
38609
+ const key2 = node.name ?? `#${out.length}`;
38610
+ if (!seen.has(key2)) {
38611
+ seen.add(key2);
38612
+ out.push(node);
38613
+ }
38245
38614
  }
38246
38615
  for (const child262 of node.children ?? []) {
38247
- const found = findHierarchyItemNode(child262);
38248
- if (found) {
38249
- return found;
38616
+ collectTxShapeNodes(child262, out, seen);
38617
+ }
38618
+ }
38619
+ function crossReferencesAnotherCandidate(candidate, otherNames, constraints) {
38620
+ const candidateName = candidate.name;
38621
+ if (!candidateName) {
38622
+ return false;
38623
+ }
38624
+ return (constraints ?? []).some(
38625
+ (c) => (c.type === "h" || c.type === "w") && c.for === "des" && c.forName === candidateName && c.referenceForName !== void 0 && c.referenceForName !== candidateName && otherNames.has(c.referenceForName)
38626
+ );
38627
+ }
38628
+ function resolveHierarchyItemNode(algorithmNode) {
38629
+ if (!algorithmNode) {
38630
+ return void 0;
38631
+ }
38632
+ const candidates = [];
38633
+ collectTxShapeNodes(algorithmNode, candidates, /* @__PURE__ */ new Set());
38634
+ if (candidates.length === 0) {
38635
+ return void 0;
38636
+ }
38637
+ const first = candidates[0];
38638
+ if (candidates.length < 2 || !first) {
38639
+ return first;
38640
+ }
38641
+ const allNames = new Set(
38642
+ candidates.map((c) => c.name).filter((n) => n !== void 0)
38643
+ );
38644
+ const constraints = algorithmNode.allConstraints ?? algorithmNode.constraints ?? [];
38645
+ for (const candidate of candidates) {
38646
+ const otherNames = new Set(allNames);
38647
+ if (candidate.name) {
38648
+ otherNames.delete(candidate.name);
38649
+ }
38650
+ if (crossReferencesAnotherCandidate(candidate, otherNames, constraints)) {
38651
+ return candidate;
38250
38652
  }
38251
38653
  }
38252
- return void 0;
38654
+ return first;
38253
38655
  }
38656
+ var init_smartart_hierarchy_item_template = __esm({
38657
+ "src/core/utils/smartart-hierarchy-item-template.ts"() {
38658
+ }
38659
+ });
38254
38660
  function findHierarchyItemShape(node) {
38255
- return findHierarchyItemNode(node)?.shape;
38661
+ return resolveHierarchyItemNode(node)?.shape;
38256
38662
  }
38257
38663
  function findHierarchyItemName(node) {
38258
- return findHierarchyItemNode(node)?.name;
38664
+ return resolveHierarchyItemNode(node)?.name;
38259
38665
  }
38260
38666
  function baseContext(nodeCount, elementId, palette, style, boxW, boxH, connectorLabels, itemShape, itemFontSizePx) {
38261
38667
  return {
@@ -38316,6 +38722,7 @@ var HIER_TAIL_OFFSET_RATIO;
38316
38722
  var HANG_HEIGHT_RATIO;
38317
38723
  var init_smartart_hierarchy_shared = __esm({
38318
38724
  "src/core/utils/smartart-hierarchy-shared.ts"() {
38725
+ init_smartart_hierarchy_item_template();
38319
38726
  init_smartart_layout_interpreter_preset_node();
38320
38727
  init_smartart_layout_interpreter_render();
38321
38728
  HIER_TAIL_OFFSET_RATIO = 0.25;
@@ -38323,9 +38730,11 @@ var init_smartart_hierarchy_shared = __esm({
38323
38730
  }
38324
38731
  });
38325
38732
  function computeHierarchyAxisPitches(effectiveBox, orientation, boxW, boxH, totalLeaves, depth, hangShape, tailedPitch) {
38733
+ const generationItemSize = tailedPitch && orientation.compositeHeightFactor ? boxH / orientation.compositeHeightFactor : boxH;
38326
38734
  const generationMargin = orientation.transposed ? 0 : boxH * GENERATION_MARGIN_RATIO;
38327
38735
  const fanWidth = tailedPitch ? effectiveBox.width - hangShape.maxHangDepth * HIER_TAIL_OFFSET_RATIO * boxW : effectiveBox.width;
38328
- const fanHeight = tailedPitch ? effectiveBox.height - hangShape.maxHangRows * (1 + HANG_HEIGHT_RATIO) * boxH : effectiveBox.height;
38736
+ const hangHeightRatio = orientation.transposed ? orientation.generationGapRatio : HANG_HEIGHT_RATIO;
38737
+ const fanHeight = tailedPitch ? effectiveBox.height - hangShape.maxHangRows * (1 + hangHeightRatio) * boxH : effectiveBox.height;
38329
38738
  const xPitch = compositeFanPitch(
38330
38739
  fanWidth,
38331
38740
  boxW,
@@ -38338,7 +38747,7 @@ function computeHierarchyAxisPitches(effectiveBox, orientation, boxW, boxH, tota
38338
38747
  const yPitch = computeAxisPitch(
38339
38748
  fanHeight,
38340
38749
  generationMargin,
38341
- boxH,
38750
+ generationItemSize,
38342
38751
  depth,
38343
38752
  fixedGenerationGapRatio
38344
38753
  );
@@ -38384,6 +38793,27 @@ var init_smartart_hierarchy_branch_mode = __esm({
38384
38793
  "src/core/utils/smartart-hierarchy-branch-mode.ts"() {
38385
38794
  }
38386
38795
  });
38796
+ function resolveCascadePlan(mode, orientation, depth, hangShape, boxW) {
38797
+ const active = mode === "tailed" && orientation.compositeHeightFactor !== void 0;
38798
+ if (!active) {
38799
+ return { active, pitchDepth: depth, pitchHangShape: hangShape };
38800
+ }
38801
+ return {
38802
+ active,
38803
+ pitchDepth: depth + hangShape.maxHangRows,
38804
+ pitchHangShape: { ...hangShape, maxHangRows: 0 },
38805
+ cascadeOffsetX: {
38806
+ fromLevel: depth,
38807
+ offsetPx: boxW / (orientation.compositeWidthFactor ?? 1) * CASCADE_ALIGN_OFF_RATIO
38808
+ }
38809
+ };
38810
+ }
38811
+ var CASCADE_ALIGN_OFF_RATIO;
38812
+ var init_smartart_hierarchy_cascade = __esm({
38813
+ "src/core/utils/smartart-hierarchy-cascade.ts"() {
38814
+ CASCADE_ALIGN_OFF_RATIO = 0.65;
38815
+ }
38816
+ });
38387
38817
  function isAssistant(node) {
38388
38818
  return node.nodeType === "asst";
38389
38819
  }
@@ -38581,6 +39011,36 @@ var init_smartart_hierarchy_fold_depth = __esm({
38581
39011
  "src/core/utils/smartart-hierarchy-fold-depth.ts"() {
38582
39012
  }
38583
39013
  });
39014
+ function resolveHierarchyItemFontSizePx(nodes, algorithmNode, index, boxW, boxH, fontName) {
39015
+ if (!algorithmNode) {
39016
+ return void 0;
39017
+ }
39018
+ const textNodes = nodes.filter((node) => node.text && node.text.trim().length > 0);
39019
+ if (textNodes.length === 0) {
39020
+ return void 0;
39021
+ }
39022
+ const plan = { node: algorithmNode };
39023
+ const { rootSizePx } = resolveTieredItemFontSize(
39024
+ plan,
39025
+ index,
39026
+ textNodes.map((node) => ({
39027
+ rootText: node.text,
39028
+ descendantTexts: [],
39029
+ width: boxW,
39030
+ height: boxH
39031
+ })),
39032
+ fontName,
39033
+ void 0,
39034
+ 0,
39035
+ algorithmNode
39036
+ );
39037
+ return rootSizePx;
39038
+ }
39039
+ var init_smartart_layout_interpreter_hierarchy_fontfit = __esm({
39040
+ "src/core/utils/smartart-layout-interpreter-hierarchy-fontfit.ts"() {
39041
+ init_smartart_layout_item_font_tier();
39042
+ }
39043
+ });
38584
39044
  function placeAssistants(hc, x, parentBottom, assistants, options, cursor) {
38585
39045
  for (const assistant of assistants) {
38586
39046
  const y = cursor.y;
@@ -38621,10 +39081,45 @@ function placeHangingForest(hc, roots, startX2, startY, options) {
38621
39081
  placeHangingTree(hc, root, startX2, options, cursor);
38622
39082
  }
38623
39083
  }
39084
+ function arrangeFullyHangingTree(nodes, box, palette, style, elementId, roots, itemShape, connectorLabels, algorithmNode, index, fontName, linDir, orgChart) {
39085
+ const { width: w, height: h2 } = box;
39086
+ const boxW = Math.min(w * 0.42, 160);
39087
+ const boxH = Math.min(h2 * 0.16, 30);
39088
+ const indent = boxW * 0.35;
39089
+ const vGap = boxH * 0.55;
39090
+ const hc = baseContext(
39091
+ nodes.length,
39092
+ elementId,
39093
+ palette,
39094
+ style,
39095
+ boxW,
39096
+ boxH,
39097
+ connectorLabels,
39098
+ itemShape,
39099
+ resolveHierarchyItemFontSizePx(nodes, algorithmNode, index, boxW, boxH, fontName)
39100
+ );
39101
+ placeHangingForest(hc, roots, HANGING_MODE_INSET + indent, HANGING_MODE_INSET, {
39102
+ orgChart,
39103
+ direction: linDirHangDirection(linDir),
39104
+ indent,
39105
+ vGap
39106
+ });
39107
+ return {
39108
+ nodes: hc.nodes,
39109
+ connectors: hc.connectors,
39110
+ shadowFilter: hc.ctx.shadow,
39111
+ viewBox: `0 0 ${w} ${h2}`,
39112
+ family: "hierarchy"
39113
+ };
39114
+ }
39115
+ var HANGING_MODE_INSET;
38624
39116
  var init_smartart_hierarchy_hanging = __esm({
38625
39117
  "src/core/utils/smartart-hierarchy-hanging.ts"() {
39118
+ init_smartart_hierarchy_branch_mode();
38626
39119
  init_smartart_hierarchy_orgchart_tree();
38627
39120
  init_smartart_hierarchy_shared();
39121
+ init_smartart_layout_interpreter_hierarchy_fontfit();
39122
+ HANGING_MODE_INSET = 6;
38628
39123
  }
38629
39124
  });
38630
39125
  function findCompositeDescendant(node) {
@@ -38647,7 +39142,7 @@ function findTextBearingChild(compositeNode) {
38647
39142
  (child262) => (child262.presentationOf?.axis ?? []).includes("self")
38648
39143
  );
38649
39144
  }
38650
- function resolveCompositeChildGeometry(algorithmNode, wrapperAspect) {
39145
+ function resolveCompositeChildGeometry(algorithmNode, wrapperAspect, allowOmittedWidthFactor = false) {
38651
39146
  const compositeNode = findCompositeDescendant(algorithmNode);
38652
39147
  if (!compositeNode) {
38653
39148
  return void 0;
@@ -38658,12 +39153,15 @@ function resolveCompositeChildGeometry(algorithmNode, wrapperAspect) {
38658
39153
  }
38659
39154
  const constraints = compositeNode.allConstraints ?? compositeNode.constraints ?? [];
38660
39155
  const widthConstr = constraints.find(
38661
- (c) => c.type === "w" && c.for === "ch" && c.forName === child262.name && c.referenceType === "w" && c.referenceForName === void 0 && typeof c.factor === "number"
39156
+ (c) => c.type === "w" && c.for === "ch" && c.forName === child262.name && c.referenceType === "w" && c.referenceForName === void 0 && (typeof c.factor === "number" || allowOmittedWidthFactor && c.factor === void 0)
38662
39157
  );
38663
- if (!widthConstr || widthConstr.factor === void 0 || widthConstr.factor <= 0) {
39158
+ if (!widthConstr) {
39159
+ return void 0;
39160
+ }
39161
+ const widthFactor = widthConstr.factor ?? 1;
39162
+ if (widthFactor <= 0) {
38664
39163
  return void 0;
38665
39164
  }
38666
- const widthFactor = widthConstr.factor;
38667
39165
  const selfHeightConstr = constraints.find(
38668
39166
  (c) => c.type === "h" && c.for === "ch" && c.forName === child262.name && c.referenceType === "w" && c.referenceFor === "ch" && c.referenceForName === child262.name && typeof c.factor === "number"
38669
39167
  );
@@ -38681,11 +39179,15 @@ function resolveCompositeChildGeometry(algorithmNode, wrapperAspect) {
38681
39179
  const parentRelativeHeightConstr = constraints.find(
38682
39180
  (c) => c.type === "h" && c.for === "ch" && c.forName === child262.name && c.referenceType === "h" && c.referenceFor === void 0 && c.referenceForName === void 0 && typeof c.factor === "number"
38683
39181
  );
38684
- if (parentRelativeHeightConstr && typeof wrapperAspect === "number" && wrapperAspect > 0 && typeof parentRelativeHeightConstr.factor === "number") {
39182
+ const hasCompoundTextRole = constraints.some(
39183
+ (c) => c.type === "primFontSz" && c.referenceForName === child262.name
39184
+ );
39185
+ if (parentRelativeHeightConstr && !hasCompoundTextRole && typeof wrapperAspect === "number" && wrapperAspect > 0 && typeof parentRelativeHeightConstr.factor === "number") {
38685
39186
  return {
38686
39187
  aspectRatio: parentRelativeHeightConstr.factor * wrapperAspect / widthFactor,
38687
39188
  widthFactor,
38688
- offsetXRatio
39189
+ offsetXRatio,
39190
+ heightFactor: parentRelativeHeightConstr.factor
38689
39191
  };
38690
39192
  }
38691
39193
  return void 0;
@@ -38694,18 +39196,23 @@ var init_smartart_hierarchy_composite_child = __esm({
38694
39196
  "src/core/utils/smartart-hierarchy-composite-child.ts"() {
38695
39197
  }
38696
39198
  });
38697
- function findByReference(constraints, type, referenceType) {
38698
- const match = (constraints ?? []).find(
38699
- (c) => c.type === type && c.referenceType === referenceType && typeof c.factor === "number"
38700
- );
38701
- return match?.factor;
39199
+ function findByReference(constraints, type, referenceType, preferredName) {
39200
+ const list = constraints ?? [];
39201
+ const matches = (c) => c.type === type && c.referenceType === referenceType && typeof c.factor === "number";
39202
+ if (preferredName !== void 0) {
39203
+ const named = list.find((c) => matches(c) && c.forName === preferredName);
39204
+ if (named) {
39205
+ return named.factor;
39206
+ }
39207
+ }
39208
+ return list.find(matches)?.factor;
38702
39209
  }
38703
- function resolveAspectRatio(constraints) {
38704
- const hRefW = findByReference(constraints, "h", "w");
39210
+ function resolveAspectRatio(constraints, preferredName) {
39211
+ const hRefW = findByReference(constraints, "h", "w", preferredName);
38705
39212
  if (hRefW !== void 0 && hRefW > 0) {
38706
39213
  return hRefW;
38707
39214
  }
38708
- const wRefH = findByReference(constraints, "w", "h");
39215
+ const wRefH = findByReference(constraints, "w", "h", preferredName);
38709
39216
  if (wRefH !== void 0 && wRefH > 0) {
38710
39217
  return 1 / wRefH;
38711
39218
  }
@@ -38870,14 +39377,14 @@ var init_smartart_hierarchy_transpose = __esm({
38870
39377
  "src/core/utils/smartart-hierarchy-transpose.ts"() {
38871
39378
  }
38872
39379
  });
38873
- function fitItemBox(box, columns, levels, sibSpRatio, aspectRatio, generationGapRatio, marginXRatio, marginYRatio, maxHangDepth = 0, clampToNaturalAspect = true, maxHangRows = maxHangDepth, allChildrenHang = false) {
39380
+ function fitItemBox(box, columns, levels, sibSpRatio, aspectRatio, generationGapRatio, marginXRatio, marginYRatio, maxHangDepth = 0, clampToNaturalAspect = true, maxHangRows = maxHangDepth, allChildrenHang = false, hangHeightRatio = HANG_HEIGHT_RATIO) {
38874
39381
  const n = Math.max(1, columns);
38875
39382
  const usableW = box.width - 2 * box.width * marginXRatio;
38876
39383
  const allHangExtra = allChildrenHang ? ALL_CHILDREN_HANG_EXTRA_RATIO : 0;
38877
39384
  const widthFit = usableW / (n + Math.max(0, n - 1) * sibSpRatio + maxHangDepth * HIER_TAIL_OFFSET_RATIO + allHangExtra);
38878
39385
  const generations = Math.max(1, levels);
38879
39386
  const usableH = box.height - 2 * box.height * marginYRatio;
38880
- const heightFit = usableH / (generations + maxHangRows + Math.max(0, generations - 1) * generationGapRatio + maxHangRows * HANG_HEIGHT_RATIO);
39387
+ const heightFit = usableH / (generations + maxHangRows + Math.max(0, generations - 1) * generationGapRatio + maxHangRows * hangHeightRatio);
38881
39388
  const naturalHeight = widthFit * aspectRatio;
38882
39389
  const boxH = clampToNaturalAspect ? Math.min(naturalHeight, heightFit) : heightFit;
38883
39390
  const boxW = clampToNaturalAspect ? boxH / aspectRatio : widthFit;
@@ -38905,7 +39412,7 @@ function resolveHierarchyOrientation(algorithmNode, index, mode = "std", itemSha
38905
39412
  algorithmNode?.rules
38906
39413
  );
38907
39414
  if (sibSpReferencesHeight || tailedTransposed) {
38908
- const hToW = resolveAspectRatio(constraints);
39415
+ const hToW = resolveAspectRatio(constraints, itemShapeName);
38909
39416
  return {
38910
39417
  transposed: true,
38911
39418
  sibSpRatio,
@@ -38927,8 +39434,12 @@ function resolveHierarchyOrientation(algorithmNode, index, mode = "std", itemSha
38927
39434
  cardOffsetXRatio: 0
38928
39435
  };
38929
39436
  }
38930
- const compositeAspect = resolveAspectRatio(constraints);
38931
- const compositeChild = resolveCompositeChildGeometry(algorithmNode, compositeAspect);
39437
+ const compositeAspect = resolveAspectRatio(constraints, itemShapeName);
39438
+ const compositeChild = resolveCompositeChildGeometry(
39439
+ algorithmNode,
39440
+ compositeAspect,
39441
+ mode === "tailed"
39442
+ );
38932
39443
  const aspectRatio = compositeChild?.aspectRatio ?? compositeAspect;
38933
39444
  const tailedMargin = mode === "tailed";
38934
39445
  return {
@@ -38965,6 +39476,7 @@ function resolveHierarchyOrientation(algorithmNode, index, mode = "std", itemSha
38965
39476
  marginXRatio: tailedMargin ? 0 : OUTER_MARGIN_X_RATIO,
38966
39477
  marginYRatio: tailedMargin ? 0 : OUTER_MARGIN_Y_RATIO,
38967
39478
  compositeWidthFactor: compositeChild?.widthFactor,
39479
+ compositeHeightFactor: compositeChild?.heightFactor,
38968
39480
  cardOffsetXRatio: compositeChild?.offsetXRatio ?? 0
38969
39481
  };
38970
39482
  }
@@ -39069,10 +39581,11 @@ function placeFlatChildren(hc, parentId, normal, cx, cy, xOffset, level, cellW,
39069
39581
  offset += childW;
39070
39582
  }
39071
39583
  }
39584
+ const cascadeShift = options.cascadeOffsetX && level + 1 >= options.cascadeOffsetX.fromLevel ? options.cascadeOffsetX.offsetPx : 0;
39072
39585
  let childOffset = xOffset;
39073
39586
  for (const child262 of normal) {
39074
39587
  const childW = spanOf(child262, options);
39075
- const childCx = (childOffset + childW / 2) * cellW;
39588
+ const childCx = (childOffset + childW / 2) * cellW + cascadeShift;
39076
39589
  const childCy = (level + 1) * cellH + cellH / 2;
39077
39590
  elbowConnector(
39078
39591
  hc,
@@ -39253,7 +39766,7 @@ function placeAt(hc, t, cx, cy, xOffset, spanW, level, cellW, cellH, options, si
39253
39766
  placeFlatChildren2(hc, t.node.id, normal, cx, cy, xOffset, level, cellW, cellH, options);
39254
39767
  return;
39255
39768
  }
39256
- const anchorY = cy + hc.boxH / 2 + HANG_HEIGHT_RATIO * hc.boxH;
39769
+ const anchorY = cy + hc.boxH / 2 + (options.hangHeightRatio ?? HANG_HEIGHT_RATIO) * hc.boxH;
39257
39770
  const columnOffset = hc.boxW * HIER_TAIL_OFFSET_RATIO;
39258
39771
  for (const child262 of normal) {
39259
39772
  elbowConnector(
@@ -39289,7 +39802,8 @@ function placeAt(hc, t, cx, cy, xOffset, spanW, level, cellW, cellH, options, si
39289
39802
  }
39290
39803
  function placeStandardTree(hc, t, xOffset, level, cellW, cellH, options) {
39291
39804
  const spanW = spanOf(t, options);
39292
- const cx = (xOffset + spanW / 2) * cellW;
39805
+ const cascadeShift = options.cascadeOffsetX && level >= options.cascadeOffsetX.fromLevel ? options.cascadeOffsetX.offsetPx : 0;
39806
+ const cx = (xOffset + spanW / 2) * cellW + cascadeShift;
39293
39807
  const cy = level * cellH + cellH / 2;
39294
39808
  placeAt(hc, t, cx, cy, xOffset, spanW, level, cellW, cellH, options);
39295
39809
  }
@@ -39303,36 +39817,6 @@ var init_smartart_hierarchy_standard = __esm({
39303
39817
  init_smartart_hierarchy_wrapped_groups();
39304
39818
  }
39305
39819
  });
39306
- function resolveHierarchyItemFontSizePx(nodes, algorithmNode, index, boxW, boxH, fontName) {
39307
- if (!algorithmNode) {
39308
- return void 0;
39309
- }
39310
- const textNodes = nodes.filter((node) => node.text && node.text.trim().length > 0);
39311
- if (textNodes.length === 0) {
39312
- return void 0;
39313
- }
39314
- const plan = { node: algorithmNode };
39315
- const { rootSizePx } = resolveTieredItemFontSize(
39316
- plan,
39317
- index,
39318
- textNodes.map((node) => ({
39319
- rootText: node.text,
39320
- descendantTexts: [],
39321
- width: boxW,
39322
- height: boxH
39323
- })),
39324
- fontName,
39325
- void 0,
39326
- 0,
39327
- algorithmNode
39328
- );
39329
- return rootSizePx;
39330
- }
39331
- var init_smartart_layout_interpreter_hierarchy_fontfit = __esm({
39332
- "src/core/utils/smartart-layout-interpreter-hierarchy-fontfit.ts"() {
39333
- init_smartart_layout_item_font_tier();
39334
- }
39335
- });
39336
39820
  function arrangeHierarchy(nodes, box, palette, style, elementId, presLayoutVars, connectorLabels, algorithmNode, index = EMPTY_CONSTRAINT_INDEX, childOrder3, fontName) {
39337
39821
  const { width: w, height: h2 } = box;
39338
39822
  const orgChart = presLayoutVars?.orgChart === true;
@@ -39342,28 +39826,21 @@ function arrangeHierarchy(nodes, box, palette, style, elementId, presLayoutVars,
39342
39826
  const mode = branchMode(presLayoutVars, linDir);
39343
39827
  const itemShape = algorithmNode ? findHierarchyItemShape(algorithmNode) : void 0;
39344
39828
  if (mode === "hanging") {
39345
- const boxW2 = Math.min(w * 0.42, 160);
39346
- const boxH2 = Math.min(h2 * 0.16, 30);
39347
- const indent = boxW2 * 0.35;
39348
- const vGap = boxH2 * 0.55;
39349
- const hc2 = baseContext(
39350
- nodes.length,
39351
- elementId,
39829
+ return arrangeFullyHangingTree(
39830
+ nodes,
39831
+ box,
39352
39832
  palette,
39353
39833
  style,
39354
- boxW2,
39355
- boxH2,
39356
- connectorLabels,
39834
+ elementId,
39835
+ roots,
39357
39836
  itemShape,
39358
- resolveHierarchyItemFontSizePx(nodes, algorithmNode, index, boxW2, boxH2, fontName)
39837
+ connectorLabels,
39838
+ algorithmNode,
39839
+ index,
39840
+ fontName,
39841
+ linDir,
39842
+ orgChart
39359
39843
  );
39360
- placeHangingForest(hc2, roots, INSET3 + indent, INSET3, {
39361
- orgChart,
39362
- direction: linDirHangDirection(linDir),
39363
- indent,
39364
- vGap
39365
- });
39366
- return finish(hc2.nodes, hc2.connectors, hc2.ctx.shadow, w, h2);
39367
39844
  }
39368
39845
  const orientation = resolveHierarchyOrientation(
39369
39846
  algorithmNode,
@@ -39391,8 +39868,10 @@ function arrangeHierarchy(nodes, box, palette, style, elementId, presLayoutVars,
39391
39868
  hangShape.maxHangDepth,
39392
39869
  void 0,
39393
39870
  hangShape.maxHangRows,
39394
- hangShape.allChildrenHang
39871
+ hangShape.allChildrenHang,
39872
+ orientation.transposed ? orientation.generationGapRatio : void 0
39395
39873
  );
39874
+ const cascadePlan = resolveCascadePlan(mode, orientation, depth, hangShape, boxW);
39396
39875
  const tailedPitch = mode === "tailed";
39397
39876
  const { xPitch, yPitch } = computeHierarchyAxisPitches(
39398
39877
  effectiveBox,
@@ -39400,8 +39879,8 @@ function arrangeHierarchy(nodes, box, palette, style, elementId, presLayoutVars,
39400
39879
  boxW,
39401
39880
  boxH,
39402
39881
  totalLeaves,
39403
- depth,
39404
- hangShape,
39882
+ cascadePlan.pitchDepth,
39883
+ cascadePlan.pitchHangShape,
39405
39884
  tailedPitch
39406
39885
  );
39407
39886
  const cellW = xPitch.pitch;
@@ -39421,9 +39900,11 @@ function arrangeHierarchy(nodes, box, palette, style, elementId, presLayoutVars,
39421
39900
  orgChart,
39422
39901
  perRow: rowSize,
39423
39902
  foldDeeperGenerations: algorithmNode ? hierarchyLeafFoldsDescendants(algorithmNode) : false,
39424
- resolveSpan: fanAwareWidthMap ? (t) => resolveSpanWidth(fanAwareWidthMap, t, orgChart) : void 0
39903
+ resolveSpan: fanAwareWidthMap ? (t) => resolveSpanWidth(fanAwareWidthMap, t, orgChart) : void 0,
39904
+ hangHeightRatio: orientation.transposed ? orientation.generationGapRatio : void 0,
39905
+ cascadeOffsetX: cascadePlan.cascadeOffsetX
39425
39906
  };
39426
- if (mode === "tailed") {
39907
+ if (mode === "tailed" && !cascadePlan.active) {
39427
39908
  const indent = boxW * HIER_TAIL_OFFSET_RATIO;
39428
39909
  const vGap = boxH * 0.55;
39429
39910
  const direction = tailDirection();
@@ -39451,13 +39932,13 @@ function arrangeHierarchy(nodes, box, palette, style, elementId, presLayoutVars,
39451
39932
  function finish(nodes, connectors, shadowFilter, w, h2) {
39452
39933
  return { nodes, connectors, shadowFilter, viewBox: `0 0 ${w} ${h2}`, family: "hierarchy" };
39453
39934
  }
39454
- var INSET3;
39455
39935
  var init_smartart_layout_interpreter_hierarchy = __esm({
39456
39936
  "src/core/utils/smartart-layout-interpreter-hierarchy.ts"() {
39457
39937
  init_smartart_constraint_solver();
39458
39938
  init_smartart_helpers();
39459
39939
  init_smartart_hierarchy_axis_pitch();
39460
39940
  init_smartart_hierarchy_branch_mode();
39941
+ init_smartart_hierarchy_cascade();
39461
39942
  init_smartart_hierarchy_fan_aware_width();
39462
39943
  init_smartart_hierarchy_fold_depth();
39463
39944
  init_smartart_hierarchy_hang_depth();
@@ -39469,7 +39950,6 @@ var init_smartart_layout_interpreter_hierarchy = __esm({
39469
39950
  init_smartart_hierarchy_standard();
39470
39951
  init_smartart_layout_interpreter_hierarchy_fontfit();
39471
39952
  init_smartart_layout_interpreter_model();
39472
- INSET3 = 6;
39473
39953
  }
39474
39954
  });
39475
39955
  function isChildNodeForEach(entry2) {
@@ -40202,7 +40682,7 @@ function repositionPyramidBands(result, box, planNode, topLevelIds, flatNodes, h
40202
40682
  index,
40203
40683
  roleOf(planNode),
40204
40684
  ["sibSp", "sp"],
40205
- DEFAULT_GAP_RATIO
40685
+ DEFAULT_GAP_RATIO2
40206
40686
  );
40207
40687
  const inverted = algorithmParam(planNode, "linDir") === "fromT";
40208
40688
  const nodes = result.nodes.map((rendered) => {
@@ -40327,7 +40807,8 @@ function runArrangement(input) {
40327
40807
  resolveNamedRuleOverride(collectNamedRules(layoutDefinition), itemNode(plan.node)?.name),
40328
40808
  box
40329
40809
  ) : result;
40330
- const withItemRoles = STRUCTURAL_ARRANGEMENT_KINDS.has(plan.kind) ? expandResultItemRoles(
40810
+ const isTableTemplate = isRecursiveTableItemTemplate(plan.node, presLayoutVars);
40811
+ const withItemRoles = STRUCTURAL_ARRANGEMENT_KINDS.has(plan.kind) && !isTableTemplate ? expandResultItemRoles(
40331
40812
  plan.node,
40332
40813
  withNamedRule,
40333
40814
  nodes,
@@ -40388,6 +40869,7 @@ var init_smartart_layout_interpreter = __esm({
40388
40869
  init_smartart_layout_interpreter_hierarchy();
40389
40870
  init_smartart_layout_interpreter_hub();
40390
40871
  init_smartart_layout_interpreter_item_roles();
40872
+ init_smartart_layout_interpreter_linear_table();
40391
40873
  init_smartart_layout_interpreter_model();
40392
40874
  init_smartart_layout_interpreter_named_rules();
40393
40875
  init_smartart_layout_interpreter_pyramid_bands();
@@ -45475,8 +45957,8 @@ function parseDataLabelFieldTable(group2, xmlLookup) {
45475
45957
  return void 0;
45476
45958
  }
45477
45959
  const points4 = [];
45478
- for (const table of tables) {
45479
- collectByLocalName2(table, "pt", points4);
45960
+ for (const table2 of tables) {
45961
+ collectByLocalName2(table2, "pt", points4);
45480
45962
  }
45481
45963
  const map = /* @__PURE__ */ new Map();
45482
45964
  for (const pt2 of points4) {
@@ -56151,16 +56633,327 @@ var init_slide_title = __esm({
56151
56633
  TITLE_PLACEHOLDER_TYPES = /* @__PURE__ */ new Set(["title", "ctrtitle"]);
56152
56634
  }
56153
56635
  });
56636
+ function readMaskChannel(value, mask) {
56637
+ if (mask === 0) {
56638
+ return 0;
56639
+ }
56640
+ let m = mask;
56641
+ let shift = 0;
56642
+ while ((m & 1) === 0) {
56643
+ m >>>= 1;
56644
+ shift++;
56645
+ }
56646
+ const bits = 32 - Math.clz32(m);
56647
+ const raw = (value & mask) >>> shift;
56648
+ const maxVal = (1 << bits) - 1;
56649
+ return maxVal === 0 ? 0 : Math.round(raw / maxVal * 255);
56650
+ }
56651
+ function decodeBmpFirstPixel(bytes) {
56652
+ if (bytes.length < 54 || bytes[0] !== 66 || bytes[1] !== 77) {
56653
+ return void 0;
56654
+ }
56655
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
56656
+ const pixelDataOffset = view.getUint32(10, true);
56657
+ const headerSize = view.getUint32(14, true);
56658
+ if (headerSize < 40) {
56659
+ return void 0;
56660
+ }
56661
+ const width = view.getInt32(18, true);
56662
+ const rawHeight = view.getInt32(22, true);
56663
+ const bitCount = view.getUint16(28, true);
56664
+ const compression = view.getUint32(30, true);
56665
+ if (width <= 0 || rawHeight === 0) {
56666
+ return void 0;
56667
+ }
56668
+ const topDown = rawHeight < 0;
56669
+ const height = Math.abs(rawHeight);
56670
+ let redMask = 16711680;
56671
+ let greenMask = 65280;
56672
+ let blueMask = 255;
56673
+ let paletteOffset = 14 + headerSize;
56674
+ if (compression === 3) {
56675
+ redMask = view.getUint32(54, true);
56676
+ greenMask = view.getUint32(58, true);
56677
+ blueMask = view.getUint32(62, true);
56678
+ paletteOffset = 54 + 12;
56679
+ } else if (compression !== 0) {
56680
+ return void 0;
56681
+ }
56682
+ const rowStride = Math.ceil(width * bitCount / 32) * 4;
56683
+ const rowIndexFromTop = 0;
56684
+ const storedRowIndex = topDown ? rowIndexFromTop : height - 1 - rowIndexFromTop;
56685
+ const rowStart = pixelDataOffset + storedRowIndex * rowStride;
56686
+ if (rowStart < 0 || rowStart + Math.ceil(bitCount / 8) > bytes.length) {
56687
+ return void 0;
56688
+ }
56689
+ if (bitCount <= 8) {
56690
+ const paletteCount = 1 << bitCount;
56691
+ if (paletteOffset + paletteCount * 4 > bytes.length) {
56692
+ return void 0;
56693
+ }
56694
+ let index;
56695
+ if (bitCount === 8) {
56696
+ index = bytes[rowStart];
56697
+ } else {
56698
+ const byte = bytes[rowStart];
56699
+ index = byte >> 8 - bitCount;
56700
+ }
56701
+ const entry2 = paletteOffset + index * 4;
56702
+ return { r: bytes[entry2 + 2], g: bytes[entry2 + 1], b: bytes[entry2], a: 255 };
56703
+ }
56704
+ if (bitCount === 24) {
56705
+ return { r: bytes[rowStart + 2], g: bytes[rowStart + 1], b: bytes[rowStart], a: 255 };
56706
+ }
56707
+ if (bitCount === 32) {
56708
+ const value = bytes[rowStart] | bytes[rowStart + 1] << 8 | bytes[rowStart + 2] << 16 | bytes[rowStart + 3] << 24;
56709
+ return {
56710
+ r: readMaskChannel(value, redMask),
56711
+ g: readMaskChannel(value, greenMask),
56712
+ b: readMaskChannel(value, blueMask),
56713
+ a: 255
56714
+ };
56715
+ }
56716
+ if (bitCount === 16) {
56717
+ const value = bytes[rowStart] | bytes[rowStart + 1] << 8;
56718
+ if (compression === 3) {
56719
+ return {
56720
+ r: readMaskChannel(value, redMask),
56721
+ g: readMaskChannel(value, greenMask),
56722
+ b: readMaskChannel(value, blueMask),
56723
+ a: 255
56724
+ };
56725
+ }
56726
+ const r5 = value >> 10 & 31;
56727
+ const g5 = value >> 5 & 31;
56728
+ const b5 = value & 31;
56729
+ const scale2 = (v) => Math.round(v / 31 * 255);
56730
+ return { r: scale2(r5), g: scale2(g5), b: scale2(b5), a: 255 };
56731
+ }
56732
+ return void 0;
56733
+ }
56154
56734
  var init_image_first_pixel_bmp = __esm({
56155
56735
  "src/core/utils/image-first-pixel-bmp.ts"() {
56156
56736
  }
56157
56737
  });
56738
+ function readFirstColorIndex(data, subBlocksStart, minCodeSize) {
56739
+ const clearCode = 1 << minCodeSize;
56740
+ const endCode = clearCode + 1;
56741
+ let codeSize = minCodeSize + 1;
56742
+ const reader = new GifSubBlockBitReader(data, subBlocksStart);
56743
+ for (let guard = 0; guard < 8; guard++) {
56744
+ const code = reader.bits(codeSize);
56745
+ if (code === void 0 || code === endCode) {
56746
+ return void 0;
56747
+ }
56748
+ if (code === clearCode) {
56749
+ codeSize = minCodeSize + 1;
56750
+ continue;
56751
+ }
56752
+ return code < clearCode ? code : void 0;
56753
+ }
56754
+ return void 0;
56755
+ }
56756
+ function locateFirstImage(data, start) {
56757
+ let pos2 = start;
56758
+ let transparentIndex;
56759
+ while (pos2 < data.length) {
56760
+ const marker = data[pos2];
56761
+ if (marker === 33) {
56762
+ const label = data[pos2 + 1];
56763
+ pos2 += 2;
56764
+ if (label === 249 && data[pos2] === 4) {
56765
+ const packed = data[pos2 + 1];
56766
+ const hasTransparency = (packed & 1) !== 0;
56767
+ if (hasTransparency) {
56768
+ transparentIndex = data[pos2 + 4];
56769
+ }
56770
+ }
56771
+ for (; ; ) {
56772
+ const len = data[pos2];
56773
+ pos2 += 1 + len;
56774
+ if (len === 0 || pos2 >= data.length) {
56775
+ break;
56776
+ }
56777
+ }
56778
+ } else if (marker === 44) {
56779
+ const packed = data[pos2 + 9];
56780
+ let cursor = pos2 + 10;
56781
+ let localColorTable;
56782
+ if (packed & 128) {
56783
+ const size = 2 << (packed & 7);
56784
+ localColorTable = data.subarray(cursor, cursor + size * 3);
56785
+ cursor += size * 3;
56786
+ }
56787
+ const minCodeSize = data[cursor];
56788
+ cursor += 1;
56789
+ return { image: { subBlocksStart: cursor, minCodeSize, localColorTable }, transparentIndex };
56790
+ } else {
56791
+ return void 0;
56792
+ }
56793
+ }
56794
+ return void 0;
56795
+ }
56796
+ function decodeGifFirstPixel(bytes) {
56797
+ if (bytes.length < 13) {
56798
+ return void 0;
56799
+ }
56800
+ const sig = String.fromCharCode(bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5]);
56801
+ if (sig !== "GIF87a" && sig !== "GIF89a") {
56802
+ return void 0;
56803
+ }
56804
+ const packed = bytes[10];
56805
+ let pos2 = 13;
56806
+ let globalColorTable;
56807
+ if (packed & 128) {
56808
+ const size = 2 << (packed & 7);
56809
+ globalColorTable = bytes.subarray(pos2, pos2 + size * 3);
56810
+ pos2 += size * 3;
56811
+ }
56812
+ const located = locateFirstImage(bytes, pos2);
56813
+ if (!located) {
56814
+ return void 0;
56815
+ }
56816
+ const { image, transparentIndex } = located;
56817
+ const index = readFirstColorIndex(bytes, image.subBlocksStart, image.minCodeSize);
56818
+ if (index === void 0) {
56819
+ return void 0;
56820
+ }
56821
+ const table2 = image.localColorTable ?? globalColorTable;
56822
+ if (!table2 || table2.length < (index + 1) * 3) {
56823
+ return void 0;
56824
+ }
56825
+ if (transparentIndex === index) {
56826
+ return void 0;
56827
+ }
56828
+ return { r: table2[index * 3], g: table2[index * 3 + 1], b: table2[index * 3 + 2], a: 255 };
56829
+ }
56830
+ var GifSubBlockBitReader;
56158
56831
  var init_image_first_pixel_gif = __esm({
56159
56832
  "src/core/utils/image-first-pixel-gif.ts"() {
56833
+ GifSubBlockBitReader = class {
56834
+ constructor(data, pos2) {
56835
+ this.data = data;
56836
+ this.pos = pos2;
56837
+ }
56838
+ data;
56839
+ pos;
56840
+ blockBytes = new Uint8Array(0);
56841
+ blockPos = 0;
56842
+ bitBuf = 0;
56843
+ bitCount = 0;
56844
+ ended = false;
56845
+ nextByte() {
56846
+ if (this.blockPos >= this.blockBytes.length) {
56847
+ if (this.ended || this.pos >= this.data.length) {
56848
+ this.ended = true;
56849
+ return void 0;
56850
+ }
56851
+ const len = this.data[this.pos];
56852
+ this.pos += 1;
56853
+ if (len === 0) {
56854
+ this.ended = true;
56855
+ return void 0;
56856
+ }
56857
+ this.blockBytes = this.data.subarray(this.pos, this.pos + len);
56858
+ this.blockPos = 0;
56859
+ this.pos += len;
56860
+ }
56861
+ return this.blockBytes[this.blockPos++];
56862
+ }
56863
+ /** Read `count` bits, LSB-first. Returns `undefined` at end of data. */
56864
+ bits(count) {
56865
+ while (this.bitCount < count) {
56866
+ const byte = this.nextByte();
56867
+ if (byte === void 0) {
56868
+ return void 0;
56869
+ }
56870
+ this.bitBuf |= byte << this.bitCount;
56871
+ this.bitCount += 8;
56872
+ }
56873
+ const value = this.bitBuf & (1 << count) - 1;
56874
+ this.bitBuf >>>= count;
56875
+ this.bitCount -= count;
56876
+ return value;
56877
+ }
56878
+ };
56160
56879
  }
56161
56880
  });
56881
+ function buildJpegHuffmanTable(bits, huffval) {
56882
+ const counts = new Uint16Array(17);
56883
+ for (let len = 1; len <= 16; len++) {
56884
+ counts[len] = bits[len - 1];
56885
+ }
56886
+ return { counts, symbols: huffval };
56887
+ }
56888
+ function decodeJpegHuffmanSymbol(reader, table2) {
56889
+ let code = 0;
56890
+ let first = 0;
56891
+ let index = 0;
56892
+ for (let len = 1; len <= 16; len++) {
56893
+ code = code << 1 | reader.bits(1);
56894
+ const count = table2.counts[len];
56895
+ if (count > 0 && code - first < count) {
56896
+ return table2.symbols[index + (code - first)];
56897
+ }
56898
+ index += count;
56899
+ first += count;
56900
+ first <<= 1;
56901
+ }
56902
+ throw new Error("jpeg: invalid Huffman code");
56903
+ }
56904
+ function extendSigned(value, size) {
56905
+ if (size === 0) {
56906
+ return 0;
56907
+ }
56908
+ const half = 1 << size - 1;
56909
+ return value < half ? value - (1 << size) + 1 : value;
56910
+ }
56911
+ var JpegBitReader;
56162
56912
  var init_image_first_pixel_jpeg_bitstream = __esm({
56163
56913
  "src/core/utils/image-first-pixel-jpeg-bitstream.ts"() {
56914
+ JpegBitReader = class {
56915
+ constructor(data, startOffset) {
56916
+ this.data = data;
56917
+ this.pos = startOffset;
56918
+ }
56919
+ data;
56920
+ pos;
56921
+ currentByte = 0;
56922
+ bitsLeftInByte = 0;
56923
+ /** Set once a raw (non-stuffed) 0xFF marker byte is encountered: end of this scan's data. */
56924
+ hitMarker = false;
56925
+ nextBit() {
56926
+ if (this.bitsLeftInByte === 0) {
56927
+ if (this.hitMarker || this.pos >= this.data.length) {
56928
+ return 0;
56929
+ }
56930
+ const byte = this.data[this.pos];
56931
+ if (byte === 255) {
56932
+ const next = this.data[this.pos + 1];
56933
+ if (next === 0) {
56934
+ this.pos += 2;
56935
+ } else {
56936
+ this.hitMarker = true;
56937
+ return 0;
56938
+ }
56939
+ } else {
56940
+ this.pos += 1;
56941
+ }
56942
+ this.currentByte = byte;
56943
+ this.bitsLeftInByte = 8;
56944
+ }
56945
+ this.bitsLeftInByte -= 1;
56946
+ return this.currentByte >> this.bitsLeftInByte & 1;
56947
+ }
56948
+ /** Read `count` (0-16) bits MSB-first as an unsigned integer. */
56949
+ bits(count) {
56950
+ let value = 0;
56951
+ for (let i2 = 0; i2 < count; i2++) {
56952
+ value = value << 1 | this.nextBit();
56953
+ }
56954
+ return value >>> 0;
56955
+ }
56956
+ };
56164
56957
  }
56165
56958
  });
56166
56959
  function cornerIdctWeight(u, v) {
@@ -56168,10 +56961,238 @@ function cornerIdctWeight(u, v) {
56168
56961
  const cv = v === 0 ? 1 / Math.SQRT2 : 1;
56169
56962
  return 0.25 * cu * cv * Math.cos(u * Math.PI / 16) * Math.cos(v * Math.PI / 16);
56170
56963
  }
56964
+ function decodeBlockCornerSample(reader, dcTable, acTable, quantTable) {
56965
+ const coeffs = new Float64Array(64);
56966
+ const dcSize = decodeJpegHuffmanSymbol(reader, dcTable);
56967
+ const dcBits = reader.bits(dcSize);
56968
+ const dc = extendSigned(dcBits, dcSize);
56969
+ coeffs[0] = dc * quantTable[0];
56970
+ let k = 1;
56971
+ while (k < 64) {
56972
+ const rs = decodeJpegHuffmanSymbol(reader, acTable);
56973
+ const run = rs >> 4;
56974
+ const size = rs & 15;
56975
+ if (size === 0) {
56976
+ if (run === 15) {
56977
+ k += 16;
56978
+ continue;
56979
+ }
56980
+ break;
56981
+ }
56982
+ k += run;
56983
+ if (k >= 64) {
56984
+ break;
56985
+ }
56986
+ const bits = reader.bits(size);
56987
+ const value = extendSigned(bits, size);
56988
+ const naturalIndex = ZIGZAG[k];
56989
+ coeffs[naturalIndex] = value * quantTable[k];
56990
+ k += 1;
56991
+ }
56992
+ let sum = 0;
56993
+ for (let i2 = 0; i2 < 64; i2++) {
56994
+ sum += coeffs[i2] * CORNER_WEIGHTS[i2];
56995
+ }
56996
+ return sum;
56997
+ }
56998
+ function clamp8(value) {
56999
+ return Math.max(0, Math.min(255, Math.round(value)));
57000
+ }
57001
+ function decodeJpegFirstPixel(bytes) {
57002
+ if (bytes.length < 4 || bytes[0] !== 255 || bytes[1] !== 216) {
57003
+ return void 0;
57004
+ }
57005
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
57006
+ const quantTables = /* @__PURE__ */ new Map();
57007
+ const dcTables = /* @__PURE__ */ new Map();
57008
+ const acTables = /* @__PURE__ */ new Map();
57009
+ let components;
57010
+ let pos2 = 2;
57011
+ try {
57012
+ while (pos2 + 4 <= bytes.length) {
57013
+ if (bytes[pos2] !== 255) {
57014
+ pos2 += 1;
57015
+ continue;
57016
+ }
57017
+ const marker = bytes[pos2 + 1];
57018
+ if (marker === 216 || marker === 1 || marker >= 208 && marker <= 215) {
57019
+ pos2 += 2;
57020
+ continue;
57021
+ }
57022
+ if (marker === 217) {
57023
+ return void 0;
57024
+ }
57025
+ const length = view.getUint16(pos2 + 2, false);
57026
+ const segStart = pos2 + 4;
57027
+ if (marker === 219) {
57028
+ let off = segStart;
57029
+ const segEnd = pos2 + 2 + length;
57030
+ while (off < segEnd) {
57031
+ const pq = bytes[off] >> 4;
57032
+ const tq = bytes[off] & 15;
57033
+ off += 1;
57034
+ const table2 = new Uint16Array(64);
57035
+ for (let i2 = 0; i2 < 64; i2++) {
57036
+ table2[i2] = pq === 0 ? bytes[off + i2] : view.getUint16(off + i2 * 2, false);
57037
+ }
57038
+ off += pq === 0 ? 64 : 128;
57039
+ quantTables.set(tq, table2);
57040
+ }
57041
+ } else if (marker === 192 || marker === 193) {
57042
+ const numComponents = bytes[segStart + 5];
57043
+ components = [];
57044
+ for (let i2 = 0; i2 < numComponents; i2++) {
57045
+ const base = segStart + 6 + i2 * 3;
57046
+ components.push({
57047
+ id: bytes[base],
57048
+ hSampling: bytes[base + 1] >> 4,
57049
+ vSampling: bytes[base + 1] & 15,
57050
+ quantTableId: bytes[base + 2]
57051
+ });
57052
+ }
57053
+ } else if (marker === 194) {
57054
+ return void 0;
57055
+ } else if (marker === 196) {
57056
+ let off = segStart;
57057
+ const segEnd = pos2 + 2 + length;
57058
+ while (off < segEnd) {
57059
+ const tc = bytes[off] >> 4;
57060
+ const th = bytes[off] & 15;
57061
+ off += 1;
57062
+ const bits = bytes.subarray(off, off + 16);
57063
+ off += 16;
57064
+ const total = bits.reduce((s, b) => s + b, 0);
57065
+ const huffval = bytes.subarray(off, off + total);
57066
+ off += total;
57067
+ const table2 = buildJpegHuffmanTable(bits, huffval);
57068
+ (tc === 0 ? dcTables : acTables).set(th, table2);
57069
+ }
57070
+ } else if (marker === 218) {
57071
+ if (!components) {
57072
+ return void 0;
57073
+ }
57074
+ const scanCount = bytes[segStart];
57075
+ const scanComponents = [];
57076
+ for (let i2 = 0; i2 < scanCount; i2++) {
57077
+ const base = segStart + 1 + i2 * 2;
57078
+ const compId = bytes[base];
57079
+ const comp = components.find((c) => c.id === compId);
57080
+ if (!comp) {
57081
+ return void 0;
57082
+ }
57083
+ scanComponents.push({ comp, dcId: bytes[base + 1] >> 4, acId: bytes[base + 1] & 15 });
57084
+ }
57085
+ const reader = new JpegBitReader(bytes, segStart + 1 + scanCount * 2 + 3);
57086
+ const cornerSamples = [];
57087
+ for (const sc of scanComponents) {
57088
+ const dcTable = dcTables.get(sc.dcId);
57089
+ const acTable = acTables.get(sc.acId);
57090
+ const quantTable = quantTables.get(sc.comp.quantTableId);
57091
+ if (!dcTable || !acTable || !quantTable) {
57092
+ return void 0;
57093
+ }
57094
+ const blockCount = sc.comp.hSampling * sc.comp.vSampling;
57095
+ let first;
57096
+ for (let b = 0; b < blockCount; b++) {
57097
+ const sample = decodeBlockCornerSample(reader, dcTable, acTable, quantTable);
57098
+ if (b === 0) {
57099
+ first = sample;
57100
+ }
57101
+ }
57102
+ cornerSamples.push(clamp8(first + 128));
57103
+ }
57104
+ return combineComponentsToRgb(cornerSamples);
57105
+ }
57106
+ pos2 += 2 + length;
57107
+ }
57108
+ } catch {
57109
+ return void 0;
57110
+ }
57111
+ return void 0;
57112
+ }
57113
+ function combineComponentsToRgb(samples) {
57114
+ if (samples.length === 1) {
57115
+ const y2 = samples[0];
57116
+ return { r: y2, g: y2, b: y2, a: 255 };
57117
+ }
57118
+ const [y, cb, cr] = samples;
57119
+ const r = clamp8(y + 1.402 * (cr - 128));
57120
+ const g2 = clamp8(y - 0.344136 * (cb - 128) - 0.714136 * (cr - 128));
57121
+ const b = clamp8(y + 1.772 * (cb - 128));
57122
+ return { r, g: g2, b, a: 255 };
57123
+ }
57124
+ var ZIGZAG;
57125
+ var CORNER_WEIGHTS;
56171
57126
  var init_image_first_pixel_jpeg = __esm({
56172
57127
  "src/core/utils/image-first-pixel-jpeg.ts"() {
56173
57128
  init_image_first_pixel_jpeg_bitstream();
56174
- (() => {
57129
+ ZIGZAG = [
57130
+ 0,
57131
+ 1,
57132
+ 8,
57133
+ 16,
57134
+ 9,
57135
+ 2,
57136
+ 3,
57137
+ 10,
57138
+ 17,
57139
+ 24,
57140
+ 32,
57141
+ 25,
57142
+ 18,
57143
+ 11,
57144
+ 4,
57145
+ 5,
57146
+ 12,
57147
+ 19,
57148
+ 26,
57149
+ 33,
57150
+ 40,
57151
+ 48,
57152
+ 41,
57153
+ 34,
57154
+ 27,
57155
+ 20,
57156
+ 13,
57157
+ 6,
57158
+ 7,
57159
+ 14,
57160
+ 21,
57161
+ 28,
57162
+ 35,
57163
+ 42,
57164
+ 49,
57165
+ 56,
57166
+ 57,
57167
+ 50,
57168
+ 43,
57169
+ 36,
57170
+ 29,
57171
+ 22,
57172
+ 15,
57173
+ 23,
57174
+ 30,
57175
+ 37,
57176
+ 44,
57177
+ 51,
57178
+ 58,
57179
+ 59,
57180
+ 52,
57181
+ 45,
57182
+ 38,
57183
+ 31,
57184
+ 39,
57185
+ 46,
57186
+ 53,
57187
+ 60,
57188
+ 61,
57189
+ 54,
57190
+ 47,
57191
+ 55,
57192
+ 62,
57193
+ 63
57194
+ ];
57195
+ CORNER_WEIGHTS = (() => {
56175
57196
  const weights = [];
56176
57197
  for (let naturalIndex = 0; naturalIndex < 64; naturalIndex++) {
56177
57198
  const row = Math.floor(naturalIndex / 8);
@@ -56182,9 +57203,327 @@ var init_image_first_pixel_jpeg = __esm({
56182
57203
  })();
56183
57204
  }
56184
57205
  });
57206
+ function buildHuffmanTable(lengths) {
57207
+ const maxBits = Math.max(0, ...lengths);
57208
+ const counts = new Uint16Array(maxBits + 1);
57209
+ for (const len of lengths) {
57210
+ if (len > 0) {
57211
+ counts[len]++;
57212
+ }
57213
+ }
57214
+ const offsets = new Uint16Array(maxBits + 2);
57215
+ for (let bits = 1; bits <= maxBits; bits++) {
57216
+ offsets[bits + 1] = offsets[bits] + counts[bits];
57217
+ }
57218
+ const symbols = new Uint16Array(lengths.filter((l) => l > 0).length);
57219
+ for (let symbol = 0; symbol < lengths.length; symbol++) {
57220
+ const len = lengths[symbol];
57221
+ if (len > 0) {
57222
+ symbols[offsets[len]] = symbol;
57223
+ offsets[len]++;
57224
+ }
57225
+ }
57226
+ return { counts, symbols };
57227
+ }
57228
+ function decodeSymbol(reader, table2) {
57229
+ let code = 0;
57230
+ let first = 0;
57231
+ let index = 0;
57232
+ for (let len = 1; len < table2.counts.length; len++) {
57233
+ code |= reader.bits(1);
57234
+ const count = table2.counts[len];
57235
+ if (code - first < count) {
57236
+ return table2.symbols[index + (code - first)];
57237
+ }
57238
+ index += count;
57239
+ first += count;
57240
+ first <<= 1;
57241
+ code <<= 1;
57242
+ }
57243
+ throw new Error("inflate: invalid Huffman code");
57244
+ }
57245
+ function inflateBlock(reader, out, litTable, distTable) {
57246
+ for (; ; ) {
57247
+ if (out.full) {
57248
+ return;
57249
+ }
57250
+ const symbol = decodeSymbol(reader, litTable);
57251
+ if (symbol === 256) {
57252
+ return;
57253
+ }
57254
+ if (symbol < 256) {
57255
+ out.push(symbol);
57256
+ continue;
57257
+ }
57258
+ const lengthIndex = symbol - 257;
57259
+ if (lengthIndex >= LENGTH_BASE.length) {
57260
+ throw new Error("inflate: invalid length symbol");
57261
+ }
57262
+ const length = LENGTH_BASE[lengthIndex] + reader.bits(LENGTH_EXTRA_BITS[lengthIndex]);
57263
+ const distSymbol = decodeSymbol(reader, distTable);
57264
+ if (distSymbol >= DIST_BASE.length) {
57265
+ throw new Error("inflate: invalid distance symbol");
57266
+ }
57267
+ const distance2 = DIST_BASE[distSymbol] + reader.bits(DIST_EXTRA_BITS[distSymbol]);
57268
+ for (let i2 = 0; i2 < length; i2++) {
57269
+ if (out.full) {
57270
+ return;
57271
+ }
57272
+ out.push(out.at(distance2));
57273
+ }
57274
+ }
57275
+ }
57276
+ function readDynamicTables(reader) {
57277
+ const hlit = reader.bits(5) + 257;
57278
+ const hdist = reader.bits(5) + 1;
57279
+ const hclen = reader.bits(4) + 4;
57280
+ const codeLengthLengths = new Array(19).fill(0);
57281
+ for (let i2 = 0; i2 < hclen; i2++) {
57282
+ codeLengthLengths[CODE_LENGTH_ORDER[i2]] = reader.bits(3);
57283
+ }
57284
+ const codeLengthTable = buildHuffmanTable(codeLengthLengths);
57285
+ const allLengths = [];
57286
+ while (allLengths.length < hlit + hdist) {
57287
+ const symbol = decodeSymbol(reader, codeLengthTable);
57288
+ if (symbol < 16) {
57289
+ allLengths.push(symbol);
57290
+ } else if (symbol === 16) {
57291
+ const prev = allLengths[allLengths.length - 1] ?? 0;
57292
+ const repeat = reader.bits(2) + 3;
57293
+ for (let i2 = 0; i2 < repeat; i2++) {
57294
+ allLengths.push(prev);
57295
+ }
57296
+ } else if (symbol === 17) {
57297
+ const repeat = reader.bits(3) + 3;
57298
+ for (let i2 = 0; i2 < repeat; i2++) {
57299
+ allLengths.push(0);
57300
+ }
57301
+ } else {
57302
+ const repeat = reader.bits(7) + 11;
57303
+ for (let i2 = 0; i2 < repeat; i2++) {
57304
+ allLengths.push(0);
57305
+ }
57306
+ }
57307
+ }
57308
+ const litLengths = allLengths.slice(0, hlit);
57309
+ const distLengths = allLengths.slice(hlit, hlit + hdist);
57310
+ return { lit: buildHuffmanTable(litLengths), dist: buildHuffmanTable(distLengths) };
57311
+ }
57312
+ function inflateRaw(data, maxOutputBytes = Infinity) {
57313
+ const reader = new BitReader(data);
57314
+ const out = new OutputSink(maxOutputBytes === Infinity ? 1 << 20 : maxOutputBytes);
57315
+ let final = 0;
57316
+ do {
57317
+ final = reader.bits(1);
57318
+ const type = reader.bits(2);
57319
+ if (out.full) {
57320
+ break;
57321
+ }
57322
+ if (type === 0) {
57323
+ reader.alignToByte();
57324
+ const len = reader.readByte() | reader.readByte() << 8;
57325
+ reader.readByte();
57326
+ reader.readByte();
57327
+ for (let i2 = 0; i2 < len; i2++) {
57328
+ if (out.full) {
57329
+ break;
57330
+ }
57331
+ out.push(reader.readByte());
57332
+ }
57333
+ } else if (type === 1) {
57334
+ const lit = buildHuffmanTable(FIXED_LITERAL_LENGTHS);
57335
+ const dist2 = buildHuffmanTable(FIXED_DIST_LENGTHS);
57336
+ inflateBlock(reader, out, lit, dist2);
57337
+ } else if (type === 2) {
57338
+ const { lit, dist: dist2 } = readDynamicTables(reader);
57339
+ inflateBlock(reader, out, lit, dist2);
57340
+ } else {
57341
+ throw new Error("inflate: invalid block type");
57342
+ }
57343
+ } while (!final && !out.full);
57344
+ return out.toBytes();
57345
+ }
57346
+ function zlibInflate(data, maxOutputBytes = Infinity) {
57347
+ if (data.length < 2) {
57348
+ throw new Error("inflate: truncated zlib stream");
57349
+ }
57350
+ return inflateRaw(data.subarray(2), maxOutputBytes);
57351
+ }
57352
+ var LENGTH_BASE;
57353
+ var LENGTH_EXTRA_BITS;
57354
+ var DIST_BASE;
57355
+ var DIST_EXTRA_BITS;
57356
+ var CODE_LENGTH_ORDER;
57357
+ var BitReader;
57358
+ var FIXED_LITERAL_LENGTHS;
57359
+ var FIXED_DIST_LENGTHS;
57360
+ var OutputSink;
56185
57361
  var init_inflate = __esm({
56186
57362
  "src/core/utils/inflate.ts"() {
56187
- (() => {
57363
+ LENGTH_BASE = [
57364
+ 3,
57365
+ 4,
57366
+ 5,
57367
+ 6,
57368
+ 7,
57369
+ 8,
57370
+ 9,
57371
+ 10,
57372
+ 11,
57373
+ 13,
57374
+ 15,
57375
+ 17,
57376
+ 19,
57377
+ 23,
57378
+ 27,
57379
+ 31,
57380
+ 35,
57381
+ 43,
57382
+ 51,
57383
+ 59,
57384
+ 67,
57385
+ 83,
57386
+ 99,
57387
+ 115,
57388
+ 131,
57389
+ 163,
57390
+ 195,
57391
+ 227,
57392
+ 258
57393
+ ];
57394
+ LENGTH_EXTRA_BITS = [
57395
+ 0,
57396
+ 0,
57397
+ 0,
57398
+ 0,
57399
+ 0,
57400
+ 0,
57401
+ 0,
57402
+ 0,
57403
+ 1,
57404
+ 1,
57405
+ 1,
57406
+ 1,
57407
+ 2,
57408
+ 2,
57409
+ 2,
57410
+ 2,
57411
+ 3,
57412
+ 3,
57413
+ 3,
57414
+ 3,
57415
+ 4,
57416
+ 4,
57417
+ 4,
57418
+ 4,
57419
+ 5,
57420
+ 5,
57421
+ 5,
57422
+ 5,
57423
+ 0
57424
+ ];
57425
+ DIST_BASE = [
57426
+ 1,
57427
+ 2,
57428
+ 3,
57429
+ 4,
57430
+ 5,
57431
+ 7,
57432
+ 9,
57433
+ 13,
57434
+ 17,
57435
+ 25,
57436
+ 33,
57437
+ 49,
57438
+ 65,
57439
+ 97,
57440
+ 129,
57441
+ 193,
57442
+ 257,
57443
+ 385,
57444
+ 513,
57445
+ 769,
57446
+ 1025,
57447
+ 1537,
57448
+ 2049,
57449
+ 3073,
57450
+ 4097,
57451
+ 6145,
57452
+ 8193,
57453
+ 12289,
57454
+ 16385,
57455
+ 24577
57456
+ ];
57457
+ DIST_EXTRA_BITS = [
57458
+ 0,
57459
+ 0,
57460
+ 0,
57461
+ 0,
57462
+ 1,
57463
+ 1,
57464
+ 2,
57465
+ 2,
57466
+ 3,
57467
+ 3,
57468
+ 4,
57469
+ 4,
57470
+ 5,
57471
+ 5,
57472
+ 6,
57473
+ 6,
57474
+ 7,
57475
+ 7,
57476
+ 8,
57477
+ 8,
57478
+ 9,
57479
+ 9,
57480
+ 10,
57481
+ 10,
57482
+ 11,
57483
+ 11,
57484
+ 12,
57485
+ 12,
57486
+ 13,
57487
+ 13
57488
+ ];
57489
+ CODE_LENGTH_ORDER = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];
57490
+ BitReader = class {
57491
+ constructor(data) {
57492
+ this.data = data;
57493
+ }
57494
+ data;
57495
+ pos = 0;
57496
+ bitBuf = 0;
57497
+ bitCount = 0;
57498
+ get bytePos() {
57499
+ return this.pos;
57500
+ }
57501
+ bits(count) {
57502
+ while (this.bitCount < count) {
57503
+ if (this.pos >= this.data.length) {
57504
+ throw new Error("inflate: unexpected end of stream");
57505
+ }
57506
+ this.bitBuf |= this.data[this.pos] << this.bitCount;
57507
+ this.pos++;
57508
+ this.bitCount += 8;
57509
+ }
57510
+ const value = this.bitBuf & (1 << count) - 1;
57511
+ this.bitBuf >>>= count;
57512
+ this.bitCount -= count;
57513
+ return value;
57514
+ }
57515
+ alignToByte() {
57516
+ this.bitBuf = 0;
57517
+ this.bitCount = 0;
57518
+ }
57519
+ readByte() {
57520
+ if (this.pos >= this.data.length) {
57521
+ throw new Error("inflate: unexpected end of stream");
57522
+ }
57523
+ return this.data[this.pos++];
57524
+ }
57525
+ };
57526
+ FIXED_LITERAL_LENGTHS = (() => {
56188
57527
  const lengths = new Array(288);
56189
57528
  for (let i2 = 0; i2 < 144; i2++) {
56190
57529
  lengths[i2] = 8;
@@ -56200,14 +57539,251 @@ var init_inflate = __esm({
56200
57539
  }
56201
57540
  return lengths;
56202
57541
  })();
56203
- new Array(30).fill(5);
57542
+ FIXED_DIST_LENGTHS = new Array(30).fill(5);
57543
+ OutputSink = class {
57544
+ constructor(limit) {
57545
+ this.limit = limit;
57546
+ this.buf = new Uint8Array(Math.min(limit, 4096) || 64);
57547
+ }
57548
+ limit;
57549
+ buf;
57550
+ len = 0;
57551
+ get length() {
57552
+ return this.len;
57553
+ }
57554
+ get full() {
57555
+ return this.len >= this.limit;
57556
+ }
57557
+ push(byte) {
57558
+ if (this.len >= this.buf.length) {
57559
+ const next = new Uint8Array(Math.min(this.limit, this.buf.length * 2));
57560
+ next.set(this.buf);
57561
+ this.buf = next;
57562
+ }
57563
+ this.buf[this.len++] = byte;
57564
+ }
57565
+ at(offsetFromEnd) {
57566
+ return this.buf[this.len - offsetFromEnd];
57567
+ }
57568
+ toBytes() {
57569
+ return this.buf.subarray(0, this.len);
57570
+ }
57571
+ };
56204
57572
  }
56205
57573
  });
57574
+ function channelsForColorType(colorType) {
57575
+ switch (colorType) {
57576
+ case 0:
57577
+ return 1;
57578
+ // grayscale
57579
+ case 2:
57580
+ return 3;
57581
+ // truecolor
57582
+ case 3:
57583
+ return 1;
57584
+ // indexed
57585
+ case 4:
57586
+ return 2;
57587
+ // grayscale + alpha
57588
+ case 6:
57589
+ return 4;
57590
+ // truecolor + alpha
57591
+ default:
57592
+ return void 0;
57593
+ }
57594
+ }
57595
+ function hasPngSignature(bytes) {
57596
+ if (bytes.length < 8) {
57597
+ return false;
57598
+ }
57599
+ for (let i2 = 0; i2 < PNG_SIGNATURE2.length; i2++) {
57600
+ if (bytes[i2] !== PNG_SIGNATURE2[i2]) {
57601
+ return false;
57602
+ }
57603
+ }
57604
+ return true;
57605
+ }
57606
+ function readChunks(bytes) {
57607
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
57608
+ let offset = 8;
57609
+ let header;
57610
+ let palette;
57611
+ let transparency;
57612
+ const idatParts = [];
57613
+ let idatTotal = 0;
57614
+ while (offset + 8 <= bytes.length) {
57615
+ const length = view.getUint32(offset, false);
57616
+ const type = String.fromCharCode(
57617
+ bytes[offset + 4],
57618
+ bytes[offset + 5],
57619
+ bytes[offset + 6],
57620
+ bytes[offset + 7]
57621
+ );
57622
+ const dataStart = offset + 8;
57623
+ if (dataStart + length > bytes.length) {
57624
+ break;
57625
+ }
57626
+ const data = bytes.subarray(dataStart, dataStart + length);
57627
+ if (type === "IHDR" && length >= 13) {
57628
+ header = {
57629
+ width: view.getUint32(dataStart, false),
57630
+ height: view.getUint32(dataStart + 4, false),
57631
+ bitDepth: data[8],
57632
+ colorType: data[9]
57633
+ };
57634
+ } else if (type === "PLTE") {
57635
+ palette = data;
57636
+ } else if (type === "tRNS") {
57637
+ transparency = data;
57638
+ } else if (type === "IDAT") {
57639
+ idatParts.push(data);
57640
+ idatTotal += data.length;
57641
+ if (idatTotal > 4096) {
57642
+ break;
57643
+ }
57644
+ } else if (type === "IEND") {
57645
+ break;
57646
+ }
57647
+ offset = dataStart + length + 4;
57648
+ }
57649
+ const idat = new Uint8Array(idatTotal);
57650
+ let pos2 = 0;
57651
+ for (const part of idatParts) {
57652
+ idat.set(part, pos2);
57653
+ pos2 += part.length;
57654
+ }
57655
+ return { header, palette, transparency, idat };
57656
+ }
57657
+ function firstSample(byte, bitDepth) {
57658
+ if (bitDepth >= 8) {
57659
+ return byte;
57660
+ }
57661
+ return byte >> 8 - bitDepth;
57662
+ }
57663
+ function scaleTo8Bit(value, bitDepth) {
57664
+ if (bitDepth === 8) {
57665
+ return value;
57666
+ }
57667
+ if (bitDepth === 16) {
57668
+ return value;
57669
+ }
57670
+ const maxVal = (1 << bitDepth) - 1;
57671
+ return Math.round(value / maxVal * 255);
57672
+ }
57673
+ function decodePngFirstPixel(bytes) {
57674
+ if (!hasPngSignature(bytes)) {
57675
+ return void 0;
57676
+ }
57677
+ const { header, palette, transparency, idat } = readChunks(bytes);
57678
+ if (!header || idat.length === 0) {
57679
+ return void 0;
57680
+ }
57681
+ const channels = channelsForColorType(header.colorType);
57682
+ if (channels === void 0) {
57683
+ return void 0;
57684
+ }
57685
+ const bytesPerSample = header.bitDepth === 16 ? 2 : 1;
57686
+ const neededDataBytes = header.bitDepth < 8 ? 1 : channels * bytesPerSample;
57687
+ let raw;
57688
+ try {
57689
+ raw = zlibInflate(idat, 1 + neededDataBytes);
57690
+ } catch {
57691
+ return void 0;
57692
+ }
57693
+ if (raw.length < 1 + neededDataBytes) {
57694
+ return void 0;
57695
+ }
57696
+ const data = raw.subarray(1);
57697
+ const readSample = (index) => {
57698
+ if (header.bitDepth < 8) {
57699
+ return firstSample(data[0], header.bitDepth);
57700
+ }
57701
+ if (header.bitDepth === 16) {
57702
+ return data[index * 2];
57703
+ }
57704
+ return data[index];
57705
+ };
57706
+ switch (header.colorType) {
57707
+ case 0: {
57708
+ const gray = scaleTo8Bit(readSample(0), header.bitDepth);
57709
+ const isTransparent = transparency && transparency.length >= 2 && readSample(0) === (transparency[1] ?? -1);
57710
+ return { r: gray, g: gray, b: gray, a: isTransparent ? 0 : 255 };
57711
+ }
57712
+ case 2: {
57713
+ const r = scaleTo8Bit(readSample(0), header.bitDepth);
57714
+ const g2 = scaleTo8Bit(readSample(1), header.bitDepth);
57715
+ const b = scaleTo8Bit(readSample(2), header.bitDepth);
57716
+ return { r, g: g2, b, a: 255 };
57717
+ }
57718
+ case 3: {
57719
+ const index = readSample(0);
57720
+ if (!palette || palette.length < (index + 1) * 3) {
57721
+ return void 0;
57722
+ }
57723
+ const alpha = transparency && transparency.length > index ? transparency[index] : 255;
57724
+ return {
57725
+ r: palette[index * 3],
57726
+ g: palette[index * 3 + 1],
57727
+ b: palette[index * 3 + 2],
57728
+ a: alpha
57729
+ };
57730
+ }
57731
+ case 4: {
57732
+ const gray = scaleTo8Bit(readSample(0), header.bitDepth);
57733
+ const alpha = scaleTo8Bit(readSample(1), header.bitDepth);
57734
+ return { r: gray, g: gray, b: gray, a: alpha };
57735
+ }
57736
+ case 6: {
57737
+ const r = scaleTo8Bit(readSample(0), header.bitDepth);
57738
+ const g2 = scaleTo8Bit(readSample(1), header.bitDepth);
57739
+ const b = scaleTo8Bit(readSample(2), header.bitDepth);
57740
+ const a = scaleTo8Bit(readSample(3), header.bitDepth);
57741
+ return { r, g: g2, b, a };
57742
+ }
57743
+ default:
57744
+ return void 0;
57745
+ }
57746
+ }
57747
+ var PNG_SIGNATURE2;
56206
57748
  var init_image_first_pixel_png = __esm({
56207
57749
  "src/core/utils/image-first-pixel-png.ts"() {
56208
57750
  init_inflate();
57751
+ PNG_SIGNATURE2 = [137, 80, 78, 71, 13, 10, 26, 10];
56209
57752
  }
56210
57753
  });
57754
+ function hexChannel(value) {
57755
+ return Math.max(0, Math.min(255, Math.round(value))).toString(16).padStart(2, "0");
57756
+ }
57757
+ function sniffAndDecode(bytes) {
57758
+ if (bytes.length < 4) {
57759
+ return void 0;
57760
+ }
57761
+ if (bytes[0] === 137 && bytes[1] === 80 && bytes[2] === 78 && bytes[3] === 71) {
57762
+ return decodePngFirstPixel(bytes);
57763
+ }
57764
+ if (bytes[0] === 255 && bytes[1] === 216) {
57765
+ return decodeJpegFirstPixel(bytes);
57766
+ }
57767
+ if (bytes[0] === 71 && bytes[1] === 73 && bytes[2] === 70) {
57768
+ return decodeGifFirstPixel(bytes);
57769
+ }
57770
+ if (bytes[0] === 66 && bytes[1] === 77) {
57771
+ return decodeBmpFirstPixel(bytes);
57772
+ }
57773
+ return void 0;
57774
+ }
57775
+ function sampleFirstPixelColorFromBytes(bytes) {
57776
+ let pixel;
57777
+ try {
57778
+ pixel = sniffAndDecode(bytes);
57779
+ } catch {
57780
+ return void 0;
57781
+ }
57782
+ if (!pixel || pixel.a === 0) {
57783
+ return void 0;
57784
+ }
57785
+ return `#${hexChannel(pixel.r)}${hexChannel(pixel.g)}${hexChannel(pixel.b)}`;
57786
+ }
56211
57787
  var init_image_first_pixel = __esm({
56212
57788
  "src/core/utils/image-first-pixel.ts"() {
56213
57789
  init_image_first_pixel_bmp();
@@ -56216,30 +57792,532 @@ var init_image_first_pixel = __esm({
56216
57792
  init_image_first_pixel_png();
56217
57793
  }
56218
57794
  });
57795
+ function readFrameAt(bytes, offset) {
57796
+ if (offset + 7 > bytes.length) {
57797
+ return void 0;
57798
+ }
57799
+ if (bytes[offset] !== 255 || (bytes[offset + 1] & 240) !== 240) {
57800
+ return void 0;
57801
+ }
57802
+ const freqIndex = bytes[offset + 2] >> 2 & 15;
57803
+ const sampleRate = SAMPLE_RATES[freqIndex];
57804
+ if (!sampleRate) {
57805
+ return void 0;
57806
+ }
57807
+ const length = (bytes[offset + 3] & 3) << 11 | bytes[offset + 4] << 3 | bytes[offset + 5] >> 5 & 7;
57808
+ if (length < 7) {
57809
+ return void 0;
57810
+ }
57811
+ return { length, sampleRate };
57812
+ }
57813
+ function estimateAdtsDurationMs(bytes) {
57814
+ const first = readFrameAt(bytes, 0);
57815
+ if (!first) {
57816
+ return void 0;
57817
+ }
57818
+ let offset = 0;
57819
+ let frameCount = 0;
57820
+ while (offset < bytes.length) {
57821
+ const frame2 = readFrameAt(bytes, offset);
57822
+ if (!frame2) {
57823
+ break;
57824
+ }
57825
+ frameCount++;
57826
+ offset += frame2.length;
57827
+ }
57828
+ if (frameCount === 0) {
57829
+ return void 0;
57830
+ }
57831
+ return frameCount * 1024 / first.sampleRate * 1e3;
57832
+ }
57833
+ var SAMPLE_RATES;
56219
57834
  var init_media_duration_adts = __esm({
56220
57835
  "src/core/utils/media-duration-adts.ts"() {
57836
+ SAMPLE_RATES = [
57837
+ 96e3,
57838
+ 88200,
57839
+ 64e3,
57840
+ 48e3,
57841
+ 44100,
57842
+ 32e3,
57843
+ 24e3,
57844
+ 22050,
57845
+ 16e3,
57846
+ 12e3,
57847
+ 11025,
57848
+ 8e3,
57849
+ 7350
57850
+ ];
56221
57851
  }
56222
57852
  });
57853
+ function readVInt(bytes, offset, keepMarker) {
57854
+ if (offset >= bytes.length) {
57855
+ return void 0;
57856
+ }
57857
+ const first = bytes[offset];
57858
+ if (first === 0) {
57859
+ return void 0;
57860
+ }
57861
+ let length = 1;
57862
+ let mask = 128;
57863
+ while (length <= 8 && (first & mask) === 0) {
57864
+ mask >>= 1;
57865
+ length++;
57866
+ }
57867
+ if (length > 8 || offset + length > bytes.length) {
57868
+ return void 0;
57869
+ }
57870
+ let value = keepMarker ? first : first & mask - 1;
57871
+ for (let i2 = 1; i2 < length; i2++) {
57872
+ value = value * 256 + bytes[offset + i2];
57873
+ }
57874
+ return { value, length };
57875
+ }
57876
+ function readElementAt(bytes, offset) {
57877
+ const idVint = readVInt(bytes, offset, true);
57878
+ if (!idVint) {
57879
+ return void 0;
57880
+ }
57881
+ const sizeVint = readVInt(bytes, offset + idVint.length, false);
57882
+ if (!sizeVint) {
57883
+ return void 0;
57884
+ }
57885
+ const dataStart = offset + idVint.length + sizeVint.length;
57886
+ const allOnes = 2 ** (7 * sizeVint.length) - 1;
57887
+ const dataEnd = sizeVint.value === allOnes ? bytes.length : dataStart + sizeVint.value;
57888
+ return { id: idVint.value, dataStart, dataEnd: Math.min(dataEnd, bytes.length) };
57889
+ }
57890
+ function findChild2(bytes, start, end, id) {
57891
+ let offset = start;
57892
+ while (offset < end) {
57893
+ const element = readElementAt(bytes, offset);
57894
+ if (!element || element.dataEnd > end || element.dataEnd <= offset) {
57895
+ return void 0;
57896
+ }
57897
+ if (element.id === id) {
57898
+ return element;
57899
+ }
57900
+ offset = element.dataEnd;
57901
+ }
57902
+ return void 0;
57903
+ }
57904
+ function readUint(bytes, start, end) {
57905
+ let value = 0;
57906
+ for (let i2 = start; i2 < end; i2++) {
57907
+ value = value * 256 + bytes[i2];
57908
+ }
57909
+ return value;
57910
+ }
57911
+ function readFloat(bytes, start, end) {
57912
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
57913
+ const length = end - start;
57914
+ if (length === 4) {
57915
+ return view.getFloat32(start, false);
57916
+ }
57917
+ if (length === 8) {
57918
+ return view.getFloat64(start, false);
57919
+ }
57920
+ return void 0;
57921
+ }
57922
+ function estimateEbmlDurationMs(bytes) {
57923
+ const ebml = readElementAt(bytes, 0);
57924
+ if (!ebml || ebml.id !== EBML_ID) {
57925
+ return void 0;
57926
+ }
57927
+ const segment = findChild2(bytes, ebml.dataEnd, bytes.length, SEGMENT_ID);
57928
+ if (!segment) {
57929
+ return void 0;
57930
+ }
57931
+ const info = findChild2(bytes, segment.dataStart, segment.dataEnd, INFO_ID);
57932
+ if (!info) {
57933
+ return void 0;
57934
+ }
57935
+ const durationEl = findChild2(bytes, info.dataStart, info.dataEnd, DURATION_ID);
57936
+ if (!durationEl) {
57937
+ return void 0;
57938
+ }
57939
+ const duration = readFloat(bytes, durationEl.dataStart, durationEl.dataEnd);
57940
+ if (duration === void 0) {
57941
+ return void 0;
57942
+ }
57943
+ const scaleEl = findChild2(bytes, info.dataStart, info.dataEnd, TIMECODE_SCALE_ID);
57944
+ const timecodeScaleNs = scaleEl ? readUint(bytes, scaleEl.dataStart, scaleEl.dataEnd) : 1e6;
57945
+ return duration * timecodeScaleNs / 1e6;
57946
+ }
57947
+ var EBML_ID;
57948
+ var SEGMENT_ID;
57949
+ var INFO_ID;
57950
+ var TIMECODE_SCALE_ID;
57951
+ var DURATION_ID;
56223
57952
  var init_media_duration_ebml = __esm({
56224
57953
  "src/core/utils/media-duration-ebml.ts"() {
57954
+ EBML_ID = 440786851;
57955
+ SEGMENT_ID = 408125543;
57956
+ INFO_ID = 357149030;
57957
+ TIMECODE_SCALE_ID = 2807729;
57958
+ DURATION_ID = 17545;
56225
57959
  }
56226
57960
  });
57961
+ function readBoxes(bytes, rangeStart, rangeEnd) {
57962
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
57963
+ const boxes = [];
57964
+ let offset = rangeStart;
57965
+ while (offset + 8 <= rangeEnd) {
57966
+ const size32 = view.getUint32(offset, false);
57967
+ const type = String.fromCharCode(
57968
+ bytes[offset + 4],
57969
+ bytes[offset + 5],
57970
+ bytes[offset + 6],
57971
+ bytes[offset + 7]
57972
+ );
57973
+ let payloadStart = offset + 8;
57974
+ let boxEnd;
57975
+ if (size32 === 1) {
57976
+ if (offset + 16 > rangeEnd) {
57977
+ break;
57978
+ }
57979
+ const hi = view.getUint32(offset + 8, false);
57980
+ const lo = view.getUint32(offset + 12, false);
57981
+ boxEnd = offset + hi * 2 ** 32 + lo;
57982
+ payloadStart = offset + 16;
57983
+ } else if (size32 === 0) {
57984
+ boxEnd = rangeEnd;
57985
+ } else {
57986
+ boxEnd = offset + size32;
57987
+ }
57988
+ if (boxEnd <= offset || boxEnd > rangeEnd) {
57989
+ break;
57990
+ }
57991
+ boxes.push({ type, start: payloadStart, end: boxEnd });
57992
+ offset = boxEnd;
57993
+ }
57994
+ return boxes;
57995
+ }
57996
+ function findBox(boxes, type) {
57997
+ return boxes.find((b) => b.type === type);
57998
+ }
57999
+ function looksLikeIsoBmff(bytes) {
58000
+ if (bytes.length < 12) {
58001
+ return false;
58002
+ }
58003
+ return bytes[4] === 102 && bytes[5] === 116 && bytes[6] === 121 && bytes[7] === 112;
58004
+ }
58005
+ function estimateIsoBmffDurationMs(bytes) {
58006
+ if (!looksLikeIsoBmff(bytes)) {
58007
+ return void 0;
58008
+ }
58009
+ const top = readBoxes(bytes, 0, bytes.length);
58010
+ const moov = findBox(top, "moov");
58011
+ if (!moov) {
58012
+ return void 0;
58013
+ }
58014
+ const moovChildren = readBoxes(bytes, moov.start, moov.end);
58015
+ const mvhd = findBox(moovChildren, "mvhd");
58016
+ if (!mvhd || mvhd.end - mvhd.start < 1) {
58017
+ return void 0;
58018
+ }
58019
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
58020
+ const version = bytes[mvhd.start];
58021
+ let timescale;
58022
+ let duration;
58023
+ if (version === 1) {
58024
+ if (mvhd.start + 32 > mvhd.end) {
58025
+ return void 0;
58026
+ }
58027
+ timescale = view.getUint32(mvhd.start + 20, false);
58028
+ const hi = view.getUint32(mvhd.start + 24, false);
58029
+ const lo = view.getUint32(mvhd.start + 28, false);
58030
+ duration = hi * 2 ** 32 + lo;
58031
+ } else {
58032
+ if (mvhd.start + 20 > mvhd.end) {
58033
+ return void 0;
58034
+ }
58035
+ timescale = view.getUint32(mvhd.start + 12, false);
58036
+ duration = view.getUint32(mvhd.start + 16, false);
58037
+ }
58038
+ if (!timescale) {
58039
+ return void 0;
58040
+ }
58041
+ return duration / timescale * 1e3;
58042
+ }
56227
58043
  var init_media_duration_isobmff = __esm({
56228
58044
  "src/core/utils/media-duration-isobmff.ts"() {
56229
58045
  }
56230
58046
  });
58047
+ function skipId3v2(bytes) {
58048
+ if (bytes.length < 10 || bytes[0] !== 73 || bytes[1] !== 68 || bytes[2] !== 51) {
58049
+ return 0;
58050
+ }
58051
+ const size = (bytes[6] & 127) * 2097152 + (bytes[7] & 127) * 16384 + (bytes[8] & 127) * 128 + (bytes[9] & 127);
58052
+ return 10 + size;
58053
+ }
58054
+ function findFirstFrame(bytes, start) {
58055
+ for (let i2 = start; i2 + 4 <= bytes.length; i2++) {
58056
+ if (bytes[i2] !== 255 || (bytes[i2 + 1] & 224) !== 224) {
58057
+ continue;
58058
+ }
58059
+ const b1 = bytes[i2 + 1];
58060
+ const b2 = bytes[i2 + 2];
58061
+ const b3 = bytes[i2 + 3];
58062
+ const versionId = b1 >> 3 & 3;
58063
+ const layerId = b1 >> 1 & 3;
58064
+ if (versionId === 1 || layerId !== 1) {
58065
+ continue;
58066
+ }
58067
+ const bitrateIndex = b2 >> 4 & 15;
58068
+ const sampleRateIndex = b2 >> 2 & 3;
58069
+ if (bitrateIndex === 0 || bitrateIndex === 15 || sampleRateIndex === 3) {
58070
+ continue;
58071
+ }
58072
+ const table2 = versionId === 3 ? BITRATE_TABLE["1-3"] : BITRATE_TABLE["2-3"];
58073
+ const bitrateKbps = table2[bitrateIndex];
58074
+ const sampleRate = SAMPLE_RATE_TABLE[versionId]?.[sampleRateIndex];
58075
+ if (!sampleRate) {
58076
+ continue;
58077
+ }
58078
+ const padding = b2 >> 1 & 1;
58079
+ const channelMode = b3 >> 6 & 3;
58080
+ const samplesPerFrame = versionId === 3 ? 1152 : 576;
58081
+ const frameLength = Math.floor(samplesPerFrame / 8 * (bitrateKbps * 1e3)) / sampleRate + padding;
58082
+ return {
58083
+ offset: i2,
58084
+ versionId,
58085
+ bitrateKbps,
58086
+ sampleRate,
58087
+ channelMode,
58088
+ padding,
58089
+ frameLength: Math.floor(frameLength)
58090
+ };
58091
+ }
58092
+ return void 0;
58093
+ }
58094
+ function readXingFrameCount(bytes, frame2) {
58095
+ const sideInfoSize = frame2.versionId === 3 ? frame2.channelMode === 3 ? 17 : 32 : frame2.channelMode === 3 ? 9 : 17;
58096
+ const tagStart = frame2.offset + 4 + sideInfoSize;
58097
+ if (tagStart + 8 > bytes.length) {
58098
+ return void 0;
58099
+ }
58100
+ const tag = String.fromCharCode(
58101
+ bytes[tagStart],
58102
+ bytes[tagStart + 1],
58103
+ bytes[tagStart + 2],
58104
+ bytes[tagStart + 3]
58105
+ );
58106
+ if (tag !== "Xing" && tag !== "Info") {
58107
+ return void 0;
58108
+ }
58109
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
58110
+ const flags = view.getUint32(tagStart + 4, false);
58111
+ if ((flags & 1) === 0) {
58112
+ return void 0;
58113
+ }
58114
+ return view.getUint32(tagStart + 8, false);
58115
+ }
58116
+ function readVbriFrameCount(bytes, frame2) {
58117
+ const tagStart = frame2.offset + 4 + 32;
58118
+ if (tagStart + 14 > bytes.length) {
58119
+ return void 0;
58120
+ }
58121
+ const tag = String.fromCharCode(
58122
+ bytes[tagStart],
58123
+ bytes[tagStart + 1],
58124
+ bytes[tagStart + 2],
58125
+ bytes[tagStart + 3]
58126
+ );
58127
+ if (tag !== "VBRI") {
58128
+ return void 0;
58129
+ }
58130
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
58131
+ return view.getUint32(tagStart + 14, false);
58132
+ }
58133
+ function estimateMp3DurationMs(bytes) {
58134
+ const start = skipId3v2(bytes);
58135
+ const frame2 = findFirstFrame(bytes, start);
58136
+ if (!frame2) {
58137
+ return void 0;
58138
+ }
58139
+ const samplesPerFrame = frame2.versionId === 3 ? 1152 : 576;
58140
+ const xingFrames = readXingFrameCount(bytes, frame2);
58141
+ if (xingFrames !== void 0) {
58142
+ return xingFrames * samplesPerFrame / frame2.sampleRate * 1e3;
58143
+ }
58144
+ const vbriFrames = readVbriFrameCount(bytes, frame2);
58145
+ if (vbriFrames !== void 0) {
58146
+ return vbriFrames * samplesPerFrame / frame2.sampleRate * 1e3;
58147
+ }
58148
+ const audioBytes = bytes.length - frame2.offset;
58149
+ if (frame2.bitrateKbps <= 0) {
58150
+ return void 0;
58151
+ }
58152
+ return audioBytes * 8 / (frame2.bitrateKbps * 1e3) * 1e3;
58153
+ }
58154
+ var BITRATE_TABLE;
58155
+ var SAMPLE_RATE_TABLE;
56231
58156
  var init_media_duration_mp3 = __esm({
56232
58157
  "src/core/utils/media-duration-mp3.ts"() {
58158
+ BITRATE_TABLE = {
58159
+ // MPEG version 1, Layer III (kbps), index 0 = "free", 15 = "bad".
58160
+ "1-3": [0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 0],
58161
+ // MPEG version 2/2.5, Layer III.
58162
+ "2-3": [0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0]
58163
+ };
58164
+ SAMPLE_RATE_TABLE = {
58165
+ 0: [11025, 12e3, 8e3],
58166
+ // MPEG 2.5
58167
+ 2: [22050, 24e3, 16e3],
58168
+ // MPEG 2
58169
+ 3: [44100, 48e3, 32e3]
58170
+ // MPEG 1
58171
+ };
56233
58172
  }
56234
58173
  });
58174
+ function matchesAt(bytes, offset, pattern) {
58175
+ if (offset + pattern.length > bytes.length) {
58176
+ return false;
58177
+ }
58178
+ for (let i2 = 0; i2 < pattern.length; i2++) {
58179
+ if (bytes[offset + i2] !== pattern[i2]) {
58180
+ return false;
58181
+ }
58182
+ }
58183
+ return true;
58184
+ }
58185
+ function readPageAt(bytes, offset) {
58186
+ if (!matchesAt(bytes, offset, OGG_CAPTURE)) {
58187
+ return void 0;
58188
+ }
58189
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
58190
+ const lo = view.getUint32(offset + 6, true);
58191
+ const hi = view.getUint32(offset + 10, true);
58192
+ const granulePosition = hi * 2 ** 32 + lo;
58193
+ const pageSegments = bytes[offset + 26];
58194
+ const segmentTableStart = offset + 27;
58195
+ let dataLength = 0;
58196
+ for (let i2 = 0; i2 < pageSegments; i2++) {
58197
+ dataLength += bytes[segmentTableStart + i2];
58198
+ }
58199
+ const dataStart = segmentTableStart + pageSegments;
58200
+ return { granulePosition, dataStart, dataEnd: dataStart + dataLength };
58201
+ }
58202
+ function detectCodecSampleRate(bytes, page) {
58203
+ const start = page.dataStart;
58204
+ if (matchesAt(bytes, start, [79, 112, 117, 115, 72, 101, 97, 100])) {
58205
+ return { opus: true, sampleRate: 48e3 };
58206
+ }
58207
+ if (matchesAt(bytes, start + 1, [118, 111, 114, 98, 105, 115])) {
58208
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
58209
+ const sampleRate = view.getUint32(start + 1 + 6 + 4 + 1, true);
58210
+ return { opus: false, sampleRate };
58211
+ }
58212
+ return void 0;
58213
+ }
58214
+ function estimateOggDurationMs(bytes) {
58215
+ if (!matchesAt(bytes, 0, OGG_CAPTURE)) {
58216
+ return void 0;
58217
+ }
58218
+ const firstPage = readPageAt(bytes, 0);
58219
+ if (!firstPage) {
58220
+ return void 0;
58221
+ }
58222
+ const codec = detectCodecSampleRate(bytes, firstPage);
58223
+ if (!codec || !codec.sampleRate) {
58224
+ return void 0;
58225
+ }
58226
+ let lastPageOffset;
58227
+ for (let i2 = bytes.length - OGG_CAPTURE.length; i2 >= 0; i2--) {
58228
+ if (matchesAt(bytes, i2, OGG_CAPTURE)) {
58229
+ lastPageOffset = i2;
58230
+ break;
58231
+ }
58232
+ }
58233
+ if (lastPageOffset === void 0) {
58234
+ return void 0;
58235
+ }
58236
+ const lastPage = readPageAt(bytes, lastPageOffset);
58237
+ if (!lastPage || lastPage.granulePosition <= 0) {
58238
+ return void 0;
58239
+ }
58240
+ return lastPage.granulePosition / codec.sampleRate * 1e3;
58241
+ }
58242
+ var OGG_CAPTURE;
56235
58243
  var init_media_duration_ogg = __esm({
56236
58244
  "src/core/utils/media-duration-ogg.ts"() {
58245
+ OGG_CAPTURE = [79, 103, 103, 83];
56237
58246
  }
56238
58247
  });
58248
+ function estimateWavDurationMs(bytes) {
58249
+ if (bytes.length < 12) {
58250
+ return void 0;
58251
+ }
58252
+ const isRiff = bytes[0] === 82 && bytes[1] === 73 && bytes[2] === 70 && bytes[3] === 70;
58253
+ const isWave = bytes[8] === 87 && bytes[9] === 65 && bytes[10] === 86 && bytes[11] === 69;
58254
+ if (!isRiff || !isWave) {
58255
+ return void 0;
58256
+ }
58257
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
58258
+ let offset = 12;
58259
+ let byteRate;
58260
+ let dataSize;
58261
+ while (offset + 8 <= bytes.length) {
58262
+ const id = String.fromCharCode(
58263
+ bytes[offset],
58264
+ bytes[offset + 1],
58265
+ bytes[offset + 2],
58266
+ bytes[offset + 3]
58267
+ );
58268
+ const size = view.getUint32(offset + 4, true);
58269
+ const dataStart = offset + 8;
58270
+ if (id === "fmt " && dataStart + 16 <= bytes.length) {
58271
+ byteRate = view.getUint32(dataStart + 8, true);
58272
+ } else if (id === "data") {
58273
+ dataSize = size;
58274
+ }
58275
+ if (byteRate !== void 0 && dataSize !== void 0) {
58276
+ break;
58277
+ }
58278
+ offset = dataStart + size + size % 2;
58279
+ }
58280
+ if (!byteRate || dataSize === void 0) {
58281
+ return void 0;
58282
+ }
58283
+ return dataSize / byteRate * 1e3;
58284
+ }
56239
58285
  var init_media_duration_wav = __esm({
56240
58286
  "src/core/utils/media-duration-wav.ts"() {
56241
58287
  }
56242
58288
  });
58289
+ function estimateMediaDurationMs(bytes) {
58290
+ if (bytes.length < 4) {
58291
+ return void 0;
58292
+ }
58293
+ try {
58294
+ if (bytes[0] === 82 && bytes[1] === 73 && bytes[2] === 70 && bytes[3] === 70) {
58295
+ return estimateWavDurationMs(bytes);
58296
+ }
58297
+ if (bytes[0] === 79 && bytes[1] === 103 && bytes[2] === 103 && bytes[3] === 83) {
58298
+ return estimateOggDurationMs(bytes);
58299
+ }
58300
+ if (bytes[0] === 26 && bytes[1] === 69 && bytes[2] === 223 && bytes[3] === 163) {
58301
+ return estimateEbmlDurationMs(bytes);
58302
+ }
58303
+ if (looksLikeIsoBmff(bytes)) {
58304
+ return estimateIsoBmffDurationMs(bytes);
58305
+ }
58306
+ if (bytes[0] === 73 && bytes[1] === 68 && bytes[2] === 51) {
58307
+ return estimateMp3DurationMs(bytes);
58308
+ }
58309
+ if (bytes[0] === 255 && (bytes[1] & 224) === 224) {
58310
+ const mp3 = estimateMp3DurationMs(bytes);
58311
+ if (mp3 !== void 0) {
58312
+ return mp3;
58313
+ }
58314
+ return estimateAdtsDurationMs(bytes);
58315
+ }
58316
+ return void 0;
58317
+ } catch {
58318
+ return void 0;
58319
+ }
58320
+ }
56243
58321
  var init_media_duration = __esm({
56244
58322
  "src/core/utils/media-duration.ts"() {
56245
58323
  init_media_duration_adts();
@@ -64632,7 +66710,7 @@ var init_PptxTableDataParser = __esm({
64632
66710
  const xmlRows = this.context.ensureArray(tableNode["a:tr"]);
64633
66711
  const rows = xmlRows.map((rowNode) => {
64634
66712
  const rowHeightEmu = parseInt(String(rowNode?.["@_h"] || "0"), 10) || 0;
64635
- const rowHeight = Math.round(rowHeightEmu / this.context.emuPerPx);
66713
+ const rowHeight = rowHeightEmu / this.context.emuPerPx;
64636
66714
  const xmlCells = this.context.ensureArray(rowNode["a:tc"]);
64637
66715
  return {
64638
66716
  height: rowHeight,
@@ -65442,15 +67520,15 @@ function readPositiveInteger(value) {
65442
67520
  return Number.isFinite(parsed) && parsed > 0 ? parsed : 0;
65443
67521
  }
65444
67522
  function getTableGridExtent(graphicData) {
65445
- const table = graphicData?.["a:tbl"];
65446
- if (!table) {
67523
+ const table2 = graphicData?.["a:tbl"];
67524
+ if (!table2) {
65447
67525
  return void 0;
65448
67526
  }
65449
- const grid = table["a:tblGrid"];
67527
+ const grid = table2["a:tblGrid"];
65450
67528
  const widthEmu = ensureArrayLike2(
65451
67529
  grid?.["a:gridCol"]
65452
67530
  ).reduce((sum, column) => sum + readPositiveInteger(column?.["@_w"]), 0);
65453
- const heightEmu = ensureArrayLike2(table["a:tr"]).reduce(
67531
+ const heightEmu = ensureArrayLike2(table2["a:tr"]).reduce(
65454
67532
  (sum, row) => sum + readPositiveInteger(row?.["@_h"]),
65455
67533
  0
65456
67534
  );
@@ -69801,6 +71879,139 @@ var init_animation_timeline_anchors = __esm({
69801
71879
  init_animation_timing_ownership();
69802
71880
  }
69803
71881
  });
71882
+ function patchMediaCallDuration(animations, rawShapeId, realMs, remap) {
71883
+ const roundedReal = Math.round(realMs);
71884
+ for (const anim of animations) {
71885
+ if (anim.kind === "media" || anim.targetId !== rawShapeId) {
71886
+ continue;
71887
+ }
71888
+ const oldMs = anim.durationMs;
71889
+ if (oldMs === void 0 || oldMs <= 0 || oldMs === roundedReal) {
71890
+ continue;
71891
+ }
71892
+ anim.durationMs = roundedReal;
71893
+ const existing = remap.get(oldMs);
71894
+ if (existing === void 0) {
71895
+ remap.set(oldMs, roundedReal);
71896
+ } else if (existing !== roundedReal) {
71897
+ remap.delete(oldMs);
71898
+ }
71899
+ }
71900
+ }
71901
+ function applyPlainDelayRemap(animations, remap) {
71902
+ if (remap.size === 0) {
71903
+ return;
71904
+ }
71905
+ for (const anim of animations) {
71906
+ if (anim.parGroupDelayMs !== void 0) {
71907
+ const real = remap.get(anim.parGroupDelayMs);
71908
+ if (real !== void 0) {
71909
+ anim.parGroupDelayMs = real;
71910
+ }
71911
+ }
71912
+ for (const conditions of [anim.startConditions, anim.endConditions]) {
71913
+ if (!conditions) {
71914
+ continue;
71915
+ }
71916
+ for (const cond of conditions) {
71917
+ if (cond.event !== void 0 || cond.targetTimeNodeId !== void 0 || cond.targetShapeId !== void 0 || typeof cond.delay !== "number" || cond.delay <= 0) {
71918
+ continue;
71919
+ }
71920
+ const real = remap.get(cond.delay);
71921
+ if (real !== void 0) {
71922
+ cond.delay = real;
71923
+ }
71924
+ }
71925
+ }
71926
+ }
71927
+ }
71928
+ var init_native_animation_media_duration_plain_delay = __esm({
71929
+ "src/core/services/native-animation-media-duration-plain-delay.ts"() {
71930
+ }
71931
+ });
71932
+ function isMediaElement(el) {
71933
+ return el.type === "media";
71934
+ }
71935
+ function collectMediaElementsByRawId(elements2) {
71936
+ const map = /* @__PURE__ */ new Map();
71937
+ const walk2 = (els) => {
71938
+ for (const el of els) {
71939
+ if (isMediaElement(el) && el.mediaPath) {
71940
+ const rawId = readCnvPrId(el.rawXml);
71941
+ if (rawId) {
71942
+ map.set(rawId, el);
71943
+ }
71944
+ }
71945
+ if (el.type === "group" && Array.isArray(el.children)) {
71946
+ walk2(el.children);
71947
+ }
71948
+ }
71949
+ };
71950
+ walk2(elements2);
71951
+ return map;
71952
+ }
71953
+ function patchOnStopAudioConditions(animations, nodeId, rawShapeId, realMs) {
71954
+ for (const anim of animations) {
71955
+ for (const conditions of [anim.startConditions, anim.endConditions]) {
71956
+ if (!conditions) {
71957
+ continue;
71958
+ }
71959
+ for (const cond of conditions) {
71960
+ if (cond.event !== "onStopAudio") {
71961
+ continue;
71962
+ }
71963
+ const namesThisNode = nodeId !== void 0 && cond.targetTimeNodeId === nodeId || cond.targetShapeId === rawShapeId;
71964
+ if (namesThisNode) {
71965
+ cond.delay = Math.round(realMs);
71966
+ }
71967
+ }
71968
+ }
71969
+ }
71970
+ }
71971
+ async function attachRealMediaDurations(elements2, nativeAnimations, readBytes) {
71972
+ if (!nativeAnimations || nativeAnimations.length === 0) {
71973
+ return;
71974
+ }
71975
+ const mediaByRawId = collectMediaElementsByRawId(elements2);
71976
+ if (mediaByRawId.size === 0) {
71977
+ return;
71978
+ }
71979
+ const plainDelayRemap = /* @__PURE__ */ new Map();
71980
+ for (const anim of nativeAnimations) {
71981
+ if (anim.kind !== "media" || anim.targetId === void 0) {
71982
+ continue;
71983
+ }
71984
+ const element = mediaByRawId.get(anim.targetId);
71985
+ if (!element?.mediaPath) {
71986
+ continue;
71987
+ }
71988
+ let bytes;
71989
+ try {
71990
+ bytes = await readBytes(element.mediaPath);
71991
+ } catch {
71992
+ continue;
71993
+ }
71994
+ if (!bytes) {
71995
+ continue;
71996
+ }
71997
+ const realMs = estimateMediaDurationMs(bytes);
71998
+ if (realMs === void 0 || !Number.isFinite(realMs) || realMs <= 0) {
71999
+ continue;
72000
+ }
72001
+ anim.durationMs = Math.round(realMs);
72002
+ element.metadata = { ...element.metadata, duration: realMs / 1e3 };
72003
+ patchOnStopAudioConditions(nativeAnimations, anim.nodeId, anim.targetId, realMs);
72004
+ patchMediaCallDuration(nativeAnimations, anim.targetId, realMs, plainDelayRemap);
72005
+ }
72006
+ applyPlainDelayRemap(nativeAnimations, plainDelayRemap);
72007
+ }
72008
+ var init_native_animation_media_duration = __esm({
72009
+ "src/core/services/native-animation-media-duration.ts"() {
72010
+ init_media_duration();
72011
+ init_animation_target_reconcile();
72012
+ init_native_animation_media_duration_plain_delay();
72013
+ }
72014
+ });
69804
72015
  function asNode3(value) {
69805
72016
  return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
69806
72017
  }
@@ -69841,6 +72052,7 @@ var init_PptxSlideLoaderService = __esm({
69841
72052
  init_animation_sound_merge();
69842
72053
  init_animation_target_reconcile();
69843
72054
  init_animation_timeline_anchors();
72055
+ init_native_animation_media_duration();
69844
72056
  init_slide_name();
69845
72057
  PptxSlideLoaderService = class {
69846
72058
  /**
@@ -70032,6 +72244,17 @@ var init_PptxSlideLoaderService = __esm({
70032
72244
  animations = timeline.animations;
70033
72245
  animationTimelineAnchors = timeline.anchors.length > 0 ? timeline.anchors : void 0;
70034
72246
  }
72247
+ await attachRealMediaDurations(elements2, nativeAnimations, async (mediaPath) => {
72248
+ const file = params.zip.file(mediaPath);
72249
+ if (!file) {
72250
+ return void 0;
72251
+ }
72252
+ try {
72253
+ return await file.async("uint8array");
72254
+ } catch {
72255
+ return void 0;
72256
+ }
72257
+ });
70035
72258
  reconcileAnimationTargets(elements2, nativeAnimations, animations, animationTimelineAnchors);
70036
72259
  mergeNativeSoundIntoEditorAnimations(nativeAnimations, animations);
70037
72260
  mergeNativeBuildTemplatesIntoEditorAnimations(nativeAnimations, animations);
@@ -83071,28 +85294,28 @@ function applyChartDataTable(plotArea, dataTable, localName28, resolveColor2) {
83071
85294
  }
83072
85295
  return;
83073
85296
  }
83074
- const table = {
85297
+ const table2 = {
83075
85298
  ...tableKey ? plotArea[tableKey] : void 0
83076
85299
  };
83077
85300
  for (const flag of FLAGS2) {
83078
85301
  const value = dataTable[flag];
83079
85302
  if (value !== void 0) {
83080
- setOrdered4(table, flag, { "@_val": value ? "1" : "0" }, TABLE_ORDER, localName28);
85303
+ setOrdered4(table2, flag, { "@_val": value ? "1" : "0" }, TABLE_ORDER, localName28);
83081
85304
  }
83082
85305
  }
83083
85306
  if (dataTable.spPr) {
83084
- const spPrKey = findKey14(table, "spPr", localName28);
85307
+ const spPrKey = findKey14(table2, "spPr", localName28);
83085
85308
  const spPr = writeChartShapeProps(
83086
- spPrKey ? table[spPrKey] : void 0,
85309
+ spPrKey ? table2[spPrKey] : void 0,
83087
85310
  dataTable.spPr,
83088
85311
  localName28,
83089
85312
  resolveColor2
83090
85313
  );
83091
- setOrdered4(table, "spPr", spPr, TABLE_ORDER, localName28);
85314
+ setOrdered4(table2, "spPr", spPr, TABLE_ORDER, localName28);
83092
85315
  }
83093
85316
  if (dataTable.txPr) {
83094
- const txPrKey = findKey14(table, "txPr", localName28);
83095
- const authoredDefRPr = resolveTxPrDefRPr(txPrKey ? table[txPrKey] : void 0, {
85317
+ const txPrKey = findKey14(table2, "txPr", localName28);
85318
+ const authoredDefRPr = resolveTxPrDefRPr(txPrKey ? table2[txPrKey] : void 0, {
83096
85319
  getChildByLocalName: (parent, name) => {
83097
85320
  if (!parent) {
83098
85321
  return void 0;
@@ -83103,13 +85326,13 @@ function applyChartDataTable(plotArea, dataTable, localName28, resolveColor2) {
83103
85326
  });
83104
85327
  const txPr = buildDefRPrTextProperties(dataTable.txPr, authoredDefRPr, resolveColor2);
83105
85328
  if (txPr) {
83106
- setOrdered4(table, "txPr", txPr, TABLE_ORDER, localName28);
85329
+ setOrdered4(table2, "txPr", txPr, TABLE_ORDER, localName28);
83107
85330
  }
83108
85331
  }
83109
85332
  if (tableKey) {
83110
- plotArea[tableKey] = table;
85333
+ plotArea[tableKey] = table2;
83111
85334
  } else {
83112
- setOrdered4(plotArea, "dTable", table, PLOT_AREA_ORDER, localName28);
85335
+ setOrdered4(plotArea, "dTable", table2, PLOT_AREA_ORDER, localName28);
83113
85336
  }
83114
85337
  }
83115
85338
  var TABLE_ORDER;
@@ -89096,10 +91319,10 @@ function buildImageEffectsFilter(effects, idSuffix) {
89096
91319
  }
89097
91320
  if (typeof effects.biLevel === "number") {
89098
91321
  next("p6a", `<feColorMatrix in="__IN__" type="saturate" values="0" result="__OUT__"/>`);
89099
- const table = biLevelTable(effects.biLevel);
91322
+ const table2 = biLevelTable(effects.biLevel);
89100
91323
  next(
89101
91324
  "p6b",
89102
- `<feComponentTransfer in="__IN__" result="__OUT__"><feFuncR type="discrete" tableValues="${table}"/><feFuncG type="discrete" tableValues="${table}"/><feFuncB type="discrete" tableValues="${table}"/></feComponentTransfer>`
91325
+ `<feComponentTransfer in="__IN__" result="__OUT__"><feFuncR type="discrete" tableValues="${table2}"/><feFuncG type="discrete" tableValues="${table2}"/><feFuncB type="discrete" tableValues="${table2}"/></feComponentTransfer>`
89103
91326
  );
89104
91327
  }
89105
91328
  if (effects.duotone) {
@@ -96971,11 +99194,11 @@ function updateCellTextInRawXml(element, rowIndex, colIndex, text22) {
96971
99194
  return void 0;
96972
99195
  }
96973
99196
  const newRawXml = structuredClone(element.rawXml);
96974
- const table = getTblFromRawXml(newRawXml);
96975
- if (!table) {
99197
+ const table2 = getTblFromRawXml(newRawXml);
99198
+ if (!table2) {
96976
99199
  return void 0;
96977
99200
  }
96978
- const rows = ensureArray19(table["a:tr"]);
99201
+ const rows = ensureArray19(table2["a:tr"]);
96979
99202
  if (rowIndex < 0 || rowIndex >= rows.length) {
96980
99203
  return void 0;
96981
99204
  }
@@ -97021,11 +99244,11 @@ function updateCellTextStyleInRawXml(element, rowIndex, colIndex, styleUpdates)
97021
99244
  return void 0;
97022
99245
  }
97023
99246
  const newRawXml = structuredClone(element.rawXml);
97024
- const table = getTblFromRawXml(newRawXml);
97025
- if (!table) {
99247
+ const table2 = getTblFromRawXml(newRawXml);
99248
+ if (!table2) {
97026
99249
  return void 0;
97027
99250
  }
97028
- const rows = ensureArray19(table["a:tr"]);
99251
+ const rows = ensureArray19(table2["a:tr"]);
97029
99252
  if (rowIndex < 0 || rowIndex >= rows.length) {
97030
99253
  return void 0;
97031
99254
  }
@@ -97123,11 +99346,11 @@ function updateMergeAttrsInRawXml(element, tableData) {
97123
99346
  return void 0;
97124
99347
  }
97125
99348
  const newRawXml = structuredClone(element.rawXml);
97126
- const table = getTblFromRawXml(newRawXml);
97127
- if (!table) {
99349
+ const table2 = getTblFromRawXml(newRawXml);
99350
+ if (!table2) {
97128
99351
  return void 0;
97129
99352
  }
97130
- const xmlRows = ensureArray19(table["a:tr"]);
99353
+ const xmlRows = ensureArray19(table2["a:tr"]);
97131
99354
  for (let rIdx = 0; rIdx < Math.min(tableData.rows.length, xmlRows.length); rIdx++) {
97132
99355
  const dataRow = tableData.rows[rIdx];
97133
99356
  const xmlCells = ensureArray19(xmlRows[rIdx]["a:tc"]);
@@ -97181,12 +99404,12 @@ function rebuildTableStructureInRawXml(element, tableData) {
97181
99404
  return void 0;
97182
99405
  }
97183
99406
  const newRawXml = structuredClone(element.rawXml);
97184
- const table = getTblFromRawXml(newRawXml);
97185
- if (!table) {
99407
+ const table2 = getTblFromRawXml(newRawXml);
99408
+ if (!table2) {
97186
99409
  return void 0;
97187
99410
  }
97188
99411
  const existingGridCols = ensureArray19(
97189
- table["a:tblGrid"]?.["a:gridCol"]
99412
+ table2["a:tblGrid"]?.["a:gridCol"]
97190
99413
  );
97191
99414
  const totalWidthEmu = existingGridCols.reduce((sum, col) => {
97192
99415
  return sum + (parseInt(String(col?.["@_w"] || "0"), 10) || 0);
@@ -97194,11 +99417,11 @@ function rebuildTableStructureInRawXml(element, tableData) {
97194
99417
  const newGridCols = tableData.columnWidths.map((w) => ({
97195
99418
  "@_w": String(Math.round(w * totalWidthEmu))
97196
99419
  }));
97197
- if (!table["a:tblGrid"]) {
97198
- table["a:tblGrid"] = {};
99420
+ if (!table2["a:tblGrid"]) {
99421
+ table2["a:tblGrid"] = {};
97199
99422
  }
97200
- table["a:tblGrid"]["a:gridCol"] = newGridCols.length === 1 ? newGridCols[0] : newGridCols;
97201
- const existingXmlRows = ensureArray19(table["a:tr"]);
99423
+ table2["a:tblGrid"]["a:gridCol"] = newGridCols.length === 1 ? newGridCols[0] : newGridCols;
99424
+ const existingXmlRows = ensureArray19(table2["a:tr"]);
97202
99425
  const newXmlRows = tableData.rows.map((dataRow, ri) => {
97203
99426
  const existingRow = ri < existingXmlRows.length ? existingXmlRows[ri] : void 0;
97204
99427
  const existingCells = existingRow ? ensureArray19(existingRow["a:tc"]) : [];
@@ -97237,7 +99460,7 @@ function rebuildTableStructureInRawXml(element, tableData) {
97237
99460
  "a:tc": newXmlCells.length === 1 ? newXmlCells[0] : newXmlCells
97238
99461
  };
97239
99462
  });
97240
- table["a:tr"] = newXmlRows.length === 1 ? newXmlRows[0] : newXmlRows;
99463
+ table2["a:tr"] = newXmlRows.length === 1 ? newXmlRows[0] : newXmlRows;
97241
99464
  return newRawXml;
97242
99465
  }
97243
99466
  var init_table_cell_rawxml_ops = __esm({
@@ -136078,8 +138301,8 @@ function applyTableCellImagePatches(elements, resolvedMap, refs) {
136078
138301
  if (!cellPatches || el.type !== "table") {
136079
138302
  return el;
136080
138303
  }
136081
- const table = el;
136082
- const tableData = table.tableData;
138304
+ const table2 = el;
138305
+ const tableData = table2.tableData;
136083
138306
  if (!tableData) {
136084
138307
  return el;
136085
138308
  }
@@ -136100,7 +138323,7 @@ function applyTableCellImagePatches(elements, resolvedMap, refs) {
136100
138323
  });
136101
138324
  return { ...row, cells: newCells };
136102
138325
  });
136103
- return { ...table, tableData: { ...tableData, rows: newRows } };
138326
+ return { ...table2, tableData: { ...tableData, rows: newRows } };
136104
138327
  });
136105
138328
  }
136106
138329
  function buildInitialGuides(presentationGuides, firstSlideGuides) {
@@ -139325,9 +141548,9 @@ function buildImageAlphaFilterMarkup(effects) {
139325
141548
  }
139326
141549
  if (typeof effects.alphaBiLevel === "number") {
139327
141550
  const t = clamp32(effects.alphaBiLevel / 100, 0, 1);
139328
- const table = Array.from({ length: 10 }, (_, i2) => i2 / 10 >= t ? "1" : "0").join(" ");
141551
+ const table2 = Array.from({ length: 10 }, (_, i2) => i2 / 10 >= t ? "1" : "0").join(" ");
139329
141552
  next(
139330
- (inp, out) => `<feComponentTransfer in="${inp}" result="${out}"><feFuncA type="discrete" tableValues="${table}"/></feComponentTransfer>`
141553
+ (inp, out) => `<feComponentTransfer in="${inp}" result="${out}"><feFuncA type="discrete" tableValues="${table2}"/></feComponentTransfer>`
139331
141554
  );
139332
141555
  }
139333
141556
  if (typeof effects.biLevel === "number") {
@@ -143441,7 +145664,7 @@ function notifyBarFacePicturePixelListeners() {
143441
145664
  function getBarFacePicturePixelSampleVersion() {
143442
145665
  return sampleVersion;
143443
145666
  }
143444
- function hexChannel(value) {
145667
+ function hexChannel2(value) {
143445
145668
  return Math.max(0, Math.min(255, Math.round(value))).toString(16).padStart(2, "0");
143446
145669
  }
143447
145670
  function decodeFirstPixelColor(imageUrl) {
@@ -143463,7 +145686,7 @@ function decodeFirstPixelColor(imageUrl) {
143463
145686
  }
143464
145687
  ctx.drawImage(img, 0, 0, 1, 1, 0, 0, 1, 1);
143465
145688
  const [r, g2, b, a] = ctx.getImageData(0, 0, 1, 1).data;
143466
- resolve2(a === 0 ? void 0 : `#${hexChannel(r)}${hexChannel(g2)}${hexChannel(b)}`);
145689
+ resolve2(a === 0 ? void 0 : `#${hexChannel2(r)}${hexChannel2(g2)}${hexChannel2(b)}`);
143467
145690
  } catch {
143468
145691
  resolve2(void 0);
143469
145692
  }
@@ -143487,6 +145710,33 @@ function ensureBarFacePicturePixelSampled(imageUrl, sampler = decodeFirstPixelCo
143487
145710
  });
143488
145711
  inFlight.set(imageUrl, pending);
143489
145712
  }
145713
+ function trySampleFirstPixelColorSync(imageUrl) {
145714
+ const parsed = parseDataUrlToBytes(imageUrl);
145715
+ if (!parsed) {
145716
+ return void 0;
145717
+ }
145718
+ try {
145719
+ return sampleFirstPixelColorFromBytes(parsed.bytes);
145720
+ } catch {
145721
+ return void 0;
145722
+ }
145723
+ }
145724
+ function resolveBarFacePicturePixelColor(imageUrl) {
145725
+ const cached = getCachedBarFacePicturePixelColor(imageUrl);
145726
+ if (cached !== void 0) {
145727
+ return cached;
145728
+ }
145729
+ if (sampleCache.has(imageUrl) || inFlight.has(imageUrl)) {
145730
+ return void 0;
145731
+ }
145732
+ const sync = trySampleFirstPixelColorSync(imageUrl);
145733
+ if (sync !== void 0) {
145734
+ sampleCache.set(imageUrl, sync);
145735
+ return sync;
145736
+ }
145737
+ ensureBarFacePicturePixelSampled(imageUrl);
145738
+ return void 0;
145739
+ }
143490
145740
  function resolveUntargetedBarFaceFill(face, baseColor) {
143491
145741
  return face === "end" ? tint2(baseColor, 0.22) : shade2(baseColor, 0.25);
143492
145742
  }
@@ -143522,11 +145772,10 @@ function resolveExtrusionFaceFill(facePoints, face, resolvedColor, rect22, pictu
143522
145772
  if (!activePicture?.imageUrl) {
143523
145773
  return fallback;
143524
145774
  }
143525
- const sampled = getCachedBarFacePicturePixelColor(activePicture.imageUrl);
145775
+ const sampled = resolveBarFacePicturePixelColor(activePicture.imageUrl);
143526
145776
  if (sampled !== void 0) {
143527
145777
  return resolveUntargetedBarFaceFill(face, sampled);
143528
145778
  }
143529
- ensureBarFacePicturePixelSampled(activePicture.imageUrl);
143530
145779
  return fallback;
143531
145780
  }
143532
145781
  var LEGEND_ITEM_WIDTH = 80;
@@ -145349,8 +147598,8 @@ var DEFAULT_CELL_FONT_PX = 8;
145349
147598
  var DEFAULT_BORDER_COLOR = "#cbd5e1";
145350
147599
  var DEFAULT_TEXT_COLOR22 = "#334155";
145351
147600
  function computeDataTablePrimitives(chartData, layout, colorPalette) {
145352
- const table = chartData.dataTable;
145353
- if (!table) {
147601
+ const table2 = chartData.dataTable;
147602
+ if (!table2) {
145354
147603
  return [];
145355
147604
  }
145356
147605
  const categories = chartData.categories;
@@ -145359,18 +147608,18 @@ function computeDataTablePrimitives(chartData, layout, colorPalette) {
145359
147608
  return [];
145360
147609
  }
145361
147610
  const out = [];
145362
- const showH = table.showHorzBorder !== false;
145363
- const showV = table.showVertBorder !== false;
145364
- const showO = table.showOutline !== false;
145365
- const showK = table.showKeys !== false;
145366
- const borderColor = table.spPr?.strokeColor ?? DEFAULT_BORDER_COLOR;
145367
- const borderWidth = table.spPr?.strokeWidth ?? 1;
145368
- const textColor = table.txPr?.color ?? DEFAULT_TEXT_COLOR22;
145369
- const fontFamily = table.txPr?.fontFamily;
145370
- const fontSize = table.txPr?.fontSize !== void 0 ? chartFontPx(table.txPr.fontSize) : DEFAULT_CELL_FONT_PX;
145371
- const headerWeight = table.txPr?.bold === false ? "normal" : "bold";
145372
- const cellWeight = table.txPr?.bold ? "bold" : "normal";
145373
- const fontStyle = table.txPr?.italic ? "italic" : "normal";
147611
+ const showH = table2.showHorzBorder !== false;
147612
+ const showV = table2.showVertBorder !== false;
147613
+ const showO = table2.showOutline !== false;
147614
+ const showK = table2.showKeys !== false;
147615
+ const borderColor = table2.spPr?.strokeColor ?? DEFAULT_BORDER_COLOR;
147616
+ const borderWidth = table2.spPr?.strokeWidth ?? 1;
147617
+ const textColor = table2.txPr?.color ?? DEFAULT_TEXT_COLOR22;
147618
+ const fontFamily = table2.txPr?.fontFamily;
147619
+ const fontSize = table2.txPr?.fontSize !== void 0 ? chartFontPx(table2.txPr.fontSize) : DEFAULT_CELL_FONT_PX;
147620
+ const headerWeight = table2.txPr?.bold === false ? "normal" : "bold";
147621
+ const cellWeight = table2.txPr?.bold ? "bold" : "normal";
147622
+ const fontStyle = table2.txPr?.italic ? "italic" : "normal";
145374
147623
  const catCount = categories.length;
145375
147624
  const seriesCount = series.length;
145376
147625
  const keyColW = showK ? DATA_TABLE_KEY_W : 0;
@@ -145378,14 +147627,14 @@ function computeDataTablePrimitives(chartData, layout, colorPalette) {
145378
147627
  const cellW = catCount > 0 ? (totalW - keyColW) / catCount : totalW - keyColW;
145379
147628
  const tableTop = layout.plotBottom + DATA_TABLE_PADDING;
145380
147629
  const tableH = DATA_TABLE_HEADER_H + seriesCount * DATA_TABLE_ROW_H;
145381
- if (table.spPr?.fillColor) {
147630
+ if (table2.spPr?.fillColor) {
145382
147631
  out.push({
145383
147632
  kind: "rect",
145384
147633
  x: layout.plotLeft,
145385
147634
  y: tableTop,
145386
147635
  w: totalW,
145387
147636
  h: tableH,
145388
- fill: table.spPr.fillColor
147637
+ fill: table2.spPr.fillColor
145389
147638
  });
145390
147639
  }
145391
147640
  if (showO) {
@@ -188194,8 +190443,8 @@ var LABEL_KEYS = {
188194
190443
  function entry(id, extra = {}) {
188195
190444
  return { id, labelKey: LABEL_KEYS[id], ...extra };
188196
190445
  }
188197
- function tableEntries(table) {
188198
- if (!table) {
190446
+ function tableEntries(table2) {
190447
+ if (!table2) {
188199
190448
  return [];
188200
190449
  }
188201
190450
  const rowsAndColumns = [
@@ -188206,10 +190455,10 @@ function tableEntries(table) {
188206
190455
  entry("table-insert-col-right"),
188207
190456
  entry("table-delete-col")
188208
190457
  ];
188209
- if (table.hasMultiCellSelection) {
190458
+ if (table2.hasMultiCellSelection) {
188210
190459
  return [...rowsAndColumns, entry("table-merge-selected", { separatorBefore: true })];
188211
190460
  }
188212
- if (table.isMergedCell) {
190461
+ if (table2.isMergedCell) {
188213
190462
  return [...rowsAndColumns, entry("table-split", { separatorBefore: true })];
188214
190463
  }
188215
190464
  return [
@@ -188219,7 +190468,7 @@ function tableEntries(table) {
188219
190468
  ];
188220
190469
  }
188221
190470
  function buildContextMenuEntries(context = {}) {
188222
- const { elementType, table, hasMultiSelection, aiEnabled, hasClipboard, selectionGroupable } = context;
190471
+ const { elementType, table: table2, hasMultiSelection, aiEnabled, hasClipboard, selectionGroupable } = context;
188223
190472
  const lockedOut = selectionGroupable === false;
188224
190473
  const entries = [
188225
190474
  entry("copy"),
@@ -188235,7 +190484,7 @@ function buildContextMenuEntries(context = {}) {
188235
190484
  entries.push(entry("ai-ask", { separatorBefore: true }), entry("ai-fix"));
188236
190485
  }
188237
190486
  entries.push(entry("comment", { separatorBefore: true }), entry("hyperlink"));
188238
- entries.push(...tableEntries(table));
190487
+ entries.push(...tableEntries(table2));
188239
190488
  if (hasMultiSelection) {
188240
190489
  entries.push(
188241
190490
  entry("group", { separatorBefore: true, ...lockedOut ? { disabled: true } : {} })
@@ -195636,6 +197885,262 @@ function applyBackgroundEdit(entry2, edit) {
195636
197885
  payload: { styleId: entry2.styleId, section: "background" }
195637
197886
  };
195638
197887
  }
197888
+ var MIN_TILE_DIM = 256;
197889
+ function computeExportTilePlan(fullWidth, fullHeight, maxDim) {
197890
+ const safeMax = Math.max(MIN_TILE_DIM, Math.floor(maxDim));
197891
+ const fw = Math.max(1, Math.round(fullWidth));
197892
+ const fh = Math.max(1, Math.round(fullHeight));
197893
+ if (fw <= safeMax && fh <= safeMax) {
197894
+ return {
197895
+ fullWidth: fw,
197896
+ fullHeight: fh,
197897
+ tiled: false,
197898
+ cols: 1,
197899
+ rows: 1,
197900
+ tiles: [{ col: 0, row: 0, x: 0, y: 0, width: fw, height: fh }]
197901
+ };
197902
+ }
197903
+ const cols = Math.ceil(fw / safeMax);
197904
+ const rows = Math.ceil(fh / safeMax);
197905
+ const baseTileW = Math.ceil(fw / cols);
197906
+ const baseTileH = Math.ceil(fh / rows);
197907
+ const tiles = [];
197908
+ for (let row = 0; row < rows; row++) {
197909
+ const y = row * baseTileH;
197910
+ const height = Math.min(baseTileH, fh - y);
197911
+ for (let col = 0; col < cols; col++) {
197912
+ const x = col * baseTileW;
197913
+ const width = Math.min(baseTileW, fw - x);
197914
+ tiles.push({ col, row, x, y, width, height });
197915
+ }
197916
+ }
197917
+ return { fullWidth: fw, fullHeight: fh, tiled: true, cols, rows, tiles };
197918
+ }
197919
+ function tileRectToSourceRect(tile, scale2) {
197920
+ const s = scale2 > 0 ? scale2 : 1;
197921
+ return {
197922
+ x: tile.x / s,
197923
+ y: tile.y / s,
197924
+ width: tile.width / s,
197925
+ height: tile.height / s
197926
+ };
197927
+ }
197928
+ var EXCLUDED_STYLE_PROPERTIES = /* @__PURE__ */ new Set([
197929
+ "cursor",
197930
+ "caret-color",
197931
+ "user-select",
197932
+ "-webkit-user-select",
197933
+ "all"
197934
+ ]);
197935
+ function buildInlineStyleText(computed) {
197936
+ const parts = [];
197937
+ for (let i2 = 0; i2 < computed.length; i2++) {
197938
+ const prop = computed.item(i2);
197939
+ if (EXCLUDED_STYLE_PROPERTIES.has(prop)) {
197940
+ continue;
197941
+ }
197942
+ const value = computed.getPropertyValue(prop);
197943
+ if (!value) {
197944
+ continue;
197945
+ }
197946
+ parts.push(`${prop}:${value}`);
197947
+ }
197948
+ return parts.join(";");
197949
+ }
197950
+ function inlineComputedStylesOnClone(liveRoot, cloneRoot, readComputedStyle) {
197951
+ const liveEl = liveRoot;
197952
+ const cloneEl = cloneRoot;
197953
+ cloneEl.setAttribute("style", buildInlineStyleText(readComputedStyle(liveEl)));
197954
+ const liveChildren = liveRoot.children;
197955
+ const cloneChildren = cloneRoot.children;
197956
+ const count = Math.min(liveChildren.length, cloneChildren.length);
197957
+ for (let i2 = 0; i2 < count; i2++) {
197958
+ inlineComputedStylesOnClone(liveChildren[i2], cloneChildren[i2], readComputedStyle);
197959
+ }
197960
+ }
197961
+ function collectFontFaceCss(doc) {
197962
+ const blocks = [];
197963
+ const styles = doc.querySelectorAll("style");
197964
+ for (let i2 = 0; i2 < styles.length; i2++) {
197965
+ const text22 = styles[i2].textContent ?? "";
197966
+ if (text22.includes("@font-face")) {
197967
+ blocks.push(text22);
197968
+ }
197969
+ }
197970
+ return blocks.join("\n\n");
197971
+ }
197972
+ async function fetchTextIfCrossOriginSafe(url) {
197973
+ try {
197974
+ const response = await fetch(url, { mode: "cors" });
197975
+ if (!response.ok) {
197976
+ return null;
197977
+ }
197978
+ return await response.text();
197979
+ } catch {
197980
+ return null;
197981
+ }
197982
+ }
197983
+ var FONT_FACE_URL_PATTERN = /url\(\s*["']?([^"')]+)["']?\s*\)/gu;
197984
+ async function inlineFontFaceUrls(css, fetchDataUrl) {
197985
+ const urls = /* @__PURE__ */ new Set();
197986
+ for (const match of css.matchAll(FONT_FACE_URL_PATTERN)) {
197987
+ const raw = match[1];
197988
+ if (raw.startsWith("http:") || raw.startsWith("https:")) {
197989
+ urls.add(raw);
197990
+ }
197991
+ }
197992
+ if (urls.size === 0) {
197993
+ return { css, allEmbedded: true };
197994
+ }
197995
+ const resolved = await Promise.all(
197996
+ Array.from(urls, async (url) => [url, await fetchDataUrl(url)])
197997
+ );
197998
+ let inlined = css;
197999
+ let allEmbedded = true;
198000
+ for (const [url, dataUrl] of resolved) {
198001
+ if (dataUrl) {
198002
+ inlined = inlined.split(url).join(dataUrl);
198003
+ } else {
198004
+ allEmbedded = false;
198005
+ }
198006
+ }
198007
+ return { css: inlined, allEmbedded };
198008
+ }
198009
+ async function collectExternalFontFaceCss(doc, fetchDataUrl) {
198010
+ const links = doc.querySelectorAll('link[rel="stylesheet"]');
198011
+ const blocks = [];
198012
+ let allEmbedded = true;
198013
+ for (let i2 = 0; i2 < links.length; i2++) {
198014
+ const href = links[i2].getAttribute("href");
198015
+ if (!href || !(href.startsWith("http:") || href.startsWith("https:"))) {
198016
+ continue;
198017
+ }
198018
+ const css = await fetchTextIfCrossOriginSafe(href);
198019
+ if (!css) {
198020
+ allEmbedded = false;
198021
+ continue;
198022
+ }
198023
+ const inlined = await inlineFontFaceUrls(css, fetchDataUrl);
198024
+ blocks.push(inlined.css);
198025
+ if (!inlined.allEmbedded) {
198026
+ allEmbedded = false;
198027
+ }
198028
+ }
198029
+ return { css: blocks.join("\n\n"), allEmbedded };
198030
+ }
198031
+ async function fetchAsDataUrl(url) {
198032
+ try {
198033
+ const response = await fetch(url, { mode: url.startsWith("blob:") ? "same-origin" : "cors" });
198034
+ if (!response.ok) {
198035
+ return null;
198036
+ }
198037
+ const blob = await response.blob();
198038
+ return await new Promise((resolve2, reject) => {
198039
+ const reader = new FileReader();
198040
+ reader.onloadend = () => resolve2(reader.result);
198041
+ reader.onerror = reject;
198042
+ reader.readAsDataURL(blob);
198043
+ });
198044
+ } catch {
198045
+ return null;
198046
+ }
198047
+ }
198048
+ function extractCssUrl(value) {
198049
+ const match = /url\(\s*["']?([^"')]+)["']?\s*\)/u.exec(value);
198050
+ return match ? match[1] : null;
198051
+ }
198052
+ function needsEmbedding(url) {
198053
+ return url.startsWith("blob:") || url.startsWith("http:") || url.startsWith("https:");
198054
+ }
198055
+ async function runImgTask(img, src) {
198056
+ const dataUrl = await fetchAsDataUrl(src);
198057
+ if (!dataUrl) {
198058
+ return false;
198059
+ }
198060
+ img.setAttribute("src", dataUrl);
198061
+ return true;
198062
+ }
198063
+ async function runSvgImageTask(svgImg, href) {
198064
+ const dataUrl = await fetchAsDataUrl(href);
198065
+ if (!dataUrl) {
198066
+ return false;
198067
+ }
198068
+ svgImg.setAttribute("href", dataUrl);
198069
+ svgImg.removeAttribute("xlink:href");
198070
+ return true;
198071
+ }
198072
+ async function runBackgroundTask(el, bg, url) {
198073
+ const dataUrl = await fetchAsDataUrl(url);
198074
+ if (!dataUrl) {
198075
+ return false;
198076
+ }
198077
+ el.style.backgroundImage = bg.replace(url, dataUrl);
198078
+ return true;
198079
+ }
198080
+ async function embedImagesOnClone(root) {
198081
+ const tasks = [];
198082
+ for (const img of root.querySelectorAll("img")) {
198083
+ const src = img.getAttribute("src") ?? "";
198084
+ if (needsEmbedding(src)) {
198085
+ tasks.push(() => runImgTask(img, src));
198086
+ }
198087
+ }
198088
+ for (const svgImg of root.querySelectorAll("image")) {
198089
+ const href = svgImg.getAttribute("href") ?? svgImg.getAttribute("xlink:href") ?? "";
198090
+ if (needsEmbedding(href)) {
198091
+ tasks.push(() => runSvgImageTask(svgImg, href));
198092
+ }
198093
+ }
198094
+ const withBackground = [root, ...Array.from(root.querySelectorAll("*"))];
198095
+ for (const el of withBackground) {
198096
+ const bg = el.style.backgroundImage;
198097
+ if (!bg || bg === "none") {
198098
+ continue;
198099
+ }
198100
+ const url = extractCssUrl(bg);
198101
+ if (url && needsEmbedding(url)) {
198102
+ tasks.push(() => runBackgroundTask(el, bg, url));
198103
+ }
198104
+ }
198105
+ const results = await Promise.all(tasks.map((task) => task()));
198106
+ const unembeddableCount = results.filter((embedded) => !embedded).length;
198107
+ return { allEmbedded: unembeddableCount === 0, unembeddableCount };
198108
+ }
198109
+ function escapeAttr(value) {
198110
+ return value.replace(/&/gu, "&amp;").replace(/"/gu, "&quot;");
198111
+ }
198112
+ async function buildForeignObjectSvgBody(element, doc, options) {
198113
+ const {
198114
+ width,
198115
+ height,
198116
+ backgroundColor,
198117
+ readComputedStyle = (el) => window.getComputedStyle(el)
198118
+ } = options;
198119
+ const clone3 = element.cloneNode(true);
198120
+ inlineComputedStylesOnClone(element, clone3, readComputedStyle);
198121
+ const [{ allEmbedded: imagesEmbedded }, externalFonts] = await Promise.all([
198122
+ embedImagesOnClone(clone3),
198123
+ collectExternalFontFaceCss(doc, fetchAsDataUrl)
198124
+ ]);
198125
+ const allEmbedded = imagesEmbedded && externalFonts.allEmbedded;
198126
+ const fontFaceCss = [collectFontFaceCss(doc), externalFonts.css].filter(Boolean).join("\n\n");
198127
+ const defs = fontFaceCss ? `<defs><style type="text/css"><![CDATA[${fontFaceCss}]]></style></defs>` : "";
198128
+ const bgRect = backgroundColor ? `<rect width="${width}" height="${height}" fill="${escapeAttr(backgroundColor)}" />` : "";
198129
+ const bodyMarkup = [
198130
+ defs,
198131
+ bgRect,
198132
+ `<foreignObject x="0" y="0" width="${width}" height="${height}">`,
198133
+ `<div xmlns="http://www.w3.org/1999/xhtml" style="width:${width}px;height:${height}px;overflow:hidden;">`,
198134
+ clone3.outerHTML,
198135
+ "</div>",
198136
+ "</foreignObject>"
198137
+ ].join("");
198138
+ return { bodyMarkup, allEmbedded, naturalWidth: width, naturalHeight: height };
198139
+ }
198140
+ function wrapForeignObjectSvg(bodyMarkup, tile) {
198141
+ const { viewBoxX, viewBoxY, viewBoxWidth, viewBoxHeight, outputWidth, outputHeight } = tile;
198142
+ return `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="${outputWidth}" height="${outputHeight}" viewBox="${viewBoxX} ${viewBoxY} ${viewBoxWidth} ${viewBoxHeight}">${bodyMarkup}</svg>`;
198143
+ }
195639
198144
  var FALLBACK_DOWNLOAD_NAME = "presentation.pptx";
195640
198145
  var REVOKE_DELAY_MS = 200;
195641
198146
  var OPEN_REVOKE_DELAY_MS = 6e4;
@@ -195898,11 +198403,11 @@ function lzwEncode(indexed, minCodeSize) {
195898
198403
  let codeSize = minCodeSize + 1;
195899
198404
  let nextCode = eoiCode + 1;
195900
198405
  const maxTableSize = 4096;
195901
- const table = /* @__PURE__ */ new Map();
198406
+ const table2 = /* @__PURE__ */ new Map();
195902
198407
  const initTable = () => {
195903
- table.clear();
198408
+ table2.clear();
195904
198409
  for (let i2 = 0; i2 < clearCode; i2++) {
195905
- table.set(String(i2), i2);
198410
+ table2.set(String(i2), i2);
195906
198411
  }
195907
198412
  codeSize = minCodeSize + 1;
195908
198413
  nextCode = eoiCode + 1;
@@ -195923,15 +198428,15 @@ function lzwEncode(indexed, minCodeSize) {
195923
198428
  let current = String(indexed[0]);
195924
198429
  for (let i2 = 1; i2 < indexed.length; i2++) {
195925
198430
  const next = `${current},${String(indexed[i2])}`;
195926
- if (table.has(next)) {
198431
+ if (table2.has(next)) {
195927
198432
  current = next;
195928
198433
  } else {
195929
- const currentCode = table.get(current);
198434
+ const currentCode = table2.get(current);
195930
198435
  if (currentCode !== void 0) {
195931
198436
  writeBits(currentCode, codeSize);
195932
198437
  }
195933
198438
  if (nextCode < maxTableSize) {
195934
- table.set(next, nextCode++);
198439
+ table2.set(next, nextCode++);
195935
198440
  if (nextCode > 1 << codeSize && codeSize < 12) {
195936
198441
  codeSize++;
195937
198442
  }
@@ -195942,7 +198447,7 @@ function lzwEncode(indexed, minCodeSize) {
195942
198447
  current = String(indexed[i2]);
195943
198448
  }
195944
198449
  }
195945
- const finalCode = table.get(current);
198450
+ const finalCode = table2.get(current);
195946
198451
  if (finalCode !== void 0) {
195947
198452
  writeBits(finalCode, codeSize);
195948
198453
  }
@@ -196909,13 +199414,13 @@ async function normalizeColorsForCapture(doc, clonedEl) {
196909
199414
  resolveRootCustomProperties(doc);
196910
199415
  resolveUnsupportedColours(clonedEl);
196911
199416
  }
196912
- function buildSlidesPdfBytes(images) {
196913
- const PAGE_W = 842;
196914
- const PAGE_H = 595;
199417
+ var PDF_SLIDES_PAGE_WIDTH_PT = 842;
199418
+ var PDF_SLIDES_PAGE_HEIGHT_PT = 595;
199419
+ function buildTiledSlidesPdfBytes(pages) {
199420
+ const PAGE_W = PDF_SLIDES_PAGE_WIDTH_PT;
199421
+ const PAGE_H = PDF_SLIDES_PAGE_HEIGHT_PT;
196915
199422
  const offsets = [];
196916
199423
  let pos2 = 0;
196917
- const objCount = 2 + images.length * 3;
196918
- const pageObjIds = [];
196919
199424
  const segments = [];
196920
199425
  const emitStr = (s) => {
196921
199426
  segments.push(s);
@@ -196931,33 +199436,42 @@ function buildSlidesPdfBytes(images) {
196931
199436
  emitStr("%PDF-1.4\n%\xE2\xE3\xCF\xD3\n");
196932
199437
  markObj();
196933
199438
  emitStr("1 0 obj\n<< /Type /Catalog /Pages 2 0 R >>\nendobj\n");
196934
- for (let i2 = 0; i2 < images.length; i2++) {
196935
- const img = images[i2];
196936
- const imgObjId = 3 + i2 * 3;
196937
- const pageObjId = 3 + i2 * 3 + 1;
196938
- const contObjId = 3 + i2 * 3 + 2;
199439
+ let nextObjId = 3;
199440
+ const pageObjIds = [];
199441
+ for (const pageImages of pages) {
199442
+ const imgObjIds = [];
199443
+ for (let i2 = 0; i2 < pageImages.length; i2++) {
199444
+ imgObjIds.push(nextObjId);
199445
+ nextObjId++;
199446
+ }
199447
+ const pageObjId = nextObjId++;
199448
+ const contObjId = nextObjId++;
196939
199449
  pageObjIds.push(pageObjId);
196940
- const scale2 = Math.min(PAGE_W / img.w, PAGE_H / img.h);
196941
- const dw = img.w * scale2;
196942
- const dh = img.h * scale2;
196943
- const dx = (PAGE_W - dw) / 2;
196944
- const dy = (PAGE_H - dh) / 2;
196945
- markObj();
196946
- const imgHeader = `${imgObjId} 0 obj
196947
- << /Type /XObject /Subtype /Image /Width ${img.w} /Height ${img.h} /ColorSpace /DeviceRGB /BitsPerComponent 8 /Filter /DCTDecode /Length ${img.bytes.length} >>
199450
+ for (let idx = 0; idx < pageImages.length; idx++) {
199451
+ markObj();
199452
+ const { image } = pageImages[idx];
199453
+ emitStr(
199454
+ `${imgObjIds[idx]} 0 obj
199455
+ << /Type /XObject /Subtype /Image /Width ${image.w} /Height ${image.h} /ColorSpace /DeviceRGB /BitsPerComponent 8 /Filter /DCTDecode /Length ${image.bytes.length} >>
196948
199456
  stream
196949
- `;
196950
- emitStr(imgHeader);
196951
- emitBin(img.bytes);
196952
- emitStr("\nendstream\nendobj\n");
199457
+ `
199458
+ );
199459
+ emitBin(image.bytes);
199460
+ emitStr("\nendstream\nendobj\n");
199461
+ }
196953
199462
  markObj();
199463
+ const xobjectDict = pageImages.map((_, idx) => `/Img${idx} ${imgObjIds[idx]} 0 R`).join(" ");
196954
199464
  emitStr(
196955
199465
  `${pageObjId} 0 obj
196956
- << /Type /Page /Parent 2 0 R /MediaBox [0 0 ${PAGE_W} ${PAGE_H}] /Contents ${contObjId} 0 R /Resources << /XObject << /Img${i2} ${imgObjId} 0 R >> >> >>
199466
+ << /Type /Page /Parent 2 0 R /MediaBox [0 0 ${PAGE_W} ${PAGE_H}] /Contents ${contObjId} 0 R /Resources << /XObject << ${xobjectDict} >> >> >>
196957
199467
  endobj
196958
199468
  `
196959
199469
  );
196960
- const contentStream = `q ${dw.toFixed(2)} 0 0 ${dh.toFixed(2)} ${dx.toFixed(2)} ${dy.toFixed(2)} cm /Img${i2} Do Q`;
199470
+ const contentStream = pageImages.map((entry2, idx) => {
199471
+ const { x, y, width, height } = entry2.placement;
199472
+ const rawY = PAGE_H - y - height;
199473
+ return `q ${width.toFixed(2)} 0 0 ${height.toFixed(2)} ${x.toFixed(2)} ${rawY.toFixed(2)} cm /Img${idx} Do Q`;
199474
+ }).join(" ");
196961
199475
  markObj();
196962
199476
  emitStr(
196963
199477
  `${contObjId} 0 obj
@@ -196972,9 +199486,10 @@ endobj
196972
199486
  const pagesKids = pageObjIds.map((id) => `${id} 0 R`).join(" ");
196973
199487
  offsets.splice(1, 0, pos2);
196974
199488
  emitStr(`2 0 obj
196975
- << /Type /Pages /Kids [${pagesKids}] /Count ${images.length} >>
199489
+ << /Type /Pages /Kids [${pagesKids}] /Count ${pages.length} >>
196976
199490
  endobj
196977
199491
  `);
199492
+ const objCount = nextObjId - 1;
196978
199493
  const xrefPos = pos2;
196979
199494
  const totalObjs = objCount + 1;
196980
199495
  emitStr(`xref
@@ -197428,6 +199943,531 @@ function segmentFrameCount(durationMs, fps) {
197428
199943
  }
197429
199944
  return Math.max(1, Math.ceil(durationMs / (1e3 / fps)));
197430
199945
  }
199946
+ var table;
199947
+ function getTable() {
199948
+ if (table) {
199949
+ return table;
199950
+ }
199951
+ const t = new Uint32Array(256);
199952
+ for (let n = 0; n < 256; n++) {
199953
+ let c = n;
199954
+ for (let k = 0; k < 8; k++) {
199955
+ c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
199956
+ }
199957
+ t[n] = c >>> 0;
199958
+ }
199959
+ table = t;
199960
+ return t;
199961
+ }
199962
+ function crc322(bytes) {
199963
+ const t = getTable();
199964
+ let crc = 4294967295;
199965
+ for (let i2 = 0; i2 < bytes.length; i2++) {
199966
+ crc = t[(crc ^ bytes[i2]) & 255] ^ crc >>> 8;
199967
+ }
199968
+ return (crc ^ 4294967295) >>> 0;
199969
+ }
199970
+ var PNG_SIGNATURE3 = new Uint8Array([137, 80, 78, 71, 13, 10, 26, 10]);
199971
+ function u32be(value) {
199972
+ return new Uint8Array([
199973
+ value >>> 24 & 255,
199974
+ value >>> 16 & 255,
199975
+ value >>> 8 & 255,
199976
+ value & 255
199977
+ ]);
199978
+ }
199979
+ function asciiBytes(type) {
199980
+ const out = new Uint8Array(type.length);
199981
+ for (let i2 = 0; i2 < type.length; i2++) {
199982
+ out[i2] = type.charCodeAt(i2);
199983
+ }
199984
+ return out;
199985
+ }
199986
+ function concatBytes2(parts) {
199987
+ const total = parts.reduce((sum, p) => sum + p.length, 0);
199988
+ const out = new Uint8Array(total);
199989
+ let offset = 0;
199990
+ for (const part of parts) {
199991
+ out.set(part, offset);
199992
+ offset += part.length;
199993
+ }
199994
+ return out;
199995
+ }
199996
+ function buildPngChunk(type, data) {
199997
+ const typeBytes = asciiBytes(type);
199998
+ const crc = crc322(concatBytes2([typeBytes, data]));
199999
+ return concatBytes2([u32be(data.length), typeBytes, data, u32be(crc)]);
200000
+ }
200001
+ var PNG_COLOR_TYPE_RGBA = 6;
200002
+ function buildIhdrChunk(width, height) {
200003
+ const data = new Uint8Array(13);
200004
+ data.set(u32be(width), 0);
200005
+ data.set(u32be(height), 4);
200006
+ data[8] = 8;
200007
+ data[9] = PNG_COLOR_TYPE_RGBA;
200008
+ data[10] = 0;
200009
+ data[11] = 0;
200010
+ data[12] = 0;
200011
+ return buildPngChunk("IHDR", data);
200012
+ }
200013
+ function buildIendChunk() {
200014
+ return buildPngChunk("IEND", new Uint8Array(0));
200015
+ }
200016
+ function assemblePng(width, height, idatChunks) {
200017
+ return concatBytes2([
200018
+ PNG_SIGNATURE3,
200019
+ buildIhdrChunk(width, height),
200020
+ ...idatChunks,
200021
+ buildIendChunk()
200022
+ ]);
200023
+ }
200024
+ function buildIdatChunk(zlibBytes) {
200025
+ return buildPngChunk("IDAT", zlibBytes);
200026
+ }
200027
+ var RGBA_BYTES_PER_PIXEL = 4;
200028
+ function filterPixelBlock(pixels, width, height) {
200029
+ const rowBytes = width * RGBA_BYTES_PER_PIXEL;
200030
+ if (pixels.length !== rowBytes * height) {
200031
+ throw new Error(
200032
+ `filterPixelBlock: expected ${rowBytes * height} bytes for ${width}x${height} RGBA, got ${pixels.length}`
200033
+ );
200034
+ }
200035
+ const out = new Uint8Array((rowBytes + 1) * height);
200036
+ for (let row = 0; row < height; row++) {
200037
+ const srcStart = row * rowBytes;
200038
+ out[row * (rowBytes + 1)] = 0;
200039
+ out.set(pixels.subarray(srcStart, srcStart + rowBytes), row * (rowBytes + 1) + 1);
200040
+ }
200041
+ return out;
200042
+ }
200043
+ async function concatChunks(parts) {
200044
+ const total = parts.reduce((sum, p) => sum + p.length, 0);
200045
+ const out = new Uint8Array(total);
200046
+ let offset = 0;
200047
+ for (const part of parts) {
200048
+ out.set(part, offset);
200049
+ offset += part.length;
200050
+ }
200051
+ return out;
200052
+ }
200053
+ async function deflateBlocks(blocks) {
200054
+ const cs = new CompressionStream("deflate");
200055
+ const writer = cs.writable.getWriter();
200056
+ const reader = cs.readable.getReader();
200057
+ const outChunks = [];
200058
+ const readLoop = (async () => {
200059
+ for (; ; ) {
200060
+ const { value, done } = await reader.read();
200061
+ if (done) {
200062
+ break;
200063
+ }
200064
+ outChunks.push(value);
200065
+ }
200066
+ })();
200067
+ for await (const block of blocks) {
200068
+ await writer.write(new Uint8Array(block));
200069
+ }
200070
+ await writer.close();
200071
+ await readLoop;
200072
+ return concatChunks(outChunks);
200073
+ }
200074
+ async function encodePngFromRowBands(width, height, rowBands) {
200075
+ let coveredRows = 0;
200076
+ async function* filteredBlocks() {
200077
+ for await (const band of rowBands) {
200078
+ coveredRows += band.bandHeight;
200079
+ yield filterPixelBlock(band.pixels, width, band.bandHeight);
200080
+ }
200081
+ }
200082
+ const zlibBytes = await deflateBlocks(filteredBlocks());
200083
+ if (coveredRows !== height) {
200084
+ throw new Error(
200085
+ `encodePngFromRowBands: row-bands covered ${coveredRows} rows, expected ${height}`
200086
+ );
200087
+ }
200088
+ return assemblePng(width, height, [buildIdatChunk(zlibBytes)]);
200089
+ }
200090
+ var ForeignObjectRasterError = class extends Error {
200091
+ constructor(message, cause) {
200092
+ super(message);
200093
+ this.cause = cause;
200094
+ this.name = "ForeignObjectRasterError";
200095
+ }
200096
+ cause;
200097
+ };
200098
+ function loadImage(src) {
200099
+ return new Promise((resolve2, reject) => {
200100
+ const img = new Image();
200101
+ img.onload = () => resolve2(img);
200102
+ img.onerror = (event) => reject(new ForeignObjectRasterError("SVG image failed to load", event));
200103
+ img.src = src;
200104
+ });
200105
+ }
200106
+ var FOREIGN_OBJECT_SVG_DATA_URL_PREFIX = "data:image/svg+xml;charset=utf-8,";
200107
+ function foreignObjectSvgToDataUrl(svg) {
200108
+ return `${FOREIGN_OBJECT_SVG_DATA_URL_PREFIX}${encodeURIComponent(svg)}`;
200109
+ }
200110
+ async function rasterizeForeignObjectSvg(svg, outputWidth, outputHeight, backgroundColor) {
200111
+ const img = await loadImage(foreignObjectSvgToDataUrl(svg));
200112
+ const canvas = document.createElement("canvas");
200113
+ canvas.width = outputWidth;
200114
+ canvas.height = outputHeight;
200115
+ const ctx = canvas.getContext("2d");
200116
+ if (!ctx) {
200117
+ throw new ForeignObjectRasterError("2D canvas context unavailable");
200118
+ }
200119
+ if (backgroundColor) {
200120
+ ctx.fillStyle = backgroundColor;
200121
+ ctx.fillRect(0, 0, outputWidth, outputHeight);
200122
+ }
200123
+ ctx.drawImage(img, 0, 0, outputWidth, outputHeight);
200124
+ try {
200125
+ ctx.getImageData(0, 0, 1, 1);
200126
+ } catch (cause) {
200127
+ throw new ForeignObjectRasterError(
200128
+ "Canvas tainted by an un-embedded cross-origin resource",
200129
+ cause
200130
+ );
200131
+ }
200132
+ return canvas;
200133
+ }
200134
+ var CANVAS_DIMENSION_CANDIDATES = [
200135
+ 16384,
200136
+ 14188,
200137
+ 11180,
200138
+ 8192,
200139
+ 4096,
200140
+ 2048
200141
+ ];
200142
+ var MARKER = { r: 17, g: 187, b: 221, a: 255 };
200143
+ function canvasReportsMarker(factory, dim) {
200144
+ try {
200145
+ const canvas = factory(dim, 1);
200146
+ const ctx = canvas.getContext("2d");
200147
+ if (!ctx) {
200148
+ return { ok: false, probeFailed: true };
200149
+ }
200150
+ ctx.fillStyle = `rgba(${MARKER.r},${MARKER.g},${MARKER.b},1)`;
200151
+ ctx.fillRect(dim - 1, 0, 1, 1);
200152
+ const pixel = ctx.getImageData(dim - 1, 0, 1, 1).data;
200153
+ const ok = pixel[0] === MARKER.r && pixel[1] === MARKER.g && pixel[2] === MARKER.b;
200154
+ return { ok, probeFailed: false };
200155
+ } catch {
200156
+ return { ok: false, probeFailed: false };
200157
+ }
200158
+ }
200159
+ function probeMaxCanvasDimension(factory = (w, h2) => {
200160
+ const el = document.createElement("canvas");
200161
+ el.width = w;
200162
+ el.height = h2;
200163
+ return el;
200164
+ }) {
200165
+ for (const dim of CANVAS_DIMENSION_CANDIDATES) {
200166
+ const { ok, probeFailed } = canvasReportsMarker(factory, dim);
200167
+ if (ok) {
200168
+ return dim;
200169
+ }
200170
+ if (probeFailed) {
200171
+ break;
200172
+ }
200173
+ }
200174
+ return CANVAS_DIMENSION_CANDIDATES[CANVAS_DIMENSION_CANDIDATES.length - 1];
200175
+ }
200176
+ function ensureExactSize(canvas, outputSize) {
200177
+ if (canvas.width === outputSize.width && canvas.height === outputSize.height) {
200178
+ return canvas;
200179
+ }
200180
+ const exact = document.createElement("canvas");
200181
+ exact.width = outputSize.width;
200182
+ exact.height = outputSize.height;
200183
+ const ctx = exact.getContext("2d");
200184
+ if (!ctx) {
200185
+ return canvas;
200186
+ }
200187
+ ctx.drawImage(
200188
+ canvas,
200189
+ 0,
200190
+ 0,
200191
+ canvas.width,
200192
+ canvas.height,
200193
+ 0,
200194
+ 0,
200195
+ outputSize.width,
200196
+ outputSize.height
200197
+ );
200198
+ return exact;
200199
+ }
200200
+ async function rasterizeWindow(body, sourceRect, outputSize, backgroundColor, options) {
200201
+ const { mode = "auto", vectorSvgFallback, html2canvasFallback, onStrategyFailed } = options;
200202
+ if (mode !== "html2canvas" && body && body.allEmbedded) {
200203
+ try {
200204
+ const svg = wrapForeignObjectSvg(body.bodyMarkup, {
200205
+ viewBoxX: sourceRect.x,
200206
+ viewBoxY: sourceRect.y,
200207
+ viewBoxWidth: sourceRect.width,
200208
+ viewBoxHeight: sourceRect.height,
200209
+ outputWidth: outputSize.width,
200210
+ outputHeight: outputSize.height
200211
+ });
200212
+ const canvas2 = await rasterizeForeignObjectSvg(
200213
+ svg,
200214
+ outputSize.width,
200215
+ outputSize.height,
200216
+ backgroundColor
200217
+ );
200218
+ return { canvas: ensureExactSize(canvas2, outputSize), strategy: "foreignObject" };
200219
+ } catch (error) {
200220
+ onStrategyFailed?.(
200221
+ "foreignObject",
200222
+ error instanceof ForeignObjectRasterError ? error : error
200223
+ );
200224
+ }
200225
+ }
200226
+ if (mode !== "html2canvas" && vectorSvgFallback) {
200227
+ try {
200228
+ const canvas2 = await vectorSvgFallback(sourceRect, outputSize);
200229
+ return { canvas: ensureExactSize(canvas2, outputSize), strategy: "vectorSvg" };
200230
+ } catch (error) {
200231
+ onStrategyFailed?.("vectorSvg", error);
200232
+ }
200233
+ }
200234
+ const canvas = await html2canvasFallback(sourceRect, outputSize);
200235
+ return { canvas: ensureExactSize(canvas, outputSize), strategy: "html2canvas" };
200236
+ }
200237
+ var RASTER_STRATEGY_FALLBACK_WARNING = "[pptx-viewer] raster export:";
200238
+ function warnStrategyFailed(strategy, error) {
200239
+ const detail = error instanceof Error ? error.message : String(error);
200240
+ console.warn(
200241
+ `${RASTER_STRATEGY_FALLBACK_WARNING} ${strategy} strategy failed, falling back to the next one (${detail})`
200242
+ );
200243
+ }
200244
+ async function rasterizeElementTiles(element, naturalWidth, naturalHeight, doc, options) {
200245
+ const scale2 = options.scale && options.scale > 0 ? options.scale : 1;
200246
+ const maxDim = options.maxCanvasDim ?? probeMaxCanvasDimension();
200247
+ const plan = computeExportTilePlan(naturalWidth * scale2, naturalHeight * scale2, maxDim);
200248
+ const body = options.mode === "html2canvas" ? void 0 : await buildForeignObjectSvgBody(
200249
+ element,
200250
+ doc,
200251
+ {
200252
+ width: naturalWidth,
200253
+ height: naturalHeight,
200254
+ backgroundColor: options.backgroundColor
200255
+ }
200256
+ );
200257
+ const strategyOptions = {
200258
+ mode: options.mode,
200259
+ vectorSvgFallback: options.vectorSvgFallback,
200260
+ html2canvasFallback: options.html2canvasFallback,
200261
+ onStrategyFailed: options.onStrategyFailed ?? warnStrategyFailed
200262
+ };
200263
+ const tiles = [];
200264
+ let done = 0;
200265
+ for (const tile of plan.tiles) {
200266
+ const { canvas, strategy } = await rasterizeWindow(
200267
+ body,
200268
+ tileRectToSourceRect(tile, scale2),
200269
+ { width: tile.width, height: tile.height },
200270
+ options.backgroundColor,
200271
+ strategyOptions
200272
+ );
200273
+ tiles.push({
200274
+ col: tile.col,
200275
+ row: tile.row,
200276
+ x: tile.x,
200277
+ y: tile.y,
200278
+ width: tile.width,
200279
+ height: tile.height,
200280
+ canvas,
200281
+ strategy
200282
+ });
200283
+ done++;
200284
+ options.onTileProgress?.(done, plan.tiles.length);
200285
+ }
200286
+ return { fullWidth: plan.fullWidth, fullHeight: plan.fullHeight, tiled: plan.tiled, tiles };
200287
+ }
200288
+ function combineTileRowPixels(tiles, fullWidth) {
200289
+ if (tiles.length === 0) {
200290
+ throw new Error("combineTileRowPixels: at least one tile is required");
200291
+ }
200292
+ const bandHeight = tiles[0].height;
200293
+ const totalWidth = tiles.reduce((sum, t) => sum + t.width, 0);
200294
+ if (totalWidth !== fullWidth) {
200295
+ throw new Error(
200296
+ `combineTileRowPixels: tile widths sum to ${totalWidth}, expected ${fullWidth}`
200297
+ );
200298
+ }
200299
+ for (const tile of tiles) {
200300
+ if (tile.height !== bandHeight) {
200301
+ throw new Error("combineTileRowPixels: every tile in a row must share the same height");
200302
+ }
200303
+ }
200304
+ const out = new Uint8Array(fullWidth * 4 * bandHeight);
200305
+ for (let y = 0; y < bandHeight; y++) {
200306
+ let xOffset = 0;
200307
+ for (const tile of tiles) {
200308
+ const rowBytes = tile.width * 4;
200309
+ const srcStart = y * rowBytes;
200310
+ const destStart = y * fullWidth * 4 + xOffset * 4;
200311
+ out.set(tile.pixels.subarray(srcStart, srcStart + rowBytes), destStart);
200312
+ xOffset += tile.width;
200313
+ }
200314
+ }
200315
+ return out;
200316
+ }
200317
+ function groupTilesByRow(tiles) {
200318
+ const rowCount = tiles.reduce((max, t) => Math.max(max, t.row), 0) + 1;
200319
+ const rows = Array.from({ length: rowCount }, () => []);
200320
+ for (const tile of tiles) {
200321
+ rows[tile.row][tile.col] = tile;
200322
+ }
200323
+ return rows;
200324
+ }
200325
+ async function stitchTilesToPng(fullWidth, fullHeight, tiles) {
200326
+ const rows = groupTilesByRow(tiles);
200327
+ async function* rowBands() {
200328
+ for (const rowTiles of rows) {
200329
+ const pixelTiles = rowTiles.map((tile) => {
200330
+ const ctx = tile.canvas.getContext("2d");
200331
+ if (!ctx) {
200332
+ throw new Error("rasterizeElement: 2D canvas context unavailable while stitching tiles");
200333
+ }
200334
+ return {
200335
+ pixels: ctx.getImageData(0, 0, tile.canvas.width, tile.canvas.height).data,
200336
+ width: tile.canvas.width,
200337
+ height: tile.canvas.height
200338
+ };
200339
+ });
200340
+ yield {
200341
+ pixels: combineTileRowPixels(pixelTiles, fullWidth),
200342
+ bandHeight: pixelTiles[0].height
200343
+ };
200344
+ }
200345
+ }
200346
+ return encodePngFromRowBands(fullWidth, fullHeight, rowBands());
200347
+ }
200348
+ async function rasterizeElement(element, naturalWidth, naturalHeight, doc, options) {
200349
+ const { fullWidth, fullHeight, tiled, tiles } = await rasterizeElementTiles(
200350
+ element,
200351
+ naturalWidth,
200352
+ naturalHeight,
200353
+ doc,
200354
+ options
200355
+ );
200356
+ if (!tiled) {
200357
+ const only = tiles[0];
200358
+ return {
200359
+ kind: "canvas",
200360
+ canvas: only.canvas,
200361
+ strategy: only.strategy,
200362
+ width: only.width,
200363
+ height: only.height
200364
+ };
200365
+ }
200366
+ const bytes = await stitchTilesToPng(fullWidth, fullHeight, tiles);
200367
+ return {
200368
+ kind: "png-bytes",
200369
+ bytes,
200370
+ width: fullWidth,
200371
+ height: fullHeight,
200372
+ strategies: tiles.map((t) => t.strategy)
200373
+ };
200374
+ }
200375
+ function placeTileOnPage(tile, fullWidth, fullHeight, pageWidth, pageHeight) {
200376
+ const fitScale = fullWidth > 0 && fullHeight > 0 ? Math.min(pageWidth / fullWidth, pageHeight / fullHeight) : 0;
200377
+ const fittedWidth = fullWidth * fitScale;
200378
+ const fittedHeight = fullHeight * fitScale;
200379
+ const offsetX = (pageWidth - fittedWidth) / 2;
200380
+ const offsetY = (pageHeight - fittedHeight) / 2;
200381
+ return {
200382
+ x: offsetX + tile.x * fitScale,
200383
+ y: offsetY + tile.y * fitScale,
200384
+ width: tile.width * fitScale,
200385
+ height: tile.height * fitScale
200386
+ };
200387
+ }
200388
+ var CANVAS_DIMENSION_CANDIDATES2 = [
200389
+ 16384,
200390
+ 14188,
200391
+ 11180,
200392
+ 8192,
200393
+ 4096,
200394
+ 2048
200395
+ ];
200396
+ var MARKER2 = { r: 17, g: 187, b: 221, a: 255 };
200397
+ function canvasReportsMarker2(factory, dim) {
200398
+ try {
200399
+ const canvas = factory(dim, 1);
200400
+ const ctx = canvas.getContext("2d");
200401
+ if (!ctx) {
200402
+ return { ok: false, probeFailed: true };
200403
+ }
200404
+ ctx.fillStyle = `rgba(${MARKER2.r},${MARKER2.g},${MARKER2.b},1)`;
200405
+ ctx.fillRect(dim - 1, 0, 1, 1);
200406
+ const pixel = ctx.getImageData(dim - 1, 0, 1, 1).data;
200407
+ const ok = pixel[0] === MARKER2.r && pixel[1] === MARKER2.g && pixel[2] === MARKER2.b;
200408
+ return { ok, probeFailed: false };
200409
+ } catch {
200410
+ return { ok: false, probeFailed: false };
200411
+ }
200412
+ }
200413
+ function probeMaxCanvasDimension2(factory = (w, h2) => {
200414
+ const el = document.createElement("canvas");
200415
+ el.width = w;
200416
+ el.height = h2;
200417
+ return el;
200418
+ }) {
200419
+ for (const dim of CANVAS_DIMENSION_CANDIDATES2) {
200420
+ const { ok, probeFailed } = canvasReportsMarker2(factory, dim);
200421
+ if (ok) {
200422
+ return dim;
200423
+ }
200424
+ if (probeFailed) {
200425
+ break;
200426
+ }
200427
+ }
200428
+ return CANVAS_DIMENSION_CANDIDATES2[CANVAS_DIMENSION_CANDIDATES2.length - 1];
200429
+ }
200430
+ var cachedMaxDim2;
200431
+ function getMaxCanvasDimension2(factory) {
200432
+ if (cachedMaxDim2 === void 0) {
200433
+ cachedMaxDim2 = probeMaxCanvasDimension2(factory);
200434
+ }
200435
+ return cachedMaxDim2;
200436
+ }
200437
+ async function rasterizeElementClampedToCanvas(element, naturalWidth, naturalHeight, doc, options) {
200438
+ const requestedScale = options.scale && options.scale > 0 ? options.scale : 1;
200439
+ const maxDim = options.maxCanvasDim ?? getMaxCanvasDimension2();
200440
+ const fullWidth = naturalWidth * requestedScale;
200441
+ const fullHeight = naturalHeight * requestedScale;
200442
+ const largestEdge = Math.max(fullWidth, fullHeight);
200443
+ const clampFactor = largestEdge > maxDim ? maxDim / largestEdge : 1;
200444
+ const effectiveScale = requestedScale * clampFactor;
200445
+ const result = await rasterizeElement(element, naturalWidth, naturalHeight, doc, {
200446
+ ...options,
200447
+ scale: effectiveScale,
200448
+ maxCanvasDim: maxDim
200449
+ });
200450
+ if (result.kind !== "canvas") {
200451
+ throw new Error(
200452
+ "rasterizeElementClampedToCanvas: rasterizeElement still tiled after clamping the scale"
200453
+ );
200454
+ }
200455
+ return { ...result, clamped: clampFactor < 1, effectiveScale };
200456
+ }
200457
+ async function rasterResultToPngBlob(result) {
200458
+ if (result.kind === "png-bytes") {
200459
+ return new Blob([result.bytes.slice()], { type: "image/png" });
200460
+ }
200461
+ return new Promise((resolve2, reject) => {
200462
+ result.canvas.toBlob((blob) => {
200463
+ if (blob) {
200464
+ resolve2(blob);
200465
+ } else {
200466
+ reject(new Error("Canvas toBlob returned null"));
200467
+ }
200468
+ }, "image/png");
200469
+ });
200470
+ }
197431
200471
  // `@preserve` (CT_SlideMaster, ECMA-376 §19.3.1.38): mirrors the
197432
200472
  /**
197433
200473
  * @fileoverview Save-side writer for slide-master parts (`p:sldMaster`).
@@ -197480,4 +200520,4 @@ function segmentFrameCount(durationMs, fps) {
197480
200520
  * `<p:extLst>` (optional)
197481
200521
  */
197482
200522
 
197483
- export { ACTION_BUTTON_PRESETS, ACTION_INDICATOR_CLASS, ACTION_INDICATOR_ICON_PATH, ARTISTIC_EFFECTS, AVATAR_COLOR_SWATCHES, BACKSTAGE_NAV, BACKSTAGE_TEMPLATES, BAR3D_SHAPE_OPTIONS, BEVEL_PRESETS, BROADCAST_THROTTLE_MS, CATEGORIES, CHARACTER_SPACING_OPTIONS, CHART_TYPE_OPTIONS, COLOR_MAP_ALIAS_KEYS, COMMENT_MARKER_SIZE, COMMENT_MENTION_ATTRIBUTE, COMMENT_MENTION_CLASS, COMMON_FONTS, COMMON_FONT_SIZES, COMPOUND_LINE_OPTIONS, CONNECTION_TIMEOUT_MS, CONNECTOR_SITE_SNAP_PX, CUSTOM_FONT_ACCEPT, DEBOUNCE_MS, DEFAULT_BROADCAST_SERVER_URL, DEFAULT_COLOR_CHANGE_TOLERANCE, DEFAULT_COLOR_MAP, DEFAULT_FONT_FAMILY2 as DEFAULT_FONT_FAMILY, DEFAULT_INSERT_CHART_KIND, DEFAULT_MOTION_PATH_PRESET_ID, DEFAULT_PALETTE2, DEFAULT_QUICK_ACCESS_COMMAND_IDS, DEFAULT_ROW_HEIGHT, DEFAULT_VIEWER_OPTIONS, DEFAULT_VIEWER_PREFERENCES, DEFAULT_VIEWER_PROFILE, DEFAULT_VIRTUAL_OVERSCAN, DIRECTIONAL_PRESETS, DUOTONE_PRESETS, EFFECT_SOUND_CATALOGUE, ELEMENT_ACTION_TYPE_OPTIONS, EMPHASIS_PRESET_VALUES, ENTRANCE_PRESET_VALUES, EQUATION_TEMPLATES, EXIT_PRESET_VALUES, EXPANDED_MAX_HEIGHT, EXPORT_ASSEMBLING_PERCENT, EXPORT_DONE_PERCENT, EncryptedFileError, FILL_MODE_OPTIONS, FILL_PATTERN_LABEL_KEYS, GRADIENT_TYPE_OPTIONS, HANDOUT_OPTIONS, HIDDEN_SLIDE_LABEL_KEY, HIDDEN_SLIDE_SLASH_GRADIENT, HIGHLIGHTER_COLORS, INDENT_PX, INK_REPLAY_KEYFRAMES, INSERT_CHART_TYPES, LBL, LINE_CAP_OPTIONS, LINE_JOIN_OPTIONS, LINK_TOOLTIP_CLASS, LINK_TOOLTIP_HINT_CLASS, LINK_TOOLTIP_HOST_CLASS, LINK_TOOLTIP_LABEL_CLASS, LINK_TOOLTIP_PANEL_CLASS, LOCAL_SYNC_ORIGIN, MATERIAL_PRESETS, MAX_INDENT_LEVEL, MAX_ZOOM_SCALE, MEDIA_CHROME_ATTRIBUTE, MIN_ZOOM_SCALE, MOBILE_BREAKPOINT, MORPH_CROSSFADE_GROUP_STYLE, MORPH_CROSSFADE_HALF_STYLE, MOTION_PATH_FAMILIES, NOTES_FONT_SIZE_DEFAULT, NOTES_FONT_SIZE_MAX, NOTES_FONT_SIZE_MIN, NOTES_FONT_SIZE_STEP, NUM, OFFICE_COLOR_SWATCHES, OUTLINE_LEVEL_ATTR, OUTLINE_ROW_ATTR, OUTLINE_SLIDE_ATTR, OUTLINE_VIEW_ATTR, PATTERN_OPTIONS, PATTERN_PRESET_OPTIONS, PEN_COLORS, PPTX_OPEN_ACCEPT, PRESENTATION_CHANNEL_NAME, PRESENTATION_HASH, PRESENTATION_HIT_TEST_CSS, PRESENTATION_MESSAGE_ORIGIN, PRESENTATION_NONCE_KEY, PRESENTATION_OPEN_EXTENSIONS, PRESENTATION_STAGE_ATTRIBUTE, PRESENTER_CONSOLE_CLASSES, PRESENTER_CONSOLE_CONTROLS, PRESENTER_NAVIGATOR_LABEL_KEYS, PRESENT_TOOLBAR_CLASSES, PRESETS, PRESET_THEMES, PptxHandler, PptxMarkdownConverter, PresentationAnimationController, QUICK_ACCESS_COMMAND_CATALOG, RADAR_STYLE_OPTIONS, READING_VIEW_ATTR, READING_VIEW_COUNTER_ATTR, READING_VIEW_STAGE_ATTR, RIBBON_SHAPE_SWATCHES, RIBBON_TRANSITION_PRESETS, RULER_FONT_SIZE, RULER_THICKNESS, SECTION_HEADING, SEL, SHAPE_PRESET_DEFS, SHAPE_QUICK_STYLES, SHORTCUT_REFERENCE_ITEMS, SLIDE_SHOW_OPTIONS, SLIDE_SIZE_PRESETS, SLIDE_TEMPLATES, SLIDE_TRANSITION_KEYFRAMES, SLIDE_TRANSITION_OPTIONS, SLIDE_VIRTUALIZATION_THRESHOLD, SMARTART_COLOR_SCHEME_LABEL_KEYS, SMARTART_PREVIEW_ELEMENT_HEIGHT, SMARTART_PREVIEW_ELEMENT_WIDTH, SMARTART_STYLE_LABEL_KEYS, SORTER_MAX_ZOOM, SORTER_MIN_ZOOM, SORTER_ZOOM_STEP, STATUS_BAR_CLASSES, STROKE_DASH_OPTIONS2 as STROKE_DASH_OPTIONS, SURFACE_WIREFRAME_OPTIONS, SWITCHABLE_LAYOUT_TYPES, SvgExporter, TABLET_BREAKPOINT, TABLE_STYLE_BORDER_SIDES, TABLE_STYLE_BORDER_SIDE_LABEL_KEYS, TABLE_STYLE_DASH_PRESETS, TABLE_STYLE_EDITOR_PARTS, TABLE_STYLE_PRESETS, TAB_ROW_ACTION_CLASSES, TEXT_BUILD_ID_SEP, TEXT_WARP_PRESETS, THEME_CATALOG, THEME_COLOR_SCHEME_KEYS, THEME_COLOR_SLOT_LABEL_KEYS, THEME_PRESETS, TITLE_BAR_CLASSES, TITLE_BAR_DEFAULT_FILE_KEY, TOOLBAR_TABS, TRANSITION_DIR_ARROWS, TRANSITION_MORPH_OPTIONS, TRANSITION_ORIENTATION_TYPES, TRANSITION_SOUND_NONE_VALUE, TRANSITION_SOUND_OTHER_VALUE, TRANSITION_SPEED_OPTIONS, TRANSITION_VALID_DIRECTIONS, ThemePresets, VIEWER_OPTIONS_TABS, VIEWER_PREFS_STORAGE_KEY, VIEWER_SHORTCUT_REFERENCE, WEBM_MIME_CANDIDATES, acceptAutosaveRecovery, acceptsPresentationInput, actionAffordanceLabels, activateModalFocus, addChartCategory, addChartSeries, addCommentToList, addQuickAccessCommand, addSection, addSiblingAfter, addSmartArtNodeAsChild, addTableStyleToMap, addTagToCollections, advanceChartMarkDrag, advanceChartValueDrag, advanceMainSequence, alignElements, animationEffectLabel, annotationOverlayZIndex, appendPresentationInkPoint, appendTableElementColumn, appendTableElementRow, apply3dEffects, applyAcceptAllSlides, applyAcceptSlide, applyAnimationTimelineOrder, applyAutoCorrect, applyCaseTransformToSegments, applyChartPartHighlight, applyColorChange, applyDuotone, applyFindReplacements, applyFormatToElement, applyHighlightClickStyle, applyImagePathPatches, applyMasterViewCrudAction, applyMotionPathPreset, applyOleDocumentParagraphEdit, applyOleNestedDeckElementTextEdit, applyOleSheetCellEdit, applyOutlineEdit, applyPreferenceToOptions, applyReadingViewCommand, applyRehearsalTimings, applyReroutedConnectors, applyResize, applyStyleToSelectedSegments, applyTableStyleDelete, applyTableStyleFieldEdit, applyTableStyleMapChange, applyTableStylePreset, applyThemeOverrideToSlide, applyThemeToData, applyTransitionSoundFile, applyTransitionStockSound, attachPresentationVisibilityPause, authorConnectorBetweenSites, autosaveSnapshotMark, availableQuickAccessCommands, backstageCardsFor, bar3DShapePatch, beginChartMarkDrag, beginChartValueDrag, beginShapeAdjustment, bringForward, bringToFront, build3DExtrusionData, buildActiveSessionUsers, buildAnimationTimelineBars, buildAnimationTimelineRows, buildAreaChart3DDataForElement, buildBarActions, buildBarChart3DDataForElement, buildBroadcastViewerUrl, buildCacheKey, buildCalloutLeaderLineSvgPath, buildChartMarkDragGeometry, buildChartViewModel, buildChromeStyle, buildCollaborationShareUrl, buildCommentMarkers, buildContentPartStrokes, buildContextMenuEntries, buildCreateCollaborationConfig, buildCssGradientFromShapeStyle, buildDeckSaveOptions, buildDirectionGrid, buildDuotoneCacheKey, buildElementClipboardPayload, buildFieldSubstitutionContext, buildFontCatalog, buildGlyphEnvelope, buildHandoutsHtml, buildHollowHitOutline, buildInitialGuides, buildInkGroupStrokes, buildInlineTextCommitPatch, buildJoinCollaborationConfig, buildLayoutPreviewGeometry, buildLineChart3DDataForElement, buildLiveInkStrokeView, buildMorphAnimationRules, buildMorphTransitionPlan, buildMotionPathPreview, buildNotesHtml, buildNotesPdfBytes, buildNotesPrintHtml, buildOleContentUpdatePatch, buildOleEditDialogDescriptor, buildOleObjectNamePatch, buildOutline, buildOutlineHtml, buildParagraphs, buildPieChart3DDataForElement, buildPresentationAudienceUrl, buildPreviewAnimation, buildPreviewElements, buildPrintDocument, buildPrintHtmlDocument, buildRectPathGradient, buildRunProgramNotice, buildRunTabLines, buildSaveSlides, buildSlideTemplateContent, buildSlideTemplateSlide, buildSlidesHtml, buildSlidesPdfBytes, buildSmartArt3DModel, buildSmartArtA11y, buildSmartArtPresetData, buildSmartArtPreviewElement, buildStrokeOutline, buildStrokePathD, buildSubpathFillOverlay, buildSubpathPaints, buildSummaryZoomView, buildSurfaceChart3DDataForElement, buildSvgGradientDef, buildTabContext, buildTableDataGrid, buildTextBlockStyle, buildTextBody3DSceneStyle, buildTextBodyLayoutStyle, buildTextBuildSpec, buildTextStyleOverrideCss, buildThemeColorGrid, buildThemeColorMap, buildThemeColorSwatchGrid, buildUserFontFaceStyles, canAddTopLevelNode, canCommitActionType, canDrillDown, canGoNext, canGoPrevious, canGroupSelection, canInteractWithElement, canRemoveTopLevelNode, canSetStrokeWidth, canUngroupSelection, canUseClipboard, cancelBuildReveal, canvasToJpegData, cellRunStyle, cellStyleToCss, centeredSvgTextLines, chartGridlinesPatch, chartGridlinesState, chartPartToAttrs, chartPreserveAspectRatio, checkModifyPassword, clampCropValue, clampNotesFontSize, clampOptionNumber, clampPercent2, clampSorterZoom, clampTransitionNumber, clampUnitInterval2 as clampUnitInterval, clampZoomScale, classifyExtraConnections, classifyMediaType, clearAllLocalViewerData, clearAudienceContent, clearLocalAwareness, clearMotionPath, clearPlaybackTimers, clearStoredViewerPrefs, clearTransitionSound, cloneElementForPaste, cloneHistorySnapshot, cloneSlide, cloneTemplateElementsBySlideId, collapseChartTitleRunsForEdit, collectCoherent3DOffNodeIds, collectConnectorSiteCandidates, collectImagePaths, collectMediaElements, collectReferencedFontFamilies, collectUsedFonts, colorWithOpacity, commentMentionQuery, commentTextSegments, comparePresentation, compatToastStackStyle, compatibilityWarningToasts, compileEquationTemplateMathMl, compileLatexEquation, computeAllNotesPages, computeAnchoredPopupPosition, computeChartLegendLayout, computeColorFilter, computeColumnBoundaries, computeDrawingViewBox, computeEntranceAnimationDelay, computeGridSpacingPx, computeHandoutLayout, computeInlineEditorRect, computeKeyboardInset, computeMarqueeHitIds, computeMergeCellDown, computeMergeCellRight, computeResizedColumnWidths, computeResizedRowHeight, computeScrollDelta, computeSelectionRect, computeSlideIndices, computeSmartArtElementLayout, computeSnapToShape, computeSplitCell, computeVirtualRange, connectorWrapperTransform, convertLatexToOmml, convertOmmlToLatex, convertOmmlToMathMl, copyFormatFromElement, createActiveAnimationGroup, createBackstagePresentation, createBlankSlide, createCollaborationLivePatcher, createDefaultChartElement, createDefaultChartUserShape, createDefaultChartUserShapeGroupChild, createDepartureChannel, createInitialPresentationSnapshot, createPlainNotesSegments, createPresenceProjector, createPresentationKeyBuffer, createPresentationSessionId, createPresenterShowGuard, createPresenterTimer, createSyncGate, createTableStyleEntry, createTouchGestureRecognizer, createViewerOptionsStore, createViewerZoomStore, createWheelStepBuffer, cursorForTool, customGeometryPathsToSvgSubpaths, defaultCssVars, defaultRadius, defaultThemeColors, deleteAutosaveSnapshot, deleteSection, deleteTableColumn, deleteTableRow, deleteTableStyleFromMap, deleteTagFromCollections, demote, deriveSlideFieldContext, deriveViewportBreakpoints, describeFontEmbedding, describeSmartArtBounds, describeTableStyleEditor, detectOrientation, detectTouchDevice, discardAutosaveRecovery, distributeElements, downloadBlob, downloadDataUrl, editCommentInList, elementActionToPptxAction, elementIdSelector, elementLockTogglePatch, encodeGif, endAudienceDisplay, ensureActionAffordanceStyles, ensureChartInteractionStyles, erasePresentationInkAt, evenColumnWidths, evenRowHeights, exportDeckJson, extraQuickAccessCommands, filterCommands, filterHiddenSlideIndices, filterInteractableIds, filterRenderedElements, findChartPartTarget, findConnectorSiteNear, findEraserHitElementId, findInSlides, findSelectedThemeSwatch, findSmartArtNodeText, finishPrintWindow, firstShowSlideIndex, flattenNodes, flattenTagCollections, forgetSessionDeck, formatAxisValue, formatBackstageDate, formatBackstageSize, formatBytes, formatCommentTimestamp, formatElapsed, formatMobileElapsed, formatRelativeTime, formatSlideCounter, formatTime, formatVersionTimestamp, fpsToFrameIntervalMs, generateBroadcastRoomId, generateElementId, generateNoteLineCount, generateTicks, getActiveXControlOverlayView, getAnimationColorBaseStyle, getAnimationInitialStyle, getAriaLabel, getAriaRole, getAriaRoleDescription, getBarFacePicturePixelSampleVersion, getBevelLightingSvgFilter, getCachedResult, getCalloutLeaderLineGeometry, getCalloutViewBoxBounds, getCellDiagonalBorders, getChartStylePalette, getChartUserShapeGroupTransform, getChartUserShapeRowChartBox, getCompoundLineOffsets, getCompoundLineWidths, getComputedEffectStyle, getComputedFillStyle, getComputedStrokeStyle, getConnectorEndpointHandles, getContentPartReplayStyles, getCropShapeClipPath, getCurrentParagraphIndex, getDraggedShapeAdjustments, getDuotoneCachedResult, getEffectSoundAsset, getEffectSoundState, getEffectStyleSource, getElementLabel, getElementTransform, getElementTransformWithoutRotation, getFragmentedTransitionDescriptor, getGroupChildParentFill, getImageColorWashStyle, getImageEffectsFilter, getImageEffectsOpacity, getImageFitStyle, getImageSvgFilters, getImageTilingStyle, getInkReplayStyles, getInlineEditorSelection, getLocalStorageUsageSummary, getNonVisualDescriptionFields, getNotesPrintableArea, getOleAriaLabel, getOleBadgeLabel, getOleDisplayName, getOleDocumentParagraphs, getOleNestedDeckDetail, getOleObjectTypeLabel, getOleSheetGrid, getOleTypeColor, getOleTypeLabel, getOverflowSegments, getPatternSvg, getPendingSelectionRestore, getPresetShapeClipPath, getPresetShapeVectorGeometry, getPrintableArea, getSessionTabId, getShapeAdjustmentHandleDescriptors, getShapeConnectionSites, getSlideBackgroundStyle, getSlideTransitionAnimations, getSoftEdgeSvgFilter, getSubstituteFontFamily, getSvgStrokeDasharray, getTableCellBandStyle, getTextBodyRotationTransform, getTextCompensationTransform, getWarpPath, groupElements, groupIntoParagraphs, groupSlidesBySection, guidePxToEmu, handleReadingViewKey, hasCopyableFormat, hasDistinctScriptFonts, hasGlyphEnvelope, hasShapeProperties, hasShowSlideAfter, hasTextProperties, hasTiltData, hexToRgbUnit, hiddenSlideCue, hideChartSeries, hollowTextFillStyle, inlineElementPointerEvents, insertCommentMention, insertTableColumn, insertTableRow, isActionHidden, isBlackboardActive, isBrowserOpenableMime, isCalloutShape, isCellInRect, isCurrentLayout, isEditableMotionPath, isEditableTextElement, isEditorTextInputTarget, isElementActionable, isElementLocked, isElementRendered, isExportAbortError, isHeaderFooterDateTextVisible, isHeaderFooterFooterTextVisible, isHeaderFooterHeaderTextVisible, isHollowShapeElement, isImageLikeElement, isImageTiled, isInkElement, isKeyboardOpen, isLegacyBinaryPresentation, isLinkedTextBox, isMixedContentBlocked, isMobileViewport, isPpactionUrl, isPresentationAdvanceClick, isPresentationSessionMessage, isSeriesUsingSecondaryAxis, isStrokeOnlyPresetElement, isSupportedPresentationFile, isTemplateElementId3 as isTemplateElementId, isUrlSafe, isWedgeCalloutPresetShape, lastShowSlideIndex, listAutosaveSnapshots, listBackstageRecentFiles, listChartUserShapeRows, loadAudienceContent, loadSessionDeck, lockResizeAspect, makeCloneId, makeSlideId, mapEditingWheel, mapEditorKey, mapOutlineKey, mapPresentationKey, mapPresentationWheel, mapSlideShowStartKey, mapSlideSorterKey, masterViewBackgroundColor, masterViewCrudActions, masterViewCrudFailureKey, masterViewElements, masterViewPseudoSlide, matchCommentMentionAuthors, mayLeaveSlideShow, mediaFallbackIcon, mediaFallbackLabelKey, mediaFallbackVisual, mediaPlaybackAttributes, mediaTransportVisible, mediaTrimEndAbsoluteMs, mediaTrimEndMsFromAbsoluteMs, mediaTrimEndMsFromSeconds, mediaTrimEndSeconds, mergeAdditiveSelection, mergeCells, mergePresentationSnapshot, mergeShapes, mergeSlideTransition, mobileElapsedSince, mobileSlideCounter, modelDataToBlobUrl, morphOptionToMode, motionPathEndPixel, motionPathFamilyLabelKey, motionPathFor, motionPathPresetIdForPath, motionPathPresetLabelKey, motionPathPresetsByFamily, motionPathToSvgD, mountAreaChart3D, mountBarChart3D, mountLineChart3D, mountModel3D, mountPieChart3D, mountSurfaceChart3D, movePresenterPointer, moveQuickAccessCommand, moveSectionDown, moveSectionUp, moveSlidesToSection, mruColorsPatch, nestedTextDecorationStyle, newTableElement, nextPresentedSlide, nextShowSlideIndex, normalizeColorsForCapture, normalizeHexColor2 as normalizeHexColor, normalizeStrokeDashType, normalizeTableStyleGuid, notesSegmentsToSpans, observeYDocSlides, ooxmlGradientAngleToCssDegrees, openNativeEyeDropper, openPendingPrintWindow, openPptxFile, openReadingView, openUrlInNewTab, paintedStrokeWidth, paragraphsToSegments, parseDrawingColor, parseDrawingColorOpacity, parsePanoseString, parsePpactionUrl, parseSegmentsFromRichEditor, partitionTemplateElements, patchChartData, pickSupportedMimeType, pieceLetterSpacing, placeAudienceWindow, placeCaretAtEnd, placeholderPromptDescriptor, playFeedbackSound, playGroup, playSlideTransitionPreview, polygonsToSvgPath, pptxActionToElementAction, preprocessCssForCapture, presentationBaseName, presentationEntrySlideIndex, presentationInkPath, presenterElapsed, presenterNextDisabled, presenterPaneAdvancesOnClick, presenterPrevDisabled, presenterTimerProgress, previousShowSlideIndex, printPropertiesFrameSlides, printPropertiesSlidesPerPage, probeAutosaveRecovery, projectDrawingShapes, promote, publishLiveGeometry, publishLiveInlineText, pushRecentColor, quickStyleSwatchCss, radarStylePatch, reResolveElementColors, reResolveSlideColors, readBackstageRecentFile, readEditableText, readOnlyRecommendation, readRibbonTransitionDraft, readSlideShowOption, readSlidesFromYDoc, readSoundFileAsDataUrl, readStoredViewerPrefs, readViewportMetrics, readingViewFitScale, rebuildDrawingShapesIfCleared, rebuildTableStructureInRawXml, reconcileSlidesInYDoc, recordProgressPercent, rectToCells, redistributeColumnWidth, registerCollaborationTeardown, registerCrossSlideAudio, registerCustomFont, remapTextToSegments, rememberSessionDeck, removeChartCategory, removeChartSeries, removeCommentFromList, removeEmptyNode, removeLastTableElementColumn, removeLastTableElementRow, removeQuickAccessCommand, removeSmartArtNode, removeTableElementColumn, removeTableElementRow, renameSection, reorder2 as reorder, reorderAnimationTimelineRows, replaceMasterViewElements, replaceOleFile, replyToCommentInList, rerouteConnectorsForMovedElements, resetPresenterTimer, resetSlideLayoutPath, resolve3DRenderingFlags, resolveActionType, resolveAudienceScreenPlacement, resolveAuthoredCustomShowId, resolveAuthoredSlideRange, resolveAutoAdvanceDelayMs, resolveAutoFitFontScale, resolveAutosaveActivation, resolveAutosaveIntervalMs, resolveAutosaveIntervalSeconds, resolveChartKind, resolveConnectorEndpointUpdate, resolveDefaultFontFamily, resolveDefaultPrintSettings, resolveDisplayedChartType, resolveElementActionAffordance, resolveElementAriaAttributes, resolveElementHighlightClick, resolveElementInteractivity, resolveExpiredAutosaveSnapshots, resolveFontKerning, resolveGoogleWebfontHref, resolveGroupChildFill, resolveHistoryDepth, resolveImageResolutionScale, resolveInlineEditAutoFitHeight, resolveInlineEditNormAutofitShrink, resolveMediaElementSource, resolveMediaTimeNodeElementIds, resolveMetricTrackingPx, resolveNotesSchematicBodyFontSizePx, resolveNotesSegments, resolveOleType, resolveOleVerbTarget, resolveOptionRootClasses, resolvePalette, resolvePresentationAction, resolveProfileInitial, resolveRevealedChartData, resolveRevealedDrawingShapeNodeIds, resolveRevealedDrawingShapes, resolveRevealedSmartArtNodes, resolveScreenTip, resolveScriptFontSet, resolveSelectionPaneRename, resolveShapeGeometry, resolveShowSlideIndexes, resolveSlideSizeSelection, resolveTableCellImageUrls, resolveTableStyleImageUrls, resolveTemplateBackgroundRows, resolveThemeCatalogEntry, resolveTitleBarStatusKey, resolveTransitionDurationMs, resolveTransitionSoundAction, resolveTransportForServerUrl, resolveViewerAddinRows, restoreFilteredSeries, restoreSegmentSelection, restoreSessionDeck, ribbonTransitionUpdates, rulerDragToGuidePosition, runPresentationAction, runProgramNoticeStackStyle, safeOpenUrl, sanitizeColor, sanitizeGradientStops, sanitizeMathMl, saveAutosaveSnapshot, saveDeckWithPassword, saveViewerProfile, savedPresentationFileName, scaleSlidesForSizeChange, scanAvailableFontFamilies, scheduleAutoAdvanceChain, scheduleMediaTrimAndFade, schemaLabel, scopeLayoutOptionsToSlide, seedRecentColors, segmentFrameCount, segmentsToEditorHtml, segmentsToParagraphs, segmentsToPlainText, sendBackward, sendToBack, seriesSecondaryAxisPatch, setAfterAnimation, setAfterAnimationColor, setCachedResult, setCellText, setChartAxisGridlineStyle, setChartAxisLogScale, setChartAxisTitleStyle, setChartCategoryLabel, setChartCellValue, setChartDataPointExplosion, setChartDataPointFill, setChartDataPointLabel, setChartDataPointMarker, setChartSeriesChartType, setChartSeriesMarker, setDataLabelsRangeCache, setDuotoneCachedResult, setEffectSound, setEffectStockSound, setMasterViewBackgroundColor, setMotionPath, setMotionPathEnd, setPendingSelectionRestore, setSmartArtNodeStyle, setTableElementCellText, shapeFillChange, shapeOutlineChange, shouldAutoFollowBroadcaster, shouldClearAutosaveCacheOnClose, shouldCommitSmartArtNodeText, shouldConfirmExternalHyperlink, shouldDiscardAutosaveOnSuccessfulSave, shouldLoopContinuously, shouldProbeAutosaveRecovery, shouldRoomSlidesReplaceLoad, shouldShowAccessibilitySection, shouldShowAutosaveRecoveryPrompt, shouldShowElementHandles, shouldUseSvgWarp, shouldWriteAutosaveSnapshot, siblingCount, siblingIndex, slideProgressPercent, slideShowOptionChange, slideSizeFromPreset, slideSizeToCanvasPx, slideStatusLabel, snapBoxToGrid, splitCell, splitRunByScriptFont, splitRunForMetrics, splitWordsForUnderline, stepPresenterZoom, stopAllPersistentAudio, storeAudienceContent, stripUnderlineDecoration, strokeOutlineViewBox, strokeWidthOf, styleShadowFilter, subscribeBarFacePicturePixelSamples, substituteFieldText, surfaceWireframePatch, svgGradientFillRef, svgLineCap, svgPathToPolygons, swapPresentationWindows, switchSmartArtLayout, tableCellCss, tableContainerCss, tableStyleAssignmentUpdate, templateSchemeFromTheme, text3dEmuToPt, text3dPtToEmu, textBuildSpanStyle, textFontSizePtToPx, textFontSizePxToPt, themeColorLabel, themeColorSchemesEqual, themeColorSwatchRows, themeSwatchCommit, themeToCssVars, toCssTextOrientation, toCssVerticalDirection, toCssWritingMode, toSlideIndex, toggleBlackboard, toggleCommentResolvedInList, togglePresenterTimer, toggleSheet, toggleStageElementMedia, toggleText3dExtrusion, transformTextCase, transitionSoundOptions, transitionSoundSelectedValue, transitionStockSoundId, trimmedMediaDurationMs, ungroupElements, updateCellTextInRawXml, updateCellTextStyleInRawXml, updateElement, updateMasterViewElement, updateMergeAttrsInRawXml, updateSmartArtNodeText, updateTagInCollections, validateMediaTrimRange, validateRoomId, vermilionDarkColors, vermilionDarkTheme, vermilionLightColors, vermilionLightTheme, vermilionRadius, viewPropertiesPatchFromPreferences, viewerOptionsToPreferences, viewerPreferencesFromViewProperties, visibleTemplateElements, warpPreviewPath, withChartPointValue, withChartTitle, withChartUserShapeAdded, withChartUserShapeGroupChildAdded, withChartUserShapeRowChartBoxUpdated, withChartUserShapeRowFlipUpdated, withChartUserShapeRowRemoved, withChartUserShapeRowRotationUpdated, withChartUserShapeRowTextUpdated, withChartUserShapeRowUpdated, withConnectorEndpointUpdate, withFrameSlides, withSlideSizeOrientation, withSlidesPerPage, writeStoredViewerPrefs };
200523
+ export { ACTION_BUTTON_PRESETS, ACTION_INDICATOR_CLASS, ACTION_INDICATOR_ICON_PATH, ARTISTIC_EFFECTS, AVATAR_COLOR_SWATCHES, BACKSTAGE_NAV, BACKSTAGE_TEMPLATES, BAR3D_SHAPE_OPTIONS, BEVEL_PRESETS, BROADCAST_THROTTLE_MS, CATEGORIES, CHARACTER_SPACING_OPTIONS, CHART_TYPE_OPTIONS, COLOR_MAP_ALIAS_KEYS, COMMENT_MARKER_SIZE, COMMENT_MENTION_ATTRIBUTE, COMMENT_MENTION_CLASS, COMMON_FONTS, COMMON_FONT_SIZES, COMPOUND_LINE_OPTIONS, CONNECTION_TIMEOUT_MS, CONNECTOR_SITE_SNAP_PX, CUSTOM_FONT_ACCEPT, DEBOUNCE_MS, DEFAULT_BROADCAST_SERVER_URL, DEFAULT_COLOR_CHANGE_TOLERANCE, DEFAULT_COLOR_MAP, DEFAULT_FONT_FAMILY2 as DEFAULT_FONT_FAMILY, DEFAULT_INSERT_CHART_KIND, DEFAULT_MOTION_PATH_PRESET_ID, DEFAULT_PALETTE2, DEFAULT_QUICK_ACCESS_COMMAND_IDS, DEFAULT_ROW_HEIGHT, DEFAULT_VIEWER_OPTIONS, DEFAULT_VIEWER_PREFERENCES, DEFAULT_VIEWER_PROFILE, DEFAULT_VIRTUAL_OVERSCAN, DIRECTIONAL_PRESETS, DUOTONE_PRESETS, EFFECT_SOUND_CATALOGUE, ELEMENT_ACTION_TYPE_OPTIONS, EMPHASIS_PRESET_VALUES, ENTRANCE_PRESET_VALUES, EQUATION_TEMPLATES, EXIT_PRESET_VALUES, EXPANDED_MAX_HEIGHT, EXPORT_ASSEMBLING_PERCENT, EXPORT_DONE_PERCENT, EncryptedFileError, FILL_MODE_OPTIONS, FILL_PATTERN_LABEL_KEYS, GRADIENT_TYPE_OPTIONS, HANDOUT_OPTIONS, HIDDEN_SLIDE_LABEL_KEY, HIDDEN_SLIDE_SLASH_GRADIENT, HIGHLIGHTER_COLORS, INDENT_PX, INK_REPLAY_KEYFRAMES, INSERT_CHART_TYPES, LBL, LINE_CAP_OPTIONS, LINE_JOIN_OPTIONS, LINK_TOOLTIP_CLASS, LINK_TOOLTIP_HINT_CLASS, LINK_TOOLTIP_HOST_CLASS, LINK_TOOLTIP_LABEL_CLASS, LINK_TOOLTIP_PANEL_CLASS, LOCAL_SYNC_ORIGIN, MATERIAL_PRESETS, MAX_INDENT_LEVEL, MAX_ZOOM_SCALE, MEDIA_CHROME_ATTRIBUTE, MIN_ZOOM_SCALE, MOBILE_BREAKPOINT, MORPH_CROSSFADE_GROUP_STYLE, MORPH_CROSSFADE_HALF_STYLE, MOTION_PATH_FAMILIES, NOTES_FONT_SIZE_DEFAULT, NOTES_FONT_SIZE_MAX, NOTES_FONT_SIZE_MIN, NOTES_FONT_SIZE_STEP, NUM, OFFICE_COLOR_SWATCHES, OUTLINE_LEVEL_ATTR, OUTLINE_ROW_ATTR, OUTLINE_SLIDE_ATTR, OUTLINE_VIEW_ATTR, PATTERN_OPTIONS, PATTERN_PRESET_OPTIONS, PDF_SLIDES_PAGE_HEIGHT_PT, PDF_SLIDES_PAGE_WIDTH_PT, PEN_COLORS, PPTX_OPEN_ACCEPT, PRESENTATION_CHANNEL_NAME, PRESENTATION_HASH, PRESENTATION_HIT_TEST_CSS, PRESENTATION_MESSAGE_ORIGIN, PRESENTATION_NONCE_KEY, PRESENTATION_OPEN_EXTENSIONS, PRESENTATION_STAGE_ATTRIBUTE, PRESENTER_CONSOLE_CLASSES, PRESENTER_CONSOLE_CONTROLS, PRESENTER_NAVIGATOR_LABEL_KEYS, PRESENT_TOOLBAR_CLASSES, PRESETS, PRESET_THEMES, PptxHandler, PptxMarkdownConverter, PresentationAnimationController, QUICK_ACCESS_COMMAND_CATALOG, RADAR_STYLE_OPTIONS, READING_VIEW_ATTR, READING_VIEW_COUNTER_ATTR, READING_VIEW_STAGE_ATTR, RIBBON_SHAPE_SWATCHES, RIBBON_TRANSITION_PRESETS, RULER_FONT_SIZE, RULER_THICKNESS, SECTION_HEADING, SEL, SHAPE_PRESET_DEFS, SHAPE_QUICK_STYLES, SHORTCUT_REFERENCE_ITEMS, SLIDE_SHOW_OPTIONS, SLIDE_SIZE_PRESETS, SLIDE_TEMPLATES, SLIDE_TRANSITION_KEYFRAMES, SLIDE_TRANSITION_OPTIONS, SLIDE_VIRTUALIZATION_THRESHOLD, SMARTART_COLOR_SCHEME_LABEL_KEYS, SMARTART_PREVIEW_ELEMENT_HEIGHT, SMARTART_PREVIEW_ELEMENT_WIDTH, SMARTART_STYLE_LABEL_KEYS, SORTER_MAX_ZOOM, SORTER_MIN_ZOOM, SORTER_ZOOM_STEP, STATUS_BAR_CLASSES, STROKE_DASH_OPTIONS2 as STROKE_DASH_OPTIONS, SURFACE_WIREFRAME_OPTIONS, SWITCHABLE_LAYOUT_TYPES, SvgExporter, TABLET_BREAKPOINT, TABLE_STYLE_BORDER_SIDES, TABLE_STYLE_BORDER_SIDE_LABEL_KEYS, TABLE_STYLE_DASH_PRESETS, TABLE_STYLE_EDITOR_PARTS, TABLE_STYLE_PRESETS, TAB_ROW_ACTION_CLASSES, TEXT_BUILD_ID_SEP, TEXT_WARP_PRESETS, THEME_CATALOG, THEME_COLOR_SCHEME_KEYS, THEME_COLOR_SLOT_LABEL_KEYS, THEME_PRESETS, TITLE_BAR_CLASSES, TITLE_BAR_DEFAULT_FILE_KEY, TOOLBAR_TABS, TRANSITION_DIR_ARROWS, TRANSITION_MORPH_OPTIONS, TRANSITION_ORIENTATION_TYPES, TRANSITION_SOUND_NONE_VALUE, TRANSITION_SOUND_OTHER_VALUE, TRANSITION_SPEED_OPTIONS, TRANSITION_VALID_DIRECTIONS, ThemePresets, VIEWER_OPTIONS_TABS, VIEWER_PREFS_STORAGE_KEY, VIEWER_SHORTCUT_REFERENCE, WEBM_MIME_CANDIDATES, acceptAutosaveRecovery, acceptsPresentationInput, actionAffordanceLabels, activateModalFocus, addChartCategory, addChartSeries, addCommentToList, addQuickAccessCommand, addSection, addSiblingAfter, addSmartArtNodeAsChild, addTableStyleToMap, addTagToCollections, advanceChartMarkDrag, advanceChartValueDrag, advanceMainSequence, alignElements, animationEffectLabel, annotationOverlayZIndex, appendPresentationInkPoint, appendTableElementColumn, appendTableElementRow, apply3dEffects, applyAcceptAllSlides, applyAcceptSlide, applyAnimationTimelineOrder, applyAutoCorrect, applyCaseTransformToSegments, applyChartPartHighlight, applyColorChange, applyDuotone, applyFindReplacements, applyFormatToElement, applyHighlightClickStyle, applyImagePathPatches, applyMasterViewCrudAction, applyMotionPathPreset, applyOleDocumentParagraphEdit, applyOleNestedDeckElementTextEdit, applyOleSheetCellEdit, applyOutlineEdit, applyPreferenceToOptions, applyReadingViewCommand, applyRehearsalTimings, applyReroutedConnectors, applyResize, applyStyleToSelectedSegments, applyTableStyleDelete, applyTableStyleFieldEdit, applyTableStyleMapChange, applyTableStylePreset, applyThemeOverrideToSlide, applyThemeToData, applyTransitionSoundFile, applyTransitionStockSound, attachPresentationVisibilityPause, authorConnectorBetweenSites, autosaveSnapshotMark, availableQuickAccessCommands, backstageCardsFor, bar3DShapePatch, beginChartMarkDrag, beginChartValueDrag, beginShapeAdjustment, bringForward, bringToFront, build3DExtrusionData, buildActiveSessionUsers, buildAnimationTimelineBars, buildAnimationTimelineRows, buildAreaChart3DDataForElement, buildBarActions, buildBarChart3DDataForElement, buildBroadcastViewerUrl, buildCacheKey, buildCalloutLeaderLineSvgPath, buildChartMarkDragGeometry, buildChartViewModel, buildChromeStyle, buildCollaborationShareUrl, buildCommentMarkers, buildContentPartStrokes, buildContextMenuEntries, buildCreateCollaborationConfig, buildCssGradientFromShapeStyle, buildDeckSaveOptions, buildDirectionGrid, buildDuotoneCacheKey, buildElementClipboardPayload, buildFieldSubstitutionContext, buildFontCatalog, buildGlyphEnvelope, buildHandoutsHtml, buildHollowHitOutline, buildInitialGuides, buildInkGroupStrokes, buildInlineTextCommitPatch, buildJoinCollaborationConfig, buildLayoutPreviewGeometry, buildLineChart3DDataForElement, buildLiveInkStrokeView, buildMorphAnimationRules, buildMorphTransitionPlan, buildMotionPathPreview, buildNotesHtml, buildNotesPdfBytes, buildNotesPrintHtml, buildOleContentUpdatePatch, buildOleEditDialogDescriptor, buildOleObjectNamePatch, buildOutline, buildOutlineHtml, buildParagraphs, buildPieChart3DDataForElement, buildPresentationAudienceUrl, buildPreviewAnimation, buildPreviewElements, buildPrintDocument, buildPrintHtmlDocument, buildRectPathGradient, buildRunProgramNotice, buildRunTabLines, buildSaveSlides, buildSlideTemplateContent, buildSlideTemplateSlide, buildSlidesHtml, buildSmartArt3DModel, buildSmartArtA11y, buildSmartArtPresetData, buildSmartArtPreviewElement, buildStrokeOutline, buildStrokePathD, buildSubpathFillOverlay, buildSubpathPaints, buildSummaryZoomView, buildSurfaceChart3DDataForElement, buildSvgGradientDef, buildTabContext, buildTableDataGrid, buildTextBlockStyle, buildTextBody3DSceneStyle, buildTextBodyLayoutStyle, buildTextBuildSpec, buildTextStyleOverrideCss, buildThemeColorGrid, buildThemeColorMap, buildThemeColorSwatchGrid, buildTiledSlidesPdfBytes, buildUserFontFaceStyles, canAddTopLevelNode, canCommitActionType, canDrillDown, canGoNext, canGoPrevious, canGroupSelection, canInteractWithElement, canRemoveTopLevelNode, canSetStrokeWidth, canUngroupSelection, canUseClipboard, cancelBuildReveal, canvasToJpegData, cellRunStyle, cellStyleToCss, centeredSvgTextLines, chartGridlinesPatch, chartGridlinesState, chartPartToAttrs, chartPreserveAspectRatio, checkModifyPassword, clampCropValue, clampNotesFontSize, clampOptionNumber, clampPercent2, clampSorterZoom, clampTransitionNumber, clampUnitInterval2 as clampUnitInterval, clampZoomScale, classifyExtraConnections, classifyMediaType, clearAllLocalViewerData, clearAudienceContent, clearLocalAwareness, clearMotionPath, clearPlaybackTimers, clearStoredViewerPrefs, clearTransitionSound, cloneElementForPaste, cloneHistorySnapshot, cloneSlide, cloneTemplateElementsBySlideId, collapseChartTitleRunsForEdit, collectCoherent3DOffNodeIds, collectConnectorSiteCandidates, collectImagePaths, collectMediaElements, collectReferencedFontFamilies, collectUsedFonts, colorWithOpacity, commentMentionQuery, commentTextSegments, comparePresentation, compatToastStackStyle, compatibilityWarningToasts, compileEquationTemplateMathMl, compileLatexEquation, computeAllNotesPages, computeAnchoredPopupPosition, computeChartLegendLayout, computeColorFilter, computeColumnBoundaries, computeDrawingViewBox, computeEntranceAnimationDelay, computeGridSpacingPx, computeHandoutLayout, computeInlineEditorRect, computeKeyboardInset, computeMarqueeHitIds, computeMergeCellDown, computeMergeCellRight, computeResizedColumnWidths, computeResizedRowHeight, computeScrollDelta, computeSelectionRect, computeSlideIndices, computeSmartArtElementLayout, computeSnapToShape, computeSplitCell, computeVirtualRange, connectorWrapperTransform, convertLatexToOmml, convertOmmlToLatex, convertOmmlToMathMl, copyFormatFromElement, createActiveAnimationGroup, createBackstagePresentation, createBlankSlide, createCollaborationLivePatcher, createDefaultChartElement, createDefaultChartUserShape, createDefaultChartUserShapeGroupChild, createDepartureChannel, createInitialPresentationSnapshot, createPlainNotesSegments, createPresenceProjector, createPresentationKeyBuffer, createPresentationSessionId, createPresenterShowGuard, createPresenterTimer, createSyncGate, createTableStyleEntry, createTouchGestureRecognizer, createViewerOptionsStore, createViewerZoomStore, createWheelStepBuffer, cursorForTool, customGeometryPathsToSvgSubpaths, defaultCssVars, defaultRadius, defaultThemeColors, deleteAutosaveSnapshot, deleteSection, deleteTableColumn, deleteTableRow, deleteTableStyleFromMap, deleteTagFromCollections, demote, deriveSlideFieldContext, deriveViewportBreakpoints, describeFontEmbedding, describeSmartArtBounds, describeTableStyleEditor, detectOrientation, detectTouchDevice, discardAutosaveRecovery, distributeElements, downloadBlob, downloadDataUrl, editCommentInList, elementActionToPptxAction, elementIdSelector, elementLockTogglePatch, encodeGif, endAudienceDisplay, ensureActionAffordanceStyles, ensureChartInteractionStyles, erasePresentationInkAt, evenColumnWidths, evenRowHeights, exportDeckJson, extraQuickAccessCommands, filterCommands, filterHiddenSlideIndices, filterInteractableIds, filterRenderedElements, findChartPartTarget, findConnectorSiteNear, findEraserHitElementId, findInSlides, findSelectedThemeSwatch, findSmartArtNodeText, finishPrintWindow, firstShowSlideIndex, flattenNodes, flattenTagCollections, forgetSessionDeck, formatAxisValue, formatBackstageDate, formatBackstageSize, formatBytes, formatCommentTimestamp, formatElapsed, formatMobileElapsed, formatRelativeTime, formatSlideCounter, formatTime, formatVersionTimestamp, fpsToFrameIntervalMs, generateBroadcastRoomId, generateElementId, generateNoteLineCount, generateTicks, getActiveXControlOverlayView, getAnimationColorBaseStyle, getAnimationInitialStyle, getAriaLabel, getAriaRole, getAriaRoleDescription, getBarFacePicturePixelSampleVersion, getBevelLightingSvgFilter, getCachedResult, getCalloutLeaderLineGeometry, getCalloutViewBoxBounds, getCellDiagonalBorders, getChartStylePalette, getChartUserShapeGroupTransform, getChartUserShapeRowChartBox, getCompoundLineOffsets, getCompoundLineWidths, getComputedEffectStyle, getComputedFillStyle, getComputedStrokeStyle, getConnectorEndpointHandles, getContentPartReplayStyles, getCropShapeClipPath, getCurrentParagraphIndex, getDraggedShapeAdjustments, getDuotoneCachedResult, getEffectSoundAsset, getEffectSoundState, getEffectStyleSource, getElementLabel, getElementTransform, getElementTransformWithoutRotation, getFragmentedTransitionDescriptor, getGroupChildParentFill, getImageColorWashStyle, getImageEffectsFilter, getImageEffectsOpacity, getImageFitStyle, getImageSvgFilters, getImageTilingStyle, getInkReplayStyles, getInlineEditorSelection, getLocalStorageUsageSummary, getNonVisualDescriptionFields, getNotesPrintableArea, getOleAriaLabel, getOleBadgeLabel, getOleDisplayName, getOleDocumentParagraphs, getOleNestedDeckDetail, getOleObjectTypeLabel, getOleSheetGrid, getOleTypeColor, getOleTypeLabel, getOverflowSegments, getPatternSvg, getPendingSelectionRestore, getPresetShapeClipPath, getPresetShapeVectorGeometry, getPrintableArea, getSessionTabId, getShapeAdjustmentHandleDescriptors, getShapeConnectionSites, getSlideBackgroundStyle, getSlideTransitionAnimations, getSoftEdgeSvgFilter, getSubstituteFontFamily, getSvgStrokeDasharray, getTableCellBandStyle, getTextBodyRotationTransform, getTextCompensationTransform, getWarpPath, groupElements, groupIntoParagraphs, groupSlidesBySection, guidePxToEmu, handleReadingViewKey, hasCopyableFormat, hasDistinctScriptFonts, hasGlyphEnvelope, hasShapeProperties, hasShowSlideAfter, hasTextProperties, hasTiltData, hexToRgbUnit, hiddenSlideCue, hideChartSeries, hollowTextFillStyle, inlineElementPointerEvents, insertCommentMention, insertTableColumn, insertTableRow, isActionHidden, isBlackboardActive, isBrowserOpenableMime, isCalloutShape, isCellInRect, isCurrentLayout, isEditableMotionPath, isEditableTextElement, isEditorTextInputTarget, isElementActionable, isElementLocked, isElementRendered, isExportAbortError, isHeaderFooterDateTextVisible, isHeaderFooterFooterTextVisible, isHeaderFooterHeaderTextVisible, isHollowShapeElement, isImageLikeElement, isImageTiled, isInkElement, isKeyboardOpen, isLegacyBinaryPresentation, isLinkedTextBox, isMixedContentBlocked, isMobileViewport, isPpactionUrl, isPresentationAdvanceClick, isPresentationSessionMessage, isSeriesUsingSecondaryAxis, isStrokeOnlyPresetElement, isSupportedPresentationFile, isTemplateElementId3 as isTemplateElementId, isUrlSafe, isWedgeCalloutPresetShape, lastShowSlideIndex, listAutosaveSnapshots, listBackstageRecentFiles, listChartUserShapeRows, loadAudienceContent, loadSessionDeck, lockResizeAspect, makeCloneId, makeSlideId, mapEditingWheel, mapEditorKey, mapOutlineKey, mapPresentationKey, mapPresentationWheel, mapSlideShowStartKey, mapSlideSorterKey, masterViewBackgroundColor, masterViewCrudActions, masterViewCrudFailureKey, masterViewElements, masterViewPseudoSlide, matchCommentMentionAuthors, mayLeaveSlideShow, mediaFallbackIcon, mediaFallbackLabelKey, mediaFallbackVisual, mediaPlaybackAttributes, mediaTransportVisible, mediaTrimEndAbsoluteMs, mediaTrimEndMsFromAbsoluteMs, mediaTrimEndMsFromSeconds, mediaTrimEndSeconds, mergeAdditiveSelection, mergeCells, mergePresentationSnapshot, mergeShapes, mergeSlideTransition, mobileElapsedSince, mobileSlideCounter, modelDataToBlobUrl, morphOptionToMode, motionPathEndPixel, motionPathFamilyLabelKey, motionPathFor, motionPathPresetIdForPath, motionPathPresetLabelKey, motionPathPresetsByFamily, motionPathToSvgD, mountAreaChart3D, mountBarChart3D, mountLineChart3D, mountModel3D, mountPieChart3D, mountSurfaceChart3D, movePresenterPointer, moveQuickAccessCommand, moveSectionDown, moveSectionUp, moveSlidesToSection, mruColorsPatch, nestedTextDecorationStyle, newTableElement, nextPresentedSlide, nextShowSlideIndex, normalizeColorsForCapture, normalizeHexColor2 as normalizeHexColor, normalizeStrokeDashType, normalizeTableStyleGuid, notesSegmentsToSpans, observeYDocSlides, ooxmlGradientAngleToCssDegrees, openNativeEyeDropper, openPendingPrintWindow, openPptxFile, openReadingView, openUrlInNewTab, paintedStrokeWidth, paragraphsToSegments, parseDrawingColor, parseDrawingColorOpacity, parsePanoseString, parsePpactionUrl, parseSegmentsFromRichEditor, partitionTemplateElements, patchChartData, pickSupportedMimeType, pieceLetterSpacing, placeAudienceWindow, placeCaretAtEnd, placeTileOnPage, placeholderPromptDescriptor, playFeedbackSound, playGroup, playSlideTransitionPreview, polygonsToSvgPath, pptxActionToElementAction, preprocessCssForCapture, presentationBaseName, presentationEntrySlideIndex, presentationInkPath, presenterElapsed, presenterNextDisabled, presenterPaneAdvancesOnClick, presenterPrevDisabled, presenterTimerProgress, previousShowSlideIndex, printPropertiesFrameSlides, printPropertiesSlidesPerPage, probeAutosaveRecovery, projectDrawingShapes, promote, publishLiveGeometry, publishLiveInlineText, pushRecentColor, quickStyleSwatchCss, radarStylePatch, rasterResultToPngBlob, rasterizeElement, rasterizeElementClampedToCanvas, rasterizeElementTiles, reResolveElementColors, reResolveSlideColors, readBackstageRecentFile, readEditableText, readOnlyRecommendation, readRibbonTransitionDraft, readSlideShowOption, readSlidesFromYDoc, readSoundFileAsDataUrl, readStoredViewerPrefs, readViewportMetrics, readingViewFitScale, rebuildDrawingShapesIfCleared, rebuildTableStructureInRawXml, reconcileSlidesInYDoc, recordProgressPercent, rectToCells, redistributeColumnWidth, registerCollaborationTeardown, registerCrossSlideAudio, registerCustomFont, remapTextToSegments, rememberSessionDeck, removeChartCategory, removeChartSeries, removeCommentFromList, removeEmptyNode, removeLastTableElementColumn, removeLastTableElementRow, removeQuickAccessCommand, removeSmartArtNode, removeTableElementColumn, removeTableElementRow, renameSection, reorder2 as reorder, reorderAnimationTimelineRows, replaceMasterViewElements, replaceOleFile, replyToCommentInList, rerouteConnectorsForMovedElements, resetPresenterTimer, resetSlideLayoutPath, resolve3DRenderingFlags, resolveActionType, resolveAudienceScreenPlacement, resolveAuthoredCustomShowId, resolveAuthoredSlideRange, resolveAutoAdvanceDelayMs, resolveAutoFitFontScale, resolveAutosaveActivation, resolveAutosaveIntervalMs, resolveAutosaveIntervalSeconds, resolveChartKind, resolveConnectorEndpointUpdate, resolveDefaultFontFamily, resolveDefaultPrintSettings, resolveDisplayedChartType, resolveElementActionAffordance, resolveElementAriaAttributes, resolveElementHighlightClick, resolveElementInteractivity, resolveExpiredAutosaveSnapshots, resolveFontKerning, resolveGoogleWebfontHref, resolveGroupChildFill, resolveHistoryDepth, resolveImageResolutionScale, resolveInlineEditAutoFitHeight, resolveInlineEditNormAutofitShrink, resolveMediaElementSource, resolveMediaTimeNodeElementIds, resolveMetricTrackingPx, resolveNotesSchematicBodyFontSizePx, resolveNotesSegments, resolveOleType, resolveOleVerbTarget, resolveOptionRootClasses, resolvePalette, resolvePresentationAction, resolveProfileInitial, resolveRevealedChartData, resolveRevealedDrawingShapeNodeIds, resolveRevealedDrawingShapes, resolveRevealedSmartArtNodes, resolveScreenTip, resolveScriptFontSet, resolveSelectionPaneRename, resolveShapeGeometry, resolveShowSlideIndexes, resolveSlideSizeSelection, resolveTableCellImageUrls, resolveTableStyleImageUrls, resolveTemplateBackgroundRows, resolveThemeCatalogEntry, resolveTitleBarStatusKey, resolveTransitionDurationMs, resolveTransitionSoundAction, resolveTransportForServerUrl, resolveViewerAddinRows, restoreFilteredSeries, restoreSegmentSelection, restoreSessionDeck, ribbonTransitionUpdates, rulerDragToGuidePosition, runPresentationAction, runProgramNoticeStackStyle, safeOpenUrl, sanitizeColor, sanitizeGradientStops, sanitizeMathMl, saveAutosaveSnapshot, saveDeckWithPassword, saveViewerProfile, savedPresentationFileName, scaleSlidesForSizeChange, scanAvailableFontFamilies, scheduleAutoAdvanceChain, scheduleMediaTrimAndFade, schemaLabel, scopeLayoutOptionsToSlide, seedRecentColors, segmentFrameCount, segmentsToEditorHtml, segmentsToParagraphs, segmentsToPlainText, sendBackward, sendToBack, seriesSecondaryAxisPatch, setAfterAnimation, setAfterAnimationColor, setCachedResult, setCellText, setChartAxisGridlineStyle, setChartAxisLogScale, setChartAxisTitleStyle, setChartCategoryLabel, setChartCellValue, setChartDataPointExplosion, setChartDataPointFill, setChartDataPointLabel, setChartDataPointMarker, setChartSeriesChartType, setChartSeriesMarker, setDataLabelsRangeCache, setDuotoneCachedResult, setEffectSound, setEffectStockSound, setMasterViewBackgroundColor, setMotionPath, setMotionPathEnd, setPendingSelectionRestore, setSmartArtNodeStyle, setTableElementCellText, shapeFillChange, shapeOutlineChange, shouldAutoFollowBroadcaster, shouldClearAutosaveCacheOnClose, shouldCommitSmartArtNodeText, shouldConfirmExternalHyperlink, shouldDiscardAutosaveOnSuccessfulSave, shouldLoopContinuously, shouldProbeAutosaveRecovery, shouldRoomSlidesReplaceLoad, shouldShowAccessibilitySection, shouldShowAutosaveRecoveryPrompt, shouldShowElementHandles, shouldUseSvgWarp, shouldWriteAutosaveSnapshot, siblingCount, siblingIndex, slideProgressPercent, slideShowOptionChange, slideSizeFromPreset, slideSizeToCanvasPx, slideStatusLabel, snapBoxToGrid, splitCell, splitRunByScriptFont, splitRunForMetrics, splitWordsForUnderline, stepPresenterZoom, stopAllPersistentAudio, storeAudienceContent, stripUnderlineDecoration, strokeOutlineViewBox, strokeWidthOf, styleShadowFilter, subscribeBarFacePicturePixelSamples, substituteFieldText, surfaceWireframePatch, svgGradientFillRef, svgLineCap, svgPathToPolygons, swapPresentationWindows, switchSmartArtLayout, tableCellCss, tableContainerCss, tableStyleAssignmentUpdate, templateSchemeFromTheme, text3dEmuToPt, text3dPtToEmu, textBuildSpanStyle, textFontSizePtToPx, textFontSizePxToPt, themeColorLabel, themeColorSchemesEqual, themeColorSwatchRows, themeSwatchCommit, themeToCssVars, toCssTextOrientation, toCssVerticalDirection, toCssWritingMode, toSlideIndex, toggleBlackboard, toggleCommentResolvedInList, togglePresenterTimer, toggleSheet, toggleStageElementMedia, toggleText3dExtrusion, transformTextCase, transitionSoundOptions, transitionSoundSelectedValue, transitionStockSoundId, trimmedMediaDurationMs, ungroupElements, updateCellTextInRawXml, updateCellTextStyleInRawXml, updateElement, updateMasterViewElement, updateMergeAttrsInRawXml, updateSmartArtNodeText, updateTagInCollections, validateMediaTrimRange, validateRoomId, vermilionDarkColors, vermilionDarkTheme, vermilionLightColors, vermilionLightTheme, vermilionRadius, viewPropertiesPatchFromPreferences, viewerOptionsToPreferences, viewerPreferencesFromViewProperties, visibleTemplateElements, warpPreviewPath, withChartPointValue, withChartTitle, withChartUserShapeAdded, withChartUserShapeGroupChildAdded, withChartUserShapeRowChartBoxUpdated, withChartUserShapeRowFlipUpdated, withChartUserShapeRowRemoved, withChartUserShapeRowRotationUpdated, withChartUserShapeRowTextUpdated, withChartUserShapeRowUpdated, withConnectorEndpointUpdate, withFrameSlides, withSlideSizeOrientation, withSlidesPerPage, writeStoredViewerPrefs };