@superdoc-dev/mcp 0.14.0 → 0.15.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 (2) hide show
  1. package/dist/index.js +2256 -632
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -50479,7 +50479,7 @@ var init_remark_gfm_BUJjZJLy_es = __esm(() => {
50479
50479
  emptyOptions2 = {};
50480
50480
  });
50481
50481
 
50482
- // ../../packages/superdoc/dist/chunks/SuperConverter-DQ2wMaLK.es.js
50482
+ // ../../packages/superdoc/dist/chunks/SuperConverter-18ny5wUo.es.js
50483
50483
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
50484
50484
  const fieldValue = extension$1.config[field];
50485
50485
  if (typeof fieldValue === "function")
@@ -65160,6 +65160,34 @@ function extractLineEnds(spPr) {
65160
65160
  tail: tailConfig ?? undefined
65161
65161
  };
65162
65162
  }
65163
+ function extractShapeEffects(spPr) {
65164
+ const outerShadow = extractOuterShadowEffect(spPr);
65165
+ if (!outerShadow)
65166
+ return null;
65167
+ return { outerShadow };
65168
+ }
65169
+ function extractOuterShadowEffect(spPr) {
65170
+ const outerShdw = findChildByLocalName(findChildByLocalName(spPr?.elements, "effectLst")?.elements, "outerShdw");
65171
+ if (!outerShdw)
65172
+ return null;
65173
+ const colorResult = extractColorFromElement(outerShdw);
65174
+ if (!colorResult)
65175
+ return null;
65176
+ return stripUndefined({
65177
+ type: "outerShadow",
65178
+ blurRadius: finiteNumberOrZero(emuToPixels(outerShdw.attributes?.blurRad)),
65179
+ distance: finiteNumberOrZero(emuToPixels(outerShdw.attributes?.dist)),
65180
+ direction: finiteNumberOrZero(rotToDegrees(outerShdw.attributes?.dir)),
65181
+ color: colorResult.color,
65182
+ opacity: colorResult.alpha ?? 1
65183
+ });
65184
+ }
65185
+ function finiteNumberOrZero(value) {
65186
+ return Number.isFinite(value) ? value : 0;
65187
+ }
65188
+ function stripUndefined(value) {
65189
+ return Object.fromEntries(Object.entries(value).filter(([, fieldValue]) => fieldValue !== undefined));
65190
+ }
65163
65191
  function extractStrokeColor(spPr, style) {
65164
65192
  const ln = findChildByLocalName(spPr?.elements, "ln");
65165
65193
  if (ln) {
@@ -66801,6 +66829,26 @@ function resolveParagraphPropertiesForTextBox(paragraph2, params) {
66801
66829
  nodes: [pPr]
66802
66830
  }) || {} : {}, false, false, null);
66803
66831
  }
