@superdoc-dev/cli 0.7.0-next.20 → 0.7.0-next.22

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 (2) hide show
  1. package/dist/index.js +283 -115
  2. package/package.json +9 -9
package/dist/index.js CHANGED
@@ -65501,7 +65501,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
65501
65501
  emptyOptions2 = {};
65502
65502
  });
65503
65503
 
65504
- // ../../packages/superdoc/dist/chunks/SuperConverter-BgwP1GeS.es.js
65504
+ // ../../packages/superdoc/dist/chunks/SuperConverter-DUDABEsC.es.js
65505
65505
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
65506
65506
  const fieldValue = extension$1.config[field];
65507
65507
  if (typeof fieldValue === "function")
@@ -78803,12 +78803,15 @@ function getVectorShape({ params: params3, node: node3, graphicData, size: size2
78803
78803
  const effectExtent = extractEffectExtent(node3);
78804
78804
  const textBoxContent = wsp.elements?.find((el) => el.name === "wps:txbx")?.elements?.find((el) => el.name === "w:txbxContent");
78805
78805
  const bodyPr = wsp.elements?.find((el) => el.name === "wps:bodyPr");
78806
+ const nonVisualShapeProps = wsp.elements?.find((el) => el.name === "wps:cNvSpPr");
78806
78807
  let textContent = null;
78807
78808
  let textAlign = "left";
78808
78809
  if (textBoxContent) {
78809
78810
  textContent = extractTextFromTextBox(textBoxContent, bodyPr, params3);
78810
78811
  textAlign = textContent?.horizontalAlign || "left";
78811
78812
  }
78813
+ const isWordArt = bodyPr?.attributes?.["fromWordArt"] === "1";
78814
+ const isTextBox = nonVisualShapeProps?.attributes?.["txBox"] === "1";
78812
78815
  return {
78813
78816
  type: "vectorShape",
78814
78817
  attrs: {
@@ -78831,6 +78834,8 @@ function getVectorShape({ params: params3, node: node3, graphicData, size: size2
78831
78834
  textAlign,
78832
78835
  textVerticalAlign: textContent?.verticalAlign,
78833
78836
  textInsets: textContent?.insets,
78837
+ isWordArt,
78838
+ isTextBox,
78834
78839
  originalAttributes: node3?.attributes
78835
78840
  }
78836
78841
  };
@@ -93267,9 +93272,9 @@ function importCommentData({ docx, editor, converter }) {
93267
93272
  comments: allComments.map((el) => {
93268
93273
  const { attributes } = el;
93269
93274
  const importedId = attributes["w:id"];
93270
- const authorName = attributes["w:author"];
93271
- const authorEmail = attributes["w:email"];
93272
- const initials = attributes["w:initials"];
93275
+ const authorName = readCommentAttribute(attributes, "w:author", "custom:author");
93276
+ const authorEmail = readCommentAttribute(attributes, "w:email", "custom:email");
93277
+ const initials = readCommentAttribute(attributes, "w:initials", "custom:initials");
93273
93278
  const createdDate = attributes["w:date"];
93274
93279
  const internalId = attributes["custom:internalId"];
93275
93280
  const trackedChange = attributes["custom:trackedChange"] === "true";
@@ -115390,7 +115395,11 @@ var isRegExp = (value) => {
115390
115395
  nodes: resultNodes,
115391
115396
  consumed: 1
115392
115397
  };
115393
- }, pictNodeHandlerEntity, generateCommentsWithExtendedData = ({ docx, comments, converter, threadingProfile }) => {
115398
+ }, pictNodeHandlerEntity, readCommentAttribute = (attributes, primaryName, fallbackName) => {
115399
+ if (!attributes)
115400
+ return;
115401
+ return attributes[primaryName] ?? attributes[fallbackName];
115402
+ }, generateCommentsWithExtendedData = ({ docx, comments, converter, threadingProfile }) => {
115394
115403
  if (!comments?.length)
115395
115404
  return [];
115396
115405
  const rangeData = extractCommentRangesFromDocument(docx, converter);
@@ -117219,7 +117228,7 @@ var isRegExp = (value) => {
117219
117228
  state.kern = kernNode.attributes["w:val"];
117220
117229
  }
117221
117230
  }, SuperConverter;
117222
- var init_SuperConverter_BgwP1GeS_es = __esm(() => {
117231
+ var init_SuperConverter_DUDABEsC_es = __esm(() => {
117223
117232
  init_rolldown_runtime_Bg48TavK_es();
117224
117233
  init_jszip_C49i9kUs_es();
117225
117234
  init_xml_js_CqGKpaft_es();
@@ -154465,7 +154474,7 @@ var init_SuperConverter_BgwP1GeS_es = __esm(() => {
154465
154474
  };
154466
154475
  });
154467
154476
 
154468
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-Dcw4Hyt2.es.js
154477
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-B7F814Ir.es.js
154469
154478
  function parseSizeUnit(val = "0") {
154470
154479
  const length3 = val.toString() || "0";
154471
154480
  const value = Number.parseFloat(length3);
@@ -157057,8 +157066,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
157057
157066
  }
157058
157067
  };
157059
157068
  };
157060
- var init_create_headless_toolbar_Dcw4Hyt2_es = __esm(() => {
157061
- init_SuperConverter_BgwP1GeS_es();
157069
+ var init_create_headless_toolbar_B7F814Ir_es = __esm(() => {
157070
+ init_SuperConverter_DUDABEsC_es();
157062
157071
  init_constants_CGhJRd87_es();
157063
157072
  init_dist_B8HfvhaK_es();
157064
157073
  CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
@@ -205496,7 +205505,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
205496
205505
  init_remark_gfm_BhnWr3yf_es();
205497
205506
  });
205498
205507
 
205499
- // ../../packages/superdoc/dist/chunks/src-DlMaB1h-.es.js
205508
+ // ../../packages/superdoc/dist/chunks/src-oqYJU65d.es.js
205500
205509
  function deleteProps(obj, propOrProps) {
205501
205510
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
205502
205511
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -245254,7 +245263,7 @@ function renderBars(doc$12, svg2, series, layout) {
245254
245263
  const barHeight = Math.abs(value / valueRange) * plotHeight;
245255
245264
  const x = CHART_PADDING.left + ci * groupWidth + barGap + si * barWidth;
245256
245265
  const y$1 = value >= 0 ? baselineY - barHeight : baselineY;
245257
- const rect = doc$12.createElementNS(SVG_NS, "rect");
245266
+ const rect = doc$12.createElementNS(SVG_NS$1, "rect");
245258
245267
  rect.setAttribute("x", String(x));
245259
245268
  rect.setAttribute("y", String(y$1));
245260
245269
  rect.setAttribute("width", String(barWidth));
@@ -245266,7 +245275,7 @@ function renderBars(doc$12, svg2, series, layout) {
245266
245275
  }
245267
245276
  function renderAxes(doc$12, svg2, layout) {
245268
245277
  const { plotWidth, plotHeight, baselineY } = layout;
245269
- const vAxis = doc$12.createElementNS(SVG_NS, "line");
245278
+ const vAxis = doc$12.createElementNS(SVG_NS$1, "line");
245270
245279
  vAxis.setAttribute("x1", String(CHART_PADDING.left));
245271
245280
  vAxis.setAttribute("y1", String(CHART_PADDING.top));
245272
245281
  vAxis.setAttribute("x2", String(CHART_PADDING.left));
@@ -245274,7 +245283,7 @@ function renderAxes(doc$12, svg2, layout) {
245274
245283
  vAxis.setAttribute("stroke", AXIS_COLOR);
245275
245284
  vAxis.setAttribute("stroke-width", "1");
245276
245285
  svg2.appendChild(vAxis);
245277
- const hAxis = doc$12.createElementNS(SVG_NS, "line");
245286
+ const hAxis = doc$12.createElementNS(SVG_NS$1, "line");
245278
245287
  hAxis.setAttribute("x1", String(CHART_PADDING.left));
245279
245288
  hAxis.setAttribute("y1", String(baselineY));
245280
245289
  hAxis.setAttribute("x2", String(CHART_PADDING.left + plotWidth));
@@ -245289,7 +245298,7 @@ function renderCategoryLabels(doc$12, svg2, categories, layout, width) {
245289
245298
  const fontSize = Math.max(8, Math.min(12, width / categoryCount / 5));
245290
245299
  for (let ci = 0;ci < categories.length; ci++) {
245291
245300
  const labelX = CHART_PADDING.left + ci * groupWidth + groupWidth / 2;
245292
- const label = doc$12.createElementNS(SVG_NS, "text");
245301
+ const label = doc$12.createElementNS(SVG_NS$1, "text");
245293
245302
  label.setAttribute("x", String(labelX));
245294
245303
  label.setAttribute("y", String(CHART_PADDING.top + plotHeight + 16));
245295
245304
  label.setAttribute("text-anchor", "middle");
@@ -245307,7 +245316,7 @@ function renderValueTicks(doc$12, svg2, layout, height) {
245307
245316
  for (let i4 = 0;i4 <= VALUE_TICK_COUNT; i4++) {
245308
245317
  const tickValue = minValue + tickStep * i4;
245309
245318
  const tickY = CHART_PADDING.top + plotHeight - plotHeight * (tickValue - minValue) / valueRange;
245310
- const label = doc$12.createElementNS(SVG_NS, "text");
245319
+ const label = doc$12.createElementNS(SVG_NS$1, "text");
245311
245320
  label.setAttribute("x", String(CHART_PADDING.left - 6));
245312
245321
  label.setAttribute("y", String(tickY + 3));
245313
245322
  label.setAttribute("text-anchor", "end");
@@ -245317,7 +245326,7 @@ function renderValueTicks(doc$12, svg2, layout, height) {
245317
245326
  label.textContent = formatTickValue(tickValue);
245318
245327
  svg2.appendChild(label);
245319
245328
  if (i4 > 0 && i4 < VALUE_TICK_COUNT) {
245320
- const gridLine = doc$12.createElementNS(SVG_NS, "line");
245329
+ const gridLine = doc$12.createElementNS(SVG_NS$1, "line");
245321
245330
  gridLine.setAttribute("x1", String(CHART_PADDING.left));
245322
245331
  gridLine.setAttribute("y1", String(tickY));
245323
245332
  gridLine.setAttribute("x2", String(CHART_PADDING.left + plotWidth));
@@ -245334,14 +245343,14 @@ function renderLegend(doc$12, svg2, series, height) {
245334
245343
  for (let si = 0;si < series.length; si++) {
245335
245344
  const s2 = series[si];
245336
245345
  const color2 = SERIES_COLORS[si % SERIES_COLORS.length];
245337
- const swatch = doc$12.createElementNS(SVG_NS, "rect");
245346
+ const swatch = doc$12.createElementNS(SVG_NS$1, "rect");
245338
245347
  swatch.setAttribute("x", String(legendX));
245339
245348
  swatch.setAttribute("y", String(legendY - 8));
245340
245349
  swatch.setAttribute("width", "10");
245341
245350
  swatch.setAttribute("height", "10");
245342
245351
  swatch.setAttribute("fill", color2);
245343
245352
  svg2.appendChild(swatch);
245344
- const label = doc$12.createElementNS(SVG_NS, "text");
245353
+ const label = doc$12.createElementNS(SVG_NS$1, "text");
245345
245354
  label.setAttribute("x", String(legendX + 14));
245346
245355
  label.setAttribute("y", String(legendY));
245347
245356
  label.setAttribute("font-size", "10");
@@ -245353,7 +245362,7 @@ function renderLegend(doc$12, svg2, series, height) {
245353
245362
  }
245354
245363
  }
245355
245364
  function renderTruncationIndicator(doc$12, svg2, width) {
245356
- const indicator = doc$12.createElementNS(SVG_NS, "text");
245365
+ const indicator = doc$12.createElementNS(SVG_NS$1, "text");
245357
245366
  indicator.setAttribute("x", String(width - 8));
245358
245367
  indicator.setAttribute("y", "14");
245359
245368
  indicator.setAttribute("text-anchor", "end");
@@ -245401,7 +245410,7 @@ function pointY(layout, value) {
245401
245410
  return CHART_PADDING.top + layout.plotHeight - (value - layout.minValue) / layout.valueRange * layout.plotHeight;
245402
245411
  }
245403
245412
  function renderCartesianAxes(doc$12, svg2, layout) {
245404
- const vAxis = doc$12.createElementNS(SVG_NS, "line");
245413
+ const vAxis = doc$12.createElementNS(SVG_NS$1, "line");
245405
245414
  vAxis.setAttribute("x1", String(CHART_PADDING.left));
245406
245415
  vAxis.setAttribute("y1", String(CHART_PADDING.top));
245407
245416
  vAxis.setAttribute("x2", String(CHART_PADDING.left));
@@ -245409,7 +245418,7 @@ function renderCartesianAxes(doc$12, svg2, layout) {
245409
245418
  vAxis.setAttribute("stroke", AXIS_COLOR);
245410
245419
  vAxis.setAttribute("stroke-width", "1");
245411
245420
  svg2.appendChild(vAxis);
245412
- const hAxis = doc$12.createElementNS(SVG_NS, "line");
245421
+ const hAxis = doc$12.createElementNS(SVG_NS$1, "line");
245413
245422
  hAxis.setAttribute("x1", String(CHART_PADDING.left));
245414
245423
  hAxis.setAttribute("y1", String(layout.baselineY));
245415
245424
  hAxis.setAttribute("x2", String(CHART_PADDING.left + layout.plotWidth));
@@ -245423,7 +245432,7 @@ function renderPointCategoryLabels(doc$12, svg2, categories, layout, width) {
245423
245432
  const categoryCount = Math.max(1, labels.length);
245424
245433
  const fontSize = Math.max(8, Math.min(12, width / categoryCount / 4));
245425
245434
  for (let i4 = 0;i4 < labels.length; i4++) {
245426
- const label = doc$12.createElementNS(SVG_NS, "text");
245435
+ const label = doc$12.createElementNS(SVG_NS$1, "text");
245427
245436
  label.setAttribute("x", String(pointX(layout, i4)));
245428
245437
  label.setAttribute("y", String(CHART_PADDING.top + layout.plotHeight + 16));
245429
245438
  label.setAttribute("text-anchor", "middle");
@@ -245440,7 +245449,7 @@ function renderCartesianValueTicks(doc$12, svg2, layout, height) {
245440
245449
  for (let i4 = 0;i4 <= VALUE_TICK_COUNT; i4++) {
245441
245450
  const tickValue = layout.minValue + tickStep * i4;
245442
245451
  const tickY = CHART_PADDING.top + layout.plotHeight - layout.plotHeight * (tickValue - layout.minValue) / layout.valueRange;
245443
- const label = doc$12.createElementNS(SVG_NS, "text");
245452
+ const label = doc$12.createElementNS(SVG_NS$1, "text");
245444
245453
  label.setAttribute("x", String(CHART_PADDING.left - 6));
245445
245454
  label.setAttribute("y", String(tickY + 3));
245446
245455
  label.setAttribute("text-anchor", "end");
@@ -245450,7 +245459,7 @@ function renderCartesianValueTicks(doc$12, svg2, layout, height) {
245450
245459
  label.textContent = formatTickValue(tickValue);
245451
245460
  svg2.appendChild(label);
245452
245461
  if (i4 > 0 && i4 < VALUE_TICK_COUNT) {
245453
- const grid = doc$12.createElementNS(SVG_NS, "line");
245462
+ const grid = doc$12.createElementNS(SVG_NS$1, "line");
245454
245463
  grid.setAttribute("x1", String(CHART_PADDING.left));
245455
245464
  grid.setAttribute("y1", String(tickY));
245456
245465
  grid.setAttribute("x2", String(CHART_PADDING.left + layout.plotWidth));
@@ -245528,7 +245537,7 @@ function xyToSvgY(layout, yValue) {
245528
245537
  return CHART_PADDING.top + layout.plotHeight - (yValue - layout.minY) / layout.yRange * layout.plotHeight;
245529
245538
  }
245530
245539
  function renderXYAxes(doc$12, svg2, layout) {
245531
- const yAxis = doc$12.createElementNS(SVG_NS, "line");
245540
+ const yAxis = doc$12.createElementNS(SVG_NS$1, "line");
245532
245541
  yAxis.setAttribute("x1", String(layout.axisX));
245533
245542
  yAxis.setAttribute("y1", String(CHART_PADDING.top));
245534
245543
  yAxis.setAttribute("x2", String(layout.axisX));
@@ -245536,7 +245545,7 @@ function renderXYAxes(doc$12, svg2, layout) {
245536
245545
  yAxis.setAttribute("stroke", AXIS_COLOR);
245537
245546
  yAxis.setAttribute("stroke-width", "1");
245538
245547
  svg2.appendChild(yAxis);
245539
- const xAxis = doc$12.createElementNS(SVG_NS, "line");
245548
+ const xAxis = doc$12.createElementNS(SVG_NS$1, "line");
245540
245549
  xAxis.setAttribute("x1", String(CHART_PADDING.left));
245541
245550
  xAxis.setAttribute("y1", String(layout.axisY));
245542
245551
  xAxis.setAttribute("x2", String(CHART_PADDING.left + layout.plotWidth));
@@ -245551,7 +245560,7 @@ function renderXYTicks(doc$12, svg2, layout, height) {
245551
245560
  const tickRatio = i4 / VALUE_TICK_COUNT;
245552
245561
  const yValue = layout.minY + layout.yRange * tickRatio;
245553
245562
  const y$1 = CHART_PADDING.top + layout.plotHeight - layout.plotHeight * tickRatio;
245554
- const yLabel = doc$12.createElementNS(SVG_NS, "text");
245563
+ const yLabel = doc$12.createElementNS(SVG_NS$1, "text");
245555
245564
  yLabel.setAttribute("x", String(CHART_PADDING.left - 6));
245556
245565
  yLabel.setAttribute("y", String(y$1 + 3));
245557
245566
  yLabel.setAttribute("text-anchor", "end");
@@ -245561,7 +245570,7 @@ function renderXYTicks(doc$12, svg2, layout, height) {
245561
245570
  yLabel.textContent = formatTickValue(yValue);
245562
245571
  svg2.appendChild(yLabel);
245563
245572
  if (i4 > 0 && i4 < VALUE_TICK_COUNT) {
245564
- const grid = doc$12.createElementNS(SVG_NS, "line");
245573
+ const grid = doc$12.createElementNS(SVG_NS$1, "line");
245565
245574
  grid.setAttribute("x1", String(CHART_PADDING.left));
245566
245575
  grid.setAttribute("y1", String(y$1));
245567
245576
  grid.setAttribute("x2", String(CHART_PADDING.left + layout.plotWidth));
@@ -245572,7 +245581,7 @@ function renderXYTicks(doc$12, svg2, layout, height) {
245572
245581
  }
245573
245582
  const xValue = layout.minX + layout.xRange * tickRatio;
245574
245583
  const x = CHART_PADDING.left + layout.plotWidth * tickRatio;
245575
- const xLabel = doc$12.createElementNS(SVG_NS, "text");
245584
+ const xLabel = doc$12.createElementNS(SVG_NS$1, "text");
245576
245585
  xLabel.setAttribute("x", String(x));
245577
245586
  xLabel.setAttribute("y", String(CHART_PADDING.top + layout.plotHeight + 16));
245578
245587
  xLabel.setAttribute("text-anchor", "middle");
@@ -245603,7 +245612,7 @@ function renderScatterChart(doc$12, container, chart, geometry) {
245603
245612
  if (estimated > SVG_ELEMENT_BUDGET)
245604
245613
  return createChartPlaceholder(doc$12, container, `Chart too complex for inline rendering (${estimated} elements)`);
245605
245614
  const layout = toXYLayout(width, height, allPoints, false);
245606
- const svg2 = doc$12.createElementNS(SVG_NS, "svg");
245615
+ const svg2 = doc$12.createElementNS(SVG_NS$1, "svg");
245607
245616
  svg2.setAttribute("viewBox", `0 0 ${width} ${height}`);
245608
245617
  svg2.setAttribute("width", "100%");
245609
245618
  svg2.setAttribute("height", "100%");
@@ -245614,7 +245623,7 @@ function renderScatterChart(doc$12, container, chart, geometry) {
245614
245623
  const points = pointsBySeries[si];
245615
245624
  const color2 = SERIES_COLORS[si % SERIES_COLORS.length];
245616
245625
  for (const point5 of points) {
245617
- const marker = doc$12.createElementNS(SVG_NS, "circle");
245626
+ const marker = doc$12.createElementNS(SVG_NS$1, "circle");
245618
245627
  marker.setAttribute("cx", String(xyToSvgX(layout, point5.x)));
245619
245628
  marker.setAttribute("cy", String(xyToSvgY(layout, point5.y)));
245620
245629
  marker.setAttribute("r", "3");
@@ -245644,7 +245653,7 @@ function renderBubbleChart(doc$12, container, chart, geometry) {
245644
245653
  const layout = toXYLayout(width, height, allPoints, false);
245645
245654
  const allSizes = allPoints.map((point5) => point5.size).filter((size$1) => size$1 != null && size$1 > 0);
245646
245655
  const maxBubbleSize = allSizes.length ? Math.max(...allSizes) : 1;
245647
- const svg2 = doc$12.createElementNS(SVG_NS, "svg");
245656
+ const svg2 = doc$12.createElementNS(SVG_NS$1, "svg");
245648
245657
  svg2.setAttribute("viewBox", `0 0 ${width} ${height}`);
245649
245658
  svg2.setAttribute("width", "100%");
245650
245659
  svg2.setAttribute("height", "100%");
@@ -245657,7 +245666,7 @@ function renderBubbleChart(doc$12, container, chart, geometry) {
245657
245666
  for (const point5 of points) {
245658
245667
  const size$1 = point5.size && point5.size > 0 ? point5.size : maxBubbleSize * 0.5;
245659
245668
  const radius = maxBubbleSize > 0 ? 4 + size$1 / maxBubbleSize * 10 : 6;
245660
- const bubble = doc$12.createElementNS(SVG_NS, "circle");
245669
+ const bubble = doc$12.createElementNS(SVG_NS$1, "circle");
245661
245670
  bubble.setAttribute("cx", String(xyToSvgX(layout, point5.x)));
245662
245671
  bubble.setAttribute("cy", String(xyToSvgY(layout, point5.y)));
245663
245672
  bubble.setAttribute("r", String(Math.max(2, radius)));
@@ -245695,7 +245704,7 @@ function renderRadarChart(doc$12, container, chart, geometry) {
245695
245704
  const maxValue = allValues.length ? Math.max(...allValues) : 1;
245696
245705
  const minValue = allValues.length ? Math.min(...allValues) : 0;
245697
245706
  const valueRange = Math.max(1, maxValue - Math.min(0, minValue));
245698
- const svg2 = doc$12.createElementNS(SVG_NS, "svg");
245707
+ const svg2 = doc$12.createElementNS(SVG_NS$1, "svg");
245699
245708
  svg2.setAttribute("viewBox", `0 0 ${width} ${height}`);
245700
245709
  svg2.setAttribute("width", "100%");
245701
245710
  svg2.setAttribute("height", "100%");
@@ -245712,7 +245721,7 @@ function renderRadarChart(doc$12, container, chart, geometry) {
245712
245721
  const angle = -Math.PI / 2 + i4 * Math.PI * 2 / categoryCount;
245713
245722
  ringPoints.push(`${centerX + ringRadius * Math.cos(angle)},${centerY + ringRadius * Math.sin(angle)}`);
245714
245723
  }
245715
- const polygon = doc$12.createElementNS(SVG_NS, "polygon");
245724
+ const polygon = doc$12.createElementNS(SVG_NS$1, "polygon");
245716
245725
  polygon.setAttribute("points", ringPoints.join(" "));
245717
245726
  polygon.setAttribute("fill", "none");
245718
245727
  polygon.setAttribute("stroke", GRID_COLOR);
@@ -245723,7 +245732,7 @@ function renderRadarChart(doc$12, container, chart, geometry) {
245723
245732
  const angle = -Math.PI / 2 + i4 * Math.PI * 2 / categoryCount;
245724
245733
  const x = centerX + radius * Math.cos(angle);
245725
245734
  const y$1 = centerY + radius * Math.sin(angle);
245726
- const spoke = doc$12.createElementNS(SVG_NS, "line");
245735
+ const spoke = doc$12.createElementNS(SVG_NS$1, "line");
245727
245736
  spoke.setAttribute("x1", String(centerX));
245728
245737
  spoke.setAttribute("y1", String(centerY));
245729
245738
  spoke.setAttribute("x2", String(x));
@@ -245734,7 +245743,7 @@ function renderRadarChart(doc$12, container, chart, geometry) {
245734
245743
  const labelRadius = radius + 14;
245735
245744
  const labelX = centerX + labelRadius * Math.cos(angle);
245736
245745
  const labelY = centerY + labelRadius * Math.sin(angle);
245737
- const label = doc$12.createElementNS(SVG_NS, "text");
245746
+ const label = doc$12.createElementNS(SVG_NS$1, "text");
245738
245747
  label.setAttribute("x", String(labelX));
245739
245748
  label.setAttribute("y", String(labelY));
245740
245749
  label.setAttribute("font-size", "10");
@@ -245763,7 +245772,7 @@ function renderRadarChart(doc$12, container, chart, geometry) {
245763
245772
  });
245764
245773
  }
245765
245774
  if (points.length > 0) {
245766
- const polygon = doc$12.createElementNS(SVG_NS, "polygon");
245775
+ const polygon = doc$12.createElementNS(SVG_NS$1, "polygon");
245767
245776
  polygon.setAttribute("points", points.join(" "));
245768
245777
  polygon.setAttribute("fill", color2);
245769
245778
  polygon.setAttribute("fill-opacity", "0.18");
@@ -245772,7 +245781,7 @@ function renderRadarChart(doc$12, container, chart, geometry) {
245772
245781
  svg2.appendChild(polygon);
245773
245782
  }
245774
245783
  for (const point5 of pointPositions) {
245775
- const marker = doc$12.createElementNS(SVG_NS, "circle");
245784
+ const marker = doc$12.createElementNS(SVG_NS$1, "circle");
245776
245785
  marker.setAttribute("cx", String(point5.x));
245777
245786
  marker.setAttribute("cy", String(point5.y));
245778
245787
  marker.setAttribute("r", "2.5");
@@ -245827,7 +245836,7 @@ function renderPieSlices(doc$12, svg2, slices, centerX, centerY, radius) {
245827
245836
  continue;
245828
245837
  const sweep = slice2.value / total * Math.PI * 2;
245829
245838
  if (sweep >= Math.PI * 2 - 0.0001) {
245830
- const full = doc$12.createElementNS(SVG_NS, "circle");
245839
+ const full = doc$12.createElementNS(SVG_NS$1, "circle");
245831
245840
  full.setAttribute("cx", String(centerX));
245832
245841
  full.setAttribute("cy", String(centerY));
245833
245842
  full.setAttribute("r", String(radius));
@@ -245843,7 +245852,7 @@ function renderPieSlices(doc$12, svg2, slices, centerX, centerY, radius) {
245843
245852
  const x2 = centerX + radius * Math.cos(end$1);
245844
245853
  const y2 = centerY + radius * Math.sin(end$1);
245845
245854
  const largeArc = sweep > Math.PI ? 1 : 0;
245846
- const path2 = doc$12.createElementNS(SVG_NS, "path");
245855
+ const path2 = doc$12.createElementNS(SVG_NS$1, "path");
245847
245856
  path2.setAttribute("d", `M ${centerX} ${centerY} L ${x1} ${y1} A ${radius} ${radius} 0 ${largeArc} 1 ${x2} ${y2} Z`);
245848
245857
  path2.setAttribute("fill", slice2.color);
245849
245858
  path2.setAttribute("stroke", "#fff");
@@ -245857,14 +245866,14 @@ function renderPieLegend(doc$12, svg2, slices, width, height) {
245857
245866
  let legendX = Math.max(10, (width - totalWidth) / 2);
245858
245867
  const legendY = height - 14;
245859
245868
  for (const slice2 of slices) {
245860
- const swatch = doc$12.createElementNS(SVG_NS, "rect");
245869
+ const swatch = doc$12.createElementNS(SVG_NS$1, "rect");
245861
245870
  swatch.setAttribute("x", String(legendX));
245862
245871
  swatch.setAttribute("y", String(legendY - 8));
245863
245872
  swatch.setAttribute("width", "10");
245864
245873
  swatch.setAttribute("height", "10");
245865
245874
  swatch.setAttribute("fill", slice2.color);
245866
245875
  svg2.appendChild(swatch);
245867
- const label = doc$12.createElementNS(SVG_NS, "text");
245876
+ const label = doc$12.createElementNS(SVG_NS$1, "text");
245868
245877
  label.setAttribute("x", String(legendX + 14));
245869
245878
  label.setAttribute("y", String(legendY));
245870
245879
  label.setAttribute("font-size", "10");
@@ -245895,13 +245904,13 @@ function renderPieChart(doc$12, container, chart, geometry) {
245895
245904
  const centerX = width / 2;
245896
245905
  const centerY = titleSpace + plotHeight / 2;
245897
245906
  const radius = Math.max(8, Math.min(plotWidth, plotHeight) * 0.45);
245898
- const svg2 = doc$12.createElementNS(SVG_NS, "svg");
245907
+ const svg2 = doc$12.createElementNS(SVG_NS$1, "svg");
245899
245908
  svg2.setAttribute("viewBox", `0 0 ${width} ${height}`);
245900
245909
  svg2.setAttribute("width", "100%");
245901
245910
  svg2.setAttribute("height", "100%");
245902
245911
  svg2.style.display = "block";
245903
245912
  if (hasTitle) {
245904
- const titleEl = doc$12.createElementNS(SVG_NS, "text");
245913
+ const titleEl = doc$12.createElementNS(SVG_NS$1, "text");
245905
245914
  titleEl.setAttribute("x", String(centerX));
245906
245915
  titleEl.setAttribute("y", "24");
245907
245916
  titleEl.setAttribute("text-anchor", "middle");
@@ -245928,7 +245937,7 @@ function renderLineChart(doc$12, container, chart, geometry) {
245928
245937
  if (estimated > SVG_ELEMENT_BUDGET)
245929
245938
  return createChartPlaceholder(doc$12, container, `Chart too complex for inline rendering (${estimated} elements)`);
245930
245939
  const layout = toCartesianLayout(width, height, series, false);
245931
- const svg2 = doc$12.createElementNS(SVG_NS, "svg");
245940
+ const svg2 = doc$12.createElementNS(SVG_NS$1, "svg");
245932
245941
  svg2.setAttribute("viewBox", `0 0 ${width} ${height}`);
245933
245942
  svg2.setAttribute("width", "100%");
245934
245943
  svg2.setAttribute("height", "100%");
@@ -245947,14 +245956,14 @@ function renderLineChart(doc$12, container, chart, geometry) {
245947
245956
  }
245948
245957
  if (points.length === 0)
245949
245958
  continue;
245950
- const line = doc$12.createElementNS(SVG_NS, "polyline");
245959
+ const line = doc$12.createElementNS(SVG_NS$1, "polyline");
245951
245960
  line.setAttribute("points", points.join(" "));
245952
245961
  line.setAttribute("fill", "none");
245953
245962
  line.setAttribute("stroke", color2);
245954
245963
  line.setAttribute("stroke-width", "2");
245955
245964
  svg2.appendChild(line);
245956
245965
  for (let i4 = 0;i4 < s2.values.length; i4++) {
245957
- const marker = doc$12.createElementNS(SVG_NS, "circle");
245966
+ const marker = doc$12.createElementNS(SVG_NS$1, "circle");
245958
245967
  marker.setAttribute("cx", String(pointX(layout, i4)));
245959
245968
  marker.setAttribute("cy", String(pointY(layout, s2.values[i4] ?? 0)));
245960
245969
  marker.setAttribute("r", "2.5");
@@ -245978,7 +245987,7 @@ function renderAreaChart(doc$12, container, chart, geometry) {
245978
245987
  if (estimated > SVG_ELEMENT_BUDGET)
245979
245988
  return createChartPlaceholder(doc$12, container, `Chart too complex for inline rendering (${estimated} elements)`);
245980
245989
  const layout = toCartesianLayout(width, height, series, true);
245981
- const svg2 = doc$12.createElementNS(SVG_NS, "svg");
245990
+ const svg2 = doc$12.createElementNS(SVG_NS$1, "svg");
245982
245991
  svg2.setAttribute("viewBox", `0 0 ${width} ${height}`);
245983
245992
  svg2.setAttribute("width", "100%");
245984
245993
  svg2.setAttribute("height", "100%");
@@ -245996,7 +246005,7 @@ function renderAreaChart(doc$12, container, chart, geometry) {
245996
246005
  pathParts.push(`L ${pointX(layout, i4)} ${pointY(layout, s2.values[i4] ?? 0)}`);
245997
246006
  const lastX = pointX(layout, Math.max(0, s2.values.length - 1));
245998
246007
  pathParts.push(`L ${lastX} ${layout.baselineY} Z`);
245999
- const area = doc$12.createElementNS(SVG_NS, "path");
246008
+ const area = doc$12.createElementNS(SVG_NS$1, "path");
246000
246009
  area.setAttribute("d", pathParts.join(" "));
246001
246010
  area.setAttribute("fill", color2);
246002
246011
  area.setAttribute("fill-opacity", "0.35");
@@ -246021,7 +246030,7 @@ function renderDoughnutSlices(doc$12, svg2, slices, centerX, centerY, outerRadiu
246021
246030
  continue;
246022
246031
  const sweep = slice2.value / total * Math.PI * 2;
246023
246032
  if (sweep >= Math.PI * 2 - 0.0001) {
246024
- const ring = doc$12.createElementNS(SVG_NS, "circle");
246033
+ const ring = doc$12.createElementNS(SVG_NS$1, "circle");
246025
246034
  ring.setAttribute("cx", String(centerX));
246026
246035
  ring.setAttribute("cy", String(centerY));
246027
246036
  ring.setAttribute("r", String((outerRadius + innerRadius) / 2));
@@ -246041,7 +246050,7 @@ function renderDoughnutSlices(doc$12, svg2, slices, centerX, centerY, outerRadiu
246041
246050
  const ix2 = centerX + innerRadius * Math.cos(end$1);
246042
246051
  const iy2 = centerY + innerRadius * Math.sin(end$1);
246043
246052
  const largeArc = sweep > Math.PI ? 1 : 0;
246044
- const path2 = doc$12.createElementNS(SVG_NS, "path");
246053
+ const path2 = doc$12.createElementNS(SVG_NS$1, "path");
246045
246054
  path2.setAttribute("d", `M ${x1} ${y1} A ${outerRadius} ${outerRadius} 0 ${largeArc} 1 ${x2} ${y2} L ${ix2} ${iy2} A ${innerRadius} ${innerRadius} 0 ${largeArc} 0 ${ix1} ${iy1} Z`);
246046
246055
  path2.setAttribute("fill", slice2.color);
246047
246056
  path2.setAttribute("stroke", "#fff");
@@ -246071,13 +246080,13 @@ function renderDoughnutChart(doc$12, container, chart, geometry) {
246071
246080
  const centerY = titleSpace + plotHeight / 2;
246072
246081
  const outerRadius = Math.max(8, Math.min(plotWidth, plotHeight) * 0.45);
246073
246082
  const innerRadius = Math.max(2, outerRadius * 0.58);
246074
- const svg2 = doc$12.createElementNS(SVG_NS, "svg");
246083
+ const svg2 = doc$12.createElementNS(SVG_NS$1, "svg");
246075
246084
  svg2.setAttribute("viewBox", `0 0 ${width} ${height}`);
246076
246085
  svg2.setAttribute("width", "100%");
246077
246086
  svg2.setAttribute("height", "100%");
246078
246087
  svg2.style.display = "block";
246079
246088
  if (hasTitle) {
246080
- const titleEl = doc$12.createElementNS(SVG_NS, "text");
246089
+ const titleEl = doc$12.createElementNS(SVG_NS$1, "text");
246081
246090
  titleEl.setAttribute("x", String(centerX));
246082
246091
  titleEl.setAttribute("y", "24");
246083
246092
  titleEl.setAttribute("text-anchor", "middle");
@@ -246111,7 +246120,7 @@ function renderBarChart(doc$12, container, chart, geometry) {
246111
246120
  const estimated = estimateSvgElements(series, categories, hasLegend);
246112
246121
  if (estimated > SVG_ELEMENT_BUDGET)
246113
246122
  return createChartPlaceholder(doc$12, container, `Chart too complex for inline rendering (${estimated} elements)`);
246114
- const svg2 = doc$12.createElementNS(SVG_NS, "svg");
246123
+ const svg2 = doc$12.createElementNS(SVG_NS$1, "svg");
246115
246124
  svg2.setAttribute("viewBox", `0 0 ${width} ${height}`);
246116
246125
  svg2.setAttribute("width", "100%");
246117
246126
  svg2.setAttribute("height", "100%");
@@ -251699,7 +251708,21 @@ function computeFragmentBottom(fragment2, block, measure) {
251699
251708
  }
251700
251709
  return bottom$1;
251701
251710
  }
251702
- function shouldExcludeFromMeasurement(fragment2, block, canvasHeight) {
251711
+ function rangesIntersect(startA, endA, startB, endB) {
251712
+ return endA > startB && startA < endB;
251713
+ }
251714
+ function getPageRelativeMeasurementBand(kind, constraints) {
251715
+ if (!kind || !constraints.margins)
251716
+ return null;
251717
+ const bandSize = kind === "header" ? constraints.margins.top : constraints.margins.bottom;
251718
+ if (!Number.isFinite(bandSize) || bandSize == null || bandSize <= 0)
251719
+ return null;
251720
+ return {
251721
+ start: 0,
251722
+ end: bandSize
251723
+ };
251724
+ }
251725
+ function shouldExcludeFromMeasurement(fragment2, block, fragmentBottom, canvasHeight, kind, constraints) {
251703
251726
  if (!((fragment2.kind === "image" || fragment2.kind === "drawing") && fragment2.isAnchored === true))
251704
251727
  return false;
251705
251728
  if (block.kind !== "image" && block.kind !== "drawing")
@@ -251708,9 +251731,13 @@ function shouldExcludeFromMeasurement(fragment2, block, canvasHeight) {
251708
251731
  if (anchoredBlock.anchor?.behindDoc)
251709
251732
  return true;
251710
251733
  if (isPageRelativeAnchor(anchoredBlock)) {
251711
- const fragmentHeight = fragment2.height ?? 0;
251712
251734
  const fragmentTop = fragment2.y;
251713
- if (fragment2.y + fragmentHeight <= 0 || fragmentTop >= canvasHeight)
251735
+ if (fragmentBottom <= 0 || fragmentTop >= canvasHeight)
251736
+ return true;
251737
+ }
251738
+ if (anchoredBlock.anchor?.vRelativeFrom === "page") {
251739
+ const measurementBand = getPageRelativeMeasurementBand(kind, constraints);
251740
+ if (measurementBand && !rangesIntersect(fragment2.y, fragmentBottom, measurementBand.start, measurementBand.end))
251714
251741
  return true;
251715
251742
  }
251716
251743
  return false;
@@ -251762,7 +251789,7 @@ function layoutHeaderFooter(blocks2, measures, constraints, kind) {
251762
251789
  renderMinY = fragment2.y;
251763
251790
  if (bottom$1 > renderMaxY)
251764
251791
  renderMaxY = bottom$1;
251765
- if (shouldExcludeFromMeasurement(fragment2, block, height))
251792
+ if (shouldExcludeFromMeasurement(fragment2, block, bottom$1, height, kind, constraints))
251766
251793
  continue;
251767
251794
  if (fragment2.y < measureMinY)
251768
251795
  measureMinY = fragment2.y;
@@ -252818,14 +252845,23 @@ function computeSectionMetadataHash(sections) {
252818
252845
  return parts.join("|");
252819
252846
  }
252820
252847
  function computeConstraintsHash(constraints) {
252821
- const { width, height, pageWidth, margins, overflowBaseHeight } = constraints;
252848
+ const { width, height, pageWidth, pageHeight, margins, overflowBaseHeight } = constraints;
252822
252849
  const parts = [`w:${width}`, `h:${height}`];
252823
252850
  if (pageWidth !== undefined)
252824
252851
  parts.push(`pw:${pageWidth}`);
252852
+ if (pageHeight !== undefined)
252853
+ parts.push(`ph:${pageHeight}`);
252825
252854
  if (overflowBaseHeight !== undefined)
252826
252855
  parts.push(`obh:${overflowBaseHeight}`);
252827
- if (margins)
252856
+ if (margins) {
252828
252857
  parts.push(`ml:${margins.left}`, `mr:${margins.right}`);
252858
+ if (margins.top !== undefined)
252859
+ parts.push(`mt:${margins.top}`);
252860
+ if (margins.bottom !== undefined)
252861
+ parts.push(`mb:${margins.bottom}`);
252862
+ if (margins.header !== undefined)
252863
+ parts.push(`mh:${margins.header}`);
252864
+ }
252829
252865
  return parts.join("|");
252830
252866
  }
252831
252867
  function invalidateHeaderFooterCache(cache$2, cacheState, headerBlocks, footerBlocks, constraints, sections) {
@@ -276663,7 +276699,7 @@ var Node$13 = class Node$14 {
276663
276699
  if (current.trim())
276664
276700
  parts.push(current.trim());
276665
276701
  return parts;
276666
- }, MAX_RENDERED_SERIES = 20, MAX_POINTS_PER_SERIES = 500, SVG_ELEMENT_BUDGET = 5000, SERIES_COLORS, AXIS_COLOR = "#595959", GRID_COLOR = "#E0E0E0", LABEL_COLOR = "#333", TICK_LABEL_COLOR = "#666", FONT_FAMILY = "Calibri, Arial, sans-serif", PLACEHOLDER_BG = "#f8f9fa", PLACEHOLDER_BORDER = "#dee2e6", PLACEHOLDER_TEXT_COLOR = "#6c757d", SVG_NS = "http://www.w3.org/2000/svg", CHART_PADDING, VALUE_TICK_COUNT = 5, hashParagraphBorder$1 = (border) => {
276702
+ }, MAX_RENDERED_SERIES = 20, MAX_POINTS_PER_SERIES = 500, SVG_ELEMENT_BUDGET = 5000, SERIES_COLORS, AXIS_COLOR = "#595959", GRID_COLOR = "#E0E0E0", LABEL_COLOR = "#333", TICK_LABEL_COLOR = "#666", FONT_FAMILY = "Calibri, Arial, sans-serif", PLACEHOLDER_BG = "#f8f9fa", PLACEHOLDER_BORDER = "#dee2e6", PLACEHOLDER_TEXT_COLOR = "#6c757d", SVG_NS$1 = "http://www.w3.org/2000/svg", CHART_PADDING, VALUE_TICK_COUNT = 5, hashParagraphBorder$1 = (border) => {
276667
276703
  const parts = [];
276668
276704
  if (border.style !== undefined)
276669
276705
  parts.push(`s:${border.style}`);
@@ -279168,7 +279204,7 @@ var Node$13 = class Node$14 {
279168
279204
  mtable.appendChild(mtr);
279169
279205
  }
279170
279206
  return mtable.childNodes.length > 0 ? mtable : null;
279171
- }, MATHML_NS = "http://www.w3.org/1998/Math/MathML", MATH_OBJECT_REGISTRY, ARGUMENT_ELEMENTS, LIST_MARKER_GAP$1 = 8, DEFAULT_PAGE_HEIGHT_PX = 1056, DEFAULT_VIRTUALIZED_PAGE_GAP = 72, LINK_DATASET_KEYS, MAX_HREF_LENGTH = 2048, SAFE_ANCHOR_PATTERN, MAX_DATA_URL_LENGTH, VALID_IMAGE_DATA_URL, MAX_RESIZE_MULTIPLIER = 3, FALLBACK_MAX_DIMENSION = 1000, MIN_IMAGE_DIMENSION = 20, AMBIGUOUS_LINK_PATTERNS, linkMetrics, TRACK_CHANGE_BASE_CLASS, TRACK_CHANGE_MODIFIER_CLASS, LINK_TARGET_SET, normalizeAnchor$1 = (value) => {
279207
+ }, MATHML_NS = "http://www.w3.org/1998/Math/MathML", MATH_OBJECT_REGISTRY, ARGUMENT_ELEMENTS, LIST_MARKER_GAP$1 = 8, DEFAULT_PAGE_HEIGHT_PX = 1056, DEFAULT_VIRTUALIZED_PAGE_GAP = 72, LINK_DATASET_KEYS, MAX_HREF_LENGTH = 2048, SAFE_ANCHOR_PATTERN, MAX_DATA_URL_LENGTH, VALID_IMAGE_DATA_URL, SVG_NS = "http://www.w3.org/2000/svg", WORDART_LINE_FILL_RATIO = 0.9, MAX_RESIZE_MULTIPLIER = 3, FALLBACK_MAX_DIMENSION = 1000, MIN_IMAGE_DIMENSION = 20, AMBIGUOUS_LINK_PATTERNS, linkMetrics, TRACK_CHANGE_BASE_CLASS, TRACK_CHANGE_MODIFIER_CLASS, LINK_TARGET_SET, normalizeAnchor$1 = (value) => {
279172
279208
  if (typeof value !== "string")
279173
279209
  return null;
279174
279210
  const trimmed = value.trim();
@@ -289283,12 +289319,12 @@ var Node$13 = class Node$14 {
289283
289319
  return;
289284
289320
  console.log(...args$1);
289285
289321
  }, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions;
289286
- var init_src_DlMaB1h_es = __esm(() => {
289322
+ var init_src_oqYJU65d_es = __esm(() => {
289287
289323
  init_rolldown_runtime_Bg48TavK_es();
289288
- init_SuperConverter_BgwP1GeS_es();
289324
+ init_SuperConverter_DUDABEsC_es();
289289
289325
  init_jszip_C49i9kUs_es();
289290
289326
  init_uuid_qzgm05fK_es();
289291
- init_create_headless_toolbar_Dcw4Hyt2_es();
289327
+ init_create_headless_toolbar_B7F814Ir_es();
289292
289328
  init_constants_CGhJRd87_es();
289293
289329
  init_dist_B8HfvhaK_es();
289294
289330
  init_unified_Dsuw2be5_es();
@@ -315845,7 +315881,7 @@ function print() { __p += __j.call(arguments, '') }
315845
315881
  const fragment2 = data.fragments[fi];
315846
315882
  let isBehindDoc = false;
315847
315883
  if (fragment2.kind === "image" || fragment2.kind === "drawing")
315848
- isBehindDoc = fragment2.behindDoc === true || fragment2.behindDoc == null && "zIndex" in fragment2 && fragment2.zIndex === 0;
315884
+ isBehindDoc = fragment2.behindDoc === true || fragment2.behindDoc == null && "zIndex" in fragment2 && fragment2.zIndex === 0 || this.shouldRenderBehindPageContent(fragment2, kind);
315849
315885
  if (isBehindDoc)
315850
315886
  behindDocFragments.push({
315851
315887
  fragment: fragment2,
@@ -316631,26 +316667,13 @@ function print() { __p += __j.call(arguments, '') }
316631
316667
  img2.style.objectPosition = "left top";
316632
316668
  applyImageClipPath(img2, resolveBlockClipPath(block), { clipContainer: fragmentEl });
316633
316669
  img2.style.display = block.display === "inline" ? "inline-block" : "block";
316634
- const transforms = [];
316635
- if (block.rotation != null && block.rotation !== 0) {
316636
- const angleRad = block.rotation * Math.PI / 180;
316637
- const w = block.width ?? fragment2.width;
316638
- const h$2 = block.height ?? fragment2.height;
316639
- const cosA = Math.cos(angleRad);
316640
- const sinA = Math.sin(angleRad);
316641
- const newTopLeftX = w / 2 * (1 - cosA) + h$2 / 2 * sinA;
316642
- const newTopLeftY = w / 2 * sinA + h$2 / 2 * (1 - cosA);
316643
- transforms.push(`translate(${-newTopLeftX}px, ${-newTopLeftY}px)`);
316644
- transforms.push(`rotate(${block.rotation}deg)`);
316645
- }
316646
- if (block.flipH)
316647
- transforms.push("scaleX(-1)");
316648
- if (block.flipV)
316649
- transforms.push("scaleY(-1)");
316650
- if (transforms.length > 0) {
316651
- img2.style.transform = transforms.join(" ");
316652
- img2.style.transformOrigin = "center";
316653
- }
316670
+ this.applyImageGeometryTransform(fragmentEl, {
316671
+ width: block.width ?? fragment2.width,
316672
+ height: block.height ?? fragment2.height,
316673
+ rotation: block.rotation,
316674
+ flipH: block.flipH,
316675
+ flipV: block.flipV
316676
+ });
316654
316677
  const filters = buildImageFilters(block);
316655
316678
  if (filters.length > 0)
316656
316679
  img2.style.filter = filters.join(" ");
@@ -316665,6 +316688,30 @@ function print() { __p += __j.call(arguments, '') }
316665
316688
  return this.createErrorPlaceholder(fragment2.blockId, error3);
316666
316689
  }
316667
316690
  }
316691
+ buildImageGeometryTransform(attrs) {
316692
+ const transforms = [];
316693
+ if (attrs.rotation != null && attrs.rotation !== 0) {
316694
+ const angleRad = attrs.rotation * Math.PI / 180;
316695
+ const cosA = Math.cos(angleRad);
316696
+ const sinA = Math.sin(angleRad);
316697
+ const newTopLeftX = attrs.width / 2 * (1 - cosA) + attrs.height / 2 * sinA;
316698
+ const newTopLeftY = attrs.width / 2 * sinA + attrs.height / 2 * (1 - cosA);
316699
+ transforms.push(`translate(${-newTopLeftX}px, ${-newTopLeftY}px)`);
316700
+ transforms.push(`rotate(${attrs.rotation}deg)`);
316701
+ }
316702
+ if (attrs.flipH)
316703
+ transforms.push("scaleX(-1)");
316704
+ if (attrs.flipV)
316705
+ transforms.push("scaleY(-1)");
316706
+ return transforms.join(" ");
316707
+ }
316708
+ applyImageGeometryTransform(target, attrs) {
316709
+ const transform = this.buildImageGeometryTransform(attrs);
316710
+ if (!transform)
316711
+ return;
316712
+ target.style.transform = transform;
316713
+ target.style.transformOrigin = "center";
316714
+ }
316668
316715
  buildImageHyperlinkAnchor(imageEl, hyperlink, display) {
316669
316716
  if (!hyperlink?.url || !this.doc)
316670
316717
  return imageEl;
@@ -316706,7 +316753,6 @@ function print() { __p += __j.call(arguments, '') }
316706
316753
  })();
316707
316754
  if (!this.doc)
316708
316755
  throw new Error("DomPainter: document is not available");
316709
- const isVectorShapeBlock = block.kind === "drawing" && block.drawingKind === "vectorShape";
316710
316756
  const fragmentEl = this.doc.createElement("div");
316711
316757
  fragmentEl.classList.add(CLASS_NAMES$1.fragment, "superdoc-drawing-fragment");
316712
316758
  applyStyles(fragmentEl, fragmentStyles);
@@ -316729,11 +316775,9 @@ function print() { __p += __j.call(arguments, '') }
316729
316775
  innerWrapper.style.transformOrigin = "center";
316730
316776
  const scale = fragment2.scale ?? 1;
316731
316777
  const transforms = ["translate(-50%, -50%)"];
316732
- if (!isVectorShapeBlock) {
316733
- transforms.push(`rotate(${fragment2.geometry.rotation ?? 0}deg)`);
316734
- transforms.push(`scaleX(${fragment2.geometry.flipH ? -1 : 1})`);
316735
- transforms.push(`scaleY(${fragment2.geometry.flipV ? -1 : 1})`);
316736
- }
316778
+ transforms.push(`rotate(${fragment2.geometry.rotation ?? 0}deg)`);
316779
+ transforms.push(`scaleX(${fragment2.geometry.flipH ? -1 : 1})`);
316780
+ transforms.push(`scaleY(${fragment2.geometry.flipV ? -1 : 1})`);
316737
316781
  transforms.push(`scale(${scale})`);
316738
316782
  innerWrapper.style.transform = transforms.join(" ");
316739
316783
  innerWrapper.appendChild(this.renderDrawingContent(block, fragment2, context));
@@ -316753,7 +316797,7 @@ function print() { __p += __j.call(arguments, '') }
316753
316797
  if (block.drawingKind === "image")
316754
316798
  return this.createDrawingImageElement(block);
316755
316799
  if (block.drawingKind === "vectorShape")
316756
- return this.createVectorShapeElement(block, fragment2.geometry, true, 1, 1, context);
316800
+ return this.createVectorShapeElement(block, fragment2.geometry, false, 1, 1, context);
316757
316801
  if (block.drawingKind === "shapeGroup")
316758
316802
  return this.createShapeGroupElement(block, context);
316759
316803
  if (block.drawingKind === "chart")
@@ -316790,6 +316834,8 @@ function print() { __p += __j.call(arguments, '') }
316790
316834
  contentContainer.style.top = `${offsetY}px`;
316791
316835
  contentContainer.style.width = `${innerWidth}px`;
316792
316836
  contentContainer.style.height = `${innerHeight2}px`;
316837
+ if (applyTransforms && geometry)
316838
+ this.applyVectorShapeTransforms(contentContainer, geometry);
316793
316839
  const customGeomSvg = block.customGeometry ? this.tryCreateCustomGeometrySvg(block, innerWidth, innerHeight2) : null;
316794
316840
  const svgMarkup = !customGeomSvg && block.shapeKind ? this.tryCreatePresetSvg(block, innerWidth, innerHeight2) : null;
316795
316841
  const resolvedSvgMarkup = customGeomSvg || svgMarkup;
@@ -316806,24 +316852,20 @@ function print() { __p += __j.call(arguments, '') }
316806
316852
  applyAlphaToSVG(svgElement, block.fillColor);
316807
316853
  }
316808
316854
  this.applyLineEnds(svgElement, block);
316809
- if (applyTransforms && geometry)
316810
- this.applyVectorShapeTransforms(svgElement, geometry);
316811
316855
  contentContainer.appendChild(svgElement);
316812
- if (block.textContent && block.textContent.parts.length > 0) {
316813
- const textDiv = this.createFallbackTextElement(block.textContent, block.textAlign ?? "center", block.textVerticalAlign, block.textInsets, groupScaleX, groupScaleY, context);
316814
- contentContainer.appendChild(textDiv);
316856
+ if (this.hasShapeTextContent(block.textContent)) {
316857
+ const textElement = this.createShapeTextElement(block, innerWidth, innerHeight2, groupScaleX, groupScaleY, context);
316858
+ contentContainer.appendChild(textElement);
316815
316859
  }
316816
316860
  container.appendChild(contentContainer);
316817
316861
  return container;
316818
316862
  }
316819
316863
  }
316820
316864
  this.applyFallbackShapeStyle(contentContainer, block);
316821
- if (block.textContent && block.textContent.parts.length > 0) {
316822
- const textDiv = this.createFallbackTextElement(block.textContent, block.textAlign ?? "center", block.textVerticalAlign, block.textInsets, groupScaleX, groupScaleY, context);
316823
- contentContainer.appendChild(textDiv);
316865
+ if (this.hasShapeTextContent(block.textContent)) {
316866
+ const textElement = this.createShapeTextElement(block, innerWidth, innerHeight2, groupScaleX, groupScaleY, context);
316867
+ contentContainer.appendChild(textElement);
316824
316868
  }
316825
- if (applyTransforms && geometry)
316826
- this.applyVectorShapeTransforms(contentContainer, geometry);
316827
316869
  container.appendChild(contentContainer);
316828
316870
  return container;
316829
316871
  }
@@ -316850,6 +316892,125 @@ function print() { __p += __j.call(arguments, '') }
316850
316892
  } else
316851
316893
  container.style.border = "1px solid rgba(15, 23, 42, 0.3)";
316852
316894
  }
316895
+ hasShapeTextContent(textContent$1) {
316896
+ return Array.isArray(textContent$1?.parts) && textContent$1.parts.length > 0;
316897
+ }
316898
+ createShapeTextElement(block, width, height, groupScaleX = 1, groupScaleY = 1, context) {
316899
+ const textContent$1 = block.textContent;
316900
+ if (!this.hasShapeTextContent(textContent$1))
316901
+ return this.doc.createElement("div");
316902
+ if (this.shouldUseWordArtTextRenderer(block))
316903
+ return this.createWordArtTextElement(textContent$1, block.textAlign ?? "center", block.textInsets, width, height, context);
316904
+ return this.createFallbackTextElement(textContent$1, block.textAlign ?? "center", block.textVerticalAlign, block.textInsets, groupScaleX, groupScaleY, context);
316905
+ }
316906
+ shouldUseWordArtTextRenderer(block) {
316907
+ return block.attrs?.isWordArt === true && this.hasShapeTextContent(block.textContent);
316908
+ }
316909
+ createWordArtTextElement(textContent$1, textAlign, textInsets, width, height, context) {
316910
+ const svg2 = this.doc.createElementNS(SVG_NS, "svg");
316911
+ svg2.classList.add("superdoc-wordart-text");
316912
+ svg2.setAttribute("xmlns", SVG_NS);
316913
+ svg2.setAttribute("viewBox", `0 0 ${width} ${height}`);
316914
+ svg2.setAttribute("preserveAspectRatio", "none");
316915
+ svg2.style.position = "absolute";
316916
+ svg2.style.left = "0";
316917
+ svg2.style.top = "0";
316918
+ svg2.style.width = "100%";
316919
+ svg2.style.height = "100%";
316920
+ svg2.style.overflow = "visible";
316921
+ svg2.style.pointerEvents = "none";
316922
+ const insets = textInsets ?? {
316923
+ top: 0,
316924
+ right: 0,
316925
+ bottom: 0,
316926
+ left: 0
316927
+ };
316928
+ const availableWidth = Math.max(1, width - insets.left - insets.right);
316929
+ const availableHeight = Math.max(1, height - insets.top - insets.bottom);
316930
+ const lines = this.buildWordArtLines(textContent$1, context);
316931
+ const lineHeight = availableHeight / Math.max(lines.length, 1);
316932
+ const fontSize = Math.max(1, lineHeight * WORDART_LINE_FILL_RATIO);
316933
+ const textAnchor = this.getWordArtTextAnchor(textAlign);
316934
+ const textX = this.getWordArtTextX(textAlign, insets.left, availableWidth);
316935
+ lines.forEach((parts, lineIndex) => {
316936
+ if (parts.length === 0)
316937
+ return;
316938
+ const textEl = this.doc.createElementNS(SVG_NS, "text");
316939
+ textEl.setAttribute("xml:space", "preserve");
316940
+ textEl.setAttribute("x", String(textX));
316941
+ textEl.setAttribute("y", String(insets.top + lineHeight * (lineIndex + 0.5)));
316942
+ textEl.setAttribute("text-anchor", textAnchor);
316943
+ textEl.setAttribute("dominant-baseline", "middle");
316944
+ textEl.setAttribute("font-size", String(fontSize));
316945
+ textEl.setAttribute("textLength", String(availableWidth));
316946
+ textEl.setAttribute("lengthAdjust", "spacingAndGlyphs");
316947
+ parts.forEach((part) => {
316948
+ const tspan = this.doc.createElementNS(SVG_NS, "tspan");
316949
+ tspan.setAttribute("xml:space", "preserve");
316950
+ tspan.textContent = part.text;
316951
+ this.applyWordArtTextFormatting(tspan, part.formatting);
316952
+ textEl.appendChild(tspan);
316953
+ });
316954
+ svg2.appendChild(textEl);
316955
+ });
316956
+ return svg2;
316957
+ }
316958
+ buildWordArtLines(textContent$1, context) {
316959
+ const lines = [[]];
316960
+ textContent$1.parts.forEach((part) => {
316961
+ if (part.isLineBreak) {
316962
+ lines.push([]);
316963
+ return;
316964
+ }
316965
+ const resolvedText = this.resolveShapeTextPartText(part, context);
316966
+ if (!resolvedText)
316967
+ return;
316968
+ lines[lines.length - 1].push({
316969
+ text: resolvedText,
316970
+ formatting: part.formatting
316971
+ });
316972
+ });
316973
+ const nonEmptyLines = lines.filter((line) => line.length > 0);
316974
+ return nonEmptyLines.length > 0 ? nonEmptyLines : [[]];
316975
+ }
316976
+ resolveShapeTextPartText(part, context) {
316977
+ if (part.fieldType === "PAGE")
316978
+ return context?.pageNumberText ?? String(context?.pageNumber ?? 1);
316979
+ if (part.fieldType === "NUMPAGES")
316980
+ return String(context?.totalPages ?? 1);
316981
+ return part.text;
316982
+ }
316983
+ getWordArtTextAnchor(textAlign) {
316984
+ if (textAlign === "right" || textAlign === "r")
316985
+ return "end";
316986
+ if (textAlign === "center")
316987
+ return "middle";
316988
+ return "start";
316989
+ }
316990
+ getWordArtTextX(textAlign, leftInset, availableWidth) {
316991
+ if (textAlign === "right" || textAlign === "r")
316992
+ return leftInset + availableWidth;
316993
+ if (textAlign === "center")
316994
+ return leftInset + availableWidth / 2;
316995
+ return leftInset;
316996
+ }
316997
+ applyWordArtTextFormatting(element3, formatting) {
316998
+ if (!formatting)
316999
+ return;
317000
+ if (formatting.bold)
317001
+ element3.setAttribute("font-weight", "bold");
317002
+ if (formatting.italic)
317003
+ element3.setAttribute("font-style", "italic");
317004
+ if (formatting.fontFamily)
317005
+ element3.setAttribute("font-family", formatting.fontFamily);
317006
+ if (formatting.color) {
317007
+ const validatedColor = validateHexColor(formatting.color);
317008
+ if (validatedColor)
317009
+ element3.setAttribute("fill", validatedColor);
317010
+ }
317011
+ if (formatting.letterSpacing != null)
317012
+ element3.setAttribute("letter-spacing", String(formatting.letterSpacing));
317013
+ }
316853
317014
  createFallbackTextElement(textContent$1, textAlign, textVerticalAlign, textInsets, groupScaleX = 1, groupScaleY = 1, context) {
316854
317015
  const textDiv = this.doc.createElement("div");
316855
317016
  textDiv.style.position = "absolute";
@@ -316887,13 +317048,6 @@ function print() { __p += __j.call(arguments, '') }
316887
317048
  currentParagraph.style.width = "100%";
316888
317049
  currentParagraph.style.minWidth = "0";
316889
317050
  currentParagraph.style.whiteSpace = "normal";
316890
- const resolvePartText = (part) => {
316891
- if (part.fieldType === "PAGE")
316892
- return context?.pageNumberText ?? String(context?.pageNumber ?? 1);
316893
- if (part.fieldType === "NUMPAGES")
316894
- return String(context?.totalPages ?? 1);
316895
- return part.text;
316896
- };
316897
317051
  textContent$1.parts.forEach((part) => {
316898
317052
  if (part.isLineBreak) {
316899
317053
  textDiv.appendChild(currentParagraph);
@@ -316905,7 +317059,7 @@ function print() { __p += __j.call(arguments, '') }
316905
317059
  currentParagraph.style.minHeight = "1em";
316906
317060
  } else {
316907
317061
  const span = this.doc.createElement("span");
316908
- span.textContent = resolvePartText(part);
317062
+ span.textContent = this.resolveShapeTextPartText(part, context);
316909
317063
  if (part.formatting) {
316910
317064
  if (part.formatting.bold)
316911
317065
  span.style.fontWeight = "bold";
@@ -318460,6 +318614,20 @@ function print() { __p += __j.call(arguments, '') }
318460
318614
  isAnchoredMediaFragment(fragment2) {
318461
318615
  return (fragment2.kind === "image" || fragment2.kind === "drawing") && fragment2.isAnchored === true;
318462
318616
  }
318617
+ shouldRenderBehindPageContent(fragment2, section) {
318618
+ if (fragment2.behindDoc === true || fragment2.behindDoc == null && "zIndex" in fragment2 && fragment2.zIndex === 0)
318619
+ return true;
318620
+ return section === "header" && fragment2.kind === "drawing" && this.isHeaderWordArtWatermark(fragment2);
318621
+ }
318622
+ isHeaderWordArtWatermark(fragment2) {
318623
+ const lookup3 = this.blockLookup.get(fragment2.blockId);
318624
+ if (!lookup3 || lookup3.block.kind !== "drawing" || lookup3.block.drawingKind !== "vectorShape")
318625
+ return false;
318626
+ const block = lookup3.block;
318627
+ const attrs = block.attrs ?? {};
318628
+ const hasTextContent = Array.isArray(block.textContent?.parts) && block.textContent.parts.length > 0;
318629
+ return attrs.isWordArt === true && attrs.isTextBox === true && hasTextContent && block.anchor?.isAnchored === true && block.anchor.hRelativeFrom === "page" && block.anchor.alignH === "center" && block.anchor.vRelativeFrom === "page" && block.anchor.alignV === "center" && block.wrap?.type === "None";
318630
+ }
318463
318631
  resolveFragmentWrapperZIndex(fragment2, resolvedZIndex) {
318464
318632
  if (!this.isAnchoredMediaFragment(fragment2))
318465
318633
  return "";
@@ -323901,11 +324069,11 @@ var init_zipper_DbkgrypV_es = __esm(() => {
323901
324069
 
323902
324070
  // ../../packages/superdoc/dist/super-editor.es.js
323903
324071
  var init_super_editor_es = __esm(() => {
323904
- init_src_DlMaB1h_es();
323905
- init_SuperConverter_BgwP1GeS_es();
324072
+ init_src_oqYJU65d_es();
324073
+ init_SuperConverter_DUDABEsC_es();
323906
324074
  init_jszip_C49i9kUs_es();
323907
324075
  init_xml_js_CqGKpaft_es();
323908
- init_create_headless_toolbar_Dcw4Hyt2_es();
324076
+ init_create_headless_toolbar_B7F814Ir_es();
323909
324077
  init_constants_CGhJRd87_es();
323910
324078
  init_dist_B8HfvhaK_es();
323911
324079
  init_unified_Dsuw2be5_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.7.0-next.20",
3
+ "version": "0.7.0-next.22",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -24,21 +24,21 @@
24
24
  "@types/node": "22.19.2",
25
25
  "@types/ws": "^8.5.13",
26
26
  "typescript": "^5.9.2",
27
- "@superdoc/pm-adapter": "0.0.0",
27
+ "@superdoc/document-api": "0.0.1",
28
28
  "@superdoc/super-editor": "0.0.1",
29
- "superdoc": "1.26.0",
30
- "@superdoc/document-api": "0.0.1"
29
+ "@superdoc/pm-adapter": "0.0.0",
30
+ "superdoc": "1.26.0"
31
31
  },
32
32
  "module": "src/index.ts",
33
33
  "publishConfig": {
34
34
  "access": "public"
35
35
  },
36
36
  "optionalDependencies": {
37
- "@superdoc-dev/cli-darwin-arm64": "0.7.0-next.20",
38
- "@superdoc-dev/cli-darwin-x64": "0.7.0-next.20",
39
- "@superdoc-dev/cli-linux-arm64": "0.7.0-next.20",
40
- "@superdoc-dev/cli-windows-x64": "0.7.0-next.20",
41
- "@superdoc-dev/cli-linux-x64": "0.7.0-next.20"
37
+ "@superdoc-dev/cli-darwin-arm64": "0.7.0-next.22",
38
+ "@superdoc-dev/cli-darwin-x64": "0.7.0-next.22",
39
+ "@superdoc-dev/cli-linux-x64": "0.7.0-next.22",
40
+ "@superdoc-dev/cli-linux-arm64": "0.7.0-next.22",
41
+ "@superdoc-dev/cli-windows-x64": "0.7.0-next.22"
42
42
  },
43
43
  "scripts": {
44
44
  "predev": "node scripts/ensure-superdoc-build.js",