66832
+ function extractTextBoxParagraphSpacing(paragraphProperties, { paragraphIndex, paragraphCount, spcFirstLastPara } = {}) {
66833
+ const spacing = paragraphProperties?.spacing;
66834
+ if (!spacing)
66835
+ return;
66836
+ const honorFirstLast = spcFirstLastPara === "1" || spcFirstLastPara === 1 || spcFirstLastPara === true || spcFirstLastPara === "true" || spcFirstLastPara === "on";
66837
+ const isFirst = paragraphIndex === 0;
66838
+ const isLast = paragraphCount != null && paragraphIndex === paragraphCount - 1;
66839
+ const result = {};
66840
+ if (typeof spacing.before === "number" && !(isFirst && !honorFirstLast)) {
66841
+ const px = twipsToPixels(spacing.before);
66842
+ if (typeof px === "number")
66843
+ result.before = px;
66844
+ }
66845
+ if (typeof spacing.after === "number" && !(isLast && !honorFirstLast)) {
66846
+ const px = twipsToPixels(spacing.after);
66847
+ if (typeof px === "number")
66848
+ result.after = px;
66849
+ }
66850
+ return result.before === undefined && result.after === undefined ? undefined : result;
66851
+ }
66804
66852
  function extractRunFormatting(rPr, paragraphProperties, params) {
66805
66853
  const resolvedRunProperties = resolveRunProperties(params, rPr ? translator$133.encode({
66806
66854
  ...params,
@@ -66864,10 +66912,12 @@ function extractBodyPrProperties(bodyPr) {
66864
66912
  left: lIns * EMU_TO_PX
66865
66913
  };
66866
66914
  const wrap$1 = bodyPrAttrs["wrap"] || "square";
66915
+ const spcFirstLastPara = bodyPrAttrs["spcFirstLastPara"];
66867
66916
  return {
66868
66917
  verticalAlign,
66869
66918
  insets,
66870
- wrap: wrap$1
66919
+ wrap: wrap$1,
66920
+ spcFirstLastPara
66871
66921
  };
66872
66922
  }
66873
66923
  function isValidRelativeHeight(value) {
@@ -67257,14 +67307,13 @@ function handleImageNode$1(node2, params, isAnchor) {
67257
67307
  left: positionHValue,
67258
67308
  horizontal: positionHValue,
67259
67309
  top: positionVValue
67260
- }, anchorData, wrap$1, isHidden);
67310
+ }, anchorData, wrap$1, extractEffectExtent(node2), isHidden);
67261
67311
  if (uri === "http://schemas.openxmlformats.org/drawingml/2006/chart")
67262
67312
  return handleChartDrawing(params, node2, graphicData, size, padding, marginOffset, anchorData, wrap$1, isAnchor);
67263
67313
  const picture = graphicData?.elements.find((el) => el.name === "pic:pic");
67264
67314
  if (!picture || !picture.elements)
67265
67315
  return null;
67266
- const blipFill = picture.elements.find((el) => el.name === "pic:blipFill");
67267
- const blip = findChildByLocalName(blipFill?.elements, "blip");
67316
+ const blip = findChildByLocalName(picture.elements.find((el) => el.name === "pic:blipFill")?.elements, "blip");
67268
67317
  if (!blip)
67269
67318
  return null;
67270
67319
  const hasGrayscale = someChildHasLocalName(blip.elements, "grayscl");
@@ -67276,23 +67325,7 @@ function handleImageNode$1(node2, params, isAnchor) {
67276
67325
  ...Number.isFinite(rawContrast) ? { contrast: rawContrast } : {}
67277
67326
  } : undefined;
67278
67327
  const alphaModFix = extractAlphaModFix(blip);
67279
- const stretch = findChildByLocalName(blipFill?.elements, "stretch");
67280
- const fillRect = findChildByLocalName(stretch?.elements, "fillRect");
67281
- const srcRect = findChildByLocalName(blipFill?.elements, "srcRect");
67282
- const srcRectAttrs = srcRect?.attributes || {};
67283
- const clipPath = buildClipPathFromSrcRect(srcRectAttrs);
67284
- const srcRectHasNegativeValues = [
67285
- "l",
67286
- "t",
67287
- "r",
67288
- "b"
67289
- ].some((attr) => {
67290
- const val = srcRectAttrs[attr];
67291
- return val != null && parseFloat(val) < 0;
67292
- });
67293
- const shouldStretch = Boolean(stretch && fillRect);
67294
- const shouldCover = shouldStretch && !srcRectHasNegativeValues && !clipPath;
67295
- const shouldFillClippedStretch = shouldStretch && !srcRectHasNegativeValues && Boolean(clipPath);
67328
+ const { clipPath, rawSrcRect, shouldCover, shouldFillClippedStretch, shouldCoverShapeStretch, shapeClipPath } = extractPicturePresentation(picture);
67296
67329
  const spPr = picture.elements.find((el) => el.name === "pic:spPr");
67297
67330
  if (spPr) {
67298
67331
  const xfrm = findChildByLocalName(spPr.elements, "xfrm");
@@ -67412,9 +67445,10 @@ function handleImageNode$1(node2, params, isAnchor) {
67412
67445
  ...wrap$1.type === "Square" && wrap$1.attrs.wrapText ? { wrapText: wrap$1.attrs.wrapText } : {},
67413
67446
  wrapTopAndBottom: wrap$1.type === "TopAndBottom",
67414
67447
  shouldCover,
67415
- ...shouldFillClippedStretch ? { objectFit: "fill" } : {},
67448
+ ...shouldFillClippedStretch ? { objectFit: "fill" } : shouldCoverShapeStretch ? { objectFit: "cover" } : {},
67416
67449
  ...clipPath ? { clipPath } : {},
67417
- rawSrcRect: srcRect,
67450
+ ...shapeClipPath ? { shapeClipPath } : {},
67451
+ rawSrcRect,
67418
67452
  originalPadding: {
67419
67453
  distT: attributes["distT"],
67420
67454
  distB: attributes["distB"],
@@ -67462,7 +67496,9 @@ function extractTextFromTextBox(textBoxContent, bodyPr, params = {}) {
67462
67496
  return null;
67463
67497
  const paragraphs = collectTextBoxParagraphs(preProcessTextBoxContent(textBoxContent, params)?.elements || []);
67464
67498
  const textParts = [];
67499
+ const paragraphMetadata = [];
67465
67500
  let horizontalAlign = null;
67501
+ const { verticalAlign, insets, wrap: wrap$1, spcFirstLastPara } = extractBodyPrProperties(bodyPr);
67466
67502
  const appendFieldPart = (fieldType, node2, paragraphProperties) => {
67467
67503
  const rPr = node2?.elements?.find((el) => el.name === "w:rPr");
67468
67504
  const formatting = extractRunFormatting(rPr, paragraphProperties, params);
@@ -67569,6 +67605,11 @@ function extractTextFromTextBox(textBoxContent, bodyPr, params = {}) {
67569
67605
  };
67570
67606
  paragraphs.forEach((paragraph2, paragraphIndex) => {
67571
67607
  const paragraphProperties = resolveParagraphPropertiesForTextBox(paragraph2, params);
67608
+ paragraphMetadata.push({ spacing: extractTextBoxParagraphSpacing(paragraphProperties, {
67609
+ paragraphIndex,
67610
+ paragraphCount: paragraphs.length,
67611
+ spcFirstLastPara
67612
+ }) });
67572
67613
  if (!horizontalAlign)
67573
67614
  horizontalAlign = extractParagraphAlignment(paragraph2);
67574
67615
  let paragraphHasText = false;
@@ -67582,18 +67623,20 @@ function extractTextFromTextBox(textBoxContent, bodyPr, params = {}) {
67582
67623
  `,
67583
67624
  formatting: {},
67584
67625
  isLineBreak: true,
67585
- isEmptyParagraph: !paragraphHasText
67626
+ isEmptyParagraph: !paragraphHasText,
67627
+ isParagraphBoundary: true
67586
67628
  });
67587
67629
  });
67588
67630
  if (textParts.length === 0)
67589
67631
  return null;
67590
- const { verticalAlign, insets, wrap: wrap$1 } = extractBodyPrProperties(bodyPr);
67632
+ const hasParagraphSpacing = paragraphMetadata.some((paragraph2) => paragraph2.spacing);
67591
67633
  return {
67592
67634
  parts: textParts,
67593
67635
  horizontalAlign: horizontalAlign || "left",
67594
67636
  verticalAlign,
67595
67637
  insets,
67596
- wrap: wrap$1
67638
+ wrap: wrap$1,
67639
+ ...hasParagraphSpacing ? { paragraphs: paragraphMetadata } : {}
67597
67640
  };
67598
67641
  }
67599
67642
  function extractFieldInlineNodes(node2) {
@@ -67743,6 +67786,7 @@ function getVectorShape({ params, node: node2, graphicData, size, marginOffset,
67743
67786
  const strokeColor = extractStrokeColor(spPr, style);
67744
67787
  const strokeWidth = extractStrokeWidth(spPr);
67745
67788
  const lineEnds = extractLineEnds(spPr);
67789
+ const effects2 = extractShapeEffects(spPr);
67746
67790
  const effectExtent = extractEffectExtent(node2);
67747
67791
  const textBoxContent = wsp.elements?.find((el) => el.name === "wps:txbx")?.elements?.find((el) => el.name === "w:txbxContent");
67748
67792
  const bodyPr = wsp.elements?.find((el) => el.name === "wps:bodyPr");
@@ -67766,6 +67810,7 @@ function getVectorShape({ params, node: node2, graphicData, size, marginOffset,
67766
67810
  strokeColor,
67767
67811
  strokeWidth,
67768
67812
  lineEnds,
67813
+ effects: effects2,
67769
67814
  effectExtent,
67770
67815
  marginOffset,
67771
67816
  anchorData,
@@ -67799,6 +67844,7 @@ function getVectorShape({ params, node: node2, graphicData, size, marginOffset,
67799
67844
  strokeColor,
67800
67845
  strokeWidth,
67801
67846
  lineEnds,
67847
+ effects: effects2,
67802
67848
  effectExtent,
67803
67849
  marginOffset,
67804
67850
  anchorData,
@@ -87029,7 +87075,7 @@ function isShapeGroupTransform(value) {
87029
87075
  if (!value || typeof value !== "object")
87030
87076
  return false;
87031
87077
  const maybe = value;
87032
- return isFiniteNumber(maybe.x) || isFiniteNumber(maybe.y) || isFiniteNumber(maybe.width) || isFiniteNumber(maybe.height) || isFiniteNumber(maybe.childWidth) || isFiniteNumber(maybe.childHeight) || isFiniteNumber(maybe.childX) || isFiniteNumber(maybe.childY);
87078
+ return isFiniteNumber(maybe.x) || isFiniteNumber(maybe.y) || isFiniteNumber(maybe.width) || isFiniteNumber(maybe.height) || isFiniteNumber(maybe.childWidth) || isFiniteNumber(maybe.childHeight) || isFiniteNumber(maybe.childX) || isFiniteNumber(maybe.childY) || isFiniteNumber(maybe.rotation) || maybe.flipH === true || maybe.flipV === true;
87033
87079
  }
87034
87080
  function normalizeShapeSize(value) {
87035
87081
  if (!value || typeof value !== "object")
@@ -87077,13 +87123,73 @@ function normalizeEffectExtent(value) {
87077
87123
  bottom: clamp(bottom)
87078
87124
  };
87079
87125
  }
87126
+ function normalizeShapeEffects(value) {
87127
+ if (!value || typeof value !== "object")
87128
+ return;
87129
+ const outerShadow = normalizeOuterShadowEffect(value.outerShadow);
87130
+ return outerShadow ? { outerShadow } : undefined;
87131
+ }
87132
+ function normalizeOuterShadowEffect(value) {
87133
+ if (!value || typeof value !== "object")
87134
+ return;
87135
+ const maybe = value;
87136
+ if (maybe.type !== "outerShadow")
87137
+ return;
87138
+ const blurRadius = coerceNumber(maybe.blurRadius);
87139
+ const distance = coerceNumber(maybe.distance);
87140
+ const direction = coerceNumber(maybe.direction);
87141
+ const opacity = coerceNumber(maybe.opacity);
87142
+ if (blurRadius == null || blurRadius < 0 || distance == null || distance < 0 || direction == null || opacity == null || typeof maybe.color !== "string")
87143
+ return;
87144
+ const clamp = (val) => Math.max(0, Math.min(1, val));
87145
+ const normalized = {
87146
+ type: "outerShadow",
87147
+ blurRadius,
87148
+ distance,
87149
+ direction,
87150
+ color: maybe.color,
87151
+ opacity: clamp(opacity)
87152
+ };
87153
+ return Object.fromEntries(Object.entries(normalized).filter(([, fieldValue]) => fieldValue !== undefined));
87154
+ }
87080
87155
  function normalizeShapeGroupChildren(value) {
87081
87156
  if (!Array.isArray(value))
87082
87157
  return [];
87083
- return value.filter((child) => {
87158
+ return value.flatMap((child) => {
87084
87159
  if (!child || typeof child !== "object")
87085
- return false;
87086
- return typeof child.shapeType === "string";
87160
+ return [];
87161
+ if (typeof child.shapeType !== "string")
87162
+ return [];
87163
+ const shapeChild = child;
87164
+ if (shapeChild.shapeType !== "vectorShape")
87165
+ return [shapeChild];
87166
+ const attrs = shapeChild.attrs;
87167
+ if (!attrs || typeof attrs !== "object")
87168
+ return [shapeChild];
87169
+ const rawAttrs = attrs;
87170
+ const normalizedAttrs = { ...rawAttrs };
87171
+ const normalizeAttr = (key, normalize$1) => {
87172
+ if (!(key in rawAttrs))
87173
+ return;
87174
+ const normalized = normalize$1(rawAttrs[key]);
87175
+ if (normalized !== undefined)
87176
+ normalizedAttrs[key] = normalized;
87177
+ else
87178
+ delete normalizedAttrs[key];
87179
+ };
87180
+ normalizeAttr("fillColor", normalizeFillColor);
87181
+ normalizeAttr("strokeColor", normalizeStrokeColor);
87182
+ normalizeAttr("strokeWidth", coerceNumber);
87183
+ normalizeAttr("lineEnds", normalizeLineEnds);
87184
+ normalizeAttr("effects", normalizeShapeEffects);
87185
+ normalizeAttr("textContent", normalizeTextContent);
87186
+ normalizeAttr("textAlign", (value$1) => typeof value$1 === "string" ? value$1 : undefined);
87187
+ normalizeAttr("textVerticalAlign", normalizeTextVerticalAlign);
87188
+ normalizeAttr("textInsets", normalizeTextInsets);
87189
+ return [{
87190
+ ...shapeChild,
87191
+ attrs: normalizedAttrs
87192
+ }];
87087
87193
  });
87088
87194
  }
87089
87195
  function normalizeMediaKey(value) {
@@ -87372,6 +87478,25 @@ function normalizeTextContent(value) {
87372
87478
  "right"
87373
87479
  ].includes(value.horizontalAlign))
87374
87480
  result.horizontalAlign = value.horizontalAlign;
87481
+ if (Array.isArray(value.paragraphs)) {
87482
+ const normalizedParagraphs = value.paragraphs.map((paragraph2) => {
87483
+ if (!isPlainObject4(paragraph2))
87484
+ return {};
87485
+ const spacing = isPlainObject4(paragraph2.spacing) ? paragraph2.spacing : undefined;
87486
+ const before = Number.isFinite(spacing?.before) ? spacing.before : undefined;
87487
+ const after = Number.isFinite(spacing?.after) ? spacing.after : undefined;
87488
+ if (before === undefined && after === undefined)
87489
+ return {};
87490
+ const out = { spacing: {} };
87491
+ if (before !== undefined)
87492
+ out.spacing.before = before;
87493
+ if (after !== undefined)
87494
+ out.spacing.after = after;
87495
+ return out;
87496
+ });
87497
+ if (normalizedParagraphs.some((paragraph2) => ("spacing" in paragraph2)))
87498
+ result.paragraphs = normalizedParagraphs;
87499
+ }
87375
87500
  return result;
87376
87501
  }
87377
87502
  function normalizeTextVerticalAlign(value) {
@@ -89044,6 +89169,10 @@ function imageNodeToRun({ node: node2, positions, sdtMetadata }) {
89044
89169
  run$1.title = attrs.title;
89045
89170
  if (typeof attrs.clipPath === "string")
89046
89171
  run$1.clipPath = attrs.clipPath;
89172
+ if (typeof attrs.shapeClipPath === "string")
89173
+ run$1.shapeClipPath = attrs.shapeClipPath;
89174
+ if (isAllowedObjectFit$1(attrs.objectFit))
89175
+ run$1.objectFit = attrs.objectFit;
89047
89176
  const distTop = pickNumber(wrapAttrs.distTop ?? wrapAttrs.distT);
89048
89177
  if (distTop != null)
89049
89178
  run$1.distTop = distTop;
@@ -89318,7 +89447,7 @@ function vectorShapeNodeToDrawingBlock(node2, nextBlockId, positions) {
89318
89447
  const rawAttrs = getAttrs$2(node2);
89319
89448
  if (isHiddenDrawing$1(rawAttrs))
89320
89449
  return null;
89321
- const effectExtent = normalizeEffectExtent(rawAttrs.effectExtent);
89450
+ const effectExtent = mergeEffectExtents(normalizeEffectExtent(rawAttrs.effectExtent), getRequiredVectorShapeEffectExtent(rawAttrs));
89322
89451
  const baseWidth = coercePositiveNumber(rawAttrs.width, 1);
89323
89452
  const baseHeight = coercePositiveNumber(rawAttrs.height, 1);
89324
89453
  const extraWidth = (effectExtent?.left ?? 0) + (effectExtent?.right ?? 0);
@@ -89342,16 +89471,23 @@ function shapeGroupNodeToDrawingBlock(node2, nextBlockId, positions) {
89342
89471
  const size = normalizeShapeSize(rawAttrs.size);
89343
89472
  const width = size?.width ?? groupTransform?.width ?? 1;
89344
89473
  const height = size?.height ?? groupTransform?.height ?? 1;
89474
+ const childCoordinateWidth = groupTransform?.width ?? width;
89475
+ const childCoordinateHeight = groupTransform?.height ?? height;
89476
+ const shapes = normalizeShapeGroupChildren(rawAttrs.shapes);
89477
+ const effectExtent = mergeEffectExtents(normalizeEffectExtent(rawAttrs.effectExtent), getRequiredGroupEffectExtentFromChildren(shapes, childCoordinateWidth, childCoordinateHeight));
89478
+ const extraWidth = (effectExtent?.left ?? 0) + (effectExtent?.right ?? 0);
89479
+ const extraHeight = (effectExtent?.top ?? 0) + (effectExtent?.bottom ?? 0);
89345
89480
  return buildDrawingBlock(rawAttrs, nextBlockId, positions, node2, {
89346
- width: coercePositiveNumber(width, 1),
89347
- height: coercePositiveNumber(height, 1),
89481
+ width: coercePositiveNumber(width + extraWidth, 1),
89482
+ height: coercePositiveNumber(height + extraHeight, 1),
89348
89483
  rotation: coerceNumber(rawAttrs.rotation) ?? 0,
89349
89484
  flipH: coerceBoolean(rawAttrs.flipH) ?? false,
89350
89485
  flipV: coerceBoolean(rawAttrs.flipV) ?? false
89351
89486
  }, "shapeGroup", {
89352
89487
  groupTransform,
89353
- shapes: normalizeShapeGroupChildren(rawAttrs.shapes),
89354
- size
89488
+ shapes,
89489
+ size,
89490
+ effectExtent
89355
89491
  });
89356
89492
  }
89357
89493
  function shapeContainerNodeToDrawingBlock(node2, nextBlockId, positions) {
@@ -90199,7 +90335,13 @@ function paragraphToFlowBlocks({ para, nextBlockId, positions, storyKey, tracked
90199
90335
  visitNode(child, [], undefined, undefined);
90200
90336
  });
90201
90337
  flushParagraph();
90202
- if (!blocks.some((block) => block.kind === "paragraph") && !suppressedByVanish && !paragraphProps.runProperties?.vanish)
90338
+ if (!blocks.some((block) => block.kind === "paragraph") && !suppressedByVanish && !paragraphProps.runProperties?.vanish) {
90339
+ let syntheticParagraphAttrs = deepClone(paragraphAttrs);
90340
+ if (isSectPrMarker)
90341
+ if (syntheticParagraphAttrs)
90342
+ syntheticParagraphAttrs.sectPrMarker = true;
90343
+ else
90344
+ syntheticParagraphAttrs = { sectPrMarker: true };
90203
90345
  blocks.push({
90204
90346
  kind: "paragraph",
90205
90347
  id: baseBlockId,
@@ -90208,9 +90350,10 @@ function paragraphToFlowBlocks({ para, nextBlockId, positions, storyKey, tracked
90208
90350
  fontFamily: defaultFont,
90209
90351
  fontSize: defaultSize
90210
90352
  }],
90211
- attrs: deepClone(paragraphAttrs),
90353
+ attrs: syntheticParagraphAttrs,
90212
90354
  sourceAnchor
90213
90355
  });
90356
+ }
90214
90357
  blocks.forEach((block) => {
90215
90358
  if (block.kind === "paragraph" && block.runs.length > 1)
90216
90359
  block.runs = mergeAdjacentRuns(block.runs);
@@ -99482,7 +99625,24 @@ var isRegExp = (value) => {
99482
99625
  return true;
99483
99626
  }, areAttrsEqual = (attrsA = {}, attrsB = {}) => {
99484
99627
  return objectIncludes(attrsA, attrsB);
99485
- }, TrackInsertMarkName = "trackInsert", TrackDeleteMarkName = "trackDelete", TrackFormatMarkName = "trackFormat", TrackedFormatMarkNames, TAB_POSITION_TOLERANCE_TWIPS = 20, OOXML_PCT_DIVISOR = 5000, TWIPS_PER_PX = 15, isPlainObject$3 = (value) => value !== null && typeof value === "object" && !Array.isArray(value), OOXML_Z_INDEX_BASE = 251658240, SPACE_CHARS, SUBSCRIPT_SUPERSCRIPT_SCALE = 0.65, BASELINE_SHIFT_EPSILON = 0.000001, isAtomicRunKind = (kind) => kind === "image" || kind === "lineBreak" || kind === "break" || kind === "tab" || kind === "fieldAnnotation", isImageLikeRun = (run$1) => {
99628
+ }, TrackInsertMarkName = "trackInsert", TrackDeleteMarkName = "trackDelete", TrackFormatMarkName = "trackFormat", TrackedFormatMarkNames, TAB_POSITION_TOLERANCE_TWIPS = 20, OOXML_PCT_DIVISOR = 5000, TWIPS_PER_PX = 15, isPlainObject$3 = (value) => value !== null && typeof value === "object" && !Array.isArray(value), OOXML_Z_INDEX_BASE = 251658240, resolveOuterShadowOffset = (shadow) => {
99629
+ const radians = shadow.direction * Math.PI / 180;
99630
+ return {
99631
+ dx: shadow.distance * Math.cos(radians),
99632
+ dy: shadow.distance * Math.sin(radians)
99633
+ };
99634
+ }, getOuterShadowStdDeviation = (shadow) => {
99635
+ return Math.max(0, shadow.blurRadius / 2);
99636
+ }, getOuterShadowPaintExtent = (shadow) => {
99637
+ const { dx, dy } = resolveOuterShadowOffset(shadow);
99638
+ const spread = getOuterShadowStdDeviation(shadow) * 3;
99639
+ return {
99640
+ left: Math.max(0, spread - dx),
99641
+ top: Math.max(0, spread - dy),
99642
+ right: Math.max(0, spread + dx),
99643
+ bottom: Math.max(0, spread + dy)
99644
+ };
99645
+ }, SPACE_CHARS, SUBSCRIPT_SUPERSCRIPT_SCALE = 0.65, BASELINE_SHIFT_EPSILON = 0.000001, isAtomicRunKind = (kind) => kind === "image" || kind === "lineBreak" || kind === "break" || kind === "tab" || kind === "fieldAnnotation", isImageLikeRun = (run$1) => {
99486
99646
  if (!run$1 || typeof run$1 !== "object")
99487
99647
  return false;
99488
99648
  return typeof run$1.src === "string";
@@ -106000,6 +106160,37 @@ var isRegExp = (value) => {
106000
106160
  const alphaModFix = findChildByLocalName(blip?.elements, "alphaModFix");
106001
106161
  const amt = Number(alphaModFix?.attributes?.amt);
106002
106162
  return Number.isFinite(amt) ? { amt } : undefined;
106163
+ }, buildShapeClipPathFromPreset = (preset) => {
106164
+ if (preset === "ellipse")
106165
+ return "ellipse(50% 50% at 50% 50%)";
106166
+ return null;
106167
+ }, extractPicturePresentation = (picture) => {
106168
+ const blipFill = picture?.elements?.find((el) => el.name === "pic:blipFill");
106169
+ const stretch = findChildByLocalName(blipFill?.elements, "stretch");
106170
+ const fillRect = findChildByLocalName(stretch?.elements, "fillRect");
106171
+ const srcRect = findChildByLocalName(blipFill?.elements, "srcRect");
106172
+ const srcRectAttrs = srcRect?.attributes || {};
106173
+ const clipPath = buildClipPathFromSrcRect(srcRectAttrs);
106174
+ const srcRectHasNegativeValues = [
106175
+ "l",
106176
+ "t",
106177
+ "r",
106178
+ "b"
106179
+ ].some((attr) => {
106180
+ const val = srcRectAttrs[attr];
106181
+ return val != null && parseFloat(val) < 0;
106182
+ });
106183
+ const spPr = picture?.elements?.find((el) => el.name === "pic:spPr");
106184
+ const shapeClipPath = buildShapeClipPathFromPreset(findChildByLocalName(spPr?.elements, "prstGeom")?.attributes?.["prst"]);
106185
+ const shouldStretch = Boolean(stretch && fillRect);
106186
+ return {
106187
+ clipPath,
106188
+ rawSrcRect: srcRect,
106189
+ shouldCover: shouldStretch && !srcRectHasNegativeValues && !clipPath,
106190
+ shouldFillClippedStretch: shouldStretch && !srcRectHasNegativeValues && Boolean(clipPath),
106191
+ shouldCoverShapeStretch: shouldStretch && Boolean(shapeClipPath) && !clipPath,
106192
+ shapeClipPath
106193
+ };
106003
106194
  }, mergeAnchorPaddingIntoWrapDistances = (wrap$1, padding) => {
106004
106195
  if (!wrap$1?.attrs || !padding)
106005
106196
  return;
@@ -106070,7 +106261,289 @@ var isRegExp = (value) => {
106070
106261
  if (placeholder?.attrs && isHidden)
106071
106262
  placeholder.attrs.hidden = true;
106072
106263
  return placeholder;
106073
- }, handleShapeGroup = (params, node2, graphicData, size, padding, marginOffset, anchorData, wrap$1, isHidden) => {
106264
+ }, parseEmuNumber = (value, fallback = 0) => {
106265
+ const numeric = Number(value);
106266
+ return Number.isFinite(numeric) ? numeric : fallback;
106267
+ }, getGroupXfrm = (groupNode) => {
106268
+ return findChildByLocalName(findChildByLocalName(groupNode?.elements, "grpSpPr")?.elements, "xfrm");
106269
+ }, buildShapeGroupTransformAttrs = (xfrm) => {
106270
+ const groupTransform = {};
106271
+ if (!xfrm)
106272
+ return groupTransform;
106273
+ if (xfrm.attributes?.["rot"])
106274
+ groupTransform.rotation = rotToDegrees(xfrm.attributes["rot"]);
106275
+ if (xfrm.attributes?.["flipH"] === "1")
106276
+ groupTransform.flipH = true;
106277
+ if (xfrm.attributes?.["flipV"] === "1")
106278
+ groupTransform.flipV = true;
106279
+ const off = findChildByLocalName(xfrm.elements, "off");
106280
+ const ext = findChildByLocalName(xfrm.elements, "ext");
106281
+ const chOff = findChildByLocalName(xfrm.elements, "chOff");
106282
+ const chExt = findChildByLocalName(xfrm.elements, "chExt");
106283
+ if (off) {
106284
+ groupTransform.x = emuToPixels(off.attributes?.["x"] || 0);
106285
+ groupTransform.y = emuToPixels(off.attributes?.["y"] || 0);
106286
+ }
106287
+ if (ext) {
106288
+ groupTransform.width = emuToPixels(ext.attributes?.["cx"] || 0);
106289
+ groupTransform.height = emuToPixels(ext.attributes?.["cy"] || 0);
106290
+ }
106291
+ if (chOff) {
106292
+ groupTransform.childX = emuToPixels(chOff.attributes?.["x"] || 0);
106293
+ groupTransform.childY = emuToPixels(chOff.attributes?.["y"] || 0);
106294
+ groupTransform.childOriginXEmu = parseEmuNumber(chOff.attributes?.["x"]);
106295
+ groupTransform.childOriginYEmu = parseEmuNumber(chOff.attributes?.["y"]);
106296
+ }
106297
+ if (chExt) {
106298
+ groupTransform.childWidth = emuToPixels(chExt.attributes?.["cx"] || 0);
106299
+ groupTransform.childHeight = emuToPixels(chExt.attributes?.["cy"] || 0);
106300
+ }
106301
+ return groupTransform;
106302
+ }, identityMatrix = () => ({
106303
+ a: 1,
106304
+ b: 0,
106305
+ c: 0,
106306
+ d: 1,
106307
+ e: 0,
106308
+ f: 0
106309
+ }), multiplyMatrix = (left, right) => ({
106310
+ a: left.a * right.a + left.c * right.b,
106311
+ b: left.b * right.a + left.d * right.b,
106312
+ c: left.a * right.c + left.c * right.d,
106313
+ d: left.b * right.c + left.d * right.d,
106314
+ e: left.a * right.e + left.c * right.f + left.e,
106315
+ f: left.b * right.e + left.d * right.f + left.f
106316
+ }), transformPoint = (matrix, x, y) => ({
106317
+ x: matrix.a * x + matrix.c * y + matrix.e,
106318
+ y: matrix.b * x + matrix.d * y + matrix.f
106319
+ }), normalizeDegrees = (degrees) => {
106320
+ const normalized = (degrees % 360 + 360) % 360;
106321
+ return Object.is(normalized, -0) ? 0 : normalized;
106322
+ }, decomposeMatrixOrientation = (matrix) => {
106323
+ if (matrix.a * matrix.d - matrix.b * matrix.c < 0)
106324
+ return {
106325
+ rotation: normalizeDegrees(Math.atan2(-matrix.b, -matrix.a) * 180 / Math.PI),
106326
+ flipH: true,
106327
+ flipV: false
106328
+ };
106329
+ return {
106330
+ rotation: normalizeDegrees(Math.atan2(matrix.b, matrix.a) * 180 / Math.PI),
106331
+ flipH: false,
106332
+ flipV: false
106333
+ };
106334
+ }, getVisualOrientationMatrix = ({ rotation = 0, flipH = false, flipV = false } = {}) => {
106335
+ const radians = rotation * Math.PI / 180;
106336
+ const cos = Math.cos(radians);
106337
+ const sin = Math.sin(radians);
106338
+ const flipScaleX = flipH ? -1 : 1;
106339
+ const flipScaleY = flipV ? -1 : 1;
106340
+ return {
106341
+ a: cos * flipScaleX,
106342
+ b: sin * flipScaleX,
106343
+ c: -sin * flipScaleY,
106344
+ d: cos * flipScaleY,
106345
+ e: 0,
106346
+ f: 0
106347
+ };
106348
+ }, getGroupAffineTransform = (xfrm, { includeVisualTransform = false } = {}) => {
106349
+ if (!xfrm)
106350
+ return {
106351
+ matrix: identityMatrix(),
106352
+ rotation: 0,
106353
+ flipH: false,
106354
+ flipV: false
106355
+ };
106356
+ const off = findChildByLocalName(xfrm.elements, "off");
106357
+ const ext = findChildByLocalName(xfrm.elements, "ext");
106358
+ const chOff = findChildByLocalName(xfrm.elements, "chOff");
106359
+ const chExt = findChildByLocalName(xfrm.elements, "chExt");
106360
+ const childWidth = parseEmuNumber(chExt?.attributes?.["cx"]);
106361
+ const childHeight = parseEmuNumber(chExt?.attributes?.["cy"]);
106362
+ const width = parseEmuNumber(ext?.attributes?.["cx"], childWidth || 0);
106363
+ const height = parseEmuNumber(ext?.attributes?.["cy"], childHeight || 0);
106364
+ const childX = parseEmuNumber(chOff?.attributes?.["x"]);
106365
+ const childY = parseEmuNumber(chOff?.attributes?.["y"]);
106366
+ const x = parseEmuNumber(off?.attributes?.["x"]);
106367
+ const y = parseEmuNumber(off?.attributes?.["y"]);
106368
+ const scaleX = childWidth !== 0 ? width / childWidth : 1;
106369
+ const scaleY = childHeight !== 0 ? height / childHeight : 1;
106370
+ const rotation = xfrm.attributes?.["rot"] ? rotToDegrees(xfrm.attributes["rot"]) : 0;
106371
+ const flipH = xfrm.attributes?.["flipH"] === "1";
106372
+ const flipV = xfrm.attributes?.["flipV"] === "1";
106373
+ const baseMatrix = {
106374
+ a: scaleX,
106375
+ b: 0,
106376
+ c: 0,
106377
+ d: scaleY,
106378
+ e: x - childX * scaleX,
106379
+ f: y - childY * scaleY
106380
+ };
106381
+ if (!includeVisualTransform || !rotation && !flipH && !flipV)
106382
+ return {
106383
+ matrix: baseMatrix,
106384
+ rotation: 0,
106385
+ flipH: false,
106386
+ flipV: false
106387
+ };
106388
+ const radians = rotation * Math.PI / 180;
106389
+ const cos = Math.cos(radians);
106390
+ const sin = Math.sin(radians);
106391
+ const flipScaleX = flipH ? -1 : 1;
106392
+ const flipScaleY = flipV ? -1 : 1;
106393
+ const centerX = x + width / 2;
106394
+ const centerY = y + height / 2;
106395
+ return {
106396
+ matrix: multiplyMatrix({
106397
+ a: cos * flipScaleX,
106398
+ b: sin * flipScaleX,
106399
+ c: -sin * flipScaleY,
106400
+ d: cos * flipScaleY,
106401
+ e: centerX - (cos * flipScaleX * centerX + -sin * flipScaleY * centerY),
106402
+ f: centerY - (sin * flipScaleX * centerX + cos * flipScaleY * centerY)
106403
+ }, baseMatrix),
106404
+ rotation,
106405
+ flipH,
106406
+ flipV
106407
+ };
106408
+ }, composeShapeGroupTransform = (parent, child) => {
106409
+ const matrix = multiplyMatrix(parent.matrix, child.matrix);
106410
+ return {
106411
+ matrix,
106412
+ ...decomposeMatrixOrientation(matrix)
106413
+ };
106414
+ }, composeShapeGroupChildOrientation = (rect, xfrm) => {
106415
+ return decomposeMatrixOrientation(multiplyMatrix(getVisualOrientationMatrix({
106416
+ rotation: rect.rotation ?? 0,
106417
+ flipH: Boolean(rect.flipH),
106418
+ flipV: Boolean(rect.flipV)
106419
+ }), getVisualOrientationMatrix({
106420
+ rotation: xfrm?.attributes?.["rot"] ? rotToDegrees(xfrm.attributes["rot"]) : 0,
106421
+ flipH: xfrm?.attributes?.["flipH"] === "1",
106422
+ flipV: xfrm?.attributes?.["flipV"] === "1"
106423
+ })));
106424
+ }, transformShapeGroupChildRect = (transform2, rawX, rawY, rawWidth, rawHeight) => {
106425
+ const matrix = transform2.matrix ?? identityMatrix();
106426
+ const width = Math.hypot(matrix.a, matrix.b) * rawWidth;
106427
+ const height = Math.hypot(matrix.c, matrix.d) * rawHeight;
106428
+ const center = transformPoint(matrix, rawX + rawWidth / 2, rawY + rawHeight / 2);
106429
+ return {
106430
+ x: emuToPixels(center.x - width / 2),
106431
+ y: emuToPixels(center.y - height / 2),
106432
+ width: emuToPixels(width),
106433
+ height: emuToPixels(height),
106434
+ rotation: transform2.rotation ?? 0,
106435
+ flipH: Boolean(transform2.flipH),
106436
+ flipV: Boolean(transform2.flipV)
106437
+ };
106438
+ }, resolveShapeGroupPicturePath = (pic, params) => {
106439
+ const blip = findChildByLocalName(findChildByLocalName(pic.elements, "blipFill")?.elements, "blip");
106440
+ if (!blip)
106441
+ return null;
106442
+ const rEmbed = blip.attributes?.["r:embed"];
106443
+ if (!rEmbed)
106444
+ return null;
106445
+ const currentFile = params.filename || "document.xml";
106446
+ let rels = params.docx[`word/_rels/${currentFile}.rels`];
106447
+ if (!rels)
106448
+ rels = params.docx[`word/_rels/document.xml.rels`];
106449
+ const rel = rels?.elements.find((el) => el.name === "Relationships")?.elements?.find((el) => el.attributes["Id"] === rEmbed);
106450
+ if (!rel)
106451
+ return null;
106452
+ return normalizeTargetPath$1(rel.attributes?.["Target"]);
106453
+ }, parseShapeGroupVectorChild = (wsp, transform2, params) => {
106454
+ const spPr = findChildByLocalName(wsp.elements, "spPr");
106455
+ if (!spPr)
106456
+ return null;
106457
+ const shapeKind = findChildByLocalName(spPr.elements, "prstGeom")?.attributes?.["prst"];
106458
+ const customGeom = !shapeKind ? extractCustomGeometry(spPr) : null;
106459
+ const shapeXfrm = findChildByLocalName(spPr.elements, "xfrm");
106460
+ const shapeOff = findChildByLocalName(shapeXfrm?.elements, "off");
106461
+ const shapeExt = findChildByLocalName(shapeXfrm?.elements, "ext");
106462
+ const rect = transformShapeGroupChildRect(transform2, parseEmuNumber(shapeOff?.attributes?.["x"]), parseEmuNumber(shapeOff?.attributes?.["y"]), parseEmuNumber(shapeExt?.attributes?.["cx"], 914400), parseEmuNumber(shapeExt?.attributes?.["cy"], 914400));
106463
+ const orientation = composeShapeGroupChildOrientation(rect, shapeXfrm);
106464
+ const style = findChildByLocalName(wsp.elements, "style");
106465
+ const fillColor = extractFillColor(spPr, style);
106466
+ const strokeColor = extractStrokeColor(spPr, style);
106467
+ const strokeWidth = extractStrokeWidth(spPr);
106468
+ const lineEnds = extractLineEnds(spPr);
106469
+ const effects2 = extractShapeEffects(spPr);
106470
+ const cNvPr = findChildByLocalName(wsp.elements, "cNvPr");
106471
+ const shapeId = cNvPr?.attributes?.["id"];
106472
+ const shapeName = cNvPr?.attributes?.["name"];
106473
+ const textBoxContent = findChildByLocalName(findChildByLocalName(wsp.elements, "txbx")?.elements, "txbxContent");
106474
+ const bodyPr = findChildByLocalName(wsp.elements, "bodyPr");
106475
+ const textContent = textBoxContent ? extractTextFromTextBox(textBoxContent, bodyPr, params) : null;
106476
+ const textAlign = textContent?.horizontalAlign || "left";
106477
+ return {
106478
+ shapeType: "vectorShape",
106479
+ attrs: {
106480
+ kind: shapeKind,
106481
+ customGeometry: customGeom || undefined,
106482
+ ...rect,
106483
+ ...orientation,
106484
+ fillColor,
106485
+ strokeColor,
106486
+ strokeWidth,
106487
+ lineEnds,
106488
+ effects: effects2,
106489
+ shapeId,
106490
+ shapeName,
106491
+ textContent,
106492
+ textAlign,
106493
+ textVerticalAlign: textContent?.verticalAlign,
106494
+ textInsets: textContent?.insets
106495
+ }
106496
+ };
106497
+ }, parseShapeGroupImageChild = (pic, transform2, params) => {
106498
+ const spPr = findChildByLocalName(pic.elements, "spPr");
106499
+ if (!spPr)
106500
+ return null;
106501
+ const xfrm = findChildByLocalName(spPr.elements, "xfrm");
106502
+ const off = findChildByLocalName(xfrm?.elements, "off");
106503
+ const ext = findChildByLocalName(xfrm?.elements, "ext");
106504
+ const rect = transformShapeGroupChildRect(transform2, parseEmuNumber(off?.attributes?.["x"]), parseEmuNumber(off?.attributes?.["y"]), parseEmuNumber(ext?.attributes?.["cx"], 914400), parseEmuNumber(ext?.attributes?.["cy"], 914400));
106505
+ const orientation = composeShapeGroupChildOrientation(rect, xfrm);
106506
+ const path2 = resolveShapeGroupPicturePath(pic, params);
106507
+ if (!path2)
106508
+ return null;
106509
+ const alphaModFix = extractAlphaModFix(findChildByLocalName(findChildByLocalName(pic.elements, "blipFill")?.elements, "blip"));
106510
+ const cNvPr = findChildByLocalName(findChildByLocalName(pic.elements, "nvPicPr")?.elements, "cNvPr");
106511
+ const picId = cNvPr?.attributes?.["id"];
106512
+ const picName = cNvPr?.attributes?.["name"];
106513
+ const { clipPath, shouldCover, shouldFillClippedStretch, shouldCoverShapeStretch, shapeClipPath } = extractPicturePresentation(pic);
106514
+ return {
106515
+ shapeType: "image",
106516
+ attrs: {
106517
+ ...rect,
106518
+ ...orientation,
106519
+ src: path2,
106520
+ imageId: picId,
106521
+ imageName: picName,
106522
+ ...alphaModFix ? { alphaModFix } : {},
106523
+ ...clipPath ? { clipPath } : {},
106524
+ ...shapeClipPath ? { shapeClipPath } : {},
106525
+ ...shouldFillClippedStretch || shouldCoverShapeStretch ? { objectFit: shouldFillClippedStretch ? "fill" : "cover" } : shouldCover ? { objectFit: "cover" } : {}
106526
+ }
106527
+ };
106528
+ }, collectShapeGroupChildren = (groupNode, transform2, params) => {
106529
+ const children = [];
106530
+ for (const child of groupNode?.elements || []) {
106531
+ const localName = getLocalName$1(child?.name);
106532
+ if (localName === "wsp") {
106533
+ const shape = parseShapeGroupVectorChild(child, transform2, params);
106534
+ if (shape)
106535
+ children.push(shape);
106536
+ } else if (localName === "pic") {
106537
+ const picture = parseShapeGroupImageChild(child, transform2, params);
106538
+ if (picture)
106539
+ children.push(picture);
106540
+ } else if (localName === "grpSp") {
106541
+ const nestedTransform = composeShapeGroupTransform(transform2, getGroupAffineTransform(getGroupXfrm(child), { includeVisualTransform: true }));
106542
+ children.push(...collectShapeGroupChildren(child, nestedTransform, params));
106543
+ }
106544
+ }
106545
+ return children;
106546
+ }, handleShapeGroup = (params, node2, graphicData, size, padding, marginOffset, anchorData, wrap$1, effectExtent, isHidden) => {
106074
106547
  const wgp = graphicData.elements.find((el) => el.name === "wpg:wgp");
106075
106548
  if (!wgp) {
106076
106549
  const placeholder = buildShapePlaceholder(node2, size, padding, marginOffset, "group");
@@ -106078,166 +106551,9 @@ var isRegExp = (value) => {
106078
106551
  placeholder.attrs.hidden = true;
106079
106552
  return placeholder;
106080
106553
  }
106081
- const xfrm = findChildByLocalName(wgp.elements.find((el) => el.name === "wpg:grpSpPr")?.elements, "xfrm");
106082
- const groupTransform = {};
106083
- if (xfrm) {
106084
- const off = findChildByLocalName(xfrm.elements, "off");
106085
- const ext = findChildByLocalName(xfrm.elements, "ext");
106086
- const chOff = findChildByLocalName(xfrm.elements, "chOff");
106087
- const chExt = findChildByLocalName(xfrm.elements, "chExt");
106088
- if (off) {
106089
- groupTransform.x = emuToPixels(off.attributes?.["x"] || 0);
106090
- groupTransform.y = emuToPixels(off.attributes?.["y"] || 0);
106091
- }
106092
- if (ext) {
106093
- groupTransform.width = emuToPixels(ext.attributes?.["cx"] || 0);
106094
- groupTransform.height = emuToPixels(ext.attributes?.["cy"] || 0);
106095
- }
106096
- if (chOff) {
106097
- groupTransform.childX = emuToPixels(chOff.attributes?.["x"] || 0);
106098
- groupTransform.childY = emuToPixels(chOff.attributes?.["y"] || 0);
106099
- groupTransform.childOriginXEmu = parseFloat(chOff.attributes?.["x"] || 0);
106100
- groupTransform.childOriginYEmu = parseFloat(chOff.attributes?.["y"] || 0);
106101
- }
106102
- if (chExt) {
106103
- groupTransform.childWidth = emuToPixels(chExt.attributes?.["cx"] || 0);
106104
- groupTransform.childHeight = emuToPixels(chExt.attributes?.["cy"] || 0);
106105
- }
106106
- }
106107
- const childShapes = wgp.elements.filter((el) => el.name === "wps:wsp");
106108
- const childPictures = wgp.elements.filter((el) => el.name === "pic:pic");
106109
- const shapes = childShapes.map((wsp) => {
106110
- const spPr = wsp.elements?.find((el) => el.name === "wps:spPr");
106111
- if (!spPr)
106112
- return null;
106113
- const shapeKind = findChildByLocalName(spPr.elements, "prstGeom")?.attributes?.["prst"];
106114
- const customGeom = !shapeKind ? extractCustomGeometry(spPr) : null;
106115
- const shapeXfrm = findChildByLocalName(spPr.elements, "xfrm");
106116
- const shapeOff = findChildByLocalName(shapeXfrm?.elements, "off");
106117
- const shapeExt = findChildByLocalName(shapeXfrm?.elements, "ext");
106118
- const rawX = shapeOff?.attributes?.["x"] ? parseFloat(shapeOff.attributes["x"]) : 0;
106119
- const rawY = shapeOff?.attributes?.["y"] ? parseFloat(shapeOff.attributes["y"]) : 0;
106120
- const rawWidth = shapeExt?.attributes?.["cx"] ? parseFloat(shapeExt.attributes["cx"]) : 914400;
106121
- const rawHeight = shapeExt?.attributes?.["cy"] ? parseFloat(shapeExt.attributes["cy"]) : 914400;
106122
- let x, y, width, height;
106123
- if (groupTransform.childWidth && groupTransform.childHeight) {
106124
- const scaleX = groupTransform.width / groupTransform.childWidth;
106125
- const scaleY = groupTransform.height / groupTransform.childHeight;
106126
- const childOriginX = groupTransform.childOriginXEmu || 0;
106127
- const childOriginY = groupTransform.childOriginYEmu || 0;
106128
- x = groupTransform.x + emuToPixels((rawX - childOriginX) * scaleX);
106129
- y = groupTransform.y + emuToPixels((rawY - childOriginY) * scaleY);
106130
- width = emuToPixels(rawWidth * scaleX);
106131
- height = emuToPixels(rawHeight * scaleY);
106132
- } else {
106133
- x = emuToPixels(rawX);
106134
- y = emuToPixels(rawY);
106135
- width = emuToPixels(rawWidth);
106136
- height = emuToPixels(rawHeight);
106137
- }
106138
- const rotation = shapeXfrm?.attributes?.["rot"] ? rotToDegrees(shapeXfrm.attributes["rot"]) : 0;
106139
- const flipH = shapeXfrm?.attributes?.["flipH"] === "1";
106140
- const flipV = shapeXfrm?.attributes?.["flipV"] === "1";
106141
- const style = wsp.elements?.find((el) => el.name === "wps:style");
106142
- const fillColor = extractFillColor(spPr, style);
106143
- const strokeColor = extractStrokeColor(spPr, style);
106144
- const strokeWidth = extractStrokeWidth(spPr);
106145
- const lineEnds = extractLineEnds(spPr);
106146
- const cNvPr = wsp.elements?.find((el) => el.name === "wps:cNvPr");
106147
- const shapeId = cNvPr?.attributes?.["id"];
106148
- const shapeName = cNvPr?.attributes?.["name"];
106149
- const textBoxContent = wsp.elements?.find((el) => el.name === "wps:txbx")?.elements?.find((el) => el.name === "w:txbxContent");
106150
- const bodyPr = wsp.elements?.find((el) => el.name === "wps:bodyPr");
106151
- let textContent = null;
106152
- if (textBoxContent)
106153
- textContent = extractTextFromTextBox(textBoxContent, bodyPr, params);
106154
- const textAlign = textContent?.horizontalAlign || "left";
106155
- return {
106156
- shapeType: "vectorShape",
106157
- attrs: {
106158
- kind: shapeKind,
106159
- customGeometry: customGeom || undefined,
106160
- x,
106161
- y,
106162
- width,
106163
- height,
106164
- rotation,
106165
- flipH,
106166
- flipV,
106167
- fillColor,
106168
- strokeColor,
106169
- strokeWidth,
106170
- lineEnds,
106171
- shapeId,
106172
- shapeName,
106173
- textContent,
106174
- textAlign,
106175
- textVerticalAlign: textContent?.verticalAlign,
106176
- textInsets: textContent?.insets
106177
- }
106178
- };
106179
- }).filter(Boolean);
106180
- const allShapes = [...childPictures.map((pic) => {
106181
- const spPr = pic.elements?.find((el) => el.name === "pic:spPr");
106182
- if (!spPr)
106183
- return null;
106184
- const xfrm$1 = findChildByLocalName(spPr.elements, "xfrm");
106185
- const off = findChildByLocalName(xfrm$1?.elements, "off");
106186
- const ext = findChildByLocalName(xfrm$1?.elements, "ext");
106187
- const rawX = off?.attributes?.["x"] ? parseFloat(off.attributes["x"]) : 0;
106188
- const rawY = off?.attributes?.["y"] ? parseFloat(off.attributes["y"]) : 0;
106189
- const rawWidth = ext?.attributes?.["cx"] ? parseFloat(ext.attributes["cx"]) : 914400;
106190
- const rawHeight = ext?.attributes?.["cy"] ? parseFloat(ext.attributes["cy"]) : 914400;
106191
- let x, y, width, height;
106192
- if (groupTransform.childWidth && groupTransform.childHeight) {
106193
- const scaleX = groupTransform.width / groupTransform.childWidth;
106194
- const scaleY = groupTransform.height / groupTransform.childHeight;
106195
- const childOriginX = groupTransform.childOriginXEmu || 0;
106196
- const childOriginY = groupTransform.childOriginYEmu || 0;
106197
- x = groupTransform.x + emuToPixels((rawX - childOriginX) * scaleX);
106198
- y = groupTransform.y + emuToPixels((rawY - childOriginY) * scaleY);
106199
- width = emuToPixels(rawWidth * scaleX);
106200
- height = emuToPixels(rawHeight * scaleY);
106201
- } else {
106202
- x = emuToPixels(rawX);
106203
- y = emuToPixels(rawY);
106204
- width = emuToPixels(rawWidth);
106205
- height = emuToPixels(rawHeight);
106206
- }
106207
- const blipFill = pic.elements?.find((el) => el.name === "pic:blipFill");
106208
- const blip = findChildByLocalName(blipFill?.elements, "blip");
106209
- if (!blip)
106210
- return null;
106211
- const alphaModFix = extractAlphaModFix(blip);
106212
- const rEmbed = blip.attributes?.["r:embed"];
106213
- if (!rEmbed)
106214
- return null;
106215
- const currentFile = params.filename || "document.xml";
106216
- let rels = params.docx[`word/_rels/${currentFile}.rels`];
106217
- if (!rels)
106218
- rels = params.docx[`word/_rels/document.xml.rels`];
106219
- const { elements } = rels?.elements.find((el) => el.name === "Relationships") || [];
106220
- const rel = elements?.find((el) => el.attributes["Id"] === rEmbed);
106221
- if (!rel)
106222
- return null;
106223
- const path2 = normalizeTargetPath$1(rel.attributes?.["Target"]);
106224
- const cNvPr = pic.elements?.find((el) => el.name === "pic:nvPicPr")?.elements?.find((el) => el.name === "pic:cNvPr");
106225
- const picId = cNvPr?.attributes?.["id"];
106226
- const picName = cNvPr?.attributes?.["name"];
106227
- return {
106228
- shapeType: "image",
106229
- attrs: {
106230
- x,
106231
- y,
106232
- width,
106233
- height,
106234
- src: path2,
106235
- imageId: picId,
106236
- imageName: picName,
106237
- ...alphaModFix ? { alphaModFix } : {}
106238
- }
106239
- };
106240
- }).filter(Boolean), ...shapes];
106554
+ const groupXfrm = getGroupXfrm(wgp);
106555
+ const groupTransform = buildShapeGroupTransformAttrs(groupXfrm);
106556
+ const allShapes = collectShapeGroupChildren(wgp, getGroupAffineTransform(groupXfrm), params);
106241
106557
  const schemaAttrs = {};
106242
106558
  const drawingNode = params.nodes?.[0];
106243
106559
  if (drawingNode?.name === DRAWING_XML_TAG)
@@ -106252,6 +106568,7 @@ var isRegExp = (value) => {
106252
106568
  size,
106253
106569
  padding,
106254
106570
  marginOffset,
106571
+ effectExtent,
106255
106572
  anchorData,
106256
106573
  wrap: wrap$1,
106257
106574
  originalAttributes: node2?.attributes
@@ -117007,7 +117324,7 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
117007
117324
  return children;
117008
117325
  }
117009
117326
  return [];
117010
- }, NON_RENDERED_STRUCTURAL_INLINE_TYPES, PARAGRAPH_CONTAINER_TYPES, NON_BREAKING_HYPHEN = "‑", DEFAULT_IMAGE_DIMENSION_PX = 100, isNodeHidden = (node2) => {
117327
+ }, NON_RENDERED_STRUCTURAL_INLINE_TYPES, PARAGRAPH_CONTAINER_TYPES, NON_BREAKING_HYPHEN = "‑", DEFAULT_IMAGE_DIMENSION_PX = 100, ALLOWED_OBJECT_FIT, isAllowedObjectFit$1 = (value) => typeof value === "string" && ALLOWED_OBJECT_FIT.has(value), isNodeHidden = (node2) => {
117011
117328
  const attrs = node2.attrs ?? {};
117012
117329
  if (attrs.hidden === true)
117013
117330
  return true;
@@ -117329,6 +117646,7 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
117329
117646
  fillColor: normalizeFillColor(rawAttrs.fillColor),
117330
117647
  strokeColor: normalizeStrokeColor(rawAttrs.strokeColor),
117331
117648
  strokeWidth: coerceNumber(rawAttrs.strokeWidth),
117649
+ effects: normalizeShapeEffects(rawAttrs.effects),
117332
117650
  textContent: normalizeTextContent(rawAttrs.textContent),
117333
117651
  textAlign: typeof rawAttrs.textAlign === "string" ? rawAttrs.textAlign : undefined,
117334
117652
  textVerticalAlign: normalizeTextVerticalAlign(rawAttrs.textVerticalAlign),
@@ -117336,6 +117654,77 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
117336
117654
  sourceAnchor,
117337
117655
  ...extraProps
117338
117656
  };
117657
+ }, mergeEffectExtents = (base$1, supplement) => {
117658
+ if (!base$1)
117659
+ return supplement;
117660
+ if (!supplement)
117661
+ return base$1;
117662
+ return {
117663
+ left: Math.max(base$1.left, supplement.left),
117664
+ top: Math.max(base$1.top, supplement.top),
117665
+ right: Math.max(base$1.right, supplement.right),
117666
+ bottom: Math.max(base$1.bottom, supplement.bottom)
117667
+ };
117668
+ }, hasEffectExtent = (extent) => {
117669
+ return !!extent && (extent.left > 0 || extent.top > 0 || extent.right > 0 || extent.bottom > 0);
117670
+ }, getCenteredStrokeHalfExtent = (attrs) => {
117671
+ if (!("fillColor" in attrs))
117672
+ return 0;
117673
+ if ("lineEnds" in attrs && attrs.lineEnds)
117674
+ return 0;
117675
+ if (attrs.strokeColor === null)
117676
+ return 0;
117677
+ const strokeWidth = pickNumber(attrs.strokeWidth) ?? 1;
117678
+ return strokeWidth > 0 ? strokeWidth / 2 : 0;
117679
+ }, getShapeGroupChildStrokeExtent = (child) => {
117680
+ if (child.shapeType !== "vectorShape" || !isPlainObject4(child.attrs))
117681
+ return 0;
117682
+ return getCenteredStrokeHalfExtent(child.attrs);
117683
+ }, getOuterShadowPaintExtent$1 = (attrs) => {
117684
+ if ("lineEnds" in attrs && attrs.lineEnds)
117685
+ return;
117686
+ const shadow = normalizeShapeEffects(attrs.effects)?.outerShadow;
117687
+ if (!shadow)
117688
+ return;
117689
+ const extent = getOuterShadowPaintExtent(shadow);
117690
+ return hasEffectExtent(extent) ? extent : undefined;
117691
+ }, getRequiredVectorShapeEffectExtent = (attrs) => {
117692
+ const strokeExtent = getCenteredStrokeHalfExtent(attrs);
117693
+ return mergeEffectExtents(strokeExtent > 0 ? {
117694
+ left: strokeExtent,
117695
+ top: strokeExtent,
117696
+ right: strokeExtent,
117697
+ bottom: strokeExtent
117698
+ } : undefined, getOuterShadowPaintExtent$1(attrs));
117699
+ }, getRequiredGroupEffectExtentFromChildren = (children, width, height) => {
117700
+ const required2 = {
117701
+ left: 0,
117702
+ top: 0,
117703
+ right: 0,
117704
+ bottom: 0
117705
+ };
117706
+ for (const child of children) {
117707
+ if (child.shapeType !== "vectorShape" || !isPlainObject4(child.attrs))
117708
+ continue;
117709
+ const strokeExtent = getShapeGroupChildStrokeExtent(child);
117710
+ const paintExtent = mergeEffectExtents(strokeExtent > 0 ? {
117711
+ left: strokeExtent,
117712
+ top: strokeExtent,
117713
+ right: strokeExtent,
117714
+ bottom: strokeExtent
117715
+ } : undefined, getOuterShadowPaintExtent$1(child.attrs));
117716
+ if (!paintExtent)
117717
+ continue;
117718
+ const childX = pickNumber(child.attrs.x) ?? 0;
117719
+ const childY = pickNumber(child.attrs.y) ?? 0;
117720
+ const childWidth = pickNumber(child.attrs.width) ?? 0;
117721
+ const childHeight = pickNumber(child.attrs.height) ?? 0;
117722
+ required2.left = Math.max(required2.left, Math.max(0, paintExtent.left - childX));
117723
+ required2.top = Math.max(required2.top, Math.max(0, paintExtent.top - childY));
117724
+ required2.right = Math.max(required2.right, Math.max(0, childX + childWidth + paintExtent.right - width));
117725
+ required2.bottom = Math.max(required2.bottom, Math.max(0, childY + childHeight + paintExtent.bottom - height));
117726
+ }
117727
+ return hasEffectExtent(required2) ? required2 : undefined;
117339
117728
  }, getAttrs$1 = (node2) => {
117340
117729
  return isPlainObject4(node2.attrs) ? { ...node2.attrs } : {};
117341
117730
  }, parseFullWidth = (value) => {
@@ -118604,7 +118993,7 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
118604
118993
  "data-track-change-date": change.date || ""
118605
118994
  }));
118606
118995
  }
118607
- }, NOTE_REFERENCE_NODE_TYPES, storeByEditor, liveSessionsByHost, cacheByHost, hostStoreSyncedKeys, BODY_LOCATOR, groupedCache, SDT_NODE_NAMES, SDT_BLOCK_NAME = "structuredContentBlock", SDT_INLINE_NAME = "structuredContent", SDT_NODE_TYPES, VALID_CONTROL_TYPES, VALID_LOCK_MODES, VALID_APPEARANCES, FIELD_LIKE_SDT_TYPES, liveDocumentCountsCache, BIBLIOGRAPHY_NAMESPACE_URI = "http://schemas.openxmlformats.org/officeDocument/2006/bibliography", CUSTOM_XML_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", CUSTOM_XML_PROPS_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", DEFAULT_SELECTED_STYLE = "/APA.XSL", DEFAULT_STYLE_NAME = "APA", DEFAULT_VERSION = "6", API_TO_OOXML_SOURCE_TYPE, OOXML_TO_API_SOURCE_TYPE, SIMPLE_FIELD_TO_XML_TAG, XML_TAG_TO_SIMPLE_FIELD, import_lib2, FONT_FAMILY_FALLBACKS, DEFAULT_GENERIC_FALLBACK = "sans-serif", DEFAULT_FONT_SIZE_PT = 10, CURRENT_APP_VERSION = "1.41.0", SUPERDOC_DOCUMENT_ORIGIN_PROPERTY = "SuperdocDocumentOrigin", STORED_DOCUMENT_ORIGINS, collectRunDefaultProperties = (runProps, { allowOverrideTypeface = true, allowOverrideSize = true, themeResolver, state }) => {
118996
+ }, NOTE_REFERENCE_NODE_TYPES, storeByEditor, liveSessionsByHost, cacheByHost, hostStoreSyncedKeys, BODY_LOCATOR, groupedCache, SDT_NODE_NAMES, SDT_BLOCK_NAME = "structuredContentBlock", SDT_INLINE_NAME = "structuredContent", SDT_NODE_TYPES, VALID_CONTROL_TYPES, VALID_LOCK_MODES, VALID_APPEARANCES, FIELD_LIKE_SDT_TYPES, liveDocumentCountsCache, BIBLIOGRAPHY_NAMESPACE_URI = "http://schemas.openxmlformats.org/officeDocument/2006/bibliography", CUSTOM_XML_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", CUSTOM_XML_PROPS_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", DEFAULT_SELECTED_STYLE = "/APA.XSL", DEFAULT_STYLE_NAME = "APA", DEFAULT_VERSION = "6", API_TO_OOXML_SOURCE_TYPE, OOXML_TO_API_SOURCE_TYPE, SIMPLE_FIELD_TO_XML_TAG, XML_TAG_TO_SIMPLE_FIELD, import_lib2, FONT_FAMILY_FALLBACKS, DEFAULT_GENERIC_FALLBACK = "sans-serif", DEFAULT_FONT_SIZE_PT = 10, CURRENT_APP_VERSION = "1.42.0", SUPERDOC_DOCUMENT_ORIGIN_PROPERTY = "SuperdocDocumentOrigin", STORED_DOCUMENT_ORIGINS, collectRunDefaultProperties = (runProps, { allowOverrideTypeface = true, allowOverrideSize = true, themeResolver, state }) => {
118608
118997
  if (!runProps?.elements?.length || !state)
118609
118998
  return;
118610
118999
  const fontsNode = runProps.elements.find((el) => el.name === "w:rFonts");
@@ -118638,7 +119027,7 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
118638
119027
  state.kern = kernNode.attributes["w:val"];
118639
119028
  }
118640
119029
  }, SuperConverter;
118641
- var init_SuperConverter_DQ2wMaLK_es = __esm(() => {
119030
+ var init_SuperConverter_18ny5wUo_es = __esm(() => {
118642
119031
  init_rolldown_runtime_Bg48TavK_es();
118643
119032
  init_jszip_C49i9kUs_es();
118644
119033
  init_xml_js_CqGKpaft_es();
@@ -146082,6 +146471,12 @@ var init_SuperConverter_DQ2wMaLK_es = __esm(() => {
146082
146471
  "index",
146083
146472
  "tableOfAuthorities"
146084
146473
  ]);
146474
+ ALLOWED_OBJECT_FIT = new Set([
146475
+ "contain",
146476
+ "cover",
146477
+ "fill",
146478
+ "scale-down"
146479
+ ]);
146085
146480
  VERTICAL_ELEMENTS = {
146086
146481
  "m:f": 0.6,
146087
146482
  "m:bar": 0.25,
@@ -147647,7 +148042,7 @@ var init_SuperConverter_DQ2wMaLK_es = __esm(() => {
147647
148042
  };
147648
148043
  });
147649
148044
 
147650
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-BhSfQYaO.es.js
148045
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-vcvhloZR.es.js
147651
148046
  function parseSizeUnit(val = "0") {
147652
148047
  const length = val.toString() || "0";
147653
148048
  const value = Number.parseFloat(length);
@@ -158390,9 +158785,9 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, MARK_KEYS, STEP_OP_CATALOG_UNFROZEN, PU
158390
158785
  }
158391
158786
  };
158392
158787
  };
158393
- var init_create_headless_toolbar_BhSfQYaO_es = __esm(() => {
158788
+ var init_create_headless_toolbar_vcvhloZR_es = __esm(() => {
158394
158789
  init_rolldown_runtime_Bg48TavK_es();
158395
- init_SuperConverter_DQ2wMaLK_es();
158790
+ init_SuperConverter_18ny5wUo_es();
158396
158791
  init_jszip_C49i9kUs_es();
158397
158792
  init_uuid_B2wVPhPi_es();
158398
158793
  init_constants_D9qj59G2_es();
@@ -214008,7 +214403,7 @@ var init_remark_gfm_DCND_V_3_es = __esm(() => {
214008
214403
  init_remark_gfm_BUJjZJLy_es();
214009
214404
  });
214010
214405
 
214011
- // ../../packages/superdoc/dist/chunks/src-CkxGCnVm.es.js
214406
+ // ../../packages/superdoc/dist/chunks/src-BFPHxhWM.es.js
214012
214407
  function deleteProps(obj, propOrProps) {
214013
214408
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
214014
214409
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -214155,7 +214550,7 @@ function prosemirrorToYXmlFragment(doc$12, xmlFragment) {
214155
214550
  }
214156
214551
  function getSuperdocVersion() {
214157
214552
  try {
214158
- return "1.41.0";
214553
+ return "1.42.0";
214159
214554
  } catch {
214160
214555
  return "unknown";
214161
214556
  }
@@ -220274,11 +220669,25 @@ function x0(t, n, o) {
220274
220669
  paths: l.paths
220275
220670
  } : null;
220276
220671
  }
220672
+ function W0(t, n, o) {
220673
+ let L = Math.max(0, Number(t) || 0), e = Math.max(0, Number(n) || 0), l = Math.min(L, e) * (16667 / 1e5), r$1 = Math.max(0, L - l), i3 = Math.max(0, e - l);
220674
+ return {
220675
+ preset: "roundRect",
220676
+ viewBox: `0 0 ${L} ${e}`,
220677
+ paths: l0([{
220678
+ d: `M 0 ${l} A ${l} ${l} 0 0 1 ${l} 0 L ${r$1} 0 A ${l} ${l} 0 0 1 ${L} ${l} L ${L} ${i3} A ${l} ${l} 0 0 1 ${r$1} ${e} L ${l} ${e} A ${l} ${l} 0 0 1 0 ${i3} Z`,
220679
+ fill: "#000000",
220680
+ stroke: "#000000"
220681
+ }], o)
220682
+ };
220683
+ }
220277
220684
  function i0(t) {
220278
220685
  let { preset: n, styleOverrides: o, width: L, height: e } = t;
220279
220686
  if (!n)
220280
220687
  throw new Error("createPresetShape requires a preset name.");
220281
- if (F.has(n) && L != null && e != null && L !== e) {
220688
+ if (n === "roundRect" && L != null && e != null)
220689
+ return W0(L, e, o);
220690
+ if (F.has(n) && L != null && e != null && (L !== e || n === "leftUpArrow")) {
220282
220691
  let i3 = x0(n, L, e);
220283
220692
  if (i3)
220284
220693
  return {
@@ -258188,6 +258597,19 @@ function calculateFirstLineIndent(block, measure) {
258188
258597
  const gutterWidthRaw = measure.marker.gutterWidth ?? 0;
258189
258598
  return markerWidth + (Number.isFinite(gutterWidthRaw) && gutterWidthRaw >= 0 ? gutterWidthRaw : 0);
258190
258599
  }
258600
+ function getSuppressedMarkerImageGroupAnchorOffset(entry, suppressVisibleSectPrMarkerParagraph, hasPageRelativeAnchorForParagraph, markerSpacingBefore) {
258601
+ if (!suppressVisibleSectPrMarkerParagraph || !hasPageRelativeAnchorForParagraph)
258602
+ return 0;
258603
+ if (entry.block.kind !== "drawing" || entry.block.drawingKind !== "shapeGroup")
258604
+ return 0;
258605
+ if (!entry.block.shapes?.some((child) => child.shapeType === "image"))
258606
+ return 0;
258607
+ if ((entry.block.anchor?.vRelativeFrom ?? "paragraph") !== "paragraph")
258608
+ return 0;
258609
+ if (entry.block.anchor?.alignV && entry.block.anchor.alignV !== "top")
258610
+ return 0;
258611
+ return Math.max(0, markerSpacingBefore / 2);
258612
+ }
258191
258613
  function layoutParagraphBlock(ctx$1, anchors) {
258192
258614
  const { block, measure, columnWidth, ensurePage, advanceColumn, columnX, floatManager } = ctx$1;
258193
258615
  const remeasureParagraph$1 = ctx$1.remeasureParagraph;
@@ -258224,6 +258646,13 @@ function layoutParagraphBlock(ctx$1, anchors) {
258224
258646
  if (!spacingExplicit.after)
258225
258647
  spacingAfter = 0;
258226
258648
  }
258649
+ const markerSpacingBefore = spacingBefore;
258650
+ const hasAnchoredObjects = Boolean(anchors?.anchoredDrawings?.length || anchors?.anchoredTables?.length);
258651
+ const suppressVisibleSectPrMarkerParagraph = attrs?.sectPrMarker === true && emptyTextParagraph && hasAnchoredObjects;
258652
+ if (suppressVisibleSectPrMarkerParagraph) {
258653
+ spacingBefore = 0;
258654
+ spacingAfter = 0;
258655
+ }
258227
258656
  const baseSpacingBefore = spacingBefore;
258228
258657
  let appliedSpacingBefore = spacingBefore === 0;
258229
258658
  let lastState = null;
@@ -258242,7 +258671,11 @@ function layoutParagraphBlock(ctx$1, anchors) {
258242
258671
  suppressSpacingBefore: shouldSuppressOwnSpacing(styleId$1, contextualSpacing, previewState.lastParagraphStyleId),
258243
258672
  rewindTrailingFromPrevious: shouldSuppressOwnSpacing(previewState.lastParagraphStyleId, previewState.lastParagraphContextualSpacing, styleId$1)
258244
258673
  }) + borderExpansion.top - (inBorderGroup ? rawBorderExpansion.bottom : 0);
258674
+ const sectionBaseTopMargin = anchors?.sectionBaseTopMargin;
258675
+ const sectionHeaderDistance = typeof anchors?.sectionHeaderDistance === "number" ? Math.max(0, anchors.sectionHeaderDistance) : 0;
258676
+ const effectiveParagraphAnchorBaseY = suppressVisibleSectPrMarkerParagraph && typeof sectionBaseTopMargin === "number" && anchors?.hasPageRelativeAnchorForParagraph !== true && Math.abs(previewState.cursorY - previewState.topMargin) < 0.001 && Math.abs(paragraphAnchorBaseY - previewState.topMargin) < 0.001 ? Math.min(sectionBaseTopMargin + sectionHeaderDistance, paragraphAnchorBaseY) : paragraphAnchorBaseY;
258245
258677
  let paragraphContentEndY = paragraphAnchorBaseY;
258678
+ const anchorFirstLineHeight = suppressVisibleSectPrMarkerParagraph ? 0 : measure.lines?.[0]?.lineHeight ?? 0;
258246
258679
  const registerAnchoredDrawingsAt = (paragraphContentStartY) => {
258247
258680
  if (!anchors?.anchoredDrawings?.length)
258248
258681
  return;
@@ -258252,14 +258685,15 @@ function layoutParagraphBlock(ctx$1, anchors) {
258252
258685
  const state = ensurePage();
258253
258686
  const contentTop = state.topMargin;
258254
258687
  const contentBottom = state.contentBottom;
258688
+ const anchorParagraphY = paragraphContentStartY + getSuppressedMarkerImageGroupAnchorOffset(entry, suppressVisibleSectPrMarkerParagraph, anchors.hasPageRelativeAnchorForParagraph === true, markerSpacingBefore);
258255
258689
  const anchorY = resolveAnchoredGraphicY({
258256
258690
  anchor: entry.block.anchor,
258257
258691
  objectHeight: entry.measure.height,
258258
258692
  contentTop,
258259
258693
  contentBottom,
258260
258694
  pageBottomMargin: anchors.pageMargins.bottom ?? 0,
258261
- anchorParagraphY: paragraphContentStartY,
258262
- firstLineHeight: measure.lines?.[0]?.lineHeight ?? 0
258695
+ anchorParagraphY,
258696
+ firstLineHeight: anchorFirstLineHeight
258263
258697
  });
258264
258698
  floatManager.registerDrawing(entry.block, entry.measure, anchorY, state.columnIndex, state.page.number);
258265
258699
  const anchorX = entry.block.anchor ? resolveAnchoredGraphicX(entry.block.anchor, state.columnIndex, anchors.columns, entry.measure.width, {
@@ -258338,7 +258772,7 @@ function layoutParagraphBlock(ctx$1, anchors) {
258338
258772
  anchors.placedAnchoredIds.add(entry.block.id);
258339
258773
  }
258340
258774
  };
258341
- registerAnchoredDrawingsAt(paragraphAnchorBaseY);
258775
+ registerAnchoredDrawingsAt(effectiveParagraphAnchorBaseY);
258342
258776
  const registerAnchoredTablesAt = (paragraphContentStartY, entries) => {
258343
258777
  if (!entries.length)
258344
258778
  return;
@@ -258354,7 +258788,7 @@ function layoutParagraphBlock(ctx$1, anchors) {
258354
258788
  const contentTop = state.topMargin;
258355
258789
  const contentBottom = state.contentBottom;
258356
258790
  const layoutOffsetV = entry.layoutOffsetV;
258357
- const firstLineHeight = measure.lines?.[0]?.lineHeight ?? 0;
258791
+ const firstLineHeight = anchorFirstLineHeight;
258358
258792
  const wrapType = entry.block.wrap?.type ?? "None";
258359
258793
  const anchorY = resolveAnchoredGraphicY({
258360
258794
  anchor: graphicAnchorY(anchorForLineScopedFormField(layoutOffsetV != null && entry.block.anchor ? {
@@ -258366,7 +258800,7 @@ function layoutParagraphBlock(ctx$1, anchors) {
258366
258800
  contentBottom,
258367
258801
  pageBottomMargin: anchors.pageMargins.bottom ?? 0,
258368
258802
  anchorParagraphY: nextStackY,
258369
- firstLineHeight: measure.lines?.[0]?.lineHeight ?? 0
258803
+ firstLineHeight: anchorFirstLineHeight
258370
258804
  });
258371
258805
  floatManager.registerTable(entry.block, entry.measure, anchorY, state.columnIndex, state.page.number);
258372
258806
  const anchorX = entry.block.anchor ? resolveAnchoredGraphicX(graphicAnchorH(entry.block.anchor), state.columnIndex, anchors.columns, totalWidth, {
@@ -258387,11 +258821,15 @@ function layoutParagraphBlock(ctx$1, anchors) {
258387
258821
  const remainingHeightOnStartPage = previewState.contentBottom - paragraphAnchorBaseY;
258388
258822
  const paragraphWillSpanPages = lines.length > 1 && totalLineHeight > remainingHeightOnStartPage;
258389
258823
  const shouldPreLayoutSquareTable = (entry) => entry.lineScopedOnAnchor === true && !paragraphWillSpanPages;
258390
- registerAnchoredTablesAt(paragraphAnchorBaseY, anchoredTablesForPara.filter((entry) => {
258824
+ registerAnchoredTablesAt(effectiveParagraphAnchorBaseY, anchoredTablesForPara.filter((entry) => {
258391
258825
  if ((entry.block.wrap?.type ?? "None") === "None")
258392
258826
  return true;
258393
258827
  return shouldPreLayoutSquareTable(entry);
258394
258828
  }));
258829
+ if (suppressVisibleSectPrMarkerParagraph) {
258830
+ registerAnchoredTablesAt(effectiveParagraphAnchorBaseY, anchors?.anchoredTables ?? []);
258831
+ return;
258832
+ }
258395
258833
  if (frame?.wrap === "none") {
258396
258834
  let state = ensurePage();
258397
258835
  if (state.cursorY >= state.contentBottom)
@@ -258852,6 +259290,34 @@ function collectPreRegisteredAnchors(blocks2, measures) {
258852
259290
  }
258853
259291
  return result;
258854
259292
  }
259293
+ function collectPageRelativeAnchorsByParagraph(blocks2, measures) {
259294
+ const map$12 = /* @__PURE__ */ new Map;
259295
+ const len2 = Math.min(blocks2.length, measures.length);
259296
+ const paragraphIndexById = buildParagraphIndexById(blocks2, len2);
259297
+ for (let i3 = 0;i3 < len2; i3 += 1) {
259298
+ const block = blocks2[i3];
259299
+ const measure = measures[i3];
259300
+ const isImage = block.kind === "image" && measure?.kind === "image";
259301
+ const isDrawing = block.kind === "drawing" && measure?.kind === "drawing";
259302
+ if (!isImage && !isDrawing)
259303
+ continue;
259304
+ const drawingBlock = block;
259305
+ const drawingMeasure = measure;
259306
+ if (!drawingBlock.anchor?.isAnchored || !isPageRelativeAnchor(drawingBlock))
259307
+ continue;
259308
+ const anchorParagraphId = typeof drawingBlock.attrs === "object" && drawingBlock.attrs ? drawingBlock.attrs.anchorParagraphId : undefined;
259309
+ const anchorParaIndex = resolveAnchorParagraphIndex(blocks2, len2, paragraphIndexById, i3, anchorParagraphId);
259310
+ if (anchorParaIndex == null)
259311
+ continue;
259312
+ const list5 = map$12.get(anchorParaIndex) ?? [];
259313
+ list5.push({
259314
+ block: drawingBlock,
259315
+ measure: drawingMeasure
259316
+ });
259317
+ map$12.set(anchorParaIndex, list5);
259318
+ }
259319
+ return map$12;
259320
+ }
258855
259321
  function collectAnchoredDrawings(blocks2, measures) {
258856
259322
  const byParagraph = /* @__PURE__ */ new Map;
258857
259323
  const withoutParagraph = [];
@@ -260794,7 +261260,58 @@ function layoutDocument(blocks2, measures, options = {}) {
260794
261260
  const paragraphlessAnchoredTables = anchoredTables.withoutParagraph;
260795
261261
  const placedAnchoredIds = /* @__PURE__ */ new Set;
260796
261262
  const preRegisteredAnchors = collectPreRegisteredAnchors(blocks2, measures);
260797
- const preRegisteredPositions = /* @__PURE__ */ new Map;
261263
+ const pageRelativeAnchorsByParagraph = collectPageRelativeAnchorsByParagraph(blocks2, measures);
261264
+ const preRegisteredAnchorIds = /* @__PURE__ */ new Set;
261265
+ const blockIndexById = new Map(blocks2.map((candidateBlock, candidateIndex) => [candidateBlock.id, candidateIndex]));
261266
+ const hasHardBreakBetween = (startIndex, endIndex) => {
261267
+ const first$1 = Math.min(startIndex, endIndex) + 1;
261268
+ const last2 = Math.max(startIndex, endIndex);
261269
+ for (let candidateIndex = first$1;candidateIndex < last2; candidateIndex += 1) {
261270
+ const candidateBlock = blocks2[candidateIndex];
261271
+ if (candidateBlock.kind === "pageBreak" || candidateBlock.kind === "sectionBreak" || candidateBlock.kind === "columnBreak")
261272
+ return true;
261273
+ }
261274
+ return false;
261275
+ };
261276
+ const shouldWrapParagraphWithPageRelativeAnchor = (anchorBlock, paragraphIndex, paragraphId) => {
261277
+ const anchorParagraphId = anchorBlock.attrs != null && typeof anchorBlock.attrs === "object" ? anchorBlock.attrs.anchorParagraphId : undefined;
261278
+ if (typeof anchorParagraphId === "string")
261279
+ return anchorParagraphId === paragraphId;
261280
+ const anchorIndex = blockIndexById.get(anchorBlock.id);
261281
+ if (anchorIndex == null || anchorIndex === paragraphIndex)
261282
+ return false;
261283
+ return !hasHardBreakBetween(paragraphIndex, anchorIndex);
261284
+ };
261285
+ const isWrappingDrawingAnchor = (anchorBlock) => {
261286
+ const wrapType = anchorBlock.wrap?.type ?? "None";
261287
+ return wrapType !== "None" && wrapType !== "Inline";
261288
+ };
261289
+ const collectLaterPageRelativeAnchorsForParagraph = (paragraphIndex, paragraphId) => {
261290
+ const anchors = [];
261291
+ for (const entry of preRegisteredAnchors) {
261292
+ const anchorIndex = blockIndexById.get(entry.block.id);
261293
+ if (anchorIndex == null || anchorIndex <= paragraphIndex)
261294
+ continue;
261295
+ if (!isWrappingDrawingAnchor(entry.block))
261296
+ continue;
261297
+ if (!shouldWrapParagraphWithPageRelativeAnchor(entry.block, paragraphIndex, paragraphId))
261298
+ continue;
261299
+ anchors.push(entry);
261300
+ }
261301
+ return anchors.length > 0 ? anchors : undefined;
261302
+ };
261303
+ const mergeAnchoredDrawings = (...groups) => {
261304
+ const merged = [];
261305
+ const seen = /* @__PURE__ */ new Set;
261306
+ for (const group of groups)
261307
+ for (const entry of group ?? []) {
261308
+ if (seen.has(entry.block.id))
261309
+ continue;
261310
+ seen.add(entry.block.id);
261311
+ merged.push(entry);
261312
+ }
261313
+ return merged.length > 0 ? merged : undefined;
261314
+ };
260798
261315
  const resolveParagraphlessAnchoredTableY = (block, measure, state) => {
260799
261316
  const contentTop = state.topMargin;
260800
261317
  const contentBottom = state.contentBottom;
@@ -260808,40 +261325,36 @@ function layoutDocument(blocks2, measures, options = {}) {
260808
261325
  preRegisteredFallbackToContentTop: true
260809
261326
  });
260810
261327
  };
260811
- const resolveParagraphlessAnchoredDrawingY = (block, measure, state) => resolveAnchoredGraphicY({
260812
- anchor: block.anchor,
260813
- objectHeight: measure.height ?? 0,
260814
- contentTop: state.topMargin,
260815
- contentBottom: state.contentBottom,
260816
- pageBottomMargin: state.page.margins?.bottom ?? activeBottomMargin,
260817
- preRegisteredFallbackToContentTop: true
260818
- });
260819
- const resolveParagraphlessAnchoredDrawingX = (block, measure, state) => block.anchor ? computeAnchorX(block.anchor, state.columnIndex, normalizeColumns(activeColumns, activePageSize.w - (activeLeftMargin + activeRightMargin)), measure.width, {
260820
- left: activeLeftMargin,
260821
- right: activeRightMargin
260822
- }, activePageSize.w) : columnX(state);
260823
- for (const entry of preRegisteredAnchors) {
260824
- const state = paginator.ensurePage();
261328
+ const resolveAnchoredDrawingPosition = (block, measure, state) => {
260825
261329
  const contentTop = state.topMargin;
260826
261330
  const contentBottom = state.contentBottom;
260827
261331
  const anchorY = resolveAnchoredGraphicY({
260828
- anchor: entry.block.anchor,
260829
- objectHeight: entry.measure.height ?? 0,
261332
+ anchor: block.anchor,
261333
+ objectHeight: measure.height ?? 0,
260830
261334
  contentTop,
260831
261335
  contentBottom,
260832
261336
  pageBottomMargin: state.page.margins?.bottom ?? activeBottomMargin,
260833
261337
  preRegisteredFallbackToContentTop: true
260834
261338
  });
260835
- const anchorX = entry.block.anchor ? computeAnchorX(entry.block.anchor, state.columnIndex, normalizeColumns(activeColumns, activePageSize.w - (activeLeftMargin + activeRightMargin)), entry.measure.width, {
260836
- left: activeLeftMargin,
260837
- right: activeRightMargin
260838
- }, activePageSize.w) : activeLeftMargin;
260839
- floatManager.registerDrawing(entry.block, entry.measure, anchorY, state.columnIndex, state.page.number);
260840
- preRegisteredPositions.set(entry.block.id, {
260841
- anchorX,
261339
+ const columns = getActiveColumnsForState(state);
261340
+ const pageMargins = {
261341
+ top: state.page.margins?.top ?? activeTopMargin,
261342
+ bottom: state.page.margins?.bottom ?? activeBottomMargin,
261343
+ left: state.page.margins?.left ?? activeLeftMargin,
261344
+ right: state.page.margins?.right ?? activeRightMargin
261345
+ };
261346
+ const pageWidth = state.page.size?.w ?? activePageSize.w;
261347
+ const contentWidth = pageWidth - ((pageMargins.left ?? 0) + (pageMargins.right ?? 0));
261348
+ return {
261349
+ anchorX: block.anchor ? computeAnchorX(block.anchor, state.columnIndex, normalizeColumns(columns, contentWidth), measure.width, {
261350
+ left: pageMargins.left,
261351
+ right: pageMargins.right
261352
+ }, pageWidth) : pageMargins.left ?? activeLeftMargin,
260842
261353
  anchorY
260843
- });
260844
- }
261354
+ };
261355
+ };
261356
+ for (const entry of preRegisteredAnchors)
261357
+ preRegisteredAnchorIds.add(entry.block.id);
260845
261358
  const keepNextChains = computeKeepNextChains(blocks2);
260846
261359
  const midChainIndices = /* @__PURE__ */ new Set;
260847
261360
  for (const chain of keepNextChains.values())
@@ -261053,20 +261566,25 @@ function layoutDocument(blocks2, measures, options = {}) {
261053
261566
  if (measure.kind !== "paragraph")
261054
261567
  throw new Error(`layoutDocument: expected paragraph measure for block ${block.id}`);
261055
261568
  const paraBlock = block;
261056
- if (!paraBlock.runs || paraBlock.runs.length === 0 || paraBlock.runs.length === 1 && (!paraBlock.runs[0].kind || paraBlock.runs[0].kind === "text") && (!paraBlock.runs[0].text || paraBlock.runs[0].text === "")) {
261569
+ const isEmpty3 = !paraBlock.runs || paraBlock.runs.length === 0 || paraBlock.runs.length === 1 && (!paraBlock.runs[0].kind || paraBlock.runs[0].kind === "text") && (!paraBlock.runs[0].text || paraBlock.runs[0].text === "");
261570
+ const drawingAnchorsForPara = anchoredByParagraph.get(index2);
261571
+ const wrappingPageRelativeAnchorsForPara = pageRelativeAnchorsByParagraph.get(index2)?.filter(({ block: anchorBlock }) => shouldWrapParagraphWithPageRelativeAnchor(anchorBlock, index2, paraBlock.id));
261572
+ const laterPageRelativeAnchorsForPara = collectLaterPageRelativeAnchorsForParagraph(index2, paraBlock.id);
261573
+ const anchorsForPara = mergeAnchoredDrawings(drawingAnchorsForPara, wrappingPageRelativeAnchorsForPara, laterPageRelativeAnchorsForPara);
261574
+ const tablesForPara = anchoredTablesByParagraph.get(index2);
261575
+ if (isEmpty3) {
261057
261576
  const isSectPrMarker = paraBlock.attrs?.sectPrMarker === true;
261058
261577
  const prevBlock = index2 > 0 ? blocks2[index2 - 1] : null;
261059
261578
  const nextBlock = index2 < blocks2.length - 1 ? blocks2[index2 + 1] : null;
261060
261579
  const nextSectionBreak = nextBlock?.kind === "sectionBreak" ? nextBlock : null;
261061
261580
  const nextBreakType = nextSectionBreak?.type ?? (nextSectionBreak?.attrs?.source === "sectPr" ? "nextPage" : undefined);
261062
261581
  const nextBreakForcesPage = nextSectionBreak && (nextBreakType === "nextPage" || nextBreakType === "evenPage" || nextBreakType === "oddPage" || nextSectionBreak.attrs?.requirePageBoundary === true);
261063
- if (isSectPrMarker && nextBreakForcesPage)
261582
+ const hasAnchoredObjectsForMarker = Boolean(anchorsForPara?.length || tablesForPara?.length);
261583
+ if (isSectPrMarker && nextBreakForcesPage && !hasAnchoredObjectsForMarker)
261064
261584
  continue;
261065
- if (prevBlock?.kind === "pageBreak" && nextBlock?.kind === "sectionBreak")
261585
+ if (prevBlock?.kind === "pageBreak" && nextBlock?.kind === "sectionBreak" && !hasAnchoredObjectsForMarker)
261066
261586
  continue;
261067
261587
  }
261068
- const anchorsForPara = anchoredByParagraph.get(index2);
261069
- const tablesForPara = anchoredTablesByParagraph.get(index2);
261070
261588
  const chain = keepNextChains.get(index2);
261071
261589
  if (midChainIndices.has(index2)) {} else if (chain) {
261072
261590
  let state = paginator.ensurePage();
@@ -261137,6 +261655,10 @@ function layoutDocument(blocks2, measures, options = {}) {
261137
261655
  overrideSpacingAfter = 0;
261138
261656
  }
261139
261657
  }
261658
+ const hasPageRelativeAnchorForPara = Boolean(pageRelativeAnchorsByParagraph.get(index2)?.length || laterPageRelativeAnchorsForPara?.length || tablesForPara?.some(({ block: tableBlock }) => {
261659
+ const vRelativeFrom = tableBlock.anchor?.vRelativeFrom;
261660
+ return vRelativeFrom === "page" || vRelativeFrom === "margin";
261661
+ }));
261140
261662
  layoutParagraphBlock({
261141
261663
  block,
261142
261664
  measure,
@@ -261162,6 +261684,9 @@ function layoutDocument(blocks2, measures, options = {}) {
261162
261684
  left: activeLeftMargin,
261163
261685
  right: activeRightMargin
261164
261686
  },
261687
+ sectionBaseTopMargin: activeSectionBaseTopMargin,
261688
+ sectionHeaderDistance: activeHeaderDistance,
261689
+ hasPageRelativeAnchorForParagraph: hasPageRelativeAnchorForPara,
261165
261690
  columns: getCurrentColumns(),
261166
261691
  placedAnchoredIds
261167
261692
  } : undefined);
@@ -261189,11 +261714,14 @@ function layoutDocument(blocks2, measures, options = {}) {
261189
261714
  if (block.kind === "image") {
261190
261715
  if (measure.kind !== "image")
261191
261716
  throw new Error(`layoutDocument: expected image measure for block ${block.id}`);
261192
- const preRegPos = preRegisteredPositions.get(block.id);
261193
- if (preRegPos && Number.isFinite(preRegPos.anchorX) && Number.isFinite(preRegPos.anchorY)) {
261717
+ if (placedAnchoredIds.has(block.id))
261718
+ continue;
261719
+ if (preRegisteredAnchorIds.has(block.id)) {
261194
261720
  const state = paginator.ensurePage();
261195
261721
  const imgBlock = block;
261196
261722
  const imgMeasure = measure;
261723
+ const { anchorX, anchorY } = resolveAnchoredDrawingPosition(imgBlock, imgMeasure, state);
261724
+ floatManager.registerDrawing(imgBlock, imgMeasure, anchorY, state.columnIndex, state.page.number);
261197
261725
  const pageContentHeight = Math.max(0, state.contentBottom - state.topMargin);
261198
261726
  const relativeFrom = imgBlock.anchor?.hRelativeFrom ?? "column";
261199
261727
  const cols = getCurrentColumns();
@@ -261219,8 +261747,8 @@ function layoutDocument(blocks2, measures, options = {}) {
261219
261747
  const fragment = {
261220
261748
  kind: "image",
261221
261749
  blockId: imgBlock.id,
261222
- x: preRegPos.anchorX,
261223
- y: preRegPos.anchorY,
261750
+ x: anchorX,
261751
+ y: anchorY,
261224
261752
  width: imgMeasure.width,
261225
261753
  height: imgMeasure.height,
261226
261754
  isAnchored: true,
@@ -261251,18 +261779,21 @@ function layoutDocument(blocks2, measures, options = {}) {
261251
261779
  if (block.kind === "drawing") {
261252
261780
  if (measure.kind !== "drawing")
261253
261781
  throw new Error(`layoutDocument: expected drawing measure for block ${block.id}`);
261254
- const preRegPos = preRegisteredPositions.get(block.id);
261255
- if (preRegPos && Number.isFinite(preRegPos.anchorX) && Number.isFinite(preRegPos.anchorY)) {
261782
+ if (placedAnchoredIds.has(block.id))
261783
+ continue;
261784
+ if (preRegisteredAnchorIds.has(block.id)) {
261256
261785
  const state = paginator.ensurePage();
261257
261786
  const drawBlock = block;
261258
261787
  const drawMeasure = measure;
261788
+ const { anchorX, anchorY } = resolveAnchoredDrawingPosition(drawBlock, drawMeasure, state);
261789
+ floatManager.registerDrawing(drawBlock, drawMeasure, anchorY, state.columnIndex, state.page.number);
261259
261790
  const contentMeasures = drawBlock.drawingKind === "textboxShape" && typeof options.remeasureParagraph === "function" ? layoutTextboxContent(drawBlock, options.remeasureParagraph) : undefined;
261260
261791
  const fragment = {
261261
261792
  kind: "drawing",
261262
261793
  blockId: drawBlock.id,
261263
261794
  drawingKind: drawBlock.drawingKind,
261264
- x: preRegPos.anchorX,
261265
- y: preRegPos.anchorY,
261795
+ x: anchorX,
261796
+ y: anchorY,
261266
261797
  width: drawMeasure.width,
261267
261798
  height: drawMeasure.height,
261268
261799
  geometry: drawMeasure.geometry,
@@ -261344,8 +261875,7 @@ function layoutDocument(blocks2, measures, options = {}) {
261344
261875
  for (const { block, measure } of paragraphlessAnchoredDrawings) {
261345
261876
  if (placedAnchoredIds.has(block.id))
261346
261877
  continue;
261347
- const anchorX = resolveParagraphlessAnchoredDrawingX(block, measure, state);
261348
- const anchorY = resolveParagraphlessAnchoredDrawingY(block, measure, state);
261878
+ const { anchorX, anchorY } = resolveAnchoredDrawingPosition(block, measure, state);
261349
261879
  if (block.kind === "image" && measure.kind === "image") {
261350
261880
  const pageContentHeight = Math.max(0, state.contentBottom - state.topMargin);
261351
261881
  const aspectRatio = measure.width > 0 && measure.height > 0 ? measure.width / measure.height : 1;
@@ -261613,6 +262143,15 @@ function getPageRelativeMeasurementBand(kind, constraints) {
261613
262143
  end: bandSize
261614
262144
  };
261615
262145
  }
262146
+ function isHeaderFooterAbsoluteOverlay(block, kind, fragment, fragmentBottom, canvasHeight) {
262147
+ if (!kind)
262148
+ return false;
262149
+ if (block.anchor?.isAnchored !== true)
262150
+ return false;
262151
+ if (block.wrap?.type !== "None")
262152
+ return false;
262153
+ return fragment.y < 0 || fragmentBottom > canvasHeight;
262154
+ }
261616
262155
  function shouldExcludeFromMeasurement(fragment, block, fragmentBottom, canvasHeight, kind, constraints) {
261617
262156
  if (!((fragment.kind === "image" || fragment.kind === "drawing") && fragment.isAnchored === true))
261618
262157
  return false;
@@ -261621,6 +262160,8 @@ function shouldExcludeFromMeasurement(fragment, block, fragmentBottom, canvasHei
261621
262160
  const anchoredBlock = block;
261622
262161
  if (anchoredBlock.anchor?.behindDoc)
261623
262162
  return true;
262163
+ if (isHeaderFooterAbsoluteOverlay(anchoredBlock, kind, fragment, fragmentBottom, canvasHeight))
262164
+ return true;
261624
262165
  if (isPageRelativeAnchor(anchoredBlock)) {
261625
262166
  const fragmentTop = fragment.y;
261626
262167
  if (fragmentBottom <= 0 || fragmentTop >= canvasHeight)
@@ -261631,13 +262172,6 @@ function shouldExcludeFromMeasurement(fragment, block, fragmentBottom, canvasHei
261631
262172
  if (measurementBand && !rangesIntersect(fragment.y, fragmentBottom, measurementBand.start, measurementBand.end))
261632
262173
  return true;
261633
262174
  }
261634
- const fragmentHeight = typeof fragment.height === "number" ? fragment.height : fragmentBottom - fragment.y;
261635
- const fragmentWidth = typeof fragment.width === "number" ? fragment.width : 0;
261636
- const heightCoversCanvas = Number.isFinite(fragmentHeight) && fragmentHeight >= canvasHeight;
261637
- const widthCoversCanvas = Number.isFinite(constraints.width) && constraints.width > 0 && fragmentWidth >= constraints.width;
261638
- const isOverlayWrap = anchoredBlock.wrap?.type === "None";
261639
- if (kind && heightCoversCanvas && widthCoversCanvas && isOverlayWrap)
261640
- return true;
261641
262175
  return false;
261642
262176
  }
261643
262177
  function layoutHeaderFooter(blocks2, measures, constraints, kind, remeasureParagraph$1) {
@@ -273678,13 +274212,17 @@ async function buildMeasuredAutoFitContentMetrics(block, workingInput, fixedLayo
273678
274212
  cellMetricKeys: contentMetrics.cellMetricKeys
273679
274213
  };
273680
274214
  }
274215
+ function isBehindDocOverlay(block) {
274216
+ return block.anchor?.behindDoc === true || block.wrap?.type === "None" && block.wrap?.behindDoc === true;
274217
+ }
274218
+ function hasNegativeVerticalPosition(block) {
274219
+ return block.anchor?.isAnchored === true && (typeof block.anchor?.offsetV === "number" && block.anchor.offsetV < 0 || typeof block.margin?.top === "number" && block.margin.top < 0);
274220
+ }
273681
274221
  async function measureImageBlock(block, constraints) {
273682
274222
  const intrinsic = getIntrinsicImageSize(block, constraints.maxWidth);
273683
- const isBlockBehindDoc = block.anchor?.behindDoc;
273684
- const isBlockWrapBehindDoc = block.wrap?.type === "None" && block.wrap?.behindDoc;
273685
274223
  const isPageRelativeAnchor$1 = block.anchor?.isAnchored && (block.anchor?.hRelativeFrom === "page" || block.anchor?.hRelativeFrom === "margin");
273686
- const maxWidth = isBlockBehindDoc || isBlockWrapBehindDoc || isPageRelativeAnchor$1 || constraints.maxWidth <= 0 ? intrinsic.width : constraints.maxWidth;
273687
- const maxHeight = block.anchor?.isAnchored && (typeof block.anchor?.offsetV === "number" && block.anchor.offsetV < 0 || typeof block.margin?.top === "number" && block.margin.top < 0) || block.objectFit === "cover" || !constraints.maxHeight || constraints.maxHeight <= 0 ? Infinity : constraints.maxHeight;
274224
+ const maxWidth = isBehindDocOverlay(block) || isPageRelativeAnchor$1 || constraints.maxWidth <= 0 ? intrinsic.width : constraints.maxWidth;
274225
+ const maxHeight = isBehindDocOverlay(block) || hasNegativeVerticalPosition(block) || block.objectFit === "cover" || !constraints.maxHeight || constraints.maxHeight <= 0 ? Infinity : constraints.maxHeight;
273688
274226
  const widthScale = maxWidth / intrinsic.width;
273689
274227
  const heightScale = maxHeight / intrinsic.height;
273690
274228
  const scale = Math.min(1, widthScale, heightScale);
@@ -273697,8 +274235,9 @@ async function measureImageBlock(block, constraints) {
273697
274235
  async function measureDrawingBlock(block, constraints) {
273698
274236
  if (block.drawingKind === "image") {
273699
274237
  const intrinsic = getIntrinsicSizeFromDims(block.width, block.height, constraints.maxWidth);
273700
- const maxWidth$1 = constraints.maxWidth > 0 ? constraints.maxWidth : intrinsic.width;
273701
- const maxHeight$1 = constraints.maxHeight && constraints.maxHeight > 0 ? constraints.maxHeight : Infinity;
274238
+ const isPageRelativeAnchor$1 = block.anchor?.isAnchored === true && (block.anchor.hRelativeFrom === "page" || block.anchor.hRelativeFrom === "margin");
274239
+ const maxWidth$1 = isBehindDocOverlay(block) || isPageRelativeAnchor$1 || constraints.maxWidth <= 0 ? intrinsic.width : constraints.maxWidth;
274240
+ const maxHeight$1 = isBehindDocOverlay(block) || hasNegativeVerticalPosition(block) || !constraints.maxHeight || constraints.maxHeight <= 0 ? Infinity : constraints.maxHeight;
273702
274241
  const widthScale$1 = maxWidth$1 / intrinsic.width;
273703
274242
  const heightScale$1 = maxHeight$1 / intrinsic.height;
273704
274243
  const scale$1 = Math.min(1, widthScale$1, heightScale$1);
@@ -273720,6 +274259,21 @@ async function measureDrawingBlock(block, constraints) {
273720
274259
  };
273721
274260
  }
273722
274261
  const geometry = ensureDrawingGeometry(block.geometry);
274262
+ if (block.drawingKind === "shapeGroup" && block.groupTransform) {
274263
+ const effectExtent = block.effectExtent ?? {
274264
+ left: 0,
274265
+ top: 0,
274266
+ right: 0,
274267
+ bottom: 0
274268
+ };
274269
+ const groupWidth = block.groupTransform.width ?? geometry.width;
274270
+ const groupHeight = block.groupTransform.height ?? geometry.height;
274271
+ geometry.width = Math.max(1, geometry.width, groupWidth + effectExtent.left + effectExtent.right);
274272
+ geometry.height = Math.max(1, geometry.height, groupHeight + effectExtent.top + effectExtent.bottom);
274273
+ geometry.rotation = normalizeRotation(block.groupTransform.rotation ?? geometry.rotation ?? 0);
274274
+ geometry.flipH = Boolean(block.groupTransform.flipH ?? geometry.flipH);
274275
+ geometry.flipV = Boolean(block.groupTransform.flipV ?? geometry.flipV);
274276
+ }
273723
274277
  const attrs = block.attrs;
273724
274278
  const indentLeft = typeof attrs?.hrIndentLeft === "number" ? attrs.hrIndentLeft : 0;
273725
274279
  const indentRight = typeof attrs?.hrIndentRight === "number" ? attrs.hrIndentRight : 0;
@@ -273731,7 +274285,7 @@ async function measureDrawingBlock(block, constraints) {
273731
274285
  const naturalHeight = Math.max(1, rotatedBounds.height);
273732
274286
  const isFloating = block.wrap?.type === "None" || block.anchor?.isAnchored === true;
273733
274287
  const maxWidth = fullWidthMax ?? (constraints.maxWidth > 0 && !isFloating ? constraints.maxWidth : naturalWidth);
273734
- const maxHeight = block.anchor?.isAnchored && (typeof block.anchor?.offsetV === "number" && block.anchor.offsetV < 0 || typeof block.margin?.top === "number" && block.margin.top < 0) || !constraints.maxHeight || constraints.maxHeight <= 0 ? Infinity : constraints.maxHeight;
274288
+ const maxHeight = isBehindDocOverlay(block) || hasNegativeVerticalPosition(block) || !constraints.maxHeight || constraints.maxHeight <= 0 ? Infinity : constraints.maxHeight;
273735
274289
  const widthScale = maxWidth / naturalWidth;
273736
274290
  const heightScale = maxHeight / naturalHeight;
273737
274291
  const normalizedScale = Math.min(1, widthScale, heightScale);
@@ -274319,15 +274873,17 @@ function shiftResolvedPaintItemY(item, yOffset) {
274319
274873
  y: item.y + yOffset
274320
274874
  };
274321
274875
  }
274322
- function isExplicitBehindDocMediaFragment(fragment) {
274323
- return (fragment.kind === "image" || fragment.kind === "drawing") && fragment.behindDoc === true;
274876
+ function isExcludedFromDecorationNormalization(fragment) {
274877
+ if (fragment.kind !== "image" && fragment.kind !== "drawing")
274878
+ return false;
274879
+ return fragment.behindDoc === true || fragment.isAnchored === true || fragment.sourceAnchor != null;
274324
274880
  }
274325
274881
  function getDecorationNormalizationMinY(fragments, layoutMinY) {
274326
274882
  if (!Number.isFinite(layoutMinY) || layoutMinY >= 0)
274327
274883
  return 0;
274328
274884
  let minY = Infinity;
274329
274885
  for (const fragment of fragments) {
274330
- if (isExplicitBehindDocMediaFragment(fragment))
274886
+ if (isExcludedFromDecorationNormalization(fragment))
274331
274887
  continue;
274332
274888
  if (Number.isFinite(fragment.y))
274333
274889
  minY = Math.min(minY, fragment.y);
@@ -292039,7 +292595,7 @@ var Node$13 = class Node$14 {
292039
292595
  domAvailabilityCache = false;
292040
292596
  return false;
292041
292597
  }
292042
- }, summaryVersion = "1.41.0", nodeKeys, markKeys, transformListsInCopiedContent = (html3) => {
292598
+ }, summaryVersion = "1.42.0", nodeKeys, markKeys, transformListsInCopiedContent = (html3) => {
292043
292599
  const container = document.createElement("div");
292044
292600
  container.innerHTML = html3;
292045
292601
  const result = [];
@@ -293225,7 +293781,7 @@ var Node$13 = class Node$14 {
293225
293781
  return () => {};
293226
293782
  const handle3 = setInterval(callback, intervalMs);
293227
293783
  return () => clearInterval(handle3);
293228
- }, HISTORY_UNSAFE_OPS, CANONICAL_COMMENT_IGNORED_KEYS, INITIAL_HASH, ROUND_CONSTANTS, V1_COVERAGE, V2_COVERAGE, SNAPSHOT_VERSION_V2 = "sd-diff-snapshot/v2", PAYLOAD_VERSION_V1 = "sd-diff-payload/v1", PAYLOAD_VERSION_V2 = "sd-diff-payload/v2", ENGINE_ID = "super-editor", STAGED_CONVERTER_KEYS, DiffServiceError, TC_LEVEL_MIN = 1, TC_LEVEL_MAX = 9, ALLOWED_WRAP_ATTRS, WRAP_TYPES_SUPPORTING_SIDE, WRAP_TYPES_SUPPORTING_DISTANCES, RELATIVE_HEIGHT_MIN = 0, RELATIVE_HEIGHT_MAX = 4294967295, FORBIDDEN_RAW_PATCH_NAMES, CONTROL_TYPE_SDT_PR_ELEMENTS, DEFAULT_CHECKBOX_SYMBOL_FONT2 = "MS Gothic", DEFAULT_CHECKBOX_CHECKED_HEX2 = "2612", DEFAULT_CHECKBOX_UNCHECKED_HEX2 = "2610", VARIANT_ORDER, KIND_ORDER, HEADER_RELATIONSHIP_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", DOCUMENT_RELS_PATH2 = "word/_rels/document.xml.rels", HEADER_FILE_PATTERN2, FOOTER_FILE_PATTERN2, BOOKMARK_SCAN_REVISION_PREFIX = "bookmark-scan:", import_lib4, CUSTOM_XML_DATA_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", CUSTOM_XML_PROPS_RELATIONSHIP_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", CUSTOM_XML_DATASTORE_NAMESPACE = "http://schemas.openxmlformats.org/officeDocument/2006/customXml", SETTINGS_PART, VALID_DISPLAYS, REFERENCE_BLOCK_PREFIX, CAPTION_STYLE_NAMES, CAPTION_PARAGRAPH_STYLE_ID = "Caption", CAPTION_FORMAT_TO_OOXML, DOCUMENT_STAT_FIELD_TYPES, TOA_LEADER_REVERSE_MAP, EDGE_NODE_TYPES, CONTENT_TYPES_PART_ID = "[Content_Types].xml", CONTENT_TYPES_NS = "http://schemas.openxmlformats.org/package/2006/content-types", contentTypesPartDescriptor, empty_exports, init_empty, CURRENT_APP_VERSION2 = "1.41.0", PIXELS_PER_INCH2 = 96, MAX_HEIGHT_BUFFER_PX = 50, MAX_WIDTH_BUFFER_PX = 20, TRACKED_REVIEW_MARK_NAMES2, isTrackedReviewMark = (mark2) => Boolean(mark2?.type?.name && TRACKED_REVIEW_MARK_NAMES2.has(mark2.type.name)), trackedReviewMarkKey = (mark2) => {
293784
+ }, HISTORY_UNSAFE_OPS, CANONICAL_COMMENT_IGNORED_KEYS, INITIAL_HASH, ROUND_CONSTANTS, V1_COVERAGE, V2_COVERAGE, SNAPSHOT_VERSION_V2 = "sd-diff-snapshot/v2", PAYLOAD_VERSION_V1 = "sd-diff-payload/v1", PAYLOAD_VERSION_V2 = "sd-diff-payload/v2", ENGINE_ID = "super-editor", STAGED_CONVERTER_KEYS, DiffServiceError, TC_LEVEL_MIN = 1, TC_LEVEL_MAX = 9, ALLOWED_WRAP_ATTRS, WRAP_TYPES_SUPPORTING_SIDE, WRAP_TYPES_SUPPORTING_DISTANCES, RELATIVE_HEIGHT_MIN = 0, RELATIVE_HEIGHT_MAX = 4294967295, FORBIDDEN_RAW_PATCH_NAMES, CONTROL_TYPE_SDT_PR_ELEMENTS, DEFAULT_CHECKBOX_SYMBOL_FONT2 = "MS Gothic", DEFAULT_CHECKBOX_CHECKED_HEX2 = "2612", DEFAULT_CHECKBOX_UNCHECKED_HEX2 = "2610", VARIANT_ORDER, KIND_ORDER, HEADER_RELATIONSHIP_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", DOCUMENT_RELS_PATH2 = "word/_rels/document.xml.rels", HEADER_FILE_PATTERN2, FOOTER_FILE_PATTERN2, BOOKMARK_SCAN_REVISION_PREFIX = "bookmark-scan:", import_lib4, CUSTOM_XML_DATA_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", CUSTOM_XML_PROPS_RELATIONSHIP_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", CUSTOM_XML_DATASTORE_NAMESPACE = "http://schemas.openxmlformats.org/officeDocument/2006/customXml", SETTINGS_PART, VALID_DISPLAYS, REFERENCE_BLOCK_PREFIX, CAPTION_STYLE_NAMES, CAPTION_PARAGRAPH_STYLE_ID = "Caption", CAPTION_FORMAT_TO_OOXML, DOCUMENT_STAT_FIELD_TYPES, TOA_LEADER_REVERSE_MAP, EDGE_NODE_TYPES, CONTENT_TYPES_PART_ID = "[Content_Types].xml", CONTENT_TYPES_NS = "http://schemas.openxmlformats.org/package/2006/content-types", contentTypesPartDescriptor, empty_exports, init_empty, CURRENT_APP_VERSION2 = "1.42.0", PIXELS_PER_INCH2 = 96, MAX_HEIGHT_BUFFER_PX = 50, MAX_WIDTH_BUFFER_PX = 20, TRACKED_REVIEW_MARK_NAMES2, isTrackedReviewMark = (mark2) => Boolean(mark2?.type?.name && TRACKED_REVIEW_MARK_NAMES2.has(mark2.type.name)), trackedReviewMarkKey = (mark2) => {
293229
293785
  if (!isTrackedReviewMark(mark2))
293230
293786
  return null;
293231
293787
  const id2 = typeof mark2.attrs?.id === "string" ? mark2.attrs.id : "";
@@ -295890,6 +296446,12 @@ menclose::after {
295890
296446
  if (!SUPPORTED_IMAGE_CLIP_PATH_PREFIXES.some((prefix2) => lower.startsWith(prefix2)))
295891
296447
  return "";
295892
296448
  return normalized;
296449
+ }, applyImageObjectFit = (img2, objectFit) => {
296450
+ img2.style.objectFit = objectFit;
296451
+ if (objectFit === "cover")
296452
+ img2.style.objectPosition = "left top";
296453
+ else
296454
+ img2.style.removeProperty("object-position");
295893
296455
  }, applyRunDataAttributes = (element3, dataAttrs) => {
295894
296456
  if (!dataAttrs)
295895
296457
  return;
@@ -296177,7 +296739,10 @@ menclose::after {
296177
296739
  }, renderImageRun = (run2, context) => {
296178
296740
  if (!run2.src)
296179
296741
  return null;
296180
- const hasClipPath = typeof run2.clipPath === "string" && run2.clipPath.trim().length > 0;
296742
+ const runClipPath = readImageClipPathValue(run2.clipPath);
296743
+ const shapeClipPath = readImageClipPathValue(run2.shapeClipPath);
296744
+ const hasClipPath = runClipPath.length > 0;
296745
+ const hasShapeClipPath = shapeClipPath.length > 0;
296181
296746
  const img2 = context.doc.createElement("img");
296182
296747
  img2.classList.add(DOM_CLASS_NAMES.INLINE_IMAGE);
296183
296748
  if (typeof run2.src === "string" && run2.src.startsWith("data:")) {
@@ -296191,7 +296756,7 @@ menclose::after {
296191
296756
  else
296192
296757
  return null;
296193
296758
  }
296194
- if (!hasClipPath) {
296759
+ if (!hasClipPath && !hasShapeClipPath) {
296195
296760
  img2.width = run2.width;
296196
296761
  img2.height = run2.height;
296197
296762
  } else
@@ -296204,7 +296769,9 @@ menclose::after {
296204
296769
  minWidth: "0",
296205
296770
  minHeight: "0"
296206
296771
  });
296207
- applyImageClipPath(img2, run2.clipPath);
296772
+ applyImageClipPath(img2, runClipPath);
296773
+ if (run2.objectFit)
296774
+ applyImageObjectFit(img2, run2.objectFit);
296208
296775
  if (run2.width > 0 && run2.height > 0) {
296209
296776
  const aspectRatio = run2.width / run2.height;
296210
296777
  const inlineImageMetadata = {
@@ -296222,7 +296789,7 @@ menclose::after {
296222
296789
  if (run2.title)
296223
296790
  img2.title = run2.title;
296224
296791
  img2.style.display = "inline-block";
296225
- const useWrapper = hasClipPath && run2.width > 0 && run2.height > 0;
296792
+ const useWrapper = (hasClipPath || hasShapeClipPath) && run2.width > 0 && run2.height > 0;
296226
296793
  if (!useWrapper) {
296227
296794
  img2.style.verticalAlign = run2.verticalAlign ?? "top";
296228
296795
  if (run2.distTop)
@@ -296283,6 +296850,8 @@ menclose::after {
296283
296850
  wrapper.style.marginRight = `${run2.distRight}px`;
296284
296851
  wrapper.style.position = "relative";
296285
296852
  wrapper.style.zIndex = "1";
296853
+ if (shapeClipPath)
296854
+ wrapper.style.clipPath = shapeClipPath;
296286
296855
  if (run2.pmStart != null)
296287
296856
  wrapper.dataset.pmStart = String(run2.pmStart);
296288
296857
  if (run2.pmEnd != null)
@@ -296302,7 +296871,6 @@ menclose::after {
296302
296871
  context.applySdtDataset(img2, run2.sdt);
296303
296872
  if (run2.dataAttrs)
296304
296873
  applyRunDataAttributes(img2, run2.dataAttrs);
296305
- const runClipPath = readImageClipPathValue(run2.clipPath);
296306
296874
  if (runClipPath) {
296307
296875
  img2.style.clipPath = runClipPath;
296308
296876
  img2.style.display = "block";
@@ -296348,6 +296916,12 @@ menclose::after {
296348
296916
  return "";
296349
296917
  const record3 = block;
296350
296918
  return readImageClipPathValue(record3.clipPath) || resolveClipPathFromAttrs$1(record3.attrs);
296919
+ }, resolveBlockImageShapeClipPath = (block) => {
296920
+ if (!block || typeof block !== "object")
296921
+ return "";
296922
+ const record3 = block;
296923
+ const attrs = record3.attrs && typeof record3.attrs === "object" ? record3.attrs : undefined;
296924
+ return readImageClipPathValue(record3.shapeClipPath) || readImageClipPathValue(attrs?.shapeClipPath);
296351
296925
  }, createBlockImageContent = ({ doc: doc$12, block, className, clipContainer, imageDisplay, hyperlinkDisplay = "block", buildImageHyperlinkAnchor: buildImageHyperlinkAnchor$1 }) => {
296352
296926
  const img2 = doc$12.createElement("img");
296353
296927
  if (className)
@@ -296357,10 +296931,19 @@ menclose::after {
296357
296931
  img2.alt = block.alt ?? "";
296358
296932
  img2.style.width = "100%";
296359
296933
  img2.style.height = "100%";
296360
- img2.style.objectFit = block.objectFit ?? "contain";
296361
- if (block.objectFit === "cover")
296362
- img2.style.objectPosition = "left top";
296363
- applyImageClipPath(img2, resolveBlockImageClipPath(block), clipContainer ? { clipContainer } : undefined);
296934
+ applyImageObjectFit(img2, block.objectFit ?? "contain");
296935
+ const shapeClipPath = resolveBlockImageShapeClipPath(block);
296936
+ const ownShapeClipContainer = shapeClipPath && !clipContainer ? doc$12.createElement("div") : undefined;
296937
+ if (ownShapeClipContainer) {
296938
+ ownShapeClipContainer.style.width = "100%";
296939
+ ownShapeClipContainer.style.height = "100%";
296940
+ }
296941
+ const shapeClipContainer = clipContainer ?? ownShapeClipContainer;
296942
+ if (shapeClipPath && shapeClipContainer) {
296943
+ shapeClipContainer.style.clipPath = shapeClipPath;
296944
+ shapeClipContainer.style.overflow = "hidden";
296945
+ }
296946
+ applyImageClipPath(img2, resolveBlockImageClipPath(block), shapeClipContainer ? { clipContainer: shapeClipContainer } : undefined);
296364
296947
  img2.style.display = imageDisplay ?? (block.display === "inline" ? "inline-block" : "block");
296365
296948
  const filters = buildImageFilters(block);
296366
296949
  if (filters.length > 0)
@@ -296368,7 +296951,12 @@ menclose::after {
296368
296951
  const opacity = resolveImageOpacity(block);
296369
296952
  if (opacity != null)
296370
296953
  img2.style.opacity = opacity;
296371
- return buildImageHyperlinkAnchor$1?.(img2, block.hyperlink, hyperlinkDisplay) ?? img2;
296954
+ const content3 = buildImageHyperlinkAnchor$1?.(img2, block.hyperlink, hyperlinkDisplay) ?? img2;
296955
+ if (ownShapeClipContainer) {
296956
+ ownShapeClipContainer.appendChild(content3);
296957
+ return ownShapeClipContainer;
296958
+ }
296959
+ return content3;
296372
296960
  }, buildImageHyperlinkAnchor = (doc$12, imageEl, hyperlink, display) => {
296373
296961
  if (!hyperlink?.url)
296374
296962
  return imageEl;
@@ -300504,13 +301092,24 @@ menclose::after {
300504
301092
  const img2 = doc$12.createElement("img");
300505
301093
  img2.src = attrs.src;
300506
301094
  img2.alt = attrs.alt ?? "";
300507
- img2.style.objectFit = "contain";
301095
+ applyImageObjectFit(img2, attrs.objectFit ?? "contain");
300508
301096
  img2.style.display = "block";
300509
- applyImageClipPath(img2, attrs.clipPath);
300510
301097
  const opacity = resolveImageOpacity(attrs);
300511
301098
  if (opacity != null)
300512
301099
  img2.style.opacity = opacity;
300513
- return img2;
301100
+ img2.style.width = "100%";
301101
+ img2.style.height = "100%";
301102
+ if (!attrs.clipPath && !attrs.shapeClipPath)
301103
+ return img2;
301104
+ const clipContainer = doc$12.createElement("div");
301105
+ clipContainer.style.width = "100%";
301106
+ clipContainer.style.height = "100%";
301107
+ clipContainer.style.overflow = "hidden";
301108
+ if (attrs.shapeClipPath)
301109
+ clipContainer.style.clipPath = attrs.shapeClipPath;
301110
+ applyImageClipPath(img2, attrs.clipPath, { clipContainer });
301111
+ clipContainer.appendChild(img2);
301112
+ return clipContainer;
300514
301113
  }, createShapeTextImageElement = (doc$12, part) => {
300515
301114
  const img2 = doc$12.createElement("img");
300516
301115
  img2.src = part.src;
@@ -300601,7 +301200,7 @@ menclose::after {
300601
301200
  });
300602
301201
  return createErrorPlaceholder(fragment.blockId, error48);
300603
301202
  }
300604
- }, ACTIVE_HEADER_FOOTER_WATERMARK_PREVIEW_OPACITY = "1", INACTIVE_HEADER_FOOTER_WATERMARK_PREVIEW_OPACITY = "0.5", resolveOrBuildFragmentIdentity = (fragment, story, existing) => buildLayoutSourceIdentityForFragment(existing ? {
301203
+ }, ACTIVE_HEADER_FOOTER_WATERMARK_PREVIEW_OPACITY = "1", INACTIVE_HEADER_FOOTER_WATERMARK_PREVIEW_OPACITY = "0.5", normalizeRotationDegrees = (rotation) => (rotation % 360 + 360) % 360, resolveOrBuildFragmentIdentity = (fragment, story, existing) => buildLayoutSourceIdentityForFragment(existing ? {
300605
301204
  ...fragment,
300606
301205
  layoutSourceIdentity: existing,
300607
301206
  sourceAnchor: fragment.sourceAnchor ?? existing.sourceAnchor
@@ -300615,7 +301214,7 @@ menclose::after {
300615
301214
  kind,
300616
301215
  id: id2
300617
301216
  } : { kind };
300618
- }, DEFAULT_PAGE_HEIGHT_PX = 1056, DEFAULT_VIRTUALIZED_PAGE_GAP = 72, SVG_NS = "http://www.w3.org/2000/svg", WORDART_LINE_FILL_RATIO = 0.9, DomPainter = class {
301217
+ }, DEFAULT_PAGE_HEIGHT_PX = 1056, DEFAULT_VIRTUALIZED_PAGE_GAP = 72, PAGE_BACKGROUND_OVERLAY_Z_ORDER_OFFSET = 1e6, SVG_NS = "http://www.w3.org/2000/svg", WORDART_LINE_FILL_RATIO = 0.9, DomPainter = class {
300619
301218
  constructor(options = {}) {
300620
301219
  this.mount = null;
300621
301220
  this.doc = null;
@@ -301446,6 +302045,63 @@ menclose::after {
301446
302045
  return false;
301447
302046
  return block.anchor?.vRelativeFrom === "page";
301448
302047
  }
302048
+ isHorizontallyPageRelativeAnchoredFragment(fragment, resolvedItem) {
302049
+ if (fragment.kind !== "image" && fragment.kind !== "drawing")
302050
+ return false;
302051
+ const block = resolvedItem && "block" in resolvedItem ? resolvedItem.block : undefined;
302052
+ if (!block || block.kind !== "image" && block.kind !== "drawing")
302053
+ return false;
302054
+ return block.anchor?.hRelativeFrom === "page";
302055
+ }
302056
+ isHeaderFooterAbsoluteOverlayFragment(fragment, kind, resolvedItem) {
302057
+ if (kind !== "header" && kind !== "footer")
302058
+ return false;
302059
+ if (fragment.kind !== "image" && fragment.kind !== "drawing")
302060
+ return false;
302061
+ if (fragment.isAnchored !== true)
302062
+ return false;
302063
+ const block = resolvedItem && "block" in resolvedItem ? resolvedItem.block : undefined;
302064
+ if (!block || block.kind !== "image" && block.kind !== "drawing")
302065
+ return false;
302066
+ if (block.anchor?.isAnchored !== true)
302067
+ return false;
302068
+ if (block.wrap?.type !== "None")
302069
+ return false;
302070
+ if (fragment.behindDoc === true || block.anchor?.behindDoc === true)
302071
+ return false;
302072
+ return true;
302073
+ }
302074
+ getPageBackgroundDecorationZOrder(fragment, resolvedItem) {
302075
+ const block = resolvedItem && "block" in resolvedItem ? resolvedItem.block : undefined;
302076
+ const isDrawingBlock = block?.kind === "image" || block?.kind === "drawing";
302077
+ const normalizedZIndex = normalizeZIndex(isDrawingBlock ? block.attrs?.originalAttributes : undefined);
302078
+ const isBehindDoc = (fragment.kind === "image" || fragment.kind === "drawing") && fragment.behindDoc === true || isDrawingBlock && block.anchor?.behindDoc === true;
302079
+ if (isBehindDoc && normalizedZIndex != null)
302080
+ return normalizedZIndex;
302081
+ if ((fragment.kind === "image" || fragment.kind === "drawing") && typeof fragment.zIndex === "number")
302082
+ return isBehindDoc ? fragment.zIndex : PAGE_BACKGROUND_OVERLAY_Z_ORDER_OFFSET + Math.max(1, fragment.zIndex);
302083
+ if (normalizedZIndex != null)
302084
+ return PAGE_BACKGROUND_OVERLAY_Z_ORDER_OFFSET + Math.max(1, normalizedZIndex);
302085
+ return 0;
302086
+ }
302087
+ insertPageBackgroundDecoration(pageEl, fragEl, zOrder) {
302088
+ fragEl.dataset.pageBackgroundZIndex = String(zOrder);
302089
+ let lastBackgroundDecoration = null;
302090
+ let insertBefore = null;
302091
+ for (const child of Array.from(pageEl.children)) {
302092
+ const el = child;
302093
+ if (el.dataset.behindDocSection != null || el.dataset.headerFooterOverlaySection != null) {
302094
+ if (Number(el.dataset.pageBackgroundZIndex ?? 0) > zOrder) {
302095
+ insertBefore = el;
302096
+ break;
302097
+ }
302098
+ lastBackgroundDecoration = el;
302099
+ continue;
302100
+ }
302101
+ break;
302102
+ }
302103
+ pageEl.insertBefore(fragEl, insertBefore ?? lastBackgroundDecoration?.nextSibling ?? pageEl.firstChild);
302104
+ }
301449
302105
  getDecorationAnchorPageOriginY(page, kind, effectiveOffset) {
301450
302106
  if (kind === "header")
301451
302107
  return effectiveOffset;
@@ -301470,8 +302126,12 @@ menclose::after {
301470
302126
  const className = kind === "header" ? CLASS_NAMES$1.pageHeader : CLASS_NAMES$1.pageFooter;
301471
302127
  const existing = pageEl.querySelector(`.${className}`);
301472
302128
  const data = provider ? provider(page.number, page.margins, page) : null;
302129
+ const behindDocSelector = `[data-behind-doc-section="${kind}"]`;
302130
+ const overlaySelector = `[data-header-footer-overlay-section="${kind}"]`;
301473
302131
  if (!data || data.fragments.length === 0) {
301474
302132
  existing?.remove();
302133
+ pageEl.querySelectorAll(behindDocSelector).forEach((el) => el.remove());
302134
+ pageEl.querySelectorAll(overlaySelector).forEach((el) => el.remove());
301475
302135
  return;
301476
302136
  }
301477
302137
  const container = existing ?? this.doc.createElement("div");
@@ -301533,27 +302193,34 @@ menclose::after {
301533
302193
  const decorationItems = data.items ?? [];
301534
302194
  const betweenBorderFlags = computeBetweenBorderFlags(decorationItems);
301535
302195
  const behindDocFragments = [];
302196
+ const absoluteOverlayFragments = [];
301536
302197
  const normalFragments = [];
301537
302198
  for (let fi = 0;fi < data.fragments.length; fi += 1) {
301538
302199
  const fragment = data.fragments[fi];
302200
+ const resolvedItem = decorationItems[fi];
301539
302201
  let isBehindDoc = false;
301540
302202
  if (fragment.kind === "image" || fragment.kind === "drawing") {
301541
- const resolvedItem = decorationItems[fi];
301542
- isBehindDoc = fragment.behindDoc === true || fragment.behindDoc == null && "zIndex" in fragment && fragment.zIndex === 0 || this.shouldRenderBehindPageContent(fragment, kind, resolvedItem);
302203
+ const resolvedMediaItem = resolvedItem;
302204
+ isBehindDoc = fragment.behindDoc === true || fragment.behindDoc == null && "zIndex" in fragment && fragment.zIndex === 0 || this.shouldRenderBehindPageContent(fragment, kind, resolvedMediaItem);
301543
302205
  }
301544
302206
  if (isBehindDoc)
301545
302207
  behindDocFragments.push({
301546
302208
  fragment,
301547
302209
  originalIndex: fi
301548
302210
  });
302211
+ else if (this.isHeaderFooterAbsoluteOverlayFragment(fragment, kind, resolvedItem))
302212
+ absoluteOverlayFragments.push({
302213
+ fragment,
302214
+ originalIndex: fi
302215
+ });
301549
302216
  else
301550
302217
  normalFragments.push({
301551
302218
  fragment,
301552
302219
  originalIndex: fi
301553
302220
  });
301554
302221
  }
301555
- const behindDocSelector = `[data-behind-doc-section="${kind}"]`;
301556
302222
  pageEl.querySelectorAll(behindDocSelector).forEach((el) => el.remove());
302223
+ pageEl.querySelectorAll(overlaySelector).forEach((el) => el.remove());
301557
302224
  behindDocFragments.forEach(({ fragment, originalIndex }) => {
301558
302225
  const resolvedItem = data.items?.[originalIndex];
301559
302226
  const fragEl = this.renderFragment(fragment, context, undefined, betweenBorderFlags.get(originalIndex), resolvedItem);
@@ -301566,11 +302233,12 @@ menclose::after {
301566
302233
  pageY = fragment.y;
301567
302234
  else
301568
302235
  pageY = effectiveOffset + fragment.y + (kind === "footer" ? footerYOffset : 0);
302236
+ const isHorizontallyPageRelative = this.isHorizontallyPageRelativeAnchoredFragment(fragment, resolvedItem);
301569
302237
  fragEl.style.top = `${pageY}px`;
301570
- fragEl.style.left = `${isPageRelative ? fragment.x : marginLeft + fragment.x}px`;
302238
+ fragEl.style.left = `${isHorizontallyPageRelative ? fragment.x : marginLeft + fragment.x}px`;
301571
302239
  fragEl.style.zIndex = "0";
301572
302240
  fragEl.dataset.behindDocSection = kind;
301573
- pageEl.insertBefore(fragEl, pageEl.firstChild);
302241
+ this.insertPageBackgroundDecoration(pageEl, fragEl, this.getPageBackgroundDecorationZOrder(fragment, resolvedItem));
301574
302242
  });
301575
302243
  normalFragments.forEach(({ fragment, originalIndex }) => {
301576
302244
  const resolvedItem = data.items?.[originalIndex];
@@ -301589,6 +302257,27 @@ menclose::after {
301589
302257
  });
301590
302258
  if (!existing)
301591
302259
  pageEl.appendChild(container);
302260
+ absoluteOverlayFragments.forEach(({ fragment, originalIndex }) => {
302261
+ const resolvedItem = data.items?.[originalIndex];
302262
+ const fragEl = this.renderFragment(fragment, context, undefined, betweenBorderFlags.get(originalIndex), resolvedItem);
302263
+ const isPageRelative = this.isPageRelativeAnchoredFragment(fragment, resolvedItem);
302264
+ this.applyHeaderFooterTextWatermarkPreviewOpacity(fragEl, data.isActiveHeaderFooter === true);
302265
+ let pageY;
302266
+ if (isPageRelative && kind === "footer")
302267
+ pageY = footerAnchorPageOriginY + fragment.y;
302268
+ else if (isPageRelative)
302269
+ pageY = fragment.y;
302270
+ else
302271
+ pageY = effectiveOffset + fragment.y + (kind === "footer" ? footerYOffset : 0);
302272
+ const isHorizontallyPageRelative = this.isHorizontallyPageRelativeAnchoredFragment(fragment, resolvedItem);
302273
+ fragEl.style.top = `${pageY}px`;
302274
+ fragEl.style.left = `${isHorizontallyPageRelative ? fragment.x : marginLeft + fragment.x}px`;
302275
+ fragEl.style.zIndex = "0";
302276
+ if (data.isActiveHeaderFooter !== true)
302277
+ fragEl.style.pointerEvents = "none";
302278
+ fragEl.dataset.headerFooterOverlaySection = kind;
302279
+ this.insertPageBackgroundDecoration(pageEl, fragEl, this.getPageBackgroundDecorationZOrder(fragment, resolvedItem));
302280
+ });
301592
302281
  }
301593
302282
  resetState() {
301594
302283
  if (this.mount) {
@@ -302013,6 +302702,19 @@ menclose::after {
302013
302702
  innerWrapper.style.width = `${fragment.geometry.width}px`;
302014
302703
  innerWrapper.style.height = `${fragment.geometry.height}px`;
302015
302704
  innerWrapper.style.transformOrigin = "center";
302705
+ if (block.drawingKind === "shapeGroup" && block.groupTransform) {
302706
+ const effectExtent = block.effectExtent ?? {
302707
+ left: 0,
302708
+ top: 0,
302709
+ right: 0,
302710
+ bottom: 0
302711
+ };
302712
+ const groupWidth = block.groupTransform.width ?? Math.max(0, block.geometry.width - effectExtent.left - effectExtent.right);
302713
+ const groupHeight = block.groupTransform.height ?? Math.max(0, block.geometry.height - effectExtent.top - effectExtent.bottom);
302714
+ const originX = effectExtent.left + groupWidth / 2;
302715
+ const originY = effectExtent.top + groupHeight / 2;
302716
+ innerWrapper.style.transformOrigin = `${originX}px ${originY}px`;
302717
+ }
302016
302718
  const scale = fragment.scale ?? 1;
302017
302719
  const transforms = ["translate(-50%, -50%)"];
302018
302720
  transforms.push(`rotate(${fragment.geometry.rotation ?? 0}deg)`);
@@ -302039,7 +302741,7 @@ menclose::after {
302039
302741
  if (block.drawingKind === "vectorShape" || block.drawingKind === "textboxShape")
302040
302742
  return this.createVectorShapeElement(block, fragment.geometry, false, 1, 1, context, fragment);
302041
302743
  if (block.drawingKind === "shapeGroup")
302042
- return this.createShapeGroupElement(block, context);
302744
+ return this.createShapeGroupElement(block, context, fragment.geometry);
302043
302745
  if (block.drawingKind === "chart")
302044
302746
  return this.createChartElement(block);
302045
302747
  return this.createDrawingPlaceholder();
@@ -302071,12 +302773,14 @@ menclose::after {
302071
302773
  svgElement.setAttribute("width", "100%");
302072
302774
  svgElement.setAttribute("height", "100%");
302073
302775
  svgElement.style.display = "block";
302776
+ svgElement.style.overflow = "visible";
302074
302777
  if (block.fillColor && typeof block.fillColor === "object") {
302075
302778
  if ("type" in block.fillColor && block.fillColor.type === "gradient")
302076
302779
  applyGradientToSVG(svgElement, block.fillColor);
302077
302780
  else if ("type" in block.fillColor && block.fillColor.type === "solidWithAlpha")
302078
302781
  applyAlphaToSVG(svgElement, block.fillColor);
302079
302782
  }
302783
+ this.applyShapeEffects(svgElement, block);
302080
302784
  this.applyLineEnds(svgElement, block);
302081
302785
  contentContainer.appendChild(svgElement);
302082
302786
  if (block.drawingKind === "textboxShape" || this.hasShapeTextContent(block.textContent)) {
@@ -302327,19 +303031,40 @@ menclose::after {
302327
303031
  textDiv.style.textAlign = "right";
302328
303032
  else
302329
303033
  textDiv.style.textAlign = "left";
302330
- let currentParagraph = this.doc.createElement("div");
302331
- currentParagraph.style.width = "100%";
302332
- currentParagraph.style.minWidth = "0";
302333
- currentParagraph.style.whiteSpace = "normal";
303034
+ const paragraphSpacing = textContent$1.paragraphs;
303035
+ const spacingBefore = (index2) => paragraphSpacing?.[index2]?.spacing?.before;
303036
+ const spacingAfter = (index2) => paragraphSpacing?.[index2]?.spacing?.after;
303037
+ const createParagraphElement = () => {
303038
+ const paragraph2 = this.doc.createElement("div");
303039
+ paragraph2.style.width = "100%";
303040
+ paragraph2.style.minWidth = "0";
303041
+ paragraph2.style.whiteSpace = "normal";
303042
+ paragraph2.style.marginLeft = "0";
303043
+ paragraph2.style.marginRight = "0";
303044
+ return paragraph2;
303045
+ };
303046
+ let logicalParagraphIndex = 0;
303047
+ let currentParagraph = createParagraphElement();
303048
+ const firstParagraphBefore = spacingBefore(logicalParagraphIndex);
303049
+ if (typeof firstParagraphBefore === "number")
303050
+ currentParagraph.style.marginTop = `${firstParagraphBefore}px`;
302334
303051
  textContent$1.parts.forEach((part) => {
302335
303052
  if (part.isLineBreak) {
303053
+ if (part.isParagraphBoundary) {
303054
+ const currentParagraphAfter = spacingAfter(logicalParagraphIndex);
303055
+ if (typeof currentParagraphAfter === "number")
303056
+ currentParagraph.style.marginBottom = `${currentParagraphAfter}px`;
303057
+ }
302336
303058
  textDiv.appendChild(currentParagraph);
302337
- currentParagraph = this.doc.createElement("div");
302338
- currentParagraph.style.width = "100%";
302339
- currentParagraph.style.minWidth = "0";
302340
- currentParagraph.style.whiteSpace = "normal";
303059
+ currentParagraph = createParagraphElement();
302341
303060
  if (part.isEmptyParagraph)
302342
303061
  currentParagraph.style.minHeight = "1em";
303062
+ if (part.isParagraphBoundary) {
303063
+ logicalParagraphIndex += 1;
303064
+ const nextParagraphBefore = spacingBefore(logicalParagraphIndex);
303065
+ if (typeof nextParagraphBefore === "number")
303066
+ currentParagraph.style.marginTop = `${nextParagraphBefore}px`;
303067
+ }
302343
303068
  } else if (part.kind === "image" && part.src)
302344
303069
  currentParagraph.appendChild(createShapeTextImageElement(this.doc, part));
302345
303070
  else {
@@ -302365,6 +303090,9 @@ menclose::after {
302365
303090
  currentParagraph.appendChild(span);
302366
303091
  }
302367
303092
  });
303093
+ const finalParagraphAfter = spacingAfter(logicalParagraphIndex);
303094
+ if (typeof finalParagraphAfter === "number")
303095
+ currentParagraph.style.marginBottom = `${finalParagraphAfter}px`;
302368
303096
  textDiv.appendChild(currentParagraph);
302369
303097
  return textDiv;
302370
303098
  }
@@ -302416,6 +303144,7 @@ menclose::after {
302416
303144
  const viewH = firstPath.h || height;
302417
303145
  if (viewW === 0 || viewH === 0)
302418
303146
  return null;
303147
+ const explicitStrokeEffect = viewW / width > 10 || viewH / height > 10 ? ' vector-effect="non-scaling-stroke"' : "";
302419
303148
  const edgeStroke = fillColor !== "none" && strokeColor === "none" ? ` stroke="${fillColor}" stroke-width="0.5" vector-effect="non-scaling-stroke"` : "";
302420
303149
  return `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${viewW} ${viewH}" preserveAspectRatio="none">
302421
303150
  ${custGeom.paths.map((p$12) => {
@@ -302425,7 +303154,7 @@ menclose::after {
302425
303154
  const scaleX = viewW / pathW;
302426
303155
  const scaleY = viewH / pathH;
302427
303156
  const transform2 = needsTransform ? ` transform="scale(${scaleX}, ${scaleY})"` : "";
302428
- const strokeAttr = strokeColor !== "none" ? ` stroke="${strokeColor}" stroke-width="${strokeWidth}"` : edgeStroke;
303157
+ const strokeAttr = strokeColor !== "none" ? ` stroke="${strokeColor}" stroke-width="${strokeWidth}"${explicitStrokeEffect}` : edgeStroke;
302429
303158
  return `<path d="${p$12.d}" fill="${fillColor}" fill-rule="evenodd"${strokeAttr}${transform2} />`;
302430
303159
  }).join(`
302431
303160
  `)}
@@ -302499,6 +303228,112 @@ menclose::after {
302499
303228
  target.setAttribute("marker-end", `url(#${id2})`);
302500
303229
  }
302501
303230
  }
303231
+ applyShapeEffects(svgElement, block) {
303232
+ const outerShadow = block.effects?.outerShadow;
303233
+ if (!outerShadow)
303234
+ return;
303235
+ this.applyOuterShadowEffect(svgElement, block.id, outerShadow);
303236
+ }
303237
+ applyOuterShadowEffect(svgElement, blockId, shadow) {
303238
+ const targets = this.findShapeEffectTargets(svgElement);
303239
+ if (!targets.length)
303240
+ return;
303241
+ const defs = this.ensureSvgDefs(svgElement);
303242
+ const filterId = this.sanitizeSvgId(`sd-shadow-${blockId}`);
303243
+ const outlineFilterId = this.sanitizeSvgId(`sd-shadow-outline-${blockId}`);
303244
+ if (!defs.querySelector(`#${filterId}`)) {
303245
+ const filter = this.doc.createElementNS("http://www.w3.org/2000/svg", "filter");
303246
+ filter.setAttribute("id", filterId);
303247
+ filter.setAttribute("x", "-50%");
303248
+ filter.setAttribute("y", "-50%");
303249
+ filter.setAttribute("width", "200%");
303250
+ filter.setAttribute("height", "200%");
303251
+ const { dx, dy } = resolveOuterShadowOffset(shadow);
303252
+ const dropShadow = this.doc.createElementNS("http://www.w3.org/2000/svg", "feDropShadow");
303253
+ dropShadow.setAttribute("dx", this.formatSvgNumber(dx));
303254
+ dropShadow.setAttribute("dy", this.formatSvgNumber(dy));
303255
+ dropShadow.setAttribute("stdDeviation", this.formatSvgNumber(getOuterShadowStdDeviation(shadow)));
303256
+ dropShadow.setAttribute("flood-color", shadow.color);
303257
+ dropShadow.setAttribute("flood-opacity", this.formatSvgNumber(shadow.opacity));
303258
+ filter.appendChild(dropShadow);
303259
+ defs.appendChild(filter);
303260
+ }
303261
+ targets.forEach((target) => {
303262
+ if (this.shouldRenderFilledShadowClone(target)) {
303263
+ this.appendFilledShadowClone(svgElement, defs, target, outlineFilterId, shadow);
303264
+ return;
303265
+ }
303266
+ target.setAttribute("filter", `url(#${filterId})`);
303267
+ });
303268
+ }
303269
+ findShapeEffectTargets(svgElement) {
303270
+ return Array.from(svgElement.querySelectorAll("path, line, polyline, polygon, rect, ellipse, circle")).filter((target) => !target.closest("defs") && !target.hasAttribute("data-sd-shadow-clone"));
303271
+ }
303272
+ shouldRenderFilledShadowClone(target) {
303273
+ if (target.getAttribute("fill") !== "none")
303274
+ return false;
303275
+ if (target.tagName.toLowerCase() === "path")
303276
+ return /z\s*$/i.test(target.getAttribute("d") ?? "");
303277
+ return [
303278
+ "polygon",
303279
+ "rect",
303280
+ "ellipse",
303281
+ "circle"
303282
+ ].includes(target.tagName.toLowerCase());
303283
+ }
303284
+ appendFilledShadowClone(svgElement, defs, target, filterId, shadow) {
303285
+ this.ensureOuterShadowOnlyFilter(defs, filterId, shadow);
303286
+ const clone$1 = target.cloneNode(false);
303287
+ clone$1.setAttribute("data-sd-shadow-clone", filterId);
303288
+ clone$1.setAttribute("aria-hidden", "true");
303289
+ clone$1.setAttribute("fill", "#000000");
303290
+ clone$1.setAttribute("stroke", "none");
303291
+ clone$1.setAttribute("filter", `url(#${filterId})`);
303292
+ target.parentNode?.insertBefore(clone$1, target);
303293
+ }
303294
+ ensureOuterShadowOnlyFilter(defs, filterId, shadow) {
303295
+ if (defs.querySelector(`#${filterId}`))
303296
+ return;
303297
+ const filter = this.doc.createElementNS("http://www.w3.org/2000/svg", "filter");
303298
+ filter.setAttribute("id", filterId);
303299
+ filter.setAttribute("x", "-50%");
303300
+ filter.setAttribute("y", "-50%");
303301
+ filter.setAttribute("width", "200%");
303302
+ filter.setAttribute("height", "200%");
303303
+ const blur = this.doc.createElementNS("http://www.w3.org/2000/svg", "feGaussianBlur");
303304
+ blur.setAttribute("in", "SourceAlpha");
303305
+ blur.setAttribute("stdDeviation", this.formatSvgNumber(getOuterShadowStdDeviation(shadow)));
303306
+ blur.setAttribute("result", "blur");
303307
+ const { dx, dy } = resolveOuterShadowOffset(shadow);
303308
+ const offset$1 = this.doc.createElementNS("http://www.w3.org/2000/svg", "feOffset");
303309
+ offset$1.setAttribute("in", "blur");
303310
+ offset$1.setAttribute("dx", this.formatSvgNumber(dx));
303311
+ offset$1.setAttribute("dy", this.formatSvgNumber(dy));
303312
+ offset$1.setAttribute("result", "offsetBlur");
303313
+ const flood = this.doc.createElementNS("http://www.w3.org/2000/svg", "feFlood");
303314
+ flood.setAttribute("flood-color", shadow.color);
303315
+ flood.setAttribute("flood-opacity", this.formatSvgNumber(shadow.opacity));
303316
+ flood.setAttribute("result", "shadowColor");
303317
+ const composite = this.doc.createElementNS("http://www.w3.org/2000/svg", "feComposite");
303318
+ composite.setAttribute("in", "shadowColor");
303319
+ composite.setAttribute("in2", "offsetBlur");
303320
+ composite.setAttribute("operator", "in");
303321
+ composite.setAttribute("result", "shadow");
303322
+ const outsideOnly = this.doc.createElementNS("http://www.w3.org/2000/svg", "feComposite");
303323
+ outsideOnly.setAttribute("in", "shadow");
303324
+ outsideOnly.setAttribute("in2", "SourceAlpha");
303325
+ outsideOnly.setAttribute("operator", "out");
303326
+ outsideOnly.setAttribute("result", "outerShadow");
303327
+ filter.appendChild(blur);
303328
+ filter.appendChild(offset$1);
303329
+ filter.appendChild(flood);
303330
+ filter.appendChild(composite);
303331
+ filter.appendChild(outsideOnly);
303332
+ defs.appendChild(filter);
303333
+ }
303334
+ formatSvgNumber(value) {
303335
+ return Number.isFinite(value) ? Number(value.toFixed(4)).toString() : "0";
303336
+ }
302502
303337
  findLineEndTarget(svgElement) {
302503
303338
  const line = svgElement.querySelector("line");
302504
303339
  if (line)
@@ -302587,7 +303422,7 @@ menclose::after {
302587
303422
  target.style.removeProperty("transform-origin");
302588
303423
  }
302589
303424
  }
302590
- createShapeGroupElement(block, context) {
303425
+ createShapeGroupElement(block, context, fragmentGeometry) {
302591
303426
  const groupEl = this.doc.createElement("div");
302592
303427
  groupEl.classList.add("superdoc-shape-group");
302593
303428
  groupEl.style.position = "relative";
@@ -302595,32 +303430,56 @@ menclose::after {
302595
303430
  groupEl.style.height = "100%";
302596
303431
  const groupTransform = block.groupTransform;
302597
303432
  let contentContainer = groupEl;
302598
- const visibleWidth = groupTransform?.width ?? block.geometry.width ?? 0;
302599
- const visibleHeight = groupTransform?.height ?? block.geometry.height ?? 0;
302600
- if (groupTransform) {
303433
+ const groupEffectExtent = block.effectExtent ?? {
303434
+ left: 0,
303435
+ top: 0,
303436
+ right: 0,
303437
+ bottom: 0
303438
+ };
303439
+ const hasGroupEffectExtent = groupEffectExtent.left > 0 || groupEffectExtent.top > 0 || groupEffectExtent.right > 0 || groupEffectExtent.bottom > 0;
303440
+ const visibleWidth = groupTransform?.width ?? Math.max(0, (block.geometry.width ?? 0) - groupEffectExtent.left - groupEffectExtent.right);
303441
+ const visibleHeight = groupTransform?.height ?? Math.max(0, (block.geometry.height ?? 0) - groupEffectExtent.top - groupEffectExtent.bottom);
303442
+ if (groupTransform || hasGroupEffectExtent) {
302601
303443
  const inner = this.doc.createElement("div");
302602
303444
  inner.style.position = "absolute";
302603
- inner.style.left = "0";
302604
- inner.style.top = "0";
303445
+ inner.style.left = `${groupEffectExtent.left}px`;
303446
+ inner.style.top = `${groupEffectExtent.top}px`;
302605
303447
  inner.style.width = `${Math.max(1, visibleWidth)}px`;
302606
303448
  inner.style.height = `${Math.max(1, visibleHeight)}px`;
303449
+ const groupTransforms = [];
303450
+ const normalizedGroupRotation = typeof groupTransform?.rotation === "number" ? normalizeRotationDegrees(groupTransform.rotation) : 0;
303451
+ const normalizedFragmentRotation = typeof fragmentGeometry?.rotation === "number" ? normalizeRotationDegrees(fragmentGeometry.rotation) : 0;
303452
+ const groupRotation = normalizedGroupRotation && normalizedGroupRotation !== normalizedFragmentRotation ? groupTransform?.rotation ?? 0 : 0;
303453
+ const groupFlipH = groupTransform?.flipH && groupTransform.flipH !== fragmentGeometry?.flipH;
303454
+ const groupFlipV = groupTransform?.flipV && groupTransform.flipV !== fragmentGeometry?.flipV;
303455
+ if (groupRotation)
303456
+ groupTransforms.push(`rotate(${groupRotation}deg)`);
303457
+ if (groupFlipH)
303458
+ groupTransforms.push("scaleX(-1)");
303459
+ if (groupFlipV)
303460
+ groupTransforms.push("scaleY(-1)");
303461
+ if (groupTransforms.length > 0) {
303462
+ inner.style.transformOrigin = "center";
303463
+ inner.style.transform = groupTransforms.join(" ");
303464
+ }
302607
303465
  groupEl.appendChild(inner);
302608
303466
  contentContainer = inner;
302609
303467
  }
302610
- block.shapes.forEach((child) => {
302611
- const childContent = this.createGroupChildContent(child, 1, 1, context);
303468
+ block.shapes.forEach((child, childIndex) => {
303469
+ const attrs = child.attrs ?? {};
303470
+ const paintExtent = this.getShapeGroupChildPaintExtent(child);
303471
+ const childContent = this.createGroupChildContent(child, 1, 1, context, paintExtent, block.id, childIndex);
302612
303472
  if (!childContent)
302613
303473
  return;
302614
- const attrs = child.attrs ?? {};
302615
303474
  const wrapper = this.doc.createElement("div");
302616
303475
  wrapper.classList.add("superdoc-shape-group__child");
302617
303476
  wrapper.style.position = "absolute";
302618
- wrapper.style.left = `${Number(attrs.x ?? 0)}px`;
302619
- wrapper.style.top = `${Number(attrs.y ?? 0)}px`;
303477
+ wrapper.style.left = `${Number(attrs.x ?? 0) - paintExtent.left}px`;
303478
+ wrapper.style.top = `${Number(attrs.y ?? 0) - paintExtent.top}px`;
302620
303479
  const childW = typeof attrs.width === "number" ? attrs.width : block.geometry.width;
302621
303480
  const childH = typeof attrs.height === "number" ? attrs.height : block.geometry.height;
302622
- wrapper.style.width = `${Math.max(1, childW)}px`;
302623
- wrapper.style.height = `${Math.max(1, childH)}px`;
303481
+ wrapper.style.width = `${Math.max(1, childW + paintExtent.left + paintExtent.right)}px`;
303482
+ wrapper.style.height = `${Math.max(1, childH + paintExtent.top + paintExtent.bottom)}px`;
302624
303483
  wrapper.style.transformOrigin = "center";
302625
303484
  const transforms = [];
302626
303485
  if (attrs.rotation)
@@ -302638,20 +303497,63 @@ menclose::after {
302638
303497
  });
302639
303498
  return groupEl;
302640
303499
  }
302641
- createGroupChildContent(child, groupScaleX = 1, groupScaleY = 1, context) {
303500
+ getShapeGroupChildPaintExtent(child) {
303501
+ if (child.shapeType !== "vectorShape" || !("fillColor" in child.attrs))
303502
+ return {
303503
+ left: 0,
303504
+ top: 0,
303505
+ right: 0,
303506
+ bottom: 0
303507
+ };
303508
+ const attrs = child.attrs;
303509
+ const shadowExtent = attrs.effects?.outerShadow ? getOuterShadowPaintExtent(attrs.effects.outerShadow) : {
303510
+ left: 0,
303511
+ top: 0,
303512
+ right: 0,
303513
+ bottom: 0
303514
+ };
303515
+ if (attrs.lineEnds)
303516
+ return {
303517
+ left: 0,
303518
+ top: 0,
303519
+ right: 0,
303520
+ bottom: 0
303521
+ };
303522
+ if (attrs.strokeColor === null)
303523
+ return shadowExtent;
303524
+ const rawStrokeWidth = child.attrs.strokeWidth;
303525
+ const parsedStrokeWidth = typeof rawStrokeWidth === "number" ? rawStrokeWidth : typeof rawStrokeWidth === "string" && rawStrokeWidth.trim() !== "" ? Number(rawStrokeWidth) : undefined;
303526
+ const strokeWidth = parsedStrokeWidth != null && Number.isFinite(parsedStrokeWidth) ? parsedStrokeWidth : 1;
303527
+ if (strokeWidth <= 0)
303528
+ return shadowExtent;
303529
+ const extent = strokeWidth / 2;
303530
+ return {
303531
+ left: Math.max(extent, shadowExtent.left),
303532
+ top: Math.max(extent, shadowExtent.top),
303533
+ right: Math.max(extent, shadowExtent.right),
303534
+ bottom: Math.max(extent, shadowExtent.bottom)
303535
+ };
303536
+ }
303537
+ createGroupChildContent(child, groupScaleX = 1, groupScaleY = 1, context, paintExtent = {
303538
+ left: 0,
303539
+ top: 0,
303540
+ right: 0,
303541
+ bottom: 0
303542
+ }, groupId, childIndex) {
302642
303543
  if (child.shapeType === "vectorShape" && "fillColor" in child.attrs) {
302643
303544
  const attrs = child.attrs;
302644
303545
  const childGeometry = {
302645
- width: attrs.width ?? 0,
302646
- height: attrs.height ?? 0,
303546
+ width: (attrs.width ?? 0) + paintExtent.left + paintExtent.right,
303547
+ height: (attrs.height ?? 0) + paintExtent.top + paintExtent.bottom,
302647
303548
  rotation: attrs.rotation ?? 0,
302648
303549
  flipH: attrs.flipH ?? false,
302649
303550
  flipV: attrs.flipV ?? false
302650
303551
  };
303552
+ const hasPaintExtent = paintExtent.left > 0 || paintExtent.top > 0 || paintExtent.right > 0 || paintExtent.bottom > 0;
302651
303553
  const vectorChild = {
302652
303554
  drawingKind: "vectorShape",
302653
303555
  kind: "drawing",
302654
- id: `${attrs.shapeId ?? child.shapeType}`,
303556
+ id: groupId != null ? `${groupId}-${childIndex ?? 0}-${attrs.shapeId ?? child.shapeType}` : `${attrs.shapeId ?? child.shapeType}`,
302655
303557
  geometry: childGeometry,
302656
303558
  padding: undefined,
302657
303559
  margin: undefined,
@@ -302666,10 +303568,12 @@ menclose::after {
302666
303568
  strokeColor: attrs.strokeColor,
302667
303569
  strokeWidth: attrs.strokeWidth,
302668
303570
  lineEnds: attrs.lineEnds,
303571
+ effects: attrs.effects,
302669
303572
  textContent: attrs.textContent,
302670
303573
  textAlign: attrs.textAlign,
302671
303574
  textVerticalAlign: attrs.textVerticalAlign,
302672
- textInsets: attrs.textInsets
303575
+ textInsets: attrs.textInsets,
303576
+ effectExtent: hasPaintExtent ? paintExtent : undefined
302673
303577
  };
302674
303578
  return this.createVectorShapeElement(vectorChild, childGeometry, false, groupScaleX, groupScaleY, context);
302675
303579
  }
@@ -303301,11 +304205,20 @@ menclose::after {
303301
304205
  if (!attrs || typeof attrs !== "object")
303302
304206
  return "";
303303
304207
  return readClipPathValue(attrs.clipPath);
304208
+ }, resolveShapeClipPathFromAttrs = (attrs) => {
304209
+ if (!attrs || typeof attrs !== "object")
304210
+ return "";
304211
+ return readClipPathValue(attrs.shapeClipPath);
303304
304212
  }, resolveBlockClipPath = (block) => {
303305
304213
  if (!block || typeof block !== "object")
303306
304214
  return "";
303307
304215
  const record3 = block;
303308
304216
  return readClipPathValue(record3.clipPath) || resolveClipPathFromAttrs(record3.attrs);
304217
+ }, resolveBlockShapeClipPath = (block) => {
304218
+ if (!block || typeof block !== "object")
304219
+ return "";
304220
+ const record3 = block;
304221
+ return readClipPathValue(record3.shapeClipPath) || resolveShapeClipPathFromAttrs(record3.attrs);
303309
304222
  }, imageHyperlinkVersion = (hyperlink) => {
303310
304223
  if (!hyperlink)
303311
304224
  return "";
@@ -303344,7 +304257,8 @@ menclose::after {
303344
304257
  image2.flipH ? 1 : 0,
303345
304258
  image2.flipV ? 1 : 0,
303346
304259
  imageHyperlinkVersion(image2.hyperlink),
303347
- resolveBlockClipPath(image2)
304260
+ resolveBlockClipPath(image2),
304261
+ resolveBlockShapeClipPath(image2)
303348
304262
  ].join("|"), renderedInlineImageRunVersion = (image2) => [
303349
304263
  "img",
303350
304264
  image2.src ?? "",
@@ -303353,6 +304267,8 @@ menclose::after {
303353
304267
  image2.alt ?? "",
303354
304268
  image2.title ?? "",
303355
304269
  typeof image2.clipPath === "string" ? image2.clipPath.trim() : "",
304270
+ typeof image2.shapeClipPath === "string" ? image2.shapeClipPath.trim() : "",
304271
+ image2.objectFit ?? "",
303356
304272
  image2.distTop ?? "",
303357
304273
  image2.distBottom ?? "",
303358
304274
  image2.distLeft ?? "",
@@ -303551,7 +304467,9 @@ menclose::after {
303551
304467
  vector.geometry.flipV ? 1 : 0,
303552
304468
  drawingTextVersion(vector),
303553
304469
  block.anchor?.offsetH ?? "",
303554
- block.anchor?.offsetV ?? ""
304470
+ block.anchor?.offsetV ?? "",
304471
+ vector.effects ? JSON.stringify(vector.effects) : "",
304472
+ vector.effectExtent ? JSON.stringify(vector.effectExtent) : ""
303555
304473
  ].join("|");
303556
304474
  }
303557
304475
  if (block.drawingKind === "shapeGroup") {
@@ -303561,6 +304479,7 @@ menclose::after {
303561
304479
  "drawing:group",
303562
304480
  group.geometry.width,
303563
304481
  group.geometry.height,
304482
+ group.effectExtent ? JSON.stringify(group.effectExtent) : "",
303564
304483
  group.groupTransform ? JSON.stringify(group.groupTransform) : "",
303565
304484
  childSignature
303566
304485
  ].join("|");
@@ -304256,6 +305175,7 @@ menclose::after {
304256
305175
  JSON.stringify(block.customGeometry ?? null),
304257
305176
  JSON.stringify(block.lineEnds ?? null),
304258
305177
  JSON.stringify(block.effectExtent ?? null),
305178
+ JSON.stringify(block.effects ?? null),
304259
305179
  JSON.stringify(block.textContent ?? null),
304260
305180
  block.textAlign ?? "",
304261
305181
  block.textVerticalAlign ?? "",
@@ -304419,7 +305339,7 @@ menclose::after {
304419
305339
  return `${block.id}:table:${contentHash}${tableAttrsKey}`;
304420
305340
  }
304421
305341
  if (block.kind !== "paragraph")
304422
- return block.id;
305342
+ return hashNonParagraphCellBlock(block);
304423
305343
  const trackedMode = block.attrs && "trackedChangesMode" in block.attrs && block.attrs.trackedChangesMode || "review";
304424
305344
  const trackedEnabled = resolveTrackedChangesEnabled(block.attrs, true);
304425
305345
  const runsHash = block.runs.map((run2) => {
@@ -305288,7 +306208,7 @@ menclose::after {
305288
306208
  }
305289
306209
  return true;
305290
306210
  }, imageRunsEqual = (a2, b$1) => {
305291
- return a2.src === b$1.src && a2.width === b$1.width && a2.height === b$1.height && a2.alt === b$1.alt && a2.title === b$1.title && a2.clipPath === b$1.clipPath && a2.distTop === b$1.distTop && a2.distBottom === b$1.distBottom && a2.distLeft === b$1.distLeft && a2.distRight === b$1.distRight && a2.verticalAlign === b$1.verticalAlign && a2.rotation === b$1.rotation && a2.flipH === b$1.flipH && a2.flipV === b$1.flipV && a2.gain === b$1.gain && a2.blacklevel === b$1.blacklevel && a2.grayscale === b$1.grayscale && jsonEqual(a2.lum, b$1.lum) && jsonEqual(a2.hyperlink, b$1.hyperlink) && jsonEqual(a2.sdt, b$1.sdt) && shallowRecordEqual(a2.dataAttrs, b$1.dataAttrs);
306211
+ return a2.src === b$1.src && a2.width === b$1.width && a2.height === b$1.height && a2.alt === b$1.alt && a2.title === b$1.title && a2.clipPath === b$1.clipPath && a2.shapeClipPath === b$1.shapeClipPath && a2.objectFit === b$1.objectFit && a2.distTop === b$1.distTop && a2.distBottom === b$1.distBottom && a2.distLeft === b$1.distLeft && a2.distRight === b$1.distRight && a2.verticalAlign === b$1.verticalAlign && a2.rotation === b$1.rotation && a2.flipH === b$1.flipH && a2.flipV === b$1.flipV && a2.gain === b$1.gain && a2.blacklevel === b$1.blacklevel && a2.grayscale === b$1.grayscale && jsonEqual(a2.lum, b$1.lum) && jsonEqual(a2.hyperlink, b$1.hyperlink) && jsonEqual(a2.sdt, b$1.sdt) && shallowRecordEqual(a2.dataAttrs, b$1.dataAttrs);
305292
306212
  }, imageBlocksEqual = (a2, b$1) => {
305293
306213
  return a2.src === b$1.src && a2.width === b$1.width && a2.height === b$1.height && a2.alt === b$1.alt && a2.title === b$1.title && a2.objectFit === b$1.objectFit && a2.display === b$1.display && boxSpacingEqual(a2.margin, b$1.margin) && boxSpacingEqual(a2.padding, b$1.padding) && imageAnchorEqual(a2.anchor, b$1.anchor) && imageWrapEqual(a2.wrap, b$1.wrap) && shallowRecordEqual(a2.attrs, b$1.attrs);
305294
306214
  }, drawingBlocksEqual = (a2, b$1) => {
@@ -305314,10 +306234,10 @@ menclose::after {
305314
306234
  return imageBlocksEqual(a2, b$1);
305315
306235
  if ((a2.drawingKind === "vectorShape" || a2.drawingKind === "textboxShape") && (b$1.drawingKind === "vectorShape" || b$1.drawingKind === "textboxShape")) {
305316
306236
  const textboxContentEqual = a2.drawingKind !== "textboxShape" || b$1.drawingKind !== "textboxShape" || jsonEqual(a2.contentBlocks, b$1.contentBlocks);
305317
- return drawingGeometryEqual(a2.geometry, b$1.geometry) && a2.shapeKind === b$1.shapeKind && a2.fillColor === b$1.fillColor && a2.strokeColor === b$1.strokeColor && a2.strokeWidth === b$1.strokeWidth && a2.textAlign === b$1.textAlign && a2.textVerticalAlign === b$1.textVerticalAlign && jsonEqual(a2.textInsets, b$1.textInsets) && jsonEqual(a2.textContent, b$1.textContent) && jsonEqual(a2.customGeometry, b$1.customGeometry) && jsonEqual(a2.lineEnds, b$1.lineEnds) && jsonEqual(a2.effectExtent, b$1.effectExtent) && textboxContentEqual;
306237
+ return drawingGeometryEqual(a2.geometry, b$1.geometry) && a2.shapeKind === b$1.shapeKind && jsonEqual(a2.customGeometry, b$1.customGeometry) && a2.fillColor === b$1.fillColor && a2.strokeColor === b$1.strokeColor && a2.strokeWidth === b$1.strokeWidth && a2.textAlign === b$1.textAlign && a2.textVerticalAlign === b$1.textVerticalAlign && jsonEqual(a2.textInsets, b$1.textInsets) && jsonEqual(a2.textContent, b$1.textContent) && jsonEqual(a2.lineEnds, b$1.lineEnds) && jsonEqual(a2.effects, b$1.effects) && jsonEqual(a2.effectExtent, b$1.effectExtent) && textboxContentEqual;
305318
306238
  }
305319
306239
  if (a2.drawingKind === "shapeGroup" && b$1.drawingKind === "shapeGroup")
305320
- return drawingGeometryEqual(a2.geometry, b$1.geometry) && shapeGroupTransformEqual(a2.groupTransform, b$1.groupTransform) && shapeGroupSizeEqual(a2.size, b$1.size) && shapeGroupChildrenEqual(a2.shapes, b$1.shapes);
306240
+ return drawingGeometryEqual(a2.geometry, b$1.geometry) && jsonEqual(a2.effectExtent, b$1.effectExtent) && shapeGroupTransformEqual(a2.groupTransform, b$1.groupTransform) && shapeGroupSizeEqual(a2.size, b$1.size) && shapeGroupChildrenEqual(a2.shapes, b$1.shapes);
305321
306241
  if (a2.drawingKind === "chart" && b$1.drawingKind === "chart")
305322
306242
  return drawingGeometryEqual(a2.geometry, b$1.geometry) && a2.chartRelId === b$1.chartRelId && jsonEqual(a2.chartData, b$1.chartData);
305323
306243
  return true;
@@ -305369,7 +306289,7 @@ menclose::after {
305369
306289
  return true;
305370
306290
  if (!a2 || !b$1)
305371
306291
  return !a2 && !b$1;
305372
- return a2.x === b$1.x && a2.y === b$1.y && a2.width === b$1.width && a2.height === b$1.height && a2.childX === b$1.childX && a2.childY === b$1.childY && a2.childWidth === b$1.childWidth && a2.childHeight === b$1.childHeight && a2.childOriginXEmu === b$1.childOriginXEmu && a2.childOriginYEmu === b$1.childOriginYEmu;
306292
+ return a2.x === b$1.x && a2.y === b$1.y && a2.width === b$1.width && a2.height === b$1.height && a2.childX === b$1.childX && a2.childY === b$1.childY && a2.childWidth === b$1.childWidth && a2.childHeight === b$1.childHeight && a2.childOriginXEmu === b$1.childOriginXEmu && a2.childOriginYEmu === b$1.childOriginYEmu && (a2.rotation ?? 0) === (b$1.rotation ?? 0) && Boolean(a2.flipH) === Boolean(b$1.flipH) && Boolean(a2.flipV) === Boolean(b$1.flipV);
305373
306293
  }, shapeGroupSizeEqual = (a2, b$1) => {
305374
306294
  if (a2 === b$1)
305375
306295
  return true;
@@ -308754,9 +309674,10 @@ menclose::after {
308754
309674
  const visiblePointerSurface = resolveVisibleSurfaceAtPointer(event.target, event.clientX, event.clientY);
308755
309675
  const clickedInsideVisibleActiveSurface = visiblePointerSurface?.kind === "headerFooter" && visiblePointerSurface.surface.closest(activeSurfaceSelector) != null;
308756
309676
  if (visiblePointerSurface?.kind === "bodyContent") {
308757
- const behindDocSection = (event.target instanceof Element ? event.target.closest("[data-behind-doc-section]") : null)?.dataset.behindDocSection;
309677
+ const targetElement = event.target instanceof Element ? event.target : null;
309678
+ const pageLevelSection = targetElement?.closest("[data-behind-doc-section]")?.dataset.behindDocSection ?? targetElement?.closest("[data-header-footer-overlay-section]")?.dataset.headerFooterOverlaySection;
308758
309679
  const sessionMode = session?.session?.mode;
308759
- if (behindDocSection && behindDocSection === sessionMode)
309680
+ if (pageLevelSection && pageLevelSection === sessionMode)
308760
309681
  return false;
308761
309682
  this.#callbacks.exitHeaderFooterMode?.();
308762
309683
  return false;
@@ -313047,13 +313968,13 @@ menclose::after {
313047
313968
  return;
313048
313969
  console.log(...args$1);
313049
313970
  }, 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, TRACKED_MARK_NAMES;
313050
- var init_src_CkxGCnVm_es = __esm(() => {
313971
+ var init_src_BFPHxhWM_es = __esm(() => {
313051
313972
  init_rolldown_runtime_Bg48TavK_es();
313052
- init_SuperConverter_DQ2wMaLK_es();
313973
+ init_SuperConverter_18ny5wUo_es();
313053
313974
  init_jszip_C49i9kUs_es();
313054
313975
  init_xml_js_CqGKpaft_es();
313055
313976
  init_uuid_B2wVPhPi_es();
313056
- init_create_headless_toolbar_BhSfQYaO_es();
313977
+ init_create_headless_toolbar_vcvhloZR_es();
313057
313978
  init_constants_D9qj59G2_es();
313058
313979
  init_unified_BDuVPlMu_es();
313059
313980
  init_remark_gfm_BUJjZJLy_es();
@@ -325474,6 +326395,14 @@ ${err.toString()}`);
325474
326395
  return { style: style2 };
325475
326396
  }
325476
326397
  },
326398
+ shapeClipPath: {
326399
+ default: null,
326400
+ rendered: false
326401
+ },
326402
+ objectFit: {
326403
+ default: null,
326404
+ rendered: false
326405
+ },
325477
326406
  size: {
325478
326407
  default: {},
325479
326408
  renderDOM: ({ size: size$1, shouldCover }) => {
@@ -326527,6 +327456,10 @@ ${err.toString()}`);
326527
327456
  default: null,
326528
327457
  rendered: false
326529
327458
  },
327459
+ effects: {
327460
+ default: null,
327461
+ rendered: false
327462
+ },
326530
327463
  lineEnds: {
326531
327464
  default: null,
326532
327465
  rendered: false
@@ -329218,32 +330151,419 @@ ${err.toString()}`);
329218
330151
  }]
329219
330152
  }
329220
330153
  };
329221
- F = new Set(["leftRightArrow", "upDownArrow"]);
330154
+ F = new Set([
330155
+ "bentArrow",
330156
+ "bentUpArrow",
330157
+ "downArrow",
330158
+ "leftArrow",
330159
+ "leftRightArrow",
330160
+ "leftRightUpArrow",
330161
+ "leftUpArrow",
330162
+ "quadArrow",
330163
+ "rightArrow",
330164
+ "upArrow",
330165
+ "upDownArrow",
330166
+ "uturnArrow"
330167
+ ]);
329222
330168
  X = {
330169
+ bentArrow: `<bentArrow>
330170
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
330171
+ <path w="588010" h="648335">
330172
+ <moveTo>
330173
+ <pt x="0" y="648335"/>
330174
+ </moveTo>
330175
+ <lnTo>
330176
+ <pt x="0" y="330756"/>
330177
+ </lnTo>
330178
+ <cubicBezTo>
330179
+ <pt x="0" y="188679"/>
330180
+ <pt x="115177" y="73502"/>
330181
+ <pt x="257254" y="73502"/>
330182
+ </cubicBezTo>
330183
+ <lnTo>
330184
+ <pt x="441008" y="73501"/>
330185
+ </lnTo>
330186
+ <lnTo>
330187
+ <pt x="441008" y="0"/>
330188
+ </lnTo>
330189
+ <lnTo>
330190
+ <pt x="588010" y="147003"/>
330191
+ </lnTo>
330192
+ <lnTo>
330193
+ <pt x="441008" y="294005"/>
330194
+ </lnTo>
330195
+ <lnTo>
330196
+ <pt x="441008" y="220504"/>
330197
+ </lnTo>
330198
+ <lnTo>
330199
+ <pt x="257254" y="220504"/>
330200
+ </lnTo>
330201
+ <cubicBezTo>
330202
+ <pt x="196364" y="220504"/>
330203
+ <pt x="147002" y="269866"/>
330204
+ <pt x="147002" y="330756"/>
330205
+ </cubicBezTo>
330206
+ <cubicBezTo>
330207
+ <pt x="147002" y="436616"/>
330208
+ <pt x="147003" y="542475"/>
330209
+ <pt x="147003" y="648335"/>
330210
+ </cubicBezTo>
330211
+ <lnTo>
330212
+ <pt x="0" y="648335"/>
330213
+ </lnTo>
330214
+ <close/>
330215
+ </path>
330216
+ </pathLst>
330217
+ </bentArrow>`,
330218
+ bentUpArrow: `<bentUpArrow>
330219
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
330220
+ <path w="850265" h="731520">
330221
+ <moveTo>
330222
+ <pt x="0" y="548640"/>
330223
+ </moveTo>
330224
+ <lnTo>
330225
+ <pt x="575945" y="548640"/>
330226
+ </lnTo>
330227
+ <lnTo>
330228
+ <pt x="575945" y="182880"/>
330229
+ </lnTo>
330230
+ <lnTo>
330231
+ <pt x="484505" y="182880"/>
330232
+ </lnTo>
330233
+ <lnTo>
330234
+ <pt x="667385" y="0"/>
330235
+ </lnTo>
330236
+ <lnTo>
330237
+ <pt x="850265" y="182880"/>
330238
+ </lnTo>
330239
+ <lnTo>
330240
+ <pt x="758825" y="182880"/>
330241
+ </lnTo>
330242
+ <lnTo>
330243
+ <pt x="758825" y="731520"/>
330244
+ </lnTo>
330245
+ <lnTo>
330246
+ <pt x="0" y="731520"/>
330247
+ </lnTo>
330248
+ <lnTo>
330249
+ <pt x="0" y="548640"/>
330250
+ </lnTo>
330251
+ <close/>
330252
+ </path>
330253
+ </pathLst>
330254
+ </bentUpArrow>`,
330255
+ downArrow: `<downArrow>
330256
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
330257
+ <path w="394970" h="576580">
330258
+ <moveTo>
330259
+ <pt x="0" y="379095"/>
330260
+ </moveTo>
330261
+ <lnTo>
330262
+ <pt x="98743" y="379095"/>
330263
+ </lnTo>
330264
+ <lnTo>
330265
+ <pt x="98743" y="0"/>
330266
+ </lnTo>
330267
+ <lnTo>
330268
+ <pt x="296228" y="0"/>
330269
+ </lnTo>
330270
+ <lnTo>
330271
+ <pt x="296228" y="379095"/>
330272
+ </lnTo>
330273
+ <lnTo>
330274
+ <pt x="394970" y="379095"/>
330275
+ </lnTo>
330276
+ <lnTo>
330277
+ <pt x="197485" y="576580"/>
330278
+ </lnTo>
330279
+ <lnTo>
330280
+ <pt x="0" y="379095"/>
330281
+ </lnTo>
330282
+ <close/>
330283
+ </path>
330284
+ </pathLst>
330285
+ </downArrow>`,
330286
+ leftArrow: `<leftArrow>
330287
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
330288
+ <path w="662549" h="367128">
330289
+ <moveTo>
330290
+ <pt x="0" y="183564"/>
330291
+ </moveTo>
330292
+ <lnTo>
330293
+ <pt x="183564" y="0"/>
330294
+ </lnTo>
330295
+ <lnTo>
330296
+ <pt x="183564" y="91782"/>
330297
+ </lnTo>
330298
+ <lnTo>
330299
+ <pt x="662549" y="91782"/>
330300
+ </lnTo>
330301
+ <lnTo>
330302
+ <pt x="662549" y="275346"/>
330303
+ </lnTo>
330304
+ <lnTo>
330305
+ <pt x="183564" y="275346"/>
330306
+ </lnTo>
330307
+ <lnTo>
330308
+ <pt x="183564" y="367128"/>
330309
+ </lnTo>
330310
+ <lnTo>
330311
+ <pt x="0" y="183564"/>
330312
+ </lnTo>
330313
+ <close/>
330314
+ </path>
330315
+ </pathLst>
330316
+ </leftArrow>`,
329223
330317
  leftRightArrow: `<leftRightArrow>
330318
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
330319
+ <path w="985520" h="379730">
330320
+ <moveTo>
330321
+ <pt x="0" y="189865"/>
330322
+ </moveTo>
330323
+ <lnTo>
330324
+ <pt x="189865" y="0"/>
330325
+ </lnTo>
330326
+ <lnTo>
330327
+ <pt x="189865" y="94933"/>
330328
+ </lnTo>
330329
+ <lnTo>
330330
+ <pt x="795655" y="94933"/>
330331
+ </lnTo>
330332
+ <lnTo>
330333
+ <pt x="795655" y="0"/>
330334
+ </lnTo>
330335
+ <lnTo>
330336
+ <pt x="985520" y="189865"/>
330337
+ </lnTo>
330338
+ <lnTo>
330339
+ <pt x="795655" y="379730"/>
330340
+ </lnTo>
330341
+ <lnTo>
330342
+ <pt x="795655" y="284798"/>
330343
+ </lnTo>
330344
+ <lnTo>
330345
+ <pt x="189865" y="284798"/>
330346
+ </lnTo>
330347
+ <lnTo>
330348
+ <pt x="189865" y="379730"/>
330349
+ </lnTo>
330350
+ <lnTo>
330351
+ <pt x="0" y="189865"/>
330352
+ </lnTo>
330353
+ <close/>
330354
+ </path>
330355
+ </pathLst>
330356
+ </leftRightArrow>`,
330357
+ leftRightUpArrow: `<leftRightUpArrow>
330358
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
330359
+ <path w="928370" h="634365">
330360
+ <moveTo>
330361
+ <pt x="0" y="475774"/>
330362
+ </moveTo>
330363
+ <lnTo>
330364
+ <pt x="158591" y="317183"/>
330365
+ </lnTo>
330366
+ <lnTo>
330367
+ <pt x="158591" y="396478"/>
330368
+ </lnTo>
330369
+ <lnTo>
330370
+ <pt x="384889" y="396478"/>
330371
+ </lnTo>
330372
+ <lnTo>
330373
+ <pt x="384889" y="158591"/>
330374
+ </lnTo>
330375
+ <lnTo>
330376
+ <pt x="305594" y="158591"/>
330377
+ </lnTo>
330378
+ <lnTo>
330379
+ <pt x="464185" y="0"/>
330380
+ </lnTo>
330381
+ <lnTo>
330382
+ <pt x="622776" y="158591"/>
330383
+ </lnTo>
330384
+ <lnTo>
330385
+ <pt x="543481" y="158591"/>
330386
+ </lnTo>
330387
+ <lnTo>
330388
+ <pt x="543481" y="396478"/>
330389
+ </lnTo>
330390
+ <lnTo>
330391
+ <pt x="769779" y="396478"/>
330392
+ </lnTo>
330393
+ <lnTo>
330394
+ <pt x="769779" y="317183"/>
330395
+ </lnTo>
330396
+ <lnTo>
330397
+ <pt x="928370" y="475774"/>
330398
+ </lnTo>
330399
+ <lnTo>
330400
+ <pt x="769779" y="634365"/>
330401
+ </lnTo>
330402
+ <lnTo>
330403
+ <pt x="769779" y="555069"/>
330404
+ </lnTo>
330405
+ <lnTo>
330406
+ <pt x="158591" y="555069"/>
330407
+ </lnTo>
330408
+ <lnTo>
330409
+ <pt x="158591" y="634365"/>
330410
+ </lnTo>
330411
+ <lnTo>
330412
+ <pt x="0" y="475774"/>
330413
+ </lnTo>
330414
+ <close/>
330415
+ </path>
330416
+ </pathLst>
330417
+ </leftRightUpArrow>`,
330418
+ leftUpArrow: `<leftUpArrow>
330419
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
330420
+ <path w="850265" h="850265">
330421
+ <moveTo>
330422
+ <pt x="0" y="637699"/>
330423
+ </moveTo>
330424
+ <lnTo>
330425
+ <pt x="212566" y="425133"/>
330426
+ </lnTo>
330427
+ <lnTo>
330428
+ <pt x="212566" y="531416"/>
330429
+ </lnTo>
330430
+ <lnTo>
330431
+ <pt x="531416" y="531416"/>
330432
+ </lnTo>
330433
+ <lnTo>
330434
+ <pt x="531416" y="212566"/>
330435
+ </lnTo>
330436
+ <lnTo>
330437
+ <pt x="425133" y="212566"/>
330438
+ </lnTo>
330439
+ <lnTo>
330440
+ <pt x="637699" y="0"/>
330441
+ </lnTo>
330442
+ <lnTo>
330443
+ <pt x="850265" y="212566"/>
330444
+ </lnTo>
330445
+ <lnTo>
330446
+ <pt x="743982" y="212566"/>
330447
+ </lnTo>
330448
+ <lnTo>
330449
+ <pt x="743982" y="743982"/>
330450
+ </lnTo>
330451
+ <lnTo>
330452
+ <pt x="212566" y="743982"/>
330453
+ </lnTo>
330454
+ <lnTo>
330455
+ <pt x="212566" y="850265"/>
330456
+ </lnTo>
330457
+ <lnTo>
330458
+ <pt x="0" y="637699"/>
330459
+ </lnTo>
330460
+ <close/>
330461
+ </path>
330462
+ </pathLst>
330463
+ </leftUpArrow>`,
330464
+ quadArrow: `<quadArrow>
330465
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
330466
+ <path w="788670" h="831215">
330467
+ <moveTo>
330468
+ <pt x="0" y="415608"/>
330469
+ </moveTo>
330470
+ <lnTo>
330471
+ <pt x="177451" y="238157"/>
330472
+ </lnTo>
330473
+ <lnTo>
330474
+ <pt x="177451" y="326882"/>
330475
+ </lnTo>
330476
+ <lnTo>
330477
+ <pt x="305610" y="326882"/>
330478
+ </lnTo>
330479
+ <lnTo>
330480
+ <pt x="305610" y="177451"/>
330481
+ </lnTo>
330482
+ <lnTo>
330483
+ <pt x="216884" y="177451"/>
330484
+ </lnTo>
330485
+ <lnTo>
330486
+ <pt x="394335" y="0"/>
330487
+ </lnTo>
330488
+ <lnTo>
330489
+ <pt x="571786" y="177451"/>
330490
+ </lnTo>
330491
+ <lnTo>
330492
+ <pt x="483060" y="177451"/>
330493
+ </lnTo>
330494
+ <lnTo>
330495
+ <pt x="483060" y="326882"/>
330496
+ </lnTo>
330497
+ <lnTo>
330498
+ <pt x="611219" y="326882"/>
330499
+ </lnTo>
330500
+ <lnTo>
330501
+ <pt x="611219" y="238157"/>
330502
+ </lnTo>
330503
+ <lnTo>
330504
+ <pt x="788670" y="415608"/>
330505
+ </lnTo>
330506
+ <lnTo>
330507
+ <pt x="611219" y="593058"/>
330508
+ </lnTo>
330509
+ <lnTo>
330510
+ <pt x="611219" y="504333"/>
330511
+ </lnTo>
330512
+ <lnTo>
330513
+ <pt x="483060" y="504333"/>
330514
+ </lnTo>
330515
+ <lnTo>
330516
+ <pt x="483060" y="653764"/>
330517
+ </lnTo>
330518
+ <lnTo>
330519
+ <pt x="571786" y="653764"/>
330520
+ </lnTo>
330521
+ <lnTo>
330522
+ <pt x="394335" y="831215"/>
330523
+ </lnTo>
330524
+ <lnTo>
330525
+ <pt x="216884" y="653764"/>
330526
+ </lnTo>
330527
+ <lnTo>
330528
+ <pt x="305610" y="653764"/>
330529
+ </lnTo>
330530
+ <lnTo>
330531
+ <pt x="305610" y="504333"/>
330532
+ </lnTo>
330533
+ <lnTo>
330534
+ <pt x="177451" y="504333"/>
330535
+ </lnTo>
330536
+ <lnTo>
330537
+ <pt x="177451" y="593058"/>
330538
+ </lnTo>
330539
+ <lnTo>
330540
+ <pt x="0" y="415608"/>
330541
+ </lnTo>
330542
+ <close/>
330543
+ </path>
330544
+ </pathLst>
330545
+ </quadArrow>`,
330546
+ rightArrow: `<rightArrow>
329224
330547
  <avLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
329225
330548
  <gd name="adj1" fmla="val 50000"/>
329226
330549
  <gd name="adj2" fmla="val 50000"/>
329227
330550
  </avLst>
329228
330551
  <gdLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
329229
- <gd name="maxAdj2" fmla="*/ 50000 w ss"/>
330552
+ <gd name="maxAdj2" fmla="*/ 100000 w ss"/>
329230
330553
  <gd name="a1" fmla="pin 0 adj1 100000"/>
329231
330554
  <gd name="a2" fmla="pin 0 adj2 maxAdj2"/>
329232
- <gd name="x2" fmla="*/ ss a2 100000"/>
329233
- <gd name="x3" fmla="+- r 0 x2"/>
329234
- <gd name="dy" fmla="*/ h a1 200000"/>
329235
- <gd name="y1" fmla="+- vc 0 dy"/>
329236
- <gd name="y2" fmla="+- vc dy 0"/>
329237
- <gd name="dx1" fmla="*/ y1 x2 hd2"/>
329238
- <gd name="x1" fmla="+- x2 0 dx1"/>
329239
- <gd name="x4" fmla="+- x3 dx1 0"/>
330555
+ <gd name="dx1" fmla="*/ ss a2 100000"/>
330556
+ <gd name="x1" fmla="+- r 0 dx1"/>
330557
+ <gd name="dy1" fmla="*/ h a1 200000"/>
330558
+ <gd name="y1" fmla="+- vc 0 dy1"/>
330559
+ <gd name="y2" fmla="+- vc dy1 0"/>
329240
330560
  </gdLst>
329241
330561
  <ahLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
329242
330562
  <ahXY gdRefY="adj1" minY="0" maxY="100000">
329243
- <pos x="x3" y="y1"/>
330563
+ <pos x="x1" y="y1"/>
329244
330564
  </ahXY>
329245
330565
  <ahXY gdRefX="adj2" minX="0" maxX="maxAdj2">
329246
- <pos x="x2" y="t"/>
330566
+ <pos x="x1" y="t"/>
329247
330567
  </ahXY>
329248
330568
  </ahLst>
329249
330569
  <cxnLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
@@ -329251,147 +330571,177 @@ ${err.toString()}`);
329251
330571
  <pos x="r" y="vc"/>
329252
330572
  </cxn>
329253
330573
  <cxn ang="cd4">
329254
- <pos x="x3" y="b"/>
329255
- </cxn>
329256
- <cxn ang="cd4">
329257
- <pos x="x2" y="b"/>
330574
+ <pos x="x1" y="b"/>
329258
330575
  </cxn>
329259
330576
  <cxn ang="cd2">
329260
330577
  <pos x="l" y="vc"/>
329261
330578
  </cxn>
329262
330579
  <cxn ang="3cd4">
329263
- <pos x="x2" y="t"/>
329264
- </cxn>
329265
- <cxn ang="3cd4">
329266
- <pos x="x3" y="t"/>
330580
+ <pos x="x1" y="t"/>
329267
330581
  </cxn>
329268
330582
  </cxnLst>
329269
- <rect l="x1" t="y1" r="x4" b="y2" xmlns="http://schemas.openxmlformats.org/drawingml/2006/main"/>
330583
+ <rect l="l" t="y1" r="x1" b="y2" xmlns="http://schemas.openxmlformats.org/drawingml/2006/main"/>
329270
330584
  <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
329271
330585
  <path>
329272
330586
  <moveTo>
329273
- <pt x="l" y="vc"/>
330587
+ <pt x="l" y="y1"/>
329274
330588
  </moveTo>
329275
330589
  <lnTo>
329276
- <pt x="x2" y="t"/>
330590
+ <pt x="x1" y="y1"/>
329277
330591
  </lnTo>
329278
330592
  <lnTo>
329279
- <pt x="x2" y="y1"/>
330593
+ <pt x="x1" y="t"/>
329280
330594
  </lnTo>
329281
330595
  <lnTo>
329282
- <pt x="x3" y="y1"/>
330596
+ <pt x="r" y="vc"/>
329283
330597
  </lnTo>
329284
330598
  <lnTo>
329285
- <pt x="x3" y="t"/>
330599
+ <pt x="x1" y="b"/>
329286
330600
  </lnTo>
329287
330601
  <lnTo>
329288
- <pt x="r" y="vc"/>
330602
+ <pt x="x1" y="y2"/>
330603
+ </lnTo>
330604
+ <lnTo>
330605
+ <pt x="l" y="y2"/>
330606
+ </lnTo>
330607
+ <close/>
330608
+ </path>
330609
+ </pathLst>
330610
+ </rightArrow>`,
330611
+ upArrow: `<upArrow>
330612
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
330613
+ <path w="367127" h="550008">
330614
+ <moveTo>
330615
+ <pt x="0" y="183564"/>
330616
+ </moveTo>
330617
+ <lnTo>
330618
+ <pt x="183564" y="0"/>
330619
+ </lnTo>
330620
+ <lnTo>
330621
+ <pt x="367127" y="183564"/>
330622
+ </lnTo>
330623
+ <lnTo>
330624
+ <pt x="275345" y="183564"/>
329289
330625
  </lnTo>
329290
330626
  <lnTo>
329291
- <pt x="x3" y="b"/>
330627
+ <pt x="275345" y="550008"/>
329292
330628
  </lnTo>
329293
330629
  <lnTo>
329294
- <pt x="x3" y="y2"/>
330630
+ <pt x="91782" y="550008"/>
329295
330631
  </lnTo>
329296
330632
  <lnTo>
329297
- <pt x="x2" y="y2"/>
330633
+ <pt x="91782" y="183564"/>
329298
330634
  </lnTo>
329299
330635
  <lnTo>
329300
- <pt x="x2" y="b"/>
330636
+ <pt x="0" y="183564"/>
329301
330637
  </lnTo>
329302
330638
  <close/>
329303
330639
  </path>
329304
330640
  </pathLst>
329305
- </leftRightArrow>`,
330641
+ </upArrow>`,
329306
330642
  upDownArrow: `<upDownArrow>
329307
- <avLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
329308
- <gd name="adj1" fmla="val 50000"/>
329309
- <gd name="adj2" fmla="val 50000"/>
329310
- </avLst>
329311
- <gdLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
329312
- <gd name="maxAdj2" fmla="*/ 50000 h ss"/>
329313
- <gd name="a1" fmla="pin 0 adj1 100000"/>
329314
- <gd name="a2" fmla="pin 0 adj2 maxAdj2"/>
329315
- <gd name="y2" fmla="*/ ss a2 100000"/>
329316
- <gd name="y3" fmla="+- b 0 y2"/>
329317
- <gd name="dx1" fmla="*/ w a1 200000"/>
329318
- <gd name="x1" fmla="+- hc 0 dx1"/>
329319
- <gd name="x2" fmla="+- hc dx1 0"/>
329320
- <gd name="dy1" fmla="*/ x1 y2 wd2"/>
329321
- <gd name="y1" fmla="+- y2 0 dy1"/>
329322
- <gd name="y4" fmla="+- y3 dy1 0"/>
329323
- </gdLst>
329324
- <ahLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
329325
- <ahXY gdRefX="adj1" minX="0" maxX="100000">
329326
- <pos x="x1" y="y3"/>
329327
- </ahXY>
329328
- <ahXY gdRefY="adj2" minY="0" maxY="maxAdj2">
329329
- <pos x="l" y="y2"/>
329330
- </ahXY>
329331
- </ahLst>
329332
- <cxnLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
329333
- <cxn ang="3cd4">
329334
- <pos x="hc" y="t"/>
329335
- </cxn>
329336
- <cxn ang="cd2">
329337
- <pos x="l" y="y2"/>
329338
- </cxn>
329339
- <cxn ang="cd2">
329340
- <pos x="x1" y="vc"/>
329341
- </cxn>
329342
- <cxn ang="cd2">
329343
- <pos x="l" y="y3"/>
329344
- </cxn>
329345
- <cxn ang="cd4">
329346
- <pos x="hc" y="b"/>
329347
- </cxn>
329348
- <cxn ang="0">
329349
- <pos x="r" y="y3"/>
329350
- </cxn>
329351
- <cxn ang="0">
329352
- <pos x="x2" y="vc"/>
329353
- </cxn>
329354
- <cxn ang="0">
329355
- <pos x="r" y="y2"/>
329356
- </cxn>
329357
- </cxnLst>
329358
- <rect l="x1" t="y1" r="x2" b="y4" xmlns="http://schemas.openxmlformats.org/drawingml/2006/main"/>
329359
330643
  <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
329360
- <path>
330644
+ <path w="296545" h="746760">
329361
330645
  <moveTo>
329362
- <pt x="l" y="y2"/>
330646
+ <pt x="0" y="148273"/>
329363
330647
  </moveTo>
329364
330648
  <lnTo>
329365
- <pt x="hc" y="t"/>
330649
+ <pt x="148273" y="0"/>
329366
330650
  </lnTo>
329367
330651
  <lnTo>
329368
- <pt x="r" y="y2"/>
330652
+ <pt x="296545" y="148273"/>
329369
330653
  </lnTo>
329370
330654
  <lnTo>
329371
- <pt x="x2" y="y2"/>
330655
+ <pt x="222409" y="148273"/>
329372
330656
  </lnTo>
329373
330657
  <lnTo>
329374
- <pt x="x2" y="y3"/>
330658
+ <pt x="222409" y="598488"/>
329375
330659
  </lnTo>
329376
330660
  <lnTo>
329377
- <pt x="r" y="y3"/>
330661
+ <pt x="296545" y="598488"/>
329378
330662
  </lnTo>
329379
330663
  <lnTo>
329380
- <pt x="hc" y="b"/>
330664
+ <pt x="148273" y="746760"/>
329381
330665
  </lnTo>
329382
330666
  <lnTo>
329383
- <pt x="l" y="y3"/>
330667
+ <pt x="0" y="598488"/>
329384
330668
  </lnTo>
329385
330669
  <lnTo>
329386
- <pt x="x1" y="y3"/>
330670
+ <pt x="74136" y="598488"/>
329387
330671
  </lnTo>
329388
330672
  <lnTo>
329389
- <pt x="x1" y="y2"/>
330673
+ <pt x="74136" y="148273"/>
330674
+ </lnTo>
330675
+ <lnTo>
330676
+ <pt x="0" y="148273"/>
330677
+ </lnTo>
330678
+ <close/>
330679
+ </path>
330680
+ </pathLst>
330681
+ </upDownArrow>`,
330682
+ uturnArrow: `<uturnArrow>
330683
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
330684
+ <path w="886460" h="661035">
330685
+ <moveTo>
330686
+ <pt x="0" y="661035"/>
330687
+ </moveTo>
330688
+ <lnTo>
330689
+ <pt x="0" y="289203"/>
330690
+ </lnTo>
330691
+ <cubicBezTo>
330692
+ <pt x="0" y="129481"/>
330693
+ <pt x="129481" y="0"/>
330694
+ <pt x="289203" y="0"/>
330695
+ </cubicBezTo>
330696
+ <lnTo>
330697
+ <pt x="514628" y="0"/>
330698
+ </lnTo>
330699
+ <cubicBezTo>
330700
+ <pt x="674350" y="0"/>
330701
+ <pt x="803831" y="129481"/>
330702
+ <pt x="803831" y="289203"/>
330703
+ </cubicBezTo>
330704
+ <lnTo>
330705
+ <pt x="803831" y="330518"/>
330706
+ </lnTo>
330707
+ <lnTo>
330708
+ <pt x="886460" y="330518"/>
330709
+ </lnTo>
330710
+ <lnTo>
330711
+ <pt x="721201" y="495776"/>
330712
+ </lnTo>
330713
+ <lnTo>
330714
+ <pt x="555943" y="330518"/>
330715
+ </lnTo>
330716
+ <lnTo>
330717
+ <pt x="638572" y="330518"/>
330718
+ </lnTo>
330719
+ <lnTo>
330720
+ <pt x="638572" y="289203"/>
330721
+ </lnTo>
330722
+ <cubicBezTo>
330723
+ <pt x="638572" y="220751"/>
330724
+ <pt x="583080" y="165259"/>
330725
+ <pt x="514628" y="165259"/>
330726
+ </cubicBezTo>
330727
+ <lnTo>
330728
+ <pt x="289203" y="165259"/>
330729
+ </lnTo>
330730
+ <cubicBezTo>
330731
+ <pt x="220751" y="165259"/>
330732
+ <pt x="165259" y="220751"/>
330733
+ <pt x="165259" y="289203"/>
330734
+ </cubicBezTo>
330735
+ <lnTo>
330736
+ <pt x="165259" y="661035"/>
330737
+ </lnTo>
330738
+ <lnTo>
330739
+ <pt x="0" y="661035"/>
329390
330740
  </lnTo>
329391
330741
  <close/>
329392
330742
  </path>
329393
330743
  </pathLst>
329394
- </upDownArrow>`
330744
+ </uturnArrow>`
329395
330745
  };
329396
330746
  G = {
329397
330747
  darken: "color-mix(in srgb, currentColor 60%, black)",
@@ -329495,6 +330845,10 @@ ${err.toString()}`);
329495
330845
  default: null,
329496
330846
  rendered: false
329497
330847
  },
330848
+ effects: {
330849
+ default: null,
330850
+ rendered: false
330851
+ },
329498
330852
  rotation: {
329499
330853
  default: 0,
329500
330854
  renderDOM: (attrs) => {
@@ -329629,6 +330983,10 @@ ${err.toString()}`);
329629
330983
  return offsetData;
329630
330984
  }
329631
330985
  },
330986
+ effectExtent: {
330987
+ default: null,
330988
+ rendered: false
330989
+ },
329632
330990
  hidden: {
329633
330991
  default: false,
329634
330992
  rendered: false
@@ -355910,11 +357268,11 @@ function print() { __p += __j.call(arguments, '') }
355910
357268
  ]);
355911
357269
  });
355912
357270
 
355913
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-BjToI9WN.es.js
357271
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-q-7lH9jQ.es.js
355914
357272
  var DEFAULT_TEXT_ALIGN_OPTIONS, DEFAULT_LINE_HEIGHT_OPTIONS, DEFAULT_ZOOM_OPTIONS, DEFAULT_DOCUMENT_MODE_OPTIONS, DEFAULT_FONT_SIZE_OPTIONS, headlessToolbarConstants, MOD_ALIASES, ALT_ALIASES, CTRL_ALIASES, SHIFT_ALIASES, BUILTIN_CONTEXT_MENU_GROUPS, BUILTIN_GROUP_ORDER, RESERVED_PROXY_PROPERTY_NAMES, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS, FONT_SIZE_OPTIONS;
355915
- var init_create_super_doc_ui_BjToI9WN_es = __esm(() => {
355916
- init_SuperConverter_DQ2wMaLK_es();
355917
- init_create_headless_toolbar_BhSfQYaO_es();
357273
+ var init_create_super_doc_ui_q_7lH9jQ_es = __esm(() => {
357274
+ init_SuperConverter_18ny5wUo_es();
357275
+ init_create_headless_toolbar_vcvhloZR_es();
355918
357276
  DEFAULT_TEXT_ALIGN_OPTIONS = [
355919
357277
  {
355920
357278
  label: "Left",
@@ -356205,15 +357563,15 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
356205
357563
 
356206
357564
  // ../../packages/superdoc/dist/super-editor.es.js
356207
357565
  var init_super_editor_es = __esm(() => {
356208
- init_src_CkxGCnVm_es();
356209
- init_SuperConverter_DQ2wMaLK_es();
357566
+ init_src_BFPHxhWM_es();
357567
+ init_SuperConverter_18ny5wUo_es();
356210
357568
  init_jszip_C49i9kUs_es();
356211
357569
  init_xml_js_CqGKpaft_es();
356212
- init_create_headless_toolbar_BhSfQYaO_es();
357570
+ init_create_headless_toolbar_vcvhloZR_es();
356213
357571
  init_constants_D9qj59G2_es();
356214
357572
  init_unified_BDuVPlMu_es();
356215
357573
  init_DocxZipper_BzS208BW_es();
356216
- init_create_super_doc_ui_BjToI9WN_es();
357574
+ init_create_super_doc_ui_q_7lH9jQ_es();
356217
357575
  init_ui_CGB3qmy3_es();
356218
357576
  init_eventemitter3_UwU_CLPU_es();
356219
357577
  init_errors_C_DoKMoN_es();
@@ -380254,7 +381612,6 @@ function resolveFloatingZIndex2(behindDoc, raw, fallback = 1) {
380254
381612
  return Math.max(1, raw);
380255
381613
  }
380256
381614
  var isPlainObject7 = (value) => value !== null && typeof value === "object" && !Array.isArray(value), OOXML_Z_INDEX_BASE3 = 251658240;
380257
-
380258
381615
  // ../../packages/layout-engine/contracts/src/justify-utils.ts
380259
381616
  var SPACE_CHARS2;
380260
381617
  var init_justify_utils = __esm(() => {
@@ -381174,6 +382531,37 @@ function toDrawingContentSnapshot2(value) {
381174
382531
  }
381175
382532
  return snapshot2;
381176
382533
  }
382534
+ function normalizeShapeEffects2(value) {
382535
+ if (!value || typeof value !== "object")
382536
+ return;
382537
+ const maybe = value;
382538
+ const outerShadow = normalizeOuterShadowEffect2(maybe.outerShadow);
382539
+ return outerShadow ? { outerShadow } : undefined;
382540
+ }
382541
+ function normalizeOuterShadowEffect2(value) {
382542
+ if (!value || typeof value !== "object")
382543
+ return;
382544
+ const maybe = value;
382545
+ if (maybe.type !== "outerShadow")
382546
+ return;
382547
+ const blurRadius = coerceNumber2(maybe.blurRadius);
382548
+ const distance = coerceNumber2(maybe.distance);
382549
+ const direction = coerceNumber2(maybe.direction);
382550
+ const opacity = coerceNumber2(maybe.opacity);
382551
+ if (blurRadius == null || blurRadius < 0 || distance == null || distance < 0 || direction == null || opacity == null || typeof maybe.color !== "string") {
382552
+ return;
382553
+ }
382554
+ const clamp2 = (val) => Math.max(0, Math.min(1, val));
382555
+ const normalized = {
382556
+ type: "outerShadow",
382557
+ blurRadius,
382558
+ distance,
382559
+ direction,
382560
+ color: maybe.color,
382561
+ opacity: clamp2(opacity)
382562
+ };
382563
+ return Object.fromEntries(Object.entries(normalized).filter(([, fieldValue]) => fieldValue !== undefined));
382564
+ }
381177
382565
  function isGradientFill2(value) {
381178
382566
  if (!isPlainObject8(value))
381179
382567
  return false;
@@ -381232,6 +382620,26 @@ function normalizeTextContent2(value) {
381232
382620
  if (["left", "center", "right"].includes(value.horizontalAlign)) {
381233
382621
  result.horizontalAlign = value.horizontalAlign;
381234
382622
  }
382623
+ if (Array.isArray(value.paragraphs)) {
382624
+ const normalizedParagraphs = value.paragraphs.map((paragraph3) => {
382625
+ if (!isPlainObject8(paragraph3))
382626
+ return {};
382627
+ const spacing = isPlainObject8(paragraph3.spacing) ? paragraph3.spacing : undefined;
382628
+ const before = Number.isFinite(spacing?.before) ? spacing.before : undefined;
382629
+ const after = Number.isFinite(spacing?.after) ? spacing.after : undefined;
382630
+ if (before === undefined && after === undefined)
382631
+ return {};
382632
+ const out = { spacing: {} };
382633
+ if (before !== undefined)
382634
+ out.spacing.before = before;
382635
+ if (after !== undefined)
382636
+ out.spacing.after = after;
382637
+ return out;
382638
+ });
382639
+ if (normalizedParagraphs.some((paragraph3) => ("spacing" in paragraph3))) {
382640
+ result.paragraphs = normalizedParagraphs;
382641
+ }
382642
+ }
381235
382643
  return result;
381236
382644
  }
381237
382645
  function normalizeTextVerticalAlign2(value) {
@@ -390133,6 +391541,10 @@ function imageNodeToRun2({ node: node3, positions, sdtMetadata }) {
390133
391541
  run2.title = attrs.title;
390134
391542
  if (typeof attrs.clipPath === "string")
390135
391543
  run2.clipPath = attrs.clipPath;
391544
+ if (typeof attrs.shapeClipPath === "string")
391545
+ run2.shapeClipPath = attrs.shapeClipPath;
391546
+ if (isAllowedObjectFit2(attrs.objectFit))
391547
+ run2.objectFit = attrs.objectFit;
390136
391548
  const distTop = pickNumber2(wrapAttrs.distTop ?? wrapAttrs.distT);
390137
391549
  if (distTop != null)
390138
391550
  run2.distTop = distTop;
@@ -390213,7 +391625,7 @@ function isInlineImage2(node3) {
390213
391625
  }
390214
391626
  return false;
390215
391627
  }
390216
- var DEFAULT_IMAGE_DIMENSION_PX2 = 100, isNodeHidden2 = (node3) => {
391628
+ var DEFAULT_IMAGE_DIMENSION_PX2 = 100, ALLOWED_OBJECT_FIT2, isAllowedObjectFit2 = (value) => typeof value === "string" && ALLOWED_OBJECT_FIT2.has(value), isNodeHidden2 = (node3) => {
390217
391629
  const attrs = node3.attrs ?? {};
390218
391630
  if (attrs.hidden === true)
390219
391631
  return true;
@@ -390222,6 +391634,7 @@ var DEFAULT_IMAGE_DIMENSION_PX2 = 100, isNodeHidden2 = (node3) => {
390222
391634
  var init_image = __esm(() => {
390223
391635
  init_utilities();
390224
391636
  init_common();
391637
+ ALLOWED_OBJECT_FIT2 = new Set(["contain", "cover", "fill", "scale-down"]);
390225
391638
  });
390226
391639
 
390227
391640
  // ../../packages/super-editor/src/editors/v1/core/layout-adapter/converters/inline-converters/cross-reference.ts
@@ -390649,6 +392062,7 @@ var WRAP_TYPES2, WRAP_TEXT_VALUES2, H_RELATIVE_VALUES2, V_RELATIVE_VALUES2, H_AL
390649
392062
  fillColor: normalizeFillColor2(rawAttrs.fillColor),
390650
392063
  strokeColor: normalizeStrokeColor2(rawAttrs.strokeColor),
390651
392064
  strokeWidth: coerceNumber2(rawAttrs.strokeWidth),
392065
+ effects: normalizeShapeEffects2(rawAttrs.effects),
390652
392066
  textContent: normalizeTextContent2(rawAttrs.textContent),
390653
392067
  textAlign: typeof rawAttrs.textAlign === "string" ? rawAttrs.textAlign : undefined,
390654
392068
  textVerticalAlign: normalizeTextVerticalAlign2(rawAttrs.textVerticalAlign),
@@ -390658,6 +392072,7 @@ var WRAP_TYPES2, WRAP_TEXT_VALUES2, H_RELATIVE_VALUES2, V_RELATIVE_VALUES2, H_AL
390658
392072
  };
390659
392073
  };
390660
392074
  var init_shapes = __esm(() => {
392075
+ init_src();
390661
392076
  init_utilities();
390662
392077
  init_paragraph2();
390663
392078
  WRAP_TYPES2 = new Set(["None", "Square", "Tight", "Through", "TopAndBottom", "Inline"]);
@@ -390802,7 +392217,7 @@ function imageNodeToBlock2(node3, nextBlockId, positions, _trackedMeta, _tracked
390802
392217
  const lumContrast = pickNumber2(lum?.contrast);
390803
392218
  const alphaModFix = isPlainObject10(attrs.alphaModFix) ? attrs.alphaModFix : undefined;
390804
392219
  const alphaModFixAmt = pickNumber2(alphaModFix?.amt);
390805
- const objectFit = isAllowedObjectFit2(explicitObjectFit) ? explicitObjectFit : shouldCover ? "cover" : display === "inline" ? "scale-down" : isAnchor ? "contain" : "contain";
392220
+ const objectFit = isAllowedObjectFit3(explicitObjectFit) ? explicitObjectFit : shouldCover ? "cover" : display === "inline" ? "scale-down" : isAnchor ? "contain" : "contain";
390806
392221
  const zIndexFromRelativeHeight = normalizeZIndex2(attrs.originalAttributes);
390807
392222
  const zIndex = resolveFloatingZIndex2(anchor?.behindDoc === true, zIndexFromRelativeHeight);
390808
392223
  const transformData = isPlainObject10(attrs.transformData) ? attrs.transformData : undefined;
@@ -390858,7 +392273,7 @@ function handleImageNode2(node3, context) {
390858
392273
  var WRAP_TYPES3, WRAP_TEXT_VALUES3, H_RELATIVE_VALUES3, V_RELATIVE_VALUES3, H_ALIGN_VALUES3, V_ALIGN_VALUES3, isPlainObject10 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), sourceAnchorFromAttrs2 = (attrs) => {
390859
392274
  const sourceAnchor = attrs.sourceAnchor;
390860
392275
  return isPlainObject10(sourceAnchor) ? sourceAnchor : undefined;
390861
- }, isAllowedObjectFit2 = (value) => {
392276
+ }, isAllowedObjectFit3 = (value) => {
390862
392277
  return value === "contain" || value === "cover" || value === "fill" || value === "scale-down";
390863
392278
  }, isHiddenDrawing2 = (attrs) => {
390864
392279
  if (toBoolean4(attrs.hidden) === true)
@@ -433209,6 +434624,35 @@ function extractLineEnds2(spPr) {
433209
434624
  return null;
433210
434625
  return { head: headConfig ?? undefined, tail: tailConfig ?? undefined };
433211
434626
  }
434627
+ function extractShapeEffects2(spPr) {
434628
+ const outerShadow = extractOuterShadowEffect2(spPr);
434629
+ if (!outerShadow)
434630
+ return null;
434631
+ return { outerShadow };
434632
+ }
434633
+ function extractOuterShadowEffect2(spPr) {
434634
+ const effectLst = findChildByLocalName2(spPr?.elements, "effectLst");
434635
+ const outerShdw = findChildByLocalName2(effectLst?.elements, "outerShdw");
434636
+ if (!outerShdw)
434637
+ return null;
434638
+ const colorResult = extractColorFromElement2(outerShdw);
434639
+ if (!colorResult)
434640
+ return null;
434641
+ return stripUndefined2({
434642
+ type: "outerShadow",
434643
+ blurRadius: finiteNumberOrZero2(emuToPixels2(outerShdw.attributes?.blurRad)),
434644
+ distance: finiteNumberOrZero2(emuToPixels2(outerShdw.attributes?.dist)),
434645
+ direction: finiteNumberOrZero2(rotToDegrees2(outerShdw.attributes?.dir)),
434646
+ color: colorResult.color,
434647
+ opacity: colorResult.alpha ?? 1
434648
+ });
434649
+ }
434650
+ function finiteNumberOrZero2(value) {
434651
+ return Number.isFinite(value) ? value : 0;
434652
+ }
434653
+ function stripUndefined2(value) {
434654
+ return Object.fromEntries(Object.entries(value).filter(([, fieldValue]) => fieldValue !== undefined));
434655
+ }
433212
434656
  function extractStrokeColor2(spPr, style2) {
433213
434657
  const ln = findChildByLocalName2(spPr?.elements, "ln");
433214
434658
  if (ln) {
@@ -433380,7 +434824,9 @@ function extractGradientFill2(gradFill) {
433380
434824
  }
433381
434825
  return gradient;
433382
434826
  }
433383
- var init_vector_shape_helpers = () => {};
434827
+ var init_vector_shape_helpers = __esm(() => {
434828
+ init_helpers();
434829
+ });
433384
434830
 
433385
434831
  // ../../packages/super-editor/src/editors/v1/core/super-converter/v3/handlers/wp/helpers/rtfjs/util/SVG.ts
433386
434832
  class SVGFilters2 {
@@ -448694,6 +450140,26 @@ function resolveParagraphPropertiesForTextBox2(paragraph4, params3) {
448694
450140
  const inlineParagraphProperties = pPr ? translator108.encode({ ...params3, nodes: [pPr] }) || {} : {};
448695
450141
  return resolveParagraphProperties2(params3, inlineParagraphProperties, false, false, null);
448696
450142
  }
450143
+ function extractTextBoxParagraphSpacing2(paragraphProperties, { paragraphIndex, paragraphCount, spcFirstLastPara } = {}) {
450144
+ const spacing = paragraphProperties?.spacing;
450145
+ if (!spacing)
450146
+ return;
450147
+ const honorFirstLast = spcFirstLastPara === "1" || spcFirstLastPara === 1 || spcFirstLastPara === true || spcFirstLastPara === "true" || spcFirstLastPara === "on";
450148
+ const isFirst = paragraphIndex === 0;
450149
+ const isLast = paragraphCount != null && paragraphIndex === paragraphCount - 1;
450150
+ const result = {};
450151
+ if (typeof spacing.before === "number" && !(isFirst && !honorFirstLast)) {
450152
+ const px = twipsToPixels4(spacing.before);
450153
+ if (typeof px === "number")
450154
+ result.before = px;
450155
+ }
450156
+ if (typeof spacing.after === "number" && !(isLast && !honorFirstLast)) {
450157
+ const px = twipsToPixels4(spacing.after);
450158
+ if (typeof px === "number")
450159
+ result.after = px;
450160
+ }
450161
+ return result.before === undefined && result.after === undefined ? undefined : result;
450162
+ }
448697
450163
  function extractRunFormatting2(rPr, paragraphProperties, params3) {
448698
450164
  const inlineRunProperties = rPr ? translator98.encode({ ...params3, nodes: [rPr] }) || {} : {};
448699
450165
  const resolvedRunProperties = resolveRunProperties2(params3, inlineRunProperties, paragraphProperties || {});
@@ -448758,7 +450224,8 @@ function extractBodyPrProperties2(bodyPr) {
448758
450224
  left: lIns * EMU_TO_PX
448759
450225
  };
448760
450226
  const wrap6 = bodyPrAttrs["wrap"] || "square";
448761
- return { verticalAlign, insets, wrap: wrap6 };
450227
+ const spcFirstLastPara = bodyPrAttrs["spcFirstLastPara"];
450228
+ return { verticalAlign, insets, wrap: wrap6, spcFirstLastPara };
448762
450229
  }
448763
450230
  var HEADER_FOOTER_FILENAME_PATTERN2, DEFAULT_TAB_INTERVAL_TWIPS3 = 720;
448764
450231
  var init_textbox_content_helpers = __esm(() => {
@@ -449322,7 +450789,7 @@ function handleImageNode3(node4, params3, isAnchor) {
449322
450789
  horizontal: positionHValue,
449323
450790
  top: positionVValue
449324
450791
  };
449325
- return handleShapeGroup2(params3, node4, graphicData, size3, padding, shapeMarginOffset, anchorData, wrap6, isHidden);
450792
+ return handleShapeGroup2(params3, node4, graphicData, size3, padding, shapeMarginOffset, anchorData, wrap6, extractEffectExtent2(node4), isHidden);
449326
450793
  }
449327
450794
  if (uri === CHART_URI) {
449328
450795
  return handleChartDrawing2(params3, node4, graphicData, size3, padding, marginOffset, anchorData, wrap6, isAnchor);
@@ -449345,18 +450812,7 @@ function handleImageNode3(node4, params3, isAnchor) {
449345
450812
  ...Number.isFinite(rawContrast) ? { contrast: rawContrast } : {}
449346
450813
  } : undefined;
449347
450814
  const alphaModFix = extractAlphaModFix2(blip);
449348
- const stretch = findChildByLocalName2(blipFill?.elements, "stretch");
449349
- const fillRect = findChildByLocalName2(stretch?.elements, "fillRect");
449350
- const srcRect = findChildByLocalName2(blipFill?.elements, "srcRect");
449351
- const srcRectAttrs = srcRect?.attributes || {};
449352
- const clipPath = buildClipPathFromSrcRect2(srcRectAttrs);
449353
- const srcRectHasNegativeValues = ["l", "t", "r", "b"].some((attr) => {
449354
- const val = srcRectAttrs[attr];
449355
- return val != null && parseFloat(val) < 0;
449356
- });
449357
- const shouldStretch = Boolean(stretch && fillRect);
449358
- const shouldCover = shouldStretch && !srcRectHasNegativeValues && !clipPath;
449359
- const shouldFillClippedStretch = shouldStretch && !srcRectHasNegativeValues && Boolean(clipPath);
450815
+ const { clipPath, rawSrcRect, shouldCover, shouldFillClippedStretch, shouldCoverShapeStretch, shapeClipPath } = extractPicturePresentation2(picture);
449360
450816
  const spPr = picture.elements.find((el) => el.name === "pic:spPr");
449361
450817
  if (spPr) {
449362
450818
  const xfrm = findChildByLocalName2(spPr.elements, "xfrm");
@@ -449487,9 +450943,10 @@ function handleImageNode3(node4, params3, isAnchor) {
449487
450943
  } : {},
449488
450944
  wrapTopAndBottom: wrap6.type === "TopAndBottom",
449489
450945
  shouldCover,
449490
- ...shouldFillClippedStretch ? { objectFit: "fill" } : {},
450946
+ ...shouldFillClippedStretch ? { objectFit: "fill" } : shouldCoverShapeStretch ? { objectFit: "cover" } : {},
449491
450947
  ...clipPath ? { clipPath } : {},
449492
- rawSrcRect: srcRect,
450948
+ ...shapeClipPath ? { shapeClipPath } : {},
450949
+ rawSrcRect,
449493
450950
  originalPadding: {
449494
450951
  distT: attributes["distT"],
449495
450952
  distB: attributes["distB"],
@@ -449536,7 +450993,9 @@ function extractTextFromTextBox2(textBoxContent, bodyPr, params3 = {}) {
449536
450993
  const processedContent = preProcessTextBoxContent2(textBoxContent, params3);
449537
450994
  const paragraphs = collectTextBoxParagraphs2(processedContent?.elements || []);
449538
450995
  const textParts = [];
450996
+ const paragraphMetadata = [];
449539
450997
  let horizontalAlign = null;
450998
+ const { verticalAlign, insets, wrap: wrap6, spcFirstLastPara } = extractBodyPrProperties2(bodyPr);
449540
450999
  const appendFieldPart = (fieldType, node4, paragraphProperties) => {
449541
451000
  const rPr = node4?.elements?.find((el) => el.name === "w:rPr");
449542
451001
  const formatting = extractRunFormatting2(rPr, paragraphProperties, params3);
@@ -449633,6 +451092,13 @@ function extractTextFromTextBox2(textBoxContent, bodyPr, params3 = {}) {
449633
451092
  };
449634
451093
  paragraphs.forEach((paragraph4, paragraphIndex) => {
449635
451094
  const paragraphProperties = resolveParagraphPropertiesForTextBox2(paragraph4, params3);
451095
+ paragraphMetadata.push({
451096
+ spacing: extractTextBoxParagraphSpacing2(paragraphProperties, {
451097
+ paragraphIndex,
451098
+ paragraphCount: paragraphs.length,
451099
+ spcFirstLastPara
451100
+ })
451101
+ });
449636
451102
  if (!horizontalAlign) {
449637
451103
  horizontalAlign = extractParagraphAlignment2(paragraph4);
449638
451104
  }
@@ -449649,19 +451115,21 @@ function extractTextFromTextBox2(textBoxContent, bodyPr, params3 = {}) {
449649
451115
  `,
449650
451116
  formatting: {},
449651
451117
  isLineBreak: true,
449652
- isEmptyParagraph: !paragraphHasText
451118
+ isEmptyParagraph: !paragraphHasText,
451119
+ isParagraphBoundary: true
449653
451120
  });
449654
451121
  }
449655
451122
  });
449656
451123
  if (textParts.length === 0)
449657
451124
  return null;
449658
- const { verticalAlign, insets, wrap: wrap6 } = extractBodyPrProperties2(bodyPr);
451125
+ const hasParagraphSpacing = paragraphMetadata.some((paragraph4) => paragraph4.spacing);
449659
451126
  return {
449660
451127
  parts: textParts,
449661
451128
  horizontalAlign: horizontalAlign || "left",
449662
451129
  verticalAlign,
449663
451130
  insets,
449664
- wrap: wrap6
451131
+ wrap: wrap6,
451132
+ ...hasParagraphSpacing ? { paragraphs: paragraphMetadata } : {}
449665
451133
  };
449666
451134
  }
449667
451135
  function extractFieldInlineNodes2(node4) {
@@ -449798,6 +451266,7 @@ function getVectorShape2({
449798
451266
  const strokeColor = extractStrokeColor2(spPr, style2);
449799
451267
  const strokeWidth = extractStrokeWidth2(spPr);
449800
451268
  const lineEnds = extractLineEnds2(spPr);
451269
+ const effects2 = extractShapeEffects2(spPr);
449801
451270
  const effectExtent = extractEffectExtent2(node4);
449802
451271
  const textBox = wsp.elements?.find((el) => el.name === "wps:txbx");
449803
451272
  const textBoxContent = textBox?.elements?.find((el) => el.name === "w:txbxContent");
@@ -449822,6 +451291,7 @@ function getVectorShape2({
449822
451291
  strokeColor,
449823
451292
  strokeWidth,
449824
451293
  lineEnds,
451294
+ effects: effects2,
449825
451295
  effectExtent,
449826
451296
  marginOffset,
449827
451297
  anchorData,
@@ -449856,6 +451326,7 @@ function getVectorShape2({
449856
451326
  strokeColor,
449857
451327
  strokeWidth,
449858
451328
  lineEnds,
451329
+ effects: effects2,
449859
451330
  effectExtent,
449860
451331
  marginOffset,
449861
451332
  anchorData,
@@ -449941,6 +451412,36 @@ var DRAWING_XML_TAG2 = "w:drawing", SHAPE_URI2 = "http://schemas.microsoft.com/o
449941
451412
  const alphaModFix = findChildByLocalName2(blip?.elements, "alphaModFix");
449942
451413
  const amt = Number(alphaModFix?.attributes?.amt);
449943
451414
  return Number.isFinite(amt) ? { amt } : undefined;
451415
+ }, buildShapeClipPathFromPreset2 = (preset) => {
451416
+ if (preset === "ellipse")
451417
+ return "ellipse(50% 50% at 50% 50%)";
451418
+ return null;
451419
+ }, extractPicturePresentation2 = (picture) => {
451420
+ const blipFill = picture?.elements?.find((el) => el.name === "pic:blipFill");
451421
+ const stretch = findChildByLocalName2(blipFill?.elements, "stretch");
451422
+ const fillRect = findChildByLocalName2(stretch?.elements, "fillRect");
451423
+ const srcRect = findChildByLocalName2(blipFill?.elements, "srcRect");
451424
+ const srcRectAttrs = srcRect?.attributes || {};
451425
+ const clipPath = buildClipPathFromSrcRect2(srcRectAttrs);
451426
+ const srcRectHasNegativeValues = ["l", "t", "r", "b"].some((attr) => {
451427
+ const val = srcRectAttrs[attr];
451428
+ return val != null && parseFloat(val) < 0;
451429
+ });
451430
+ const spPr = picture?.elements?.find((el) => el.name === "pic:spPr");
451431
+ const prstGeom = findChildByLocalName2(spPr?.elements, "prstGeom");
451432
+ const shapeClipPath = buildShapeClipPathFromPreset2(prstGeom?.attributes?.["prst"]);
451433
+ const shouldStretch = Boolean(stretch && fillRect);
451434
+ const shouldCover = shouldStretch && !srcRectHasNegativeValues && !clipPath;
451435
+ const shouldFillClippedStretch = shouldStretch && !srcRectHasNegativeValues && Boolean(clipPath);
451436
+ const shouldCoverShapeStretch = shouldStretch && Boolean(shapeClipPath) && !clipPath;
451437
+ return {
451438
+ clipPath,
451439
+ rawSrcRect: srcRect,
451440
+ shouldCover,
451441
+ shouldFillClippedStretch,
451442
+ shouldCoverShapeStretch,
451443
+ shapeClipPath
451444
+ };
449944
451445
  }, mergeAnchorPaddingIntoWrapDistances2 = (wrap6, padding) => {
449945
451446
  if (!wrap6?.attrs || !padding)
449946
451447
  return;
@@ -450023,7 +451524,294 @@ var DRAWING_XML_TAG2 = "w:drawing", SHAPE_URI2 = "http://schemas.microsoft.com/o
450023
451524
  placeholder.attrs.hidden = true;
450024
451525
  }
450025
451526
  return placeholder;
450026
- }, handleShapeGroup2 = (params3, node4, graphicData, size3, padding, marginOffset, anchorData, wrap6, isHidden) => {
451527
+ }, parseEmuNumber2 = (value, fallback = 0) => {
451528
+ const numeric = Number(value);
451529
+ return Number.isFinite(numeric) ? numeric : fallback;
451530
+ }, getGroupXfrm2 = (groupNode) => {
451531
+ const grpSpPr = findChildByLocalName2(groupNode?.elements, "grpSpPr");
451532
+ return findChildByLocalName2(grpSpPr?.elements, "xfrm");
451533
+ }, buildShapeGroupTransformAttrs2 = (xfrm) => {
451534
+ const groupTransform = {};
451535
+ if (!xfrm)
451536
+ return groupTransform;
451537
+ if (xfrm.attributes?.["rot"]) {
451538
+ groupTransform.rotation = rotToDegrees2(xfrm.attributes["rot"]);
451539
+ }
451540
+ if (xfrm.attributes?.["flipH"] === "1") {
451541
+ groupTransform.flipH = true;
451542
+ }
451543
+ if (xfrm.attributes?.["flipV"] === "1") {
451544
+ groupTransform.flipV = true;
451545
+ }
451546
+ const off = findChildByLocalName2(xfrm.elements, "off");
451547
+ const ext = findChildByLocalName2(xfrm.elements, "ext");
451548
+ const chOff = findChildByLocalName2(xfrm.elements, "chOff");
451549
+ const chExt = findChildByLocalName2(xfrm.elements, "chExt");
451550
+ if (off) {
451551
+ groupTransform.x = emuToPixels2(off.attributes?.["x"] || 0);
451552
+ groupTransform.y = emuToPixels2(off.attributes?.["y"] || 0);
451553
+ }
451554
+ if (ext) {
451555
+ groupTransform.width = emuToPixels2(ext.attributes?.["cx"] || 0);
451556
+ groupTransform.height = emuToPixels2(ext.attributes?.["cy"] || 0);
451557
+ }
451558
+ if (chOff) {
451559
+ groupTransform.childX = emuToPixels2(chOff.attributes?.["x"] || 0);
451560
+ groupTransform.childY = emuToPixels2(chOff.attributes?.["y"] || 0);
451561
+ groupTransform.childOriginXEmu = parseEmuNumber2(chOff.attributes?.["x"]);
451562
+ groupTransform.childOriginYEmu = parseEmuNumber2(chOff.attributes?.["y"]);
451563
+ }
451564
+ if (chExt) {
451565
+ groupTransform.childWidth = emuToPixels2(chExt.attributes?.["cx"] || 0);
451566
+ groupTransform.childHeight = emuToPixels2(chExt.attributes?.["cy"] || 0);
451567
+ }
451568
+ return groupTransform;
451569
+ }, identityMatrix2 = () => ({ a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 }), multiplyMatrix2 = (left2, right2) => ({
451570
+ a: left2.a * right2.a + left2.c * right2.b,
451571
+ b: left2.b * right2.a + left2.d * right2.b,
451572
+ c: left2.a * right2.c + left2.c * right2.d,
451573
+ d: left2.b * right2.c + left2.d * right2.d,
451574
+ e: left2.a * right2.e + left2.c * right2.f + left2.e,
451575
+ f: left2.b * right2.e + left2.d * right2.f + left2.f
451576
+ }), transformPoint2 = (matrix, x, y2) => ({
451577
+ x: matrix.a * x + matrix.c * y2 + matrix.e,
451578
+ y: matrix.b * x + matrix.d * y2 + matrix.f
451579
+ }), normalizeDegrees2 = (degrees) => {
451580
+ const normalized = (degrees % 360 + 360) % 360;
451581
+ return Object.is(normalized, -0) ? 0 : normalized;
451582
+ }, decomposeMatrixOrientation2 = (matrix) => {
451583
+ const determinant = matrix.a * matrix.d - matrix.b * matrix.c;
451584
+ if (determinant < 0) {
451585
+ return {
451586
+ rotation: normalizeDegrees2(Math.atan2(-matrix.b, -matrix.a) * 180 / Math.PI),
451587
+ flipH: true,
451588
+ flipV: false
451589
+ };
451590
+ }
451591
+ return {
451592
+ rotation: normalizeDegrees2(Math.atan2(matrix.b, matrix.a) * 180 / Math.PI),
451593
+ flipH: false,
451594
+ flipV: false
451595
+ };
451596
+ }, getVisualOrientationMatrix2 = ({ rotation = 0, flipH = false, flipV = false } = {}) => {
451597
+ const radians = rotation * Math.PI / 180;
451598
+ const cos = Math.cos(radians);
451599
+ const sin = Math.sin(radians);
451600
+ const flipScaleX = flipH ? -1 : 1;
451601
+ const flipScaleY = flipV ? -1 : 1;
451602
+ return {
451603
+ a: cos * flipScaleX,
451604
+ b: sin * flipScaleX,
451605
+ c: -sin * flipScaleY,
451606
+ d: cos * flipScaleY,
451607
+ e: 0,
451608
+ f: 0
451609
+ };
451610
+ }, getGroupAffineTransform2 = (xfrm, { includeVisualTransform = false } = {}) => {
451611
+ if (!xfrm) {
451612
+ return { matrix: identityMatrix2(), rotation: 0, flipH: false, flipV: false };
451613
+ }
451614
+ const off = findChildByLocalName2(xfrm.elements, "off");
451615
+ const ext = findChildByLocalName2(xfrm.elements, "ext");
451616
+ const chOff = findChildByLocalName2(xfrm.elements, "chOff");
451617
+ const chExt = findChildByLocalName2(xfrm.elements, "chExt");
451618
+ const childWidth = parseEmuNumber2(chExt?.attributes?.["cx"]);
451619
+ const childHeight = parseEmuNumber2(chExt?.attributes?.["cy"]);
451620
+ const width = parseEmuNumber2(ext?.attributes?.["cx"], childWidth || 0);
451621
+ const height = parseEmuNumber2(ext?.attributes?.["cy"], childHeight || 0);
451622
+ const childX = parseEmuNumber2(chOff?.attributes?.["x"]);
451623
+ const childY = parseEmuNumber2(chOff?.attributes?.["y"]);
451624
+ const x = parseEmuNumber2(off?.attributes?.["x"]);
451625
+ const y2 = parseEmuNumber2(off?.attributes?.["y"]);
451626
+ const scaleX = childWidth !== 0 ? width / childWidth : 1;
451627
+ const scaleY = childHeight !== 0 ? height / childHeight : 1;
451628
+ const rotation = xfrm.attributes?.["rot"] ? rotToDegrees2(xfrm.attributes["rot"]) : 0;
451629
+ const flipH = xfrm.attributes?.["flipH"] === "1";
451630
+ const flipV = xfrm.attributes?.["flipV"] === "1";
451631
+ const baseMatrix = {
451632
+ a: scaleX,
451633
+ b: 0,
451634
+ c: 0,
451635
+ d: scaleY,
451636
+ e: x - childX * scaleX,
451637
+ f: y2 - childY * scaleY
451638
+ };
451639
+ if (!includeVisualTransform || !rotation && !flipH && !flipV) {
451640
+ return { matrix: baseMatrix, rotation: 0, flipH: false, flipV: false };
451641
+ }
451642
+ const radians = rotation * Math.PI / 180;
451643
+ const cos = Math.cos(radians);
451644
+ const sin = Math.sin(radians);
451645
+ const flipScaleX = flipH ? -1 : 1;
451646
+ const flipScaleY = flipV ? -1 : 1;
451647
+ const centerX = x + width / 2;
451648
+ const centerY = y2 + height / 2;
451649
+ const visualMatrix = {
451650
+ a: cos * flipScaleX,
451651
+ b: sin * flipScaleX,
451652
+ c: -sin * flipScaleY,
451653
+ d: cos * flipScaleY,
451654
+ e: centerX - (cos * flipScaleX * centerX + -sin * flipScaleY * centerY),
451655
+ f: centerY - (sin * flipScaleX * centerX + cos * flipScaleY * centerY)
451656
+ };
451657
+ return { matrix: multiplyMatrix2(visualMatrix, baseMatrix), rotation, flipH, flipV };
451658
+ }, composeShapeGroupTransform2 = (parent, child) => {
451659
+ const matrix = multiplyMatrix2(parent.matrix, child.matrix);
451660
+ return {
451661
+ matrix,
451662
+ ...decomposeMatrixOrientation2(matrix)
451663
+ };
451664
+ }, composeShapeGroupChildOrientation2 = (rect, xfrm) => {
451665
+ const parentMatrix = getVisualOrientationMatrix2({
451666
+ rotation: rect.rotation ?? 0,
451667
+ flipH: Boolean(rect.flipH),
451668
+ flipV: Boolean(rect.flipV)
451669
+ });
451670
+ const childMatrix = getVisualOrientationMatrix2({
451671
+ rotation: xfrm?.attributes?.["rot"] ? rotToDegrees2(xfrm.attributes["rot"]) : 0,
451672
+ flipH: xfrm?.attributes?.["flipH"] === "1",
451673
+ flipV: xfrm?.attributes?.["flipV"] === "1"
451674
+ });
451675
+ return decomposeMatrixOrientation2(multiplyMatrix2(parentMatrix, childMatrix));
451676
+ }, transformShapeGroupChildRect2 = (transform2, rawX, rawY, rawWidth, rawHeight) => {
451677
+ const matrix = transform2.matrix ?? identityMatrix2();
451678
+ const width = Math.hypot(matrix.a, matrix.b) * rawWidth;
451679
+ const height = Math.hypot(matrix.c, matrix.d) * rawHeight;
451680
+ const center = transformPoint2(matrix, rawX + rawWidth / 2, rawY + rawHeight / 2);
451681
+ return {
451682
+ x: emuToPixels2(center.x - width / 2),
451683
+ y: emuToPixels2(center.y - height / 2),
451684
+ width: emuToPixels2(width),
451685
+ height: emuToPixels2(height),
451686
+ rotation: transform2.rotation ?? 0,
451687
+ flipH: Boolean(transform2.flipH),
451688
+ flipV: Boolean(transform2.flipV)
451689
+ };
451690
+ }, resolveShapeGroupPicturePath2 = (pic, params3) => {
451691
+ const blipFill = findChildByLocalName2(pic.elements, "blipFill");
451692
+ const blip = findChildByLocalName2(blipFill?.elements, "blip");
451693
+ if (!blip)
451694
+ return null;
451695
+ const rEmbed = blip.attributes?.["r:embed"];
451696
+ if (!rEmbed)
451697
+ return null;
451698
+ const currentFile = params3.filename || "document.xml";
451699
+ let rels = params3.docx[`word/_rels/${currentFile}.rels`];
451700
+ if (!rels)
451701
+ rels = params3.docx[`word/_rels/document.xml.rels`];
451702
+ const relationships = rels?.elements.find((el) => el.name === "Relationships");
451703
+ const elements = relationships?.elements;
451704
+ const rel = elements?.find((el) => el.attributes["Id"] === rEmbed);
451705
+ if (!rel)
451706
+ return null;
451707
+ return normalizeTargetPath2(rel.attributes?.["Target"]);
451708
+ }, parseShapeGroupVectorChild2 = (wsp, transform2, params3) => {
451709
+ const spPr = findChildByLocalName2(wsp.elements, "spPr");
451710
+ if (!spPr)
451711
+ return null;
451712
+ const prstGeom = findChildByLocalName2(spPr.elements, "prstGeom");
451713
+ const shapeKind = prstGeom?.attributes?.["prst"];
451714
+ const customGeom = !shapeKind ? extractCustomGeometry2(spPr) : null;
451715
+ const shapeXfrm = findChildByLocalName2(spPr.elements, "xfrm");
451716
+ const shapeOff = findChildByLocalName2(shapeXfrm?.elements, "off");
451717
+ const shapeExt = findChildByLocalName2(shapeXfrm?.elements, "ext");
451718
+ const rawX = parseEmuNumber2(shapeOff?.attributes?.["x"]);
451719
+ const rawY = parseEmuNumber2(shapeOff?.attributes?.["y"]);
451720
+ const rawWidth = parseEmuNumber2(shapeExt?.attributes?.["cx"], 914400);
451721
+ const rawHeight = parseEmuNumber2(shapeExt?.attributes?.["cy"], 914400);
451722
+ const rect = transformShapeGroupChildRect2(transform2, rawX, rawY, rawWidth, rawHeight);
451723
+ const orientation = composeShapeGroupChildOrientation2(rect, shapeXfrm);
451724
+ const style2 = findChildByLocalName2(wsp.elements, "style");
451725
+ const fillColor = extractFillColor2(spPr, style2);
451726
+ const strokeColor = extractStrokeColor2(spPr, style2);
451727
+ const strokeWidth = extractStrokeWidth2(spPr);
451728
+ const lineEnds = extractLineEnds2(spPr);
451729
+ const effects2 = extractShapeEffects2(spPr);
451730
+ const cNvPr = findChildByLocalName2(wsp.elements, "cNvPr");
451731
+ const shapeId = cNvPr?.attributes?.["id"];
451732
+ const shapeName = cNvPr?.attributes?.["name"];
451733
+ const textBox = findChildByLocalName2(wsp.elements, "txbx");
451734
+ const textBoxContent = findChildByLocalName2(textBox?.elements, "txbxContent");
451735
+ const bodyPr = findChildByLocalName2(wsp.elements, "bodyPr");
451736
+ const textContent2 = textBoxContent ? extractTextFromTextBox2(textBoxContent, bodyPr, params3) : null;
451737
+ const textAlign = textContent2?.horizontalAlign || "left";
451738
+ return {
451739
+ shapeType: "vectorShape",
451740
+ attrs: {
451741
+ kind: shapeKind,
451742
+ customGeometry: customGeom || undefined,
451743
+ ...rect,
451744
+ ...orientation,
451745
+ fillColor,
451746
+ strokeColor,
451747
+ strokeWidth,
451748
+ lineEnds,
451749
+ effects: effects2,
451750
+ shapeId,
451751
+ shapeName,
451752
+ textContent: textContent2,
451753
+ textAlign,
451754
+ textVerticalAlign: textContent2?.verticalAlign,
451755
+ textInsets: textContent2?.insets
451756
+ }
451757
+ };
451758
+ }, parseShapeGroupImageChild2 = (pic, transform2, params3) => {
451759
+ const spPr = findChildByLocalName2(pic.elements, "spPr");
451760
+ if (!spPr)
451761
+ return null;
451762
+ const xfrm = findChildByLocalName2(spPr.elements, "xfrm");
451763
+ const off = findChildByLocalName2(xfrm?.elements, "off");
451764
+ const ext = findChildByLocalName2(xfrm?.elements, "ext");
451765
+ const rawX = parseEmuNumber2(off?.attributes?.["x"]);
451766
+ const rawY = parseEmuNumber2(off?.attributes?.["y"]);
451767
+ const rawWidth = parseEmuNumber2(ext?.attributes?.["cx"], 914400);
451768
+ const rawHeight = parseEmuNumber2(ext?.attributes?.["cy"], 914400);
451769
+ const rect = transformShapeGroupChildRect2(transform2, rawX, rawY, rawWidth, rawHeight);
451770
+ const orientation = composeShapeGroupChildOrientation2(rect, xfrm);
451771
+ const path3 = resolveShapeGroupPicturePath2(pic, params3);
451772
+ if (!path3)
451773
+ return null;
451774
+ const blipFill = findChildByLocalName2(pic.elements, "blipFill");
451775
+ const blip = findChildByLocalName2(blipFill?.elements, "blip");
451776
+ const alphaModFix = extractAlphaModFix2(blip);
451777
+ const nvPicPr = findChildByLocalName2(pic.elements, "nvPicPr");
451778
+ const cNvPr = findChildByLocalName2(nvPicPr?.elements, "cNvPr");
451779
+ const picId = cNvPr?.attributes?.["id"];
451780
+ const picName = cNvPr?.attributes?.["name"];
451781
+ const { clipPath, shouldCover, shouldFillClippedStretch, shouldCoverShapeStretch, shapeClipPath } = extractPicturePresentation2(pic);
451782
+ return {
451783
+ shapeType: "image",
451784
+ attrs: {
451785
+ ...rect,
451786
+ ...orientation,
451787
+ src: path3,
451788
+ imageId: picId,
451789
+ imageName: picName,
451790
+ ...alphaModFix ? { alphaModFix } : {},
451791
+ ...clipPath ? { clipPath } : {},
451792
+ ...shapeClipPath ? { shapeClipPath } : {},
451793
+ ...shouldFillClippedStretch || shouldCoverShapeStretch ? { objectFit: shouldFillClippedStretch ? "fill" : "cover" } : shouldCover ? { objectFit: "cover" } : {}
451794
+ }
451795
+ };
451796
+ }, collectShapeGroupChildren2 = (groupNode, transform2, params3) => {
451797
+ const children = [];
451798
+ for (const child of groupNode?.elements || []) {
451799
+ const localName2 = getLocalName3(child?.name);
451800
+ if (localName2 === "wsp") {
451801
+ const shape = parseShapeGroupVectorChild2(child, transform2, params3);
451802
+ if (shape)
451803
+ children.push(shape);
451804
+ } else if (localName2 === "pic") {
451805
+ const picture = parseShapeGroupImageChild2(child, transform2, params3);
451806
+ if (picture)
451807
+ children.push(picture);
451808
+ } else if (localName2 === "grpSp") {
451809
+ const nestedTransform = composeShapeGroupTransform2(transform2, getGroupAffineTransform2(getGroupXfrm2(child), { includeVisualTransform: true }));
451810
+ children.push(...collectShapeGroupChildren2(child, nestedTransform, params3));
451811
+ }
451812
+ }
451813
+ return children;
451814
+ }, handleShapeGroup2 = (params3, node4, graphicData, size3, padding, marginOffset, anchorData, wrap6, effectExtent, isHidden) => {
450027
451815
  const wgp = graphicData.elements.find((el) => el.name === "wpg:wgp");
450028
451816
  if (!wgp) {
450029
451817
  const placeholder = buildShapePlaceholder2(node4, size3, padding, marginOffset, "group");
@@ -450032,174 +451820,9 @@ var DRAWING_XML_TAG2 = "w:drawing", SHAPE_URI2 = "http://schemas.microsoft.com/o
450032
451820
  }
450033
451821
  return placeholder;
450034
451822
  }
450035
- const grpSpPr = wgp.elements.find((el) => el.name === "wpg:grpSpPr");
450036
- const xfrm = findChildByLocalName2(grpSpPr?.elements, "xfrm");
450037
- const groupTransform = {};
450038
- if (xfrm) {
450039
- const off = findChildByLocalName2(xfrm.elements, "off");
450040
- const ext = findChildByLocalName2(xfrm.elements, "ext");
450041
- const chOff = findChildByLocalName2(xfrm.elements, "chOff");
450042
- const chExt = findChildByLocalName2(xfrm.elements, "chExt");
450043
- if (off) {
450044
- groupTransform.x = emuToPixels2(off.attributes?.["x"] || 0);
450045
- groupTransform.y = emuToPixels2(off.attributes?.["y"] || 0);
450046
- }
450047
- if (ext) {
450048
- groupTransform.width = emuToPixels2(ext.attributes?.["cx"] || 0);
450049
- groupTransform.height = emuToPixels2(ext.attributes?.["cy"] || 0);
450050
- }
450051
- if (chOff) {
450052
- groupTransform.childX = emuToPixels2(chOff.attributes?.["x"] || 0);
450053
- groupTransform.childY = emuToPixels2(chOff.attributes?.["y"] || 0);
450054
- groupTransform.childOriginXEmu = parseFloat(chOff.attributes?.["x"] || 0);
450055
- groupTransform.childOriginYEmu = parseFloat(chOff.attributes?.["y"] || 0);
450056
- }
450057
- if (chExt) {
450058
- groupTransform.childWidth = emuToPixels2(chExt.attributes?.["cx"] || 0);
450059
- groupTransform.childHeight = emuToPixels2(chExt.attributes?.["cy"] || 0);
450060
- }
450061
- }
450062
- const childShapes = wgp.elements.filter((el) => el.name === "wps:wsp");
450063
- const childPictures = wgp.elements.filter((el) => el.name === "pic:pic");
450064
- const shapes = childShapes.map((wsp) => {
450065
- const spPr = wsp.elements?.find((el) => el.name === "wps:spPr");
450066
- if (!spPr)
450067
- return null;
450068
- const prstGeom = findChildByLocalName2(spPr.elements, "prstGeom");
450069
- const shapeKind = prstGeom?.attributes?.["prst"];
450070
- const customGeom = !shapeKind ? extractCustomGeometry2(spPr) : null;
450071
- const shapeXfrm = findChildByLocalName2(spPr.elements, "xfrm");
450072
- const shapeOff = findChildByLocalName2(shapeXfrm?.elements, "off");
450073
- const shapeExt = findChildByLocalName2(shapeXfrm?.elements, "ext");
450074
- const rawX = shapeOff?.attributes?.["x"] ? parseFloat(shapeOff.attributes["x"]) : 0;
450075
- const rawY = shapeOff?.attributes?.["y"] ? parseFloat(shapeOff.attributes["y"]) : 0;
450076
- const rawWidth = shapeExt?.attributes?.["cx"] ? parseFloat(shapeExt.attributes["cx"]) : 914400;
450077
- const rawHeight = shapeExt?.attributes?.["cy"] ? parseFloat(shapeExt.attributes["cy"]) : 914400;
450078
- let x, y2, width, height;
450079
- if (groupTransform.childWidth && groupTransform.childHeight) {
450080
- const scaleX = groupTransform.width / groupTransform.childWidth;
450081
- const scaleY = groupTransform.height / groupTransform.childHeight;
450082
- const childOriginX = groupTransform.childOriginXEmu || 0;
450083
- const childOriginY = groupTransform.childOriginYEmu || 0;
450084
- x = groupTransform.x + emuToPixels2((rawX - childOriginX) * scaleX);
450085
- y2 = groupTransform.y + emuToPixels2((rawY - childOriginY) * scaleY);
450086
- width = emuToPixels2(rawWidth * scaleX);
450087
- height = emuToPixels2(rawHeight * scaleY);
450088
- } else {
450089
- x = emuToPixels2(rawX);
450090
- y2 = emuToPixels2(rawY);
450091
- width = emuToPixels2(rawWidth);
450092
- height = emuToPixels2(rawHeight);
450093
- }
450094
- const rotation = shapeXfrm?.attributes?.["rot"] ? rotToDegrees2(shapeXfrm.attributes["rot"]) : 0;
450095
- const flipH = shapeXfrm?.attributes?.["flipH"] === "1";
450096
- const flipV = shapeXfrm?.attributes?.["flipV"] === "1";
450097
- const style2 = wsp.elements?.find((el) => el.name === "wps:style");
450098
- const fillColor = extractFillColor2(spPr, style2);
450099
- const strokeColor = extractStrokeColor2(spPr, style2);
450100
- const strokeWidth = extractStrokeWidth2(spPr);
450101
- const lineEnds = extractLineEnds2(spPr);
450102
- const cNvPr = wsp.elements?.find((el) => el.name === "wps:cNvPr");
450103
- const shapeId = cNvPr?.attributes?.["id"];
450104
- const shapeName = cNvPr?.attributes?.["name"];
450105
- const textBox = wsp.elements?.find((el) => el.name === "wps:txbx");
450106
- const textBoxContent = textBox?.elements?.find((el) => el.name === "w:txbxContent");
450107
- const bodyPr = wsp.elements?.find((el) => el.name === "wps:bodyPr");
450108
- let textContent2 = null;
450109
- if (textBoxContent) {
450110
- textContent2 = extractTextFromTextBox2(textBoxContent, bodyPr, params3);
450111
- }
450112
- const textAlign = textContent2?.horizontalAlign || "left";
450113
- return {
450114
- shapeType: "vectorShape",
450115
- attrs: {
450116
- kind: shapeKind,
450117
- customGeometry: customGeom || undefined,
450118
- x,
450119
- y: y2,
450120
- width,
450121
- height,
450122
- rotation,
450123
- flipH,
450124
- flipV,
450125
- fillColor,
450126
- strokeColor,
450127
- strokeWidth,
450128
- lineEnds,
450129
- shapeId,
450130
- shapeName,
450131
- textContent: textContent2,
450132
- textAlign,
450133
- textVerticalAlign: textContent2?.verticalAlign,
450134
- textInsets: textContent2?.insets
450135
- }
450136
- };
450137
- }).filter(Boolean);
450138
- const pictures = childPictures.map((pic) => {
450139
- const spPr = pic.elements?.find((el) => el.name === "pic:spPr");
450140
- if (!spPr)
450141
- return null;
450142
- const xfrm2 = findChildByLocalName2(spPr.elements, "xfrm");
450143
- const off = findChildByLocalName2(xfrm2?.elements, "off");
450144
- const ext = findChildByLocalName2(xfrm2?.elements, "ext");
450145
- const rawX = off?.attributes?.["x"] ? parseFloat(off.attributes["x"]) : 0;
450146
- const rawY = off?.attributes?.["y"] ? parseFloat(off.attributes["y"]) : 0;
450147
- const rawWidth = ext?.attributes?.["cx"] ? parseFloat(ext.attributes["cx"]) : 914400;
450148
- const rawHeight = ext?.attributes?.["cy"] ? parseFloat(ext.attributes["cy"]) : 914400;
450149
- let x, y2, width, height;
450150
- if (groupTransform.childWidth && groupTransform.childHeight) {
450151
- const scaleX = groupTransform.width / groupTransform.childWidth;
450152
- const scaleY = groupTransform.height / groupTransform.childHeight;
450153
- const childOriginX = groupTransform.childOriginXEmu || 0;
450154
- const childOriginY = groupTransform.childOriginYEmu || 0;
450155
- x = groupTransform.x + emuToPixels2((rawX - childOriginX) * scaleX);
450156
- y2 = groupTransform.y + emuToPixels2((rawY - childOriginY) * scaleY);
450157
- width = emuToPixels2(rawWidth * scaleX);
450158
- height = emuToPixels2(rawHeight * scaleY);
450159
- } else {
450160
- x = emuToPixels2(rawX);
450161
- y2 = emuToPixels2(rawY);
450162
- width = emuToPixels2(rawWidth);
450163
- height = emuToPixels2(rawHeight);
450164
- }
450165
- const blipFill = pic.elements?.find((el) => el.name === "pic:blipFill");
450166
- const blip = findChildByLocalName2(blipFill?.elements, "blip");
450167
- if (!blip)
450168
- return null;
450169
- const alphaModFix = extractAlphaModFix2(blip);
450170
- const rEmbed = blip.attributes?.["r:embed"];
450171
- if (!rEmbed)
450172
- return null;
450173
- const currentFile = params3.filename || "document.xml";
450174
- let rels = params3.docx[`word/_rels/${currentFile}.rels`];
450175
- if (!rels)
450176
- rels = params3.docx[`word/_rels/document.xml.rels`];
450177
- const relationships = rels?.elements.find((el) => el.name === "Relationships");
450178
- const { elements } = relationships || [];
450179
- const rel = elements?.find((el) => el.attributes["Id"] === rEmbed);
450180
- if (!rel)
450181
- return null;
450182
- const targetPath = normalizeTargetPath2(rel.attributes?.["Target"]);
450183
- const path3 = targetPath;
450184
- const nvPicPr = pic.elements?.find((el) => el.name === "pic:nvPicPr");
450185
- const cNvPr = nvPicPr?.elements?.find((el) => el.name === "pic:cNvPr");
450186
- const picId = cNvPr?.attributes?.["id"];
450187
- const picName = cNvPr?.attributes?.["name"];
450188
- return {
450189
- shapeType: "image",
450190
- attrs: {
450191
- x,
450192
- y: y2,
450193
- width,
450194
- height,
450195
- src: path3,
450196
- imageId: picId,
450197
- imageName: picName,
450198
- ...alphaModFix ? { alphaModFix } : {}
450199
- }
450200
- };
450201
- }).filter(Boolean);
450202
- const allShapes = [...pictures, ...shapes];
451823
+ const groupXfrm = getGroupXfrm2(wgp);
451824
+ const groupTransform = buildShapeGroupTransformAttrs2(groupXfrm);
451825
+ const allShapes = collectShapeGroupChildren2(wgp, getGroupAffineTransform2(groupXfrm), params3);
450203
451826
  const schemaAttrs = {};
450204
451827
  const drawingNode = params3.nodes?.[0];
450205
451828
  if (drawingNode?.name === DRAWING_XML_TAG2) {
@@ -450215,6 +451838,7 @@ var DRAWING_XML_TAG2 = "w:drawing", SHAPE_URI2 = "http://schemas.microsoft.com/o
450215
451838
  size: size3,
450216
451839
  padding,
450217
451840
  marginOffset,
451841
+ effectExtent,
450218
451842
  anchorData,
450219
451843
  wrap: wrap6,
450220
451844
  originalAttributes: node4?.attributes