@superdoc-dev/mcp 0.12.0-next.43 → 0.12.0-next.44

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 +2265 -629
  2. package/package.json +3 -3
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-5I229j_D.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) => {
@@ -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_5I229j_D_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-CJ0cxWlH.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_CJ0cxWlH_es = __esm(() => {
158394
158789
  init_rolldown_runtime_Bg48TavK_es();
158395
- init_SuperConverter_DQ2wMaLK_es();
158790
+ init_SuperConverter_5I229j_D_es();
158396
158791
  init_jszip_C49i9kUs_es();
158397
158792
  init_uuid_B2wVPhPi_es();
158398
158793
  init_constants_D9qj59G2_es();
@@ -214007,7 +214402,7 @@ var init_remark_gfm_DCND_V_3_es = __esm(() => {
214007
214402
  init_remark_gfm_BUJjZJLy_es();
214008
214403
  });
214009
214404
 
214010
- // ../../packages/superdoc/dist/chunks/src-CR8eXLKh.es.js
214405
+ // ../../packages/superdoc/dist/chunks/src-H1-ZZyp0.es.js
214011
214406
  function deleteProps(obj, propOrProps) {
214012
214407
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
214013
214408
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -220273,11 +220668,25 @@ function x0(t, n, o) {
220273
220668
  paths: l.paths
220274
220669
  } : null;
220275
220670
  }
220671
+ function W0(t, n, o) {
220672
+ 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);
220673
+ return {
220674
+ preset: "roundRect",
220675
+ viewBox: `0 0 ${L} ${e}`,
220676
+ paths: l0([{
220677
+ 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`,
220678
+ fill: "#000000",
220679
+ stroke: "#000000"
220680
+ }], o)
220681
+ };
220682
+ }
220276
220683
  function i0(t) {
220277
220684
  let { preset: n, styleOverrides: o, width: L, height: e } = t;
220278
220685
  if (!n)
220279
220686
  throw new Error("createPresetShape requires a preset name.");
220280
- if (F.has(n) && L != null && e != null && L !== e) {
220687
+ if (n === "roundRect" && L != null && e != null)
220688
+ return W0(L, e, o);
220689
+ if (F.has(n) && L != null && e != null && (L !== e || n === "leftUpArrow")) {
220281
220690
  let i3 = x0(n, L, e);
220282
220691
  if (i3)
220283
220692
  return {
@@ -258187,6 +258596,19 @@ function calculateFirstLineIndent(block, measure) {
258187
258596
  const gutterWidthRaw = measure.marker.gutterWidth ?? 0;
258188
258597
  return markerWidth + (Number.isFinite(gutterWidthRaw) && gutterWidthRaw >= 0 ? gutterWidthRaw : 0);
258189
258598
  }
258599
+ function getSuppressedMarkerImageGroupAnchorOffset(entry, suppressVisibleSectPrMarkerParagraph, hasPageRelativeAnchorForParagraph, markerSpacingBefore) {
258600
+ if (!suppressVisibleSectPrMarkerParagraph || !hasPageRelativeAnchorForParagraph)
258601
+ return 0;
258602
+ if (entry.block.kind !== "drawing" || entry.block.drawingKind !== "shapeGroup")
258603
+ return 0;
258604
+ if (!entry.block.shapes?.some((child) => child.shapeType === "image"))
258605
+ return 0;
258606
+ if ((entry.block.anchor?.vRelativeFrom ?? "paragraph") !== "paragraph")
258607
+ return 0;
258608
+ if (entry.block.anchor?.alignV && entry.block.anchor.alignV !== "top")
258609
+ return 0;
258610
+ return Math.max(0, markerSpacingBefore / 2);
258611
+ }
258190
258612
  function layoutParagraphBlock(ctx$1, anchors) {
258191
258613
  const { block, measure, columnWidth, ensurePage, advanceColumn, columnX, floatManager } = ctx$1;
258192
258614
  const remeasureParagraph$1 = ctx$1.remeasureParagraph;
@@ -258223,6 +258645,13 @@ function layoutParagraphBlock(ctx$1, anchors) {
258223
258645
  if (!spacingExplicit.after)
258224
258646
  spacingAfter = 0;
258225
258647
  }
258648
+ const markerSpacingBefore = spacingBefore;
258649
+ const hasAnchoredObjects = Boolean(anchors?.anchoredDrawings?.length || anchors?.anchoredTables?.length);
258650
+ const suppressVisibleSectPrMarkerParagraph = attrs?.sectPrMarker === true && emptyTextParagraph && hasAnchoredObjects;
258651
+ if (suppressVisibleSectPrMarkerParagraph) {
258652
+ spacingBefore = 0;
258653
+ spacingAfter = 0;
258654
+ }
258226
258655
  const baseSpacingBefore = spacingBefore;
258227
258656
  let appliedSpacingBefore = spacingBefore === 0;
258228
258657
  let lastState = null;
@@ -258241,7 +258670,11 @@ function layoutParagraphBlock(ctx$1, anchors) {
258241
258670
  suppressSpacingBefore: shouldSuppressOwnSpacing(styleId$1, contextualSpacing, previewState.lastParagraphStyleId),
258242
258671
  rewindTrailingFromPrevious: shouldSuppressOwnSpacing(previewState.lastParagraphStyleId, previewState.lastParagraphContextualSpacing, styleId$1)
258243
258672
  }) + borderExpansion.top - (inBorderGroup ? rawBorderExpansion.bottom : 0);
258673
+ const sectionBaseTopMargin = anchors?.sectionBaseTopMargin;
258674
+ const sectionHeaderDistance = typeof anchors?.sectionHeaderDistance === "number" ? Math.max(0, anchors.sectionHeaderDistance) : 0;
258675
+ 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;
258244
258676
  let paragraphContentEndY = paragraphAnchorBaseY;
258677
+ const anchorFirstLineHeight = suppressVisibleSectPrMarkerParagraph ? 0 : measure.lines?.[0]?.lineHeight ?? 0;
258245
258678
  const registerAnchoredDrawingsAt = (paragraphContentStartY) => {
258246
258679
  if (!anchors?.anchoredDrawings?.length)
258247
258680
  return;
@@ -258251,14 +258684,15 @@ function layoutParagraphBlock(ctx$1, anchors) {
258251
258684
  const state = ensurePage();
258252
258685
  const contentTop = state.topMargin;
258253
258686
  const contentBottom = state.contentBottom;
258687
+ const anchorParagraphY = paragraphContentStartY + getSuppressedMarkerImageGroupAnchorOffset(entry, suppressVisibleSectPrMarkerParagraph, anchors.hasPageRelativeAnchorForParagraph === true, markerSpacingBefore);
258254
258688
  const anchorY = resolveAnchoredGraphicY({
258255
258689
  anchor: entry.block.anchor,
258256
258690
  objectHeight: entry.measure.height,
258257
258691
  contentTop,
258258
258692
  contentBottom,
258259
258693
  pageBottomMargin: anchors.pageMargins.bottom ?? 0,
258260
- anchorParagraphY: paragraphContentStartY,
258261
- firstLineHeight: measure.lines?.[0]?.lineHeight ?? 0
258694
+ anchorParagraphY,
258695
+ firstLineHeight: anchorFirstLineHeight
258262
258696
  });
258263
258697
  floatManager.registerDrawing(entry.block, entry.measure, anchorY, state.columnIndex, state.page.number);
258264
258698
  const anchorX = entry.block.anchor ? resolveAnchoredGraphicX(entry.block.anchor, state.columnIndex, anchors.columns, entry.measure.width, {
@@ -258337,7 +258771,7 @@ function layoutParagraphBlock(ctx$1, anchors) {
258337
258771
  anchors.placedAnchoredIds.add(entry.block.id);
258338
258772
  }
258339
258773
  };
258340
- registerAnchoredDrawingsAt(paragraphAnchorBaseY);
258774
+ registerAnchoredDrawingsAt(effectiveParagraphAnchorBaseY);
258341
258775
  const registerAnchoredTablesAt = (paragraphContentStartY, entries) => {
258342
258776
  if (!entries.length)
258343
258777
  return;
@@ -258353,7 +258787,7 @@ function layoutParagraphBlock(ctx$1, anchors) {
258353
258787
  const contentTop = state.topMargin;
258354
258788
  const contentBottom = state.contentBottom;
258355
258789
  const layoutOffsetV = entry.layoutOffsetV;
258356
- const firstLineHeight = measure.lines?.[0]?.lineHeight ?? 0;
258790
+ const firstLineHeight = anchorFirstLineHeight;
258357
258791
  const wrapType = entry.block.wrap?.type ?? "None";
258358
258792
  const anchorY = resolveAnchoredGraphicY({
258359
258793
  anchor: graphicAnchorY(anchorForLineScopedFormField(layoutOffsetV != null && entry.block.anchor ? {
@@ -258365,7 +258799,7 @@ function layoutParagraphBlock(ctx$1, anchors) {
258365
258799
  contentBottom,
258366
258800
  pageBottomMargin: anchors.pageMargins.bottom ?? 0,
258367
258801
  anchorParagraphY: nextStackY,
258368
- firstLineHeight: measure.lines?.[0]?.lineHeight ?? 0
258802
+ firstLineHeight: anchorFirstLineHeight
258369
258803
  });
258370
258804
  floatManager.registerTable(entry.block, entry.measure, anchorY, state.columnIndex, state.page.number);
258371
258805
  const anchorX = entry.block.anchor ? resolveAnchoredGraphicX(graphicAnchorH(entry.block.anchor), state.columnIndex, anchors.columns, totalWidth, {
@@ -258386,11 +258820,15 @@ function layoutParagraphBlock(ctx$1, anchors) {
258386
258820
  const remainingHeightOnStartPage = previewState.contentBottom - paragraphAnchorBaseY;
258387
258821
  const paragraphWillSpanPages = lines.length > 1 && totalLineHeight > remainingHeightOnStartPage;
258388
258822
  const shouldPreLayoutSquareTable = (entry) => entry.lineScopedOnAnchor === true && !paragraphWillSpanPages;
258389
- registerAnchoredTablesAt(paragraphAnchorBaseY, anchoredTablesForPara.filter((entry) => {
258823
+ registerAnchoredTablesAt(effectiveParagraphAnchorBaseY, anchoredTablesForPara.filter((entry) => {
258390
258824
  if ((entry.block.wrap?.type ?? "None") === "None")
258391
258825
  return true;
258392
258826
  return shouldPreLayoutSquareTable(entry);
258393
258827
  }));
258828
+ if (suppressVisibleSectPrMarkerParagraph) {
258829
+ registerAnchoredTablesAt(effectiveParagraphAnchorBaseY, anchors?.anchoredTables ?? []);
258830
+ return;
258831
+ }
258394
258832
  if (frame?.wrap === "none") {
258395
258833
  let state = ensurePage();
258396
258834
  if (state.cursorY >= state.contentBottom)
@@ -258851,6 +259289,34 @@ function collectPreRegisteredAnchors(blocks2, measures) {
258851
259289
  }
258852
259290
  return result;
258853
259291
  }
259292
+ function collectPageRelativeAnchorsByParagraph(blocks2, measures) {
259293
+ const map$12 = /* @__PURE__ */ new Map;
259294
+ const len2 = Math.min(blocks2.length, measures.length);
259295
+ const paragraphIndexById = buildParagraphIndexById(blocks2, len2);
259296
+ for (let i3 = 0;i3 < len2; i3 += 1) {
259297
+ const block = blocks2[i3];
259298
+ const measure = measures[i3];
259299
+ const isImage = block.kind === "image" && measure?.kind === "image";
259300
+ const isDrawing = block.kind === "drawing" && measure?.kind === "drawing";
259301
+ if (!isImage && !isDrawing)
259302
+ continue;
259303
+ const drawingBlock = block;
259304
+ const drawingMeasure = measure;
259305
+ if (!drawingBlock.anchor?.isAnchored || !isPageRelativeAnchor(drawingBlock))
259306
+ continue;
259307
+ const anchorParagraphId = typeof drawingBlock.attrs === "object" && drawingBlock.attrs ? drawingBlock.attrs.anchorParagraphId : undefined;
259308
+ const anchorParaIndex = resolveAnchorParagraphIndex(blocks2, len2, paragraphIndexById, i3, anchorParagraphId);
259309
+ if (anchorParaIndex == null)
259310
+ continue;
259311
+ const list5 = map$12.get(anchorParaIndex) ?? [];
259312
+ list5.push({
259313
+ block: drawingBlock,
259314
+ measure: drawingMeasure
259315
+ });
259316
+ map$12.set(anchorParaIndex, list5);
259317
+ }
259318
+ return map$12;
259319
+ }
258854
259320
  function collectAnchoredDrawings(blocks2, measures) {
258855
259321
  const byParagraph = /* @__PURE__ */ new Map;
258856
259322
  const withoutParagraph = [];
@@ -260793,7 +261259,58 @@ function layoutDocument(blocks2, measures, options = {}) {
260793
261259
  const paragraphlessAnchoredTables = anchoredTables.withoutParagraph;
260794
261260
  const placedAnchoredIds = /* @__PURE__ */ new Set;
260795
261261
  const preRegisteredAnchors = collectPreRegisteredAnchors(blocks2, measures);
260796
- const preRegisteredPositions = /* @__PURE__ */ new Map;
261262
+ const pageRelativeAnchorsByParagraph = collectPageRelativeAnchorsByParagraph(blocks2, measures);
261263
+ const preRegisteredAnchorIds = /* @__PURE__ */ new Set;
261264
+ const blockIndexById = new Map(blocks2.map((candidateBlock, candidateIndex) => [candidateBlock.id, candidateIndex]));
261265
+ const hasHardBreakBetween = (startIndex, endIndex) => {
261266
+ const first$1 = Math.min(startIndex, endIndex) + 1;
261267
+ const last2 = Math.max(startIndex, endIndex);
261268
+ for (let candidateIndex = first$1;candidateIndex < last2; candidateIndex += 1) {
261269
+ const candidateBlock = blocks2[candidateIndex];
261270
+ if (candidateBlock.kind === "pageBreak" || candidateBlock.kind === "sectionBreak" || candidateBlock.kind === "columnBreak")
261271
+ return true;
261272
+ }
261273
+ return false;
261274
+ };
261275
+ const shouldWrapParagraphWithPageRelativeAnchor = (anchorBlock, paragraphIndex, paragraphId) => {
261276
+ const anchorParagraphId = anchorBlock.attrs != null && typeof anchorBlock.attrs === "object" ? anchorBlock.attrs.anchorParagraphId : undefined;
261277
+ if (typeof anchorParagraphId === "string")
261278
+ return anchorParagraphId === paragraphId;
261279
+ const anchorIndex = blockIndexById.get(anchorBlock.id);
261280
+ if (anchorIndex == null || anchorIndex === paragraphIndex)
261281
+ return false;
261282
+ return !hasHardBreakBetween(paragraphIndex, anchorIndex);
261283
+ };
261284
+ const isWrappingDrawingAnchor = (anchorBlock) => {
261285
+ const wrapType = anchorBlock.wrap?.type ?? "None";
261286
+ return wrapType !== "None" && wrapType !== "Inline";
261287
+ };
261288
+ const collectLaterPageRelativeAnchorsForParagraph = (paragraphIndex, paragraphId) => {
261289
+ const anchors = [];
261290
+ for (const entry of preRegisteredAnchors) {
261291
+ const anchorIndex = blockIndexById.get(entry.block.id);
261292
+ if (anchorIndex == null || anchorIndex <= paragraphIndex)
261293
+ continue;
261294
+ if (!isWrappingDrawingAnchor(entry.block))
261295
+ continue;
261296
+ if (!shouldWrapParagraphWithPageRelativeAnchor(entry.block, paragraphIndex, paragraphId))
261297
+ continue;
261298
+ anchors.push(entry);
261299
+ }
261300
+ return anchors.length > 0 ? anchors : undefined;
261301
+ };
261302
+ const mergeAnchoredDrawings = (...groups) => {
261303
+ const merged = [];
261304
+ const seen = /* @__PURE__ */ new Set;
261305
+ for (const group of groups)
261306
+ for (const entry of group ?? []) {
261307
+ if (seen.has(entry.block.id))
261308
+ continue;
261309
+ seen.add(entry.block.id);
261310
+ merged.push(entry);
261311
+ }
261312
+ return merged.length > 0 ? merged : undefined;
261313
+ };
260797
261314
  const resolveParagraphlessAnchoredTableY = (block, measure, state) => {
260798
261315
  const contentTop = state.topMargin;
260799
261316
  const contentBottom = state.contentBottom;
@@ -260807,40 +261324,36 @@ function layoutDocument(blocks2, measures, options = {}) {
260807
261324
  preRegisteredFallbackToContentTop: true
260808
261325
  });
260809
261326
  };
260810
- const resolveParagraphlessAnchoredDrawingY = (block, measure, state) => resolveAnchoredGraphicY({
260811
- anchor: block.anchor,
260812
- objectHeight: measure.height ?? 0,
260813
- contentTop: state.topMargin,
260814
- contentBottom: state.contentBottom,
260815
- pageBottomMargin: state.page.margins?.bottom ?? activeBottomMargin,
260816
- preRegisteredFallbackToContentTop: true
260817
- });
260818
- const resolveParagraphlessAnchoredDrawingX = (block, measure, state) => block.anchor ? computeAnchorX(block.anchor, state.columnIndex, normalizeColumns(activeColumns, activePageSize.w - (activeLeftMargin + activeRightMargin)), measure.width, {
260819
- left: activeLeftMargin,
260820
- right: activeRightMargin
260821
- }, activePageSize.w) : columnX(state);
260822
- for (const entry of preRegisteredAnchors) {
260823
- const state = paginator.ensurePage();
261327
+ const resolveAnchoredDrawingPosition = (block, measure, state) => {
260824
261328
  const contentTop = state.topMargin;
260825
261329
  const contentBottom = state.contentBottom;
260826
261330
  const anchorY = resolveAnchoredGraphicY({
260827
- anchor: entry.block.anchor,
260828
- objectHeight: entry.measure.height ?? 0,
261331
+ anchor: block.anchor,
261332
+ objectHeight: measure.height ?? 0,
260829
261333
  contentTop,
260830
261334
  contentBottom,
260831
261335
  pageBottomMargin: state.page.margins?.bottom ?? activeBottomMargin,
260832
261336
  preRegisteredFallbackToContentTop: true
260833
261337
  });
260834
- const anchorX = entry.block.anchor ? computeAnchorX(entry.block.anchor, state.columnIndex, normalizeColumns(activeColumns, activePageSize.w - (activeLeftMargin + activeRightMargin)), entry.measure.width, {
260835
- left: activeLeftMargin,
260836
- right: activeRightMargin
260837
- }, activePageSize.w) : activeLeftMargin;
260838
- floatManager.registerDrawing(entry.block, entry.measure, anchorY, state.columnIndex, state.page.number);
260839
- preRegisteredPositions.set(entry.block.id, {
260840
- anchorX,
261338
+ const columns = getActiveColumnsForState(state);
261339
+ const pageMargins = {
261340
+ top: state.page.margins?.top ?? activeTopMargin,
261341
+ bottom: state.page.margins?.bottom ?? activeBottomMargin,
261342
+ left: state.page.margins?.left ?? activeLeftMargin,
261343
+ right: state.page.margins?.right ?? activeRightMargin
261344
+ };
261345
+ const pageWidth = state.page.size?.w ?? activePageSize.w;
261346
+ const contentWidth = pageWidth - ((pageMargins.left ?? 0) + (pageMargins.right ?? 0));
261347
+ return {
261348
+ anchorX: block.anchor ? computeAnchorX(block.anchor, state.columnIndex, normalizeColumns(columns, contentWidth), measure.width, {
261349
+ left: pageMargins.left,
261350
+ right: pageMargins.right
261351
+ }, pageWidth) : pageMargins.left ?? activeLeftMargin,
260841
261352
  anchorY
260842
- });
260843
- }
261353
+ };
261354
+ };
261355
+ for (const entry of preRegisteredAnchors)
261356
+ preRegisteredAnchorIds.add(entry.block.id);
260844
261357
  const keepNextChains = computeKeepNextChains(blocks2);
260845
261358
  const midChainIndices = /* @__PURE__ */ new Set;
260846
261359
  for (const chain of keepNextChains.values())
@@ -261052,20 +261565,25 @@ function layoutDocument(blocks2, measures, options = {}) {
261052
261565
  if (measure.kind !== "paragraph")
261053
261566
  throw new Error(`layoutDocument: expected paragraph measure for block ${block.id}`);
261054
261567
  const paraBlock = block;
261055
- 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 === "")) {
261568
+ 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 === "");
261569
+ const drawingAnchorsForPara = anchoredByParagraph.get(index2);
261570
+ const wrappingPageRelativeAnchorsForPara = pageRelativeAnchorsByParagraph.get(index2)?.filter(({ block: anchorBlock }) => shouldWrapParagraphWithPageRelativeAnchor(anchorBlock, index2, paraBlock.id));
261571
+ const laterPageRelativeAnchorsForPara = collectLaterPageRelativeAnchorsForParagraph(index2, paraBlock.id);
261572
+ const anchorsForPara = mergeAnchoredDrawings(drawingAnchorsForPara, wrappingPageRelativeAnchorsForPara, laterPageRelativeAnchorsForPara);
261573
+ const tablesForPara = anchoredTablesByParagraph.get(index2);
261574
+ if (isEmpty3) {
261056
261575
  const isSectPrMarker = paraBlock.attrs?.sectPrMarker === true;
261057
261576
  const prevBlock = index2 > 0 ? blocks2[index2 - 1] : null;
261058
261577
  const nextBlock = index2 < blocks2.length - 1 ? blocks2[index2 + 1] : null;
261059
261578
  const nextSectionBreak = nextBlock?.kind === "sectionBreak" ? nextBlock : null;
261060
261579
  const nextBreakType = nextSectionBreak?.type ?? (nextSectionBreak?.attrs?.source === "sectPr" ? "nextPage" : undefined);
261061
261580
  const nextBreakForcesPage = nextSectionBreak && (nextBreakType === "nextPage" || nextBreakType === "evenPage" || nextBreakType === "oddPage" || nextSectionBreak.attrs?.requirePageBoundary === true);
261062
- if (isSectPrMarker && nextBreakForcesPage)
261581
+ const hasAnchoredObjectsForMarker = Boolean(anchorsForPara?.length || tablesForPara?.length);
261582
+ if (isSectPrMarker && nextBreakForcesPage && !hasAnchoredObjectsForMarker)
261063
261583
  continue;
261064
- if (prevBlock?.kind === "pageBreak" && nextBlock?.kind === "sectionBreak")
261584
+ if (prevBlock?.kind === "pageBreak" && nextBlock?.kind === "sectionBreak" && !hasAnchoredObjectsForMarker)
261065
261585
  continue;
261066
261586
  }
261067
- const anchorsForPara = anchoredByParagraph.get(index2);
261068
- const tablesForPara = anchoredTablesByParagraph.get(index2);
261069
261587
  const chain = keepNextChains.get(index2);
261070
261588
  if (midChainIndices.has(index2)) {} else if (chain) {
261071
261589
  let state = paginator.ensurePage();
@@ -261136,6 +261654,10 @@ function layoutDocument(blocks2, measures, options = {}) {
261136
261654
  overrideSpacingAfter = 0;
261137
261655
  }
261138
261656
  }
261657
+ const hasPageRelativeAnchorForPara = Boolean(pageRelativeAnchorsByParagraph.get(index2)?.length || laterPageRelativeAnchorsForPara?.length || tablesForPara?.some(({ block: tableBlock }) => {
261658
+ const vRelativeFrom = tableBlock.anchor?.vRelativeFrom;
261659
+ return vRelativeFrom === "page" || vRelativeFrom === "margin";
261660
+ }));
261139
261661
  layoutParagraphBlock({
261140
261662
  block,
261141
261663
  measure,
@@ -261161,6 +261683,9 @@ function layoutDocument(blocks2, measures, options = {}) {
261161
261683
  left: activeLeftMargin,
261162
261684
  right: activeRightMargin
261163
261685
  },
261686
+ sectionBaseTopMargin: activeSectionBaseTopMargin,
261687
+ sectionHeaderDistance: activeHeaderDistance,
261688
+ hasPageRelativeAnchorForParagraph: hasPageRelativeAnchorForPara,
261164
261689
  columns: getCurrentColumns(),
261165
261690
  placedAnchoredIds
261166
261691
  } : undefined);
@@ -261188,11 +261713,14 @@ function layoutDocument(blocks2, measures, options = {}) {
261188
261713
  if (block.kind === "image") {
261189
261714
  if (measure.kind !== "image")
261190
261715
  throw new Error(`layoutDocument: expected image measure for block ${block.id}`);
261191
- const preRegPos = preRegisteredPositions.get(block.id);
261192
- if (preRegPos && Number.isFinite(preRegPos.anchorX) && Number.isFinite(preRegPos.anchorY)) {
261716
+ if (placedAnchoredIds.has(block.id))
261717
+ continue;
261718
+ if (preRegisteredAnchorIds.has(block.id)) {
261193
261719
  const state = paginator.ensurePage();
261194
261720
  const imgBlock = block;
261195
261721
  const imgMeasure = measure;
261722
+ const { anchorX, anchorY } = resolveAnchoredDrawingPosition(imgBlock, imgMeasure, state);
261723
+ floatManager.registerDrawing(imgBlock, imgMeasure, anchorY, state.columnIndex, state.page.number);
261196
261724
  const pageContentHeight = Math.max(0, state.contentBottom - state.topMargin);
261197
261725
  const relativeFrom = imgBlock.anchor?.hRelativeFrom ?? "column";
261198
261726
  const cols = getCurrentColumns();
@@ -261218,8 +261746,8 @@ function layoutDocument(blocks2, measures, options = {}) {
261218
261746
  const fragment = {
261219
261747
  kind: "image",
261220
261748
  blockId: imgBlock.id,
261221
- x: preRegPos.anchorX,
261222
- y: preRegPos.anchorY,
261749
+ x: anchorX,
261750
+ y: anchorY,
261223
261751
  width: imgMeasure.width,
261224
261752
  height: imgMeasure.height,
261225
261753
  isAnchored: true,
@@ -261250,18 +261778,21 @@ function layoutDocument(blocks2, measures, options = {}) {
261250
261778
  if (block.kind === "drawing") {
261251
261779
  if (measure.kind !== "drawing")
261252
261780
  throw new Error(`layoutDocument: expected drawing measure for block ${block.id}`);
261253
- const preRegPos = preRegisteredPositions.get(block.id);
261254
- if (preRegPos && Number.isFinite(preRegPos.anchorX) && Number.isFinite(preRegPos.anchorY)) {
261781
+ if (placedAnchoredIds.has(block.id))
261782
+ continue;
261783
+ if (preRegisteredAnchorIds.has(block.id)) {
261255
261784
  const state = paginator.ensurePage();
261256
261785
  const drawBlock = block;
261257
261786
  const drawMeasure = measure;
261787
+ const { anchorX, anchorY } = resolveAnchoredDrawingPosition(drawBlock, drawMeasure, state);
261788
+ floatManager.registerDrawing(drawBlock, drawMeasure, anchorY, state.columnIndex, state.page.number);
261258
261789
  const contentMeasures = drawBlock.drawingKind === "textboxShape" && typeof options.remeasureParagraph === "function" ? layoutTextboxContent(drawBlock, options.remeasureParagraph) : undefined;
261259
261790
  const fragment = {
261260
261791
  kind: "drawing",
261261
261792
  blockId: drawBlock.id,
261262
261793
  drawingKind: drawBlock.drawingKind,
261263
- x: preRegPos.anchorX,
261264
- y: preRegPos.anchorY,
261794
+ x: anchorX,
261795
+ y: anchorY,
261265
261796
  width: drawMeasure.width,
261266
261797
  height: drawMeasure.height,
261267
261798
  geometry: drawMeasure.geometry,
@@ -261343,8 +261874,7 @@ function layoutDocument(blocks2, measures, options = {}) {
261343
261874
  for (const { block, measure } of paragraphlessAnchoredDrawings) {
261344
261875
  if (placedAnchoredIds.has(block.id))
261345
261876
  continue;
261346
- const anchorX = resolveParagraphlessAnchoredDrawingX(block, measure, state);
261347
- const anchorY = resolveParagraphlessAnchoredDrawingY(block, measure, state);
261877
+ const { anchorX, anchorY } = resolveAnchoredDrawingPosition(block, measure, state);
261348
261878
  if (block.kind === "image" && measure.kind === "image") {
261349
261879
  const pageContentHeight = Math.max(0, state.contentBottom - state.topMargin);
261350
261880
  const aspectRatio = measure.width > 0 && measure.height > 0 ? measure.width / measure.height : 1;
@@ -261612,6 +262142,15 @@ function getPageRelativeMeasurementBand(kind, constraints) {
261612
262142
  end: bandSize
261613
262143
  };
261614
262144
  }
262145
+ function isHeaderFooterAbsoluteOverlay(block, kind, fragment, fragmentBottom, canvasHeight) {
262146
+ if (!kind)
262147
+ return false;
262148
+ if (block.anchor?.isAnchored !== true)
262149
+ return false;
262150
+ if (block.wrap?.type !== "None")
262151
+ return false;
262152
+ return fragment.y < 0 || fragmentBottom > canvasHeight;
262153
+ }
261615
262154
  function shouldExcludeFromMeasurement(fragment, block, fragmentBottom, canvasHeight, kind, constraints) {
261616
262155
  if (!((fragment.kind === "image" || fragment.kind === "drawing") && fragment.isAnchored === true))
261617
262156
  return false;
@@ -261620,6 +262159,8 @@ function shouldExcludeFromMeasurement(fragment, block, fragmentBottom, canvasHei
261620
262159
  const anchoredBlock = block;
261621
262160
  if (anchoredBlock.anchor?.behindDoc)
261622
262161
  return true;
262162
+ if (isHeaderFooterAbsoluteOverlay(anchoredBlock, kind, fragment, fragmentBottom, canvasHeight))
262163
+ return true;
261623
262164
  if (isPageRelativeAnchor(anchoredBlock)) {
261624
262165
  const fragmentTop = fragment.y;
261625
262166
  if (fragmentBottom <= 0 || fragmentTop >= canvasHeight)
@@ -261630,13 +262171,6 @@ function shouldExcludeFromMeasurement(fragment, block, fragmentBottom, canvasHei
261630
262171
  if (measurementBand && !rangesIntersect(fragment.y, fragmentBottom, measurementBand.start, measurementBand.end))
261631
262172
  return true;
261632
262173
  }
261633
- const fragmentHeight = typeof fragment.height === "number" ? fragment.height : fragmentBottom - fragment.y;
261634
- const fragmentWidth = typeof fragment.width === "number" ? fragment.width : 0;
261635
- const heightCoversCanvas = Number.isFinite(fragmentHeight) && fragmentHeight >= canvasHeight;
261636
- const widthCoversCanvas = Number.isFinite(constraints.width) && constraints.width > 0 && fragmentWidth >= constraints.width;
261637
- const isOverlayWrap = anchoredBlock.wrap?.type === "None";
261638
- if (kind && heightCoversCanvas && widthCoversCanvas && isOverlayWrap)
261639
- return true;
261640
262174
  return false;
261641
262175
  }
261642
262176
  function layoutHeaderFooter(blocks2, measures, constraints, kind, remeasureParagraph$1) {
@@ -273677,13 +274211,17 @@ async function buildMeasuredAutoFitContentMetrics(block, workingInput, fixedLayo
273677
274211
  cellMetricKeys: contentMetrics.cellMetricKeys
273678
274212
  };
273679
274213
  }
274214
+ function isBehindDocOverlay(block) {
274215
+ return block.anchor?.behindDoc === true || block.wrap?.type === "None" && block.wrap?.behindDoc === true;
274216
+ }
274217
+ function hasNegativeVerticalPosition(block) {
274218
+ return block.anchor?.isAnchored === true && (typeof block.anchor?.offsetV === "number" && block.anchor.offsetV < 0 || typeof block.margin?.top === "number" && block.margin.top < 0);
274219
+ }
273680
274220
  async function measureImageBlock(block, constraints) {
273681
274221
  const intrinsic = getIntrinsicImageSize(block, constraints.maxWidth);
273682
- const isBlockBehindDoc = block.anchor?.behindDoc;
273683
- const isBlockWrapBehindDoc = block.wrap?.type === "None" && block.wrap?.behindDoc;
273684
274222
  const isPageRelativeAnchor$1 = block.anchor?.isAnchored && (block.anchor?.hRelativeFrom === "page" || block.anchor?.hRelativeFrom === "margin");
273685
- const maxWidth = isBlockBehindDoc || isBlockWrapBehindDoc || isPageRelativeAnchor$1 || constraints.maxWidth <= 0 ? intrinsic.width : constraints.maxWidth;
273686
- 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;
274223
+ const maxWidth = isBehindDocOverlay(block) || isPageRelativeAnchor$1 || constraints.maxWidth <= 0 ? intrinsic.width : constraints.maxWidth;
274224
+ const maxHeight = isBehindDocOverlay(block) || hasNegativeVerticalPosition(block) || block.objectFit === "cover" || !constraints.maxHeight || constraints.maxHeight <= 0 ? Infinity : constraints.maxHeight;
273687
274225
  const widthScale = maxWidth / intrinsic.width;
273688
274226
  const heightScale = maxHeight / intrinsic.height;
273689
274227
  const scale = Math.min(1, widthScale, heightScale);
@@ -273696,8 +274234,9 @@ async function measureImageBlock(block, constraints) {
273696
274234
  async function measureDrawingBlock(block, constraints) {
273697
274235
  if (block.drawingKind === "image") {
273698
274236
  const intrinsic = getIntrinsicSizeFromDims(block.width, block.height, constraints.maxWidth);
273699
- const maxWidth$1 = constraints.maxWidth > 0 ? constraints.maxWidth : intrinsic.width;
273700
- const maxHeight$1 = constraints.maxHeight && constraints.maxHeight > 0 ? constraints.maxHeight : Infinity;
274237
+ const isPageRelativeAnchor$1 = block.anchor?.isAnchored === true && (block.anchor.hRelativeFrom === "page" || block.anchor.hRelativeFrom === "margin");
274238
+ const maxWidth$1 = isBehindDocOverlay(block) || isPageRelativeAnchor$1 || constraints.maxWidth <= 0 ? intrinsic.width : constraints.maxWidth;
274239
+ const maxHeight$1 = isBehindDocOverlay(block) || hasNegativeVerticalPosition(block) || !constraints.maxHeight || constraints.maxHeight <= 0 ? Infinity : constraints.maxHeight;
273701
274240
  const widthScale$1 = maxWidth$1 / intrinsic.width;
273702
274241
  const heightScale$1 = maxHeight$1 / intrinsic.height;
273703
274242
  const scale$1 = Math.min(1, widthScale$1, heightScale$1);
@@ -273719,6 +274258,21 @@ async function measureDrawingBlock(block, constraints) {
273719
274258
  };
273720
274259
  }
273721
274260
  const geometry = ensureDrawingGeometry(block.geometry);
274261
+ if (block.drawingKind === "shapeGroup" && block.groupTransform) {
274262
+ const effectExtent = block.effectExtent ?? {
274263
+ left: 0,
274264
+ top: 0,
274265
+ right: 0,
274266
+ bottom: 0
274267
+ };
274268
+ const groupWidth = block.groupTransform.width ?? geometry.width;
274269
+ const groupHeight = block.groupTransform.height ?? geometry.height;
274270
+ geometry.width = Math.max(1, geometry.width, groupWidth + effectExtent.left + effectExtent.right);
274271
+ geometry.height = Math.max(1, geometry.height, groupHeight + effectExtent.top + effectExtent.bottom);
274272
+ geometry.rotation = normalizeRotation(block.groupTransform.rotation ?? geometry.rotation ?? 0);
274273
+ geometry.flipH = Boolean(block.groupTransform.flipH ?? geometry.flipH);
274274
+ geometry.flipV = Boolean(block.groupTransform.flipV ?? geometry.flipV);
274275
+ }
273722
274276
  const attrs = block.attrs;
273723
274277
  const indentLeft = typeof attrs?.hrIndentLeft === "number" ? attrs.hrIndentLeft : 0;
273724
274278
  const indentRight = typeof attrs?.hrIndentRight === "number" ? attrs.hrIndentRight : 0;
@@ -273730,7 +274284,7 @@ async function measureDrawingBlock(block, constraints) {
273730
274284
  const naturalHeight = Math.max(1, rotatedBounds.height);
273731
274285
  const isFloating = block.wrap?.type === "None" || block.anchor?.isAnchored === true;
273732
274286
  const maxWidth = fullWidthMax ?? (constraints.maxWidth > 0 && !isFloating ? constraints.maxWidth : naturalWidth);
273733
- 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;
274287
+ const maxHeight = isBehindDocOverlay(block) || hasNegativeVerticalPosition(block) || !constraints.maxHeight || constraints.maxHeight <= 0 ? Infinity : constraints.maxHeight;
273734
274288
  const widthScale = maxWidth / naturalWidth;
273735
274289
  const heightScale = maxHeight / naturalHeight;
273736
274290
  const normalizedScale = Math.min(1, widthScale, heightScale);
@@ -274318,15 +274872,17 @@ function shiftResolvedPaintItemY(item, yOffset) {
274318
274872
  y: item.y + yOffset
274319
274873
  };
274320
274874
  }
274321
- function isExplicitBehindDocMediaFragment(fragment) {
274322
- return (fragment.kind === "image" || fragment.kind === "drawing") && fragment.behindDoc === true;
274875
+ function isExcludedFromDecorationNormalization(fragment) {
274876
+ if (fragment.kind !== "image" && fragment.kind !== "drawing")
274877
+ return false;
274878
+ return fragment.behindDoc === true || fragment.isAnchored === true || fragment.sourceAnchor != null;
274323
274879
  }
274324
274880
  function getDecorationNormalizationMinY(fragments, layoutMinY) {
274325
274881
  if (!Number.isFinite(layoutMinY) || layoutMinY >= 0)
274326
274882
  return 0;
274327
274883
  let minY = Infinity;
274328
274884
  for (const fragment of fragments) {
274329
- if (isExplicitBehindDocMediaFragment(fragment))
274885
+ if (isExcludedFromDecorationNormalization(fragment))
274330
274886
  continue;
274331
274887
  if (Number.isFinite(fragment.y))
274332
274888
  minY = Math.min(minY, fragment.y);
@@ -295889,6 +296445,12 @@ menclose::after {
295889
296445
  if (!SUPPORTED_IMAGE_CLIP_PATH_PREFIXES.some((prefix2) => lower.startsWith(prefix2)))
295890
296446
  return "";
295891
296447
  return normalized;
296448
+ }, applyImageObjectFit = (img2, objectFit) => {
296449
+ img2.style.objectFit = objectFit;
296450
+ if (objectFit === "cover")
296451
+ img2.style.objectPosition = "left top";
296452
+ else
296453
+ img2.style.removeProperty("object-position");
295892
296454
  }, applyRunDataAttributes = (element3, dataAttrs) => {
295893
296455
  if (!dataAttrs)
295894
296456
  return;
@@ -296176,7 +296738,10 @@ menclose::after {
296176
296738
  }, renderImageRun = (run2, context) => {
296177
296739
  if (!run2.src)
296178
296740
  return null;
296179
- const hasClipPath = typeof run2.clipPath === "string" && run2.clipPath.trim().length > 0;
296741
+ const runClipPath = readImageClipPathValue(run2.clipPath);
296742
+ const shapeClipPath = readImageClipPathValue(run2.shapeClipPath);
296743
+ const hasClipPath = runClipPath.length > 0;
296744
+ const hasShapeClipPath = shapeClipPath.length > 0;
296180
296745
  const img2 = context.doc.createElement("img");
296181
296746
  img2.classList.add(DOM_CLASS_NAMES.INLINE_IMAGE);
296182
296747
  if (typeof run2.src === "string" && run2.src.startsWith("data:")) {
@@ -296190,7 +296755,7 @@ menclose::after {
296190
296755
  else
296191
296756
  return null;
296192
296757
  }
296193
- if (!hasClipPath) {
296758
+ if (!hasClipPath && !hasShapeClipPath) {
296194
296759
  img2.width = run2.width;
296195
296760
  img2.height = run2.height;
296196
296761
  } else
@@ -296203,7 +296768,9 @@ menclose::after {
296203
296768
  minWidth: "0",
296204
296769
  minHeight: "0"
296205
296770
  });
296206
- applyImageClipPath(img2, run2.clipPath);
296771
+ applyImageClipPath(img2, runClipPath);
296772
+ if (run2.objectFit)
296773
+ applyImageObjectFit(img2, run2.objectFit);
296207
296774
  if (run2.width > 0 && run2.height > 0) {
296208
296775
  const aspectRatio = run2.width / run2.height;
296209
296776
  const inlineImageMetadata = {
@@ -296221,7 +296788,7 @@ menclose::after {
296221
296788
  if (run2.title)
296222
296789
  img2.title = run2.title;
296223
296790
  img2.style.display = "inline-block";
296224
- const useWrapper = hasClipPath && run2.width > 0 && run2.height > 0;
296791
+ const useWrapper = (hasClipPath || hasShapeClipPath) && run2.width > 0 && run2.height > 0;
296225
296792
  if (!useWrapper) {
296226
296793
  img2.style.verticalAlign = run2.verticalAlign ?? "top";
296227
296794
  if (run2.distTop)
@@ -296282,6 +296849,8 @@ menclose::after {
296282
296849
  wrapper.style.marginRight = `${run2.distRight}px`;
296283
296850
  wrapper.style.position = "relative";
296284
296851
  wrapper.style.zIndex = "1";
296852
+ if (shapeClipPath)
296853
+ wrapper.style.clipPath = shapeClipPath;
296285
296854
  if (run2.pmStart != null)
296286
296855
  wrapper.dataset.pmStart = String(run2.pmStart);
296287
296856
  if (run2.pmEnd != null)
@@ -296301,7 +296870,6 @@ menclose::after {
296301
296870
  context.applySdtDataset(img2, run2.sdt);
296302
296871
  if (run2.dataAttrs)
296303
296872
  applyRunDataAttributes(img2, run2.dataAttrs);
296304
- const runClipPath = readImageClipPathValue(run2.clipPath);
296305
296873
  if (runClipPath) {
296306
296874
  img2.style.clipPath = runClipPath;
296307
296875
  img2.style.display = "block";
@@ -296347,6 +296915,12 @@ menclose::after {
296347
296915
  return "";
296348
296916
  const record3 = block;
296349
296917
  return readImageClipPathValue(record3.clipPath) || resolveClipPathFromAttrs$1(record3.attrs);
296918
+ }, resolveBlockImageShapeClipPath = (block) => {
296919
+ if (!block || typeof block !== "object")
296920
+ return "";
296921
+ const record3 = block;
296922
+ const attrs = record3.attrs && typeof record3.attrs === "object" ? record3.attrs : undefined;
296923
+ return readImageClipPathValue(record3.shapeClipPath) || readImageClipPathValue(attrs?.shapeClipPath);
296350
296924
  }, createBlockImageContent = ({ doc: doc$12, block, className, clipContainer, imageDisplay, hyperlinkDisplay = "block", buildImageHyperlinkAnchor: buildImageHyperlinkAnchor$1 }) => {
296351
296925
  const img2 = doc$12.createElement("img");
296352
296926
  if (className)
@@ -296356,10 +296930,19 @@ menclose::after {
296356
296930
  img2.alt = block.alt ?? "";
296357
296931
  img2.style.width = "100%";
296358
296932
  img2.style.height = "100%";
296359
- img2.style.objectFit = block.objectFit ?? "contain";
296360
- if (block.objectFit === "cover")
296361
- img2.style.objectPosition = "left top";
296362
- applyImageClipPath(img2, resolveBlockImageClipPath(block), clipContainer ? { clipContainer } : undefined);
296933
+ applyImageObjectFit(img2, block.objectFit ?? "contain");
296934
+ const shapeClipPath = resolveBlockImageShapeClipPath(block);
296935
+ const ownShapeClipContainer = shapeClipPath && !clipContainer ? doc$12.createElement("div") : undefined;
296936
+ if (ownShapeClipContainer) {
296937
+ ownShapeClipContainer.style.width = "100%";
296938
+ ownShapeClipContainer.style.height = "100%";
296939
+ }
296940
+ const shapeClipContainer = clipContainer ?? ownShapeClipContainer;
296941
+ if (shapeClipPath && shapeClipContainer) {
296942
+ shapeClipContainer.style.clipPath = shapeClipPath;
296943
+ shapeClipContainer.style.overflow = "hidden";
296944
+ }
296945
+ applyImageClipPath(img2, resolveBlockImageClipPath(block), shapeClipContainer ? { clipContainer: shapeClipContainer } : undefined);
296363
296946
  img2.style.display = imageDisplay ?? (block.display === "inline" ? "inline-block" : "block");
296364
296947
  const filters = buildImageFilters(block);
296365
296948
  if (filters.length > 0)
@@ -296367,7 +296950,12 @@ menclose::after {
296367
296950
  const opacity = resolveImageOpacity(block);
296368
296951
  if (opacity != null)
296369
296952
  img2.style.opacity = opacity;
296370
- return buildImageHyperlinkAnchor$1?.(img2, block.hyperlink, hyperlinkDisplay) ?? img2;
296953
+ const content3 = buildImageHyperlinkAnchor$1?.(img2, block.hyperlink, hyperlinkDisplay) ?? img2;
296954
+ if (ownShapeClipContainer) {
296955
+ ownShapeClipContainer.appendChild(content3);
296956
+ return ownShapeClipContainer;
296957
+ }
296958
+ return content3;
296371
296959
  }, buildImageHyperlinkAnchor = (doc$12, imageEl, hyperlink, display) => {
296372
296960
  if (!hyperlink?.url)
296373
296961
  return imageEl;
@@ -300503,13 +301091,24 @@ menclose::after {
300503
301091
  const img2 = doc$12.createElement("img");
300504
301092
  img2.src = attrs.src;
300505
301093
  img2.alt = attrs.alt ?? "";
300506
- img2.style.objectFit = "contain";
301094
+ applyImageObjectFit(img2, attrs.objectFit ?? "contain");
300507
301095
  img2.style.display = "block";
300508
- applyImageClipPath(img2, attrs.clipPath);
300509
301096
  const opacity = resolveImageOpacity(attrs);
300510
301097
  if (opacity != null)
300511
301098
  img2.style.opacity = opacity;
300512
- return img2;
301099
+ img2.style.width = "100%";
301100
+ img2.style.height = "100%";
301101
+ if (!attrs.clipPath && !attrs.shapeClipPath)
301102
+ return img2;
301103
+ const clipContainer = doc$12.createElement("div");
301104
+ clipContainer.style.width = "100%";
301105
+ clipContainer.style.height = "100%";
301106
+ clipContainer.style.overflow = "hidden";
301107
+ if (attrs.shapeClipPath)
301108
+ clipContainer.style.clipPath = attrs.shapeClipPath;
301109
+ applyImageClipPath(img2, attrs.clipPath, { clipContainer });
301110
+ clipContainer.appendChild(img2);
301111
+ return clipContainer;
300513
301112
  }, createShapeTextImageElement = (doc$12, part) => {
300514
301113
  const img2 = doc$12.createElement("img");
300515
301114
  img2.src = part.src;
@@ -300600,7 +301199,7 @@ menclose::after {
300600
301199
  });
300601
301200
  return createErrorPlaceholder(fragment.blockId, error48);
300602
301201
  }
300603
- }, ACTIVE_HEADER_FOOTER_WATERMARK_PREVIEW_OPACITY = "1", INACTIVE_HEADER_FOOTER_WATERMARK_PREVIEW_OPACITY = "0.5", resolveOrBuildFragmentIdentity = (fragment, story, existing) => buildLayoutSourceIdentityForFragment(existing ? {
301202
+ }, 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 ? {
300604
301203
  ...fragment,
300605
301204
  layoutSourceIdentity: existing,
300606
301205
  sourceAnchor: fragment.sourceAnchor ?? existing.sourceAnchor
@@ -300614,7 +301213,7 @@ menclose::after {
300614
301213
  kind,
300615
301214
  id: id2
300616
301215
  } : { kind };
300617
- }, 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 {
301216
+ }, 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 {
300618
301217
  constructor(options = {}) {
300619
301218
  this.mount = null;
300620
301219
  this.doc = null;
@@ -301445,6 +302044,63 @@ menclose::after {
301445
302044
  return false;
301446
302045
  return block.anchor?.vRelativeFrom === "page";
301447
302046
  }
302047
+ isHorizontallyPageRelativeAnchoredFragment(fragment, resolvedItem) {
302048
+ if (fragment.kind !== "image" && fragment.kind !== "drawing")
302049
+ return false;
302050
+ const block = resolvedItem && "block" in resolvedItem ? resolvedItem.block : undefined;
302051
+ if (!block || block.kind !== "image" && block.kind !== "drawing")
302052
+ return false;
302053
+ return block.anchor?.hRelativeFrom === "page";
302054
+ }
302055
+ isHeaderFooterAbsoluteOverlayFragment(fragment, kind, resolvedItem) {
302056
+ if (kind !== "header" && kind !== "footer")
302057
+ return false;
302058
+ if (fragment.kind !== "image" && fragment.kind !== "drawing")
302059
+ return false;
302060
+ if (fragment.isAnchored !== true)
302061
+ return false;
302062
+ const block = resolvedItem && "block" in resolvedItem ? resolvedItem.block : undefined;
302063
+ if (!block || block.kind !== "image" && block.kind !== "drawing")
302064
+ return false;
302065
+ if (block.anchor?.isAnchored !== true)
302066
+ return false;
302067
+ if (block.wrap?.type !== "None")
302068
+ return false;
302069
+ if (fragment.behindDoc === true || block.anchor?.behindDoc === true)
302070
+ return false;
302071
+ return true;
302072
+ }
302073
+ getPageBackgroundDecorationZOrder(fragment, resolvedItem) {
302074
+ const block = resolvedItem && "block" in resolvedItem ? resolvedItem.block : undefined;
302075
+ const isDrawingBlock = block?.kind === "image" || block?.kind === "drawing";
302076
+ const normalizedZIndex = normalizeZIndex(isDrawingBlock ? block.attrs?.originalAttributes : undefined);
302077
+ const isBehindDoc = (fragment.kind === "image" || fragment.kind === "drawing") && fragment.behindDoc === true || isDrawingBlock && block.anchor?.behindDoc === true;
302078
+ if (isBehindDoc && normalizedZIndex != null)
302079
+ return normalizedZIndex;
302080
+ if ((fragment.kind === "image" || fragment.kind === "drawing") && typeof fragment.zIndex === "number")
302081
+ return isBehindDoc ? fragment.zIndex : PAGE_BACKGROUND_OVERLAY_Z_ORDER_OFFSET + Math.max(1, fragment.zIndex);
302082
+ if (normalizedZIndex != null)
302083
+ return PAGE_BACKGROUND_OVERLAY_Z_ORDER_OFFSET + Math.max(1, normalizedZIndex);
302084
+ return 0;
302085
+ }
302086
+ insertPageBackgroundDecoration(pageEl, fragEl, zOrder) {
302087
+ fragEl.dataset.pageBackgroundZIndex = String(zOrder);
302088
+ let lastBackgroundDecoration = null;
302089
+ let insertBefore = null;
302090
+ for (const child of Array.from(pageEl.children)) {
302091
+ const el = child;
302092
+ if (el.dataset.behindDocSection != null || el.dataset.headerFooterOverlaySection != null) {
302093
+ if (Number(el.dataset.pageBackgroundZIndex ?? 0) > zOrder) {
302094
+ insertBefore = el;
302095
+ break;
302096
+ }
302097
+ lastBackgroundDecoration = el;
302098
+ continue;
302099
+ }
302100
+ break;
302101
+ }
302102
+ pageEl.insertBefore(fragEl, insertBefore ?? lastBackgroundDecoration?.nextSibling ?? pageEl.firstChild);
302103
+ }
301448
302104
  getDecorationAnchorPageOriginY(page, kind, effectiveOffset) {
301449
302105
  if (kind === "header")
301450
302106
  return effectiveOffset;
@@ -301469,8 +302125,12 @@ menclose::after {
301469
302125
  const className = kind === "header" ? CLASS_NAMES$1.pageHeader : CLASS_NAMES$1.pageFooter;
301470
302126
  const existing = pageEl.querySelector(`.${className}`);
301471
302127
  const data = provider ? provider(page.number, page.margins, page) : null;
302128
+ const behindDocSelector = `[data-behind-doc-section="${kind}"]`;
302129
+ const overlaySelector = `[data-header-footer-overlay-section="${kind}"]`;
301472
302130
  if (!data || data.fragments.length === 0) {
301473
302131
  existing?.remove();
302132
+ pageEl.querySelectorAll(behindDocSelector).forEach((el) => el.remove());
302133
+ pageEl.querySelectorAll(overlaySelector).forEach((el) => el.remove());
301474
302134
  return;
301475
302135
  }
301476
302136
  const container = existing ?? this.doc.createElement("div");
@@ -301532,27 +302192,34 @@ menclose::after {
301532
302192
  const decorationItems = data.items ?? [];
301533
302193
  const betweenBorderFlags = computeBetweenBorderFlags(decorationItems);
301534
302194
  const behindDocFragments = [];
302195
+ const absoluteOverlayFragments = [];
301535
302196
  const normalFragments = [];
301536
302197
  for (let fi = 0;fi < data.fragments.length; fi += 1) {
301537
302198
  const fragment = data.fragments[fi];
302199
+ const resolvedItem = decorationItems[fi];
301538
302200
  let isBehindDoc = false;
301539
302201
  if (fragment.kind === "image" || fragment.kind === "drawing") {
301540
- const resolvedItem = decorationItems[fi];
301541
- isBehindDoc = fragment.behindDoc === true || fragment.behindDoc == null && "zIndex" in fragment && fragment.zIndex === 0 || this.shouldRenderBehindPageContent(fragment, kind, resolvedItem);
302202
+ const resolvedMediaItem = resolvedItem;
302203
+ isBehindDoc = fragment.behindDoc === true || fragment.behindDoc == null && "zIndex" in fragment && fragment.zIndex === 0 || this.shouldRenderBehindPageContent(fragment, kind, resolvedMediaItem);
301542
302204
  }
301543
302205
  if (isBehindDoc)
301544
302206
  behindDocFragments.push({
301545
302207
  fragment,
301546
302208
  originalIndex: fi
301547
302209
  });
302210
+ else if (this.isHeaderFooterAbsoluteOverlayFragment(fragment, kind, resolvedItem))
302211
+ absoluteOverlayFragments.push({
302212
+ fragment,
302213
+ originalIndex: fi
302214
+ });
301548
302215
  else
301549
302216
  normalFragments.push({
301550
302217
  fragment,
301551
302218
  originalIndex: fi
301552
302219
  });
301553
302220
  }
301554
- const behindDocSelector = `[data-behind-doc-section="${kind}"]`;
301555
302221
  pageEl.querySelectorAll(behindDocSelector).forEach((el) => el.remove());
302222
+ pageEl.querySelectorAll(overlaySelector).forEach((el) => el.remove());
301556
302223
  behindDocFragments.forEach(({ fragment, originalIndex }) => {
301557
302224
  const resolvedItem = data.items?.[originalIndex];
301558
302225
  const fragEl = this.renderFragment(fragment, context, undefined, betweenBorderFlags.get(originalIndex), resolvedItem);
@@ -301565,11 +302232,12 @@ menclose::after {
301565
302232
  pageY = fragment.y;
301566
302233
  else
301567
302234
  pageY = effectiveOffset + fragment.y + (kind === "footer" ? footerYOffset : 0);
302235
+ const isHorizontallyPageRelative = this.isHorizontallyPageRelativeAnchoredFragment(fragment, resolvedItem);
301568
302236
  fragEl.style.top = `${pageY}px`;
301569
- fragEl.style.left = `${isPageRelative ? fragment.x : marginLeft + fragment.x}px`;
302237
+ fragEl.style.left = `${isHorizontallyPageRelative ? fragment.x : marginLeft + fragment.x}px`;
301570
302238
  fragEl.style.zIndex = "0";
301571
302239
  fragEl.dataset.behindDocSection = kind;
301572
- pageEl.insertBefore(fragEl, pageEl.firstChild);
302240
+ this.insertPageBackgroundDecoration(pageEl, fragEl, this.getPageBackgroundDecorationZOrder(fragment, resolvedItem));
301573
302241
  });
301574
302242
  normalFragments.forEach(({ fragment, originalIndex }) => {
301575
302243
  const resolvedItem = data.items?.[originalIndex];
@@ -301588,6 +302256,27 @@ menclose::after {
301588
302256
  });
301589
302257
  if (!existing)
301590
302258
  pageEl.appendChild(container);
302259
+ absoluteOverlayFragments.forEach(({ fragment, originalIndex }) => {
302260
+ const resolvedItem = data.items?.[originalIndex];
302261
+ const fragEl = this.renderFragment(fragment, context, undefined, betweenBorderFlags.get(originalIndex), resolvedItem);
302262
+ const isPageRelative = this.isPageRelativeAnchoredFragment(fragment, resolvedItem);
302263
+ this.applyHeaderFooterTextWatermarkPreviewOpacity(fragEl, data.isActiveHeaderFooter === true);
302264
+ let pageY;
302265
+ if (isPageRelative && kind === "footer")
302266
+ pageY = footerAnchorPageOriginY + fragment.y;
302267
+ else if (isPageRelative)
302268
+ pageY = fragment.y;
302269
+ else
302270
+ pageY = effectiveOffset + fragment.y + (kind === "footer" ? footerYOffset : 0);
302271
+ const isHorizontallyPageRelative = this.isHorizontallyPageRelativeAnchoredFragment(fragment, resolvedItem);
302272
+ fragEl.style.top = `${pageY}px`;
302273
+ fragEl.style.left = `${isHorizontallyPageRelative ? fragment.x : marginLeft + fragment.x}px`;
302274
+ fragEl.style.zIndex = "0";
302275
+ if (data.isActiveHeaderFooter !== true)
302276
+ fragEl.style.pointerEvents = "none";
302277
+ fragEl.dataset.headerFooterOverlaySection = kind;
302278
+ this.insertPageBackgroundDecoration(pageEl, fragEl, this.getPageBackgroundDecorationZOrder(fragment, resolvedItem));
302279
+ });
301591
302280
  }
301592
302281
  resetState() {
301593
302282
  if (this.mount) {
@@ -302012,6 +302701,19 @@ menclose::after {
302012
302701
  innerWrapper.style.width = `${fragment.geometry.width}px`;
302013
302702
  innerWrapper.style.height = `${fragment.geometry.height}px`;
302014
302703
  innerWrapper.style.transformOrigin = "center";
302704
+ if (block.drawingKind === "shapeGroup" && block.groupTransform) {
302705
+ const effectExtent = block.effectExtent ?? {
302706
+ left: 0,
302707
+ top: 0,
302708
+ right: 0,
302709
+ bottom: 0
302710
+ };
302711
+ const groupWidth = block.groupTransform.width ?? Math.max(0, block.geometry.width - effectExtent.left - effectExtent.right);
302712
+ const groupHeight = block.groupTransform.height ?? Math.max(0, block.geometry.height - effectExtent.top - effectExtent.bottom);
302713
+ const originX = effectExtent.left + groupWidth / 2;
302714
+ const originY = effectExtent.top + groupHeight / 2;
302715
+ innerWrapper.style.transformOrigin = `${originX}px ${originY}px`;
302716
+ }
302015
302717
  const scale = fragment.scale ?? 1;
302016
302718
  const transforms = ["translate(-50%, -50%)"];
302017
302719
  transforms.push(`rotate(${fragment.geometry.rotation ?? 0}deg)`);
@@ -302038,7 +302740,7 @@ menclose::after {
302038
302740
  if (block.drawingKind === "vectorShape" || block.drawingKind === "textboxShape")
302039
302741
  return this.createVectorShapeElement(block, fragment.geometry, false, 1, 1, context, fragment);
302040
302742
  if (block.drawingKind === "shapeGroup")
302041
- return this.createShapeGroupElement(block, context);
302743
+ return this.createShapeGroupElement(block, context, fragment.geometry);
302042
302744
  if (block.drawingKind === "chart")
302043
302745
  return this.createChartElement(block);
302044
302746
  return this.createDrawingPlaceholder();
@@ -302070,12 +302772,14 @@ menclose::after {
302070
302772
  svgElement.setAttribute("width", "100%");
302071
302773
  svgElement.setAttribute("height", "100%");
302072
302774
  svgElement.style.display = "block";
302775
+ svgElement.style.overflow = "visible";
302073
302776
  if (block.fillColor && typeof block.fillColor === "object") {
302074
302777
  if ("type" in block.fillColor && block.fillColor.type === "gradient")
302075
302778
  applyGradientToSVG(svgElement, block.fillColor);
302076
302779
  else if ("type" in block.fillColor && block.fillColor.type === "solidWithAlpha")
302077
302780
  applyAlphaToSVG(svgElement, block.fillColor);
302078
302781
  }
302782
+ this.applyShapeEffects(svgElement, block);
302079
302783
  this.applyLineEnds(svgElement, block);
302080
302784
  contentContainer.appendChild(svgElement);
302081
302785
  if (block.drawingKind === "textboxShape" || this.hasShapeTextContent(block.textContent)) {
@@ -302326,19 +303030,40 @@ menclose::after {
302326
303030
  textDiv.style.textAlign = "right";
302327
303031
  else
302328
303032
  textDiv.style.textAlign = "left";
302329
- let currentParagraph = this.doc.createElement("div");
302330
- currentParagraph.style.width = "100%";
302331
- currentParagraph.style.minWidth = "0";
302332
- currentParagraph.style.whiteSpace = "normal";
303033
+ const paragraphSpacing = textContent$1.paragraphs;
303034
+ const spacingBefore = (index2) => paragraphSpacing?.[index2]?.spacing?.before;
303035
+ const spacingAfter = (index2) => paragraphSpacing?.[index2]?.spacing?.after;
303036
+ const createParagraphElement = () => {
303037
+ const paragraph2 = this.doc.createElement("div");
303038
+ paragraph2.style.width = "100%";
303039
+ paragraph2.style.minWidth = "0";
303040
+ paragraph2.style.whiteSpace = "normal";
303041
+ paragraph2.style.marginLeft = "0";
303042
+ paragraph2.style.marginRight = "0";
303043
+ return paragraph2;
303044
+ };
303045
+ let logicalParagraphIndex = 0;
303046
+ let currentParagraph = createParagraphElement();
303047
+ const firstParagraphBefore = spacingBefore(logicalParagraphIndex);
303048
+ if (typeof firstParagraphBefore === "number")
303049
+ currentParagraph.style.marginTop = `${firstParagraphBefore}px`;
302333
303050
  textContent$1.parts.forEach((part) => {
302334
303051
  if (part.isLineBreak) {
303052
+ if (part.isParagraphBoundary) {
303053
+ const currentParagraphAfter = spacingAfter(logicalParagraphIndex);
303054
+ if (typeof currentParagraphAfter === "number")
303055
+ currentParagraph.style.marginBottom = `${currentParagraphAfter}px`;
303056
+ }
302335
303057
  textDiv.appendChild(currentParagraph);
302336
- currentParagraph = this.doc.createElement("div");
302337
- currentParagraph.style.width = "100%";
302338
- currentParagraph.style.minWidth = "0";
302339
- currentParagraph.style.whiteSpace = "normal";
303058
+ currentParagraph = createParagraphElement();
302340
303059
  if (part.isEmptyParagraph)
302341
303060
  currentParagraph.style.minHeight = "1em";
303061
+ if (part.isParagraphBoundary) {
303062
+ logicalParagraphIndex += 1;
303063
+ const nextParagraphBefore = spacingBefore(logicalParagraphIndex);
303064
+ if (typeof nextParagraphBefore === "number")
303065
+ currentParagraph.style.marginTop = `${nextParagraphBefore}px`;
303066
+ }
302342
303067
  } else if (part.kind === "image" && part.src)
302343
303068
  currentParagraph.appendChild(createShapeTextImageElement(this.doc, part));
302344
303069
  else {
@@ -302364,6 +303089,9 @@ menclose::after {
302364
303089
  currentParagraph.appendChild(span);
302365
303090
  }
302366
303091
  });
303092
+ const finalParagraphAfter = spacingAfter(logicalParagraphIndex);
303093
+ if (typeof finalParagraphAfter === "number")
303094
+ currentParagraph.style.marginBottom = `${finalParagraphAfter}px`;
302367
303095
  textDiv.appendChild(currentParagraph);
302368
303096
  return textDiv;
302369
303097
  }
@@ -302415,6 +303143,7 @@ menclose::after {
302415
303143
  const viewH = firstPath.h || height;
302416
303144
  if (viewW === 0 || viewH === 0)
302417
303145
  return null;
303146
+ const explicitStrokeEffect = viewW / width > 10 || viewH / height > 10 ? ' vector-effect="non-scaling-stroke"' : "";
302418
303147
  const edgeStroke = fillColor !== "none" && strokeColor === "none" ? ` stroke="${fillColor}" stroke-width="0.5" vector-effect="non-scaling-stroke"` : "";
302419
303148
  return `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${viewW} ${viewH}" preserveAspectRatio="none">
302420
303149
  ${custGeom.paths.map((p$12) => {
@@ -302424,7 +303153,7 @@ menclose::after {
302424
303153
  const scaleX = viewW / pathW;
302425
303154
  const scaleY = viewH / pathH;
302426
303155
  const transform2 = needsTransform ? ` transform="scale(${scaleX}, ${scaleY})"` : "";
302427
- const strokeAttr = strokeColor !== "none" ? ` stroke="${strokeColor}" stroke-width="${strokeWidth}"` : edgeStroke;
303156
+ const strokeAttr = strokeColor !== "none" ? ` stroke="${strokeColor}" stroke-width="${strokeWidth}"${explicitStrokeEffect}` : edgeStroke;
302428
303157
  return `<path d="${p$12.d}" fill="${fillColor}" fill-rule="evenodd"${strokeAttr}${transform2} />`;
302429
303158
  }).join(`
302430
303159
  `)}
@@ -302498,6 +303227,112 @@ menclose::after {
302498
303227
  target.setAttribute("marker-end", `url(#${id2})`);
302499
303228
  }
302500
303229
  }
303230
+ applyShapeEffects(svgElement, block) {
303231
+ const outerShadow = block.effects?.outerShadow;
303232
+ if (!outerShadow)
303233
+ return;
303234
+ this.applyOuterShadowEffect(svgElement, block.id, outerShadow);
303235
+ }
303236
+ applyOuterShadowEffect(svgElement, blockId, shadow) {
303237
+ const targets = this.findShapeEffectTargets(svgElement);
303238
+ if (!targets.length)
303239
+ return;
303240
+ const defs = this.ensureSvgDefs(svgElement);
303241
+ const filterId = this.sanitizeSvgId(`sd-shadow-${blockId}`);
303242
+ const outlineFilterId = this.sanitizeSvgId(`sd-shadow-outline-${blockId}`);
303243
+ if (!defs.querySelector(`#${filterId}`)) {
303244
+ const filter = this.doc.createElementNS("http://www.w3.org/2000/svg", "filter");
303245
+ filter.setAttribute("id", filterId);
303246
+ filter.setAttribute("x", "-50%");
303247
+ filter.setAttribute("y", "-50%");
303248
+ filter.setAttribute("width", "200%");
303249
+ filter.setAttribute("height", "200%");
303250
+ const { dx, dy } = resolveOuterShadowOffset(shadow);
303251
+ const dropShadow = this.doc.createElementNS("http://www.w3.org/2000/svg", "feDropShadow");
303252
+ dropShadow.setAttribute("dx", this.formatSvgNumber(dx));
303253
+ dropShadow.setAttribute("dy", this.formatSvgNumber(dy));
303254
+ dropShadow.setAttribute("stdDeviation", this.formatSvgNumber(getOuterShadowStdDeviation(shadow)));
303255
+ dropShadow.setAttribute("flood-color", shadow.color);
303256
+ dropShadow.setAttribute("flood-opacity", this.formatSvgNumber(shadow.opacity));
303257
+ filter.appendChild(dropShadow);
303258
+ defs.appendChild(filter);
303259
+ }
303260
+ targets.forEach((target) => {
303261
+ if (this.shouldRenderFilledShadowClone(target)) {
303262
+ this.appendFilledShadowClone(svgElement, defs, target, outlineFilterId, shadow);
303263
+ return;
303264
+ }
303265
+ target.setAttribute("filter", `url(#${filterId})`);
303266
+ });
303267
+ }
303268
+ findShapeEffectTargets(svgElement) {
303269
+ return Array.from(svgElement.querySelectorAll("path, line, polyline, polygon, rect, ellipse, circle")).filter((target) => !target.closest("defs") && !target.hasAttribute("data-sd-shadow-clone"));
303270
+ }
303271
+ shouldRenderFilledShadowClone(target) {
303272
+ if (target.getAttribute("fill") !== "none")
303273
+ return false;
303274
+ if (target.tagName.toLowerCase() === "path")
303275
+ return /z\s*$/i.test(target.getAttribute("d") ?? "");
303276
+ return [
303277
+ "polygon",
303278
+ "rect",
303279
+ "ellipse",
303280
+ "circle"
303281
+ ].includes(target.tagName.toLowerCase());
303282
+ }
303283
+ appendFilledShadowClone(svgElement, defs, target, filterId, shadow) {
303284
+ this.ensureOuterShadowOnlyFilter(defs, filterId, shadow);
303285
+ const clone$1 = target.cloneNode(false);
303286
+ clone$1.setAttribute("data-sd-shadow-clone", filterId);
303287
+ clone$1.setAttribute("aria-hidden", "true");
303288
+ clone$1.setAttribute("fill", "#000000");
303289
+ clone$1.setAttribute("stroke", "none");
303290
+ clone$1.setAttribute("filter", `url(#${filterId})`);
303291
+ target.parentNode?.insertBefore(clone$1, target);
303292
+ }
303293
+ ensureOuterShadowOnlyFilter(defs, filterId, shadow) {
303294
+ if (defs.querySelector(`#${filterId}`))
303295
+ return;
303296
+ const filter = this.doc.createElementNS("http://www.w3.org/2000/svg", "filter");
303297
+ filter.setAttribute("id", filterId);
303298
+ filter.setAttribute("x", "-50%");
303299
+ filter.setAttribute("y", "-50%");
303300
+ filter.setAttribute("width", "200%");
303301
+ filter.setAttribute("height", "200%");
303302
+ const blur = this.doc.createElementNS("http://www.w3.org/2000/svg", "feGaussianBlur");
303303
+ blur.setAttribute("in", "SourceAlpha");
303304
+ blur.setAttribute("stdDeviation", this.formatSvgNumber(getOuterShadowStdDeviation(shadow)));
303305
+ blur.setAttribute("result", "blur");
303306
+ const { dx, dy } = resolveOuterShadowOffset(shadow);
303307
+ const offset$1 = this.doc.createElementNS("http://www.w3.org/2000/svg", "feOffset");
303308
+ offset$1.setAttribute("in", "blur");
303309
+ offset$1.setAttribute("dx", this.formatSvgNumber(dx));
303310
+ offset$1.setAttribute("dy", this.formatSvgNumber(dy));
303311
+ offset$1.setAttribute("result", "offsetBlur");
303312
+ const flood = this.doc.createElementNS("http://www.w3.org/2000/svg", "feFlood");
303313
+ flood.setAttribute("flood-color", shadow.color);
303314
+ flood.setAttribute("flood-opacity", this.formatSvgNumber(shadow.opacity));
303315
+ flood.setAttribute("result", "shadowColor");
303316
+ const composite = this.doc.createElementNS("http://www.w3.org/2000/svg", "feComposite");
303317
+ composite.setAttribute("in", "shadowColor");
303318
+ composite.setAttribute("in2", "offsetBlur");
303319
+ composite.setAttribute("operator", "in");
303320
+ composite.setAttribute("result", "shadow");
303321
+ const outsideOnly = this.doc.createElementNS("http://www.w3.org/2000/svg", "feComposite");
303322
+ outsideOnly.setAttribute("in", "shadow");
303323
+ outsideOnly.setAttribute("in2", "SourceAlpha");
303324
+ outsideOnly.setAttribute("operator", "out");
303325
+ outsideOnly.setAttribute("result", "outerShadow");
303326
+ filter.appendChild(blur);
303327
+ filter.appendChild(offset$1);
303328
+ filter.appendChild(flood);
303329
+ filter.appendChild(composite);
303330
+ filter.appendChild(outsideOnly);
303331
+ defs.appendChild(filter);
303332
+ }
303333
+ formatSvgNumber(value) {
303334
+ return Number.isFinite(value) ? Number(value.toFixed(4)).toString() : "0";
303335
+ }
302501
303336
  findLineEndTarget(svgElement) {
302502
303337
  const line = svgElement.querySelector("line");
302503
303338
  if (line)
@@ -302586,7 +303421,7 @@ menclose::after {
302586
303421
  target.style.removeProperty("transform-origin");
302587
303422
  }
302588
303423
  }
302589
- createShapeGroupElement(block, context) {
303424
+ createShapeGroupElement(block, context, fragmentGeometry) {
302590
303425
  const groupEl = this.doc.createElement("div");
302591
303426
  groupEl.classList.add("superdoc-shape-group");
302592
303427
  groupEl.style.position = "relative";
@@ -302594,32 +303429,56 @@ menclose::after {
302594
303429
  groupEl.style.height = "100%";
302595
303430
  const groupTransform = block.groupTransform;
302596
303431
  let contentContainer = groupEl;
302597
- const visibleWidth = groupTransform?.width ?? block.geometry.width ?? 0;
302598
- const visibleHeight = groupTransform?.height ?? block.geometry.height ?? 0;
302599
- if (groupTransform) {
303432
+ const groupEffectExtent = block.effectExtent ?? {
303433
+ left: 0,
303434
+ top: 0,
303435
+ right: 0,
303436
+ bottom: 0
303437
+ };
303438
+ const hasGroupEffectExtent = groupEffectExtent.left > 0 || groupEffectExtent.top > 0 || groupEffectExtent.right > 0 || groupEffectExtent.bottom > 0;
303439
+ const visibleWidth = groupTransform?.width ?? Math.max(0, (block.geometry.width ?? 0) - groupEffectExtent.left - groupEffectExtent.right);
303440
+ const visibleHeight = groupTransform?.height ?? Math.max(0, (block.geometry.height ?? 0) - groupEffectExtent.top - groupEffectExtent.bottom);
303441
+ if (groupTransform || hasGroupEffectExtent) {
302600
303442
  const inner = this.doc.createElement("div");
302601
303443
  inner.style.position = "absolute";
302602
- inner.style.left = "0";
302603
- inner.style.top = "0";
303444
+ inner.style.left = `${groupEffectExtent.left}px`;
303445
+ inner.style.top = `${groupEffectExtent.top}px`;
302604
303446
  inner.style.width = `${Math.max(1, visibleWidth)}px`;
302605
303447
  inner.style.height = `${Math.max(1, visibleHeight)}px`;
303448
+ const groupTransforms = [];
303449
+ const normalizedGroupRotation = typeof groupTransform?.rotation === "number" ? normalizeRotationDegrees(groupTransform.rotation) : 0;
303450
+ const normalizedFragmentRotation = typeof fragmentGeometry?.rotation === "number" ? normalizeRotationDegrees(fragmentGeometry.rotation) : 0;
303451
+ const groupRotation = normalizedGroupRotation && normalizedGroupRotation !== normalizedFragmentRotation ? groupTransform?.rotation ?? 0 : 0;
303452
+ const groupFlipH = groupTransform?.flipH && groupTransform.flipH !== fragmentGeometry?.flipH;
303453
+ const groupFlipV = groupTransform?.flipV && groupTransform.flipV !== fragmentGeometry?.flipV;
303454
+ if (groupRotation)
303455
+ groupTransforms.push(`rotate(${groupRotation}deg)`);
303456
+ if (groupFlipH)
303457
+ groupTransforms.push("scaleX(-1)");
303458
+ if (groupFlipV)
303459
+ groupTransforms.push("scaleY(-1)");
303460
+ if (groupTransforms.length > 0) {
303461
+ inner.style.transformOrigin = "center";
303462
+ inner.style.transform = groupTransforms.join(" ");
303463
+ }
302606
303464
  groupEl.appendChild(inner);
302607
303465
  contentContainer = inner;
302608
303466
  }
302609
- block.shapes.forEach((child) => {
302610
- const childContent = this.createGroupChildContent(child, 1, 1, context);
303467
+ block.shapes.forEach((child, childIndex) => {
303468
+ const attrs = child.attrs ?? {};
303469
+ const paintExtent = this.getShapeGroupChildPaintExtent(child);
303470
+ const childContent = this.createGroupChildContent(child, 1, 1, context, paintExtent, block.id, childIndex);
302611
303471
  if (!childContent)
302612
303472
  return;
302613
- const attrs = child.attrs ?? {};
302614
303473
  const wrapper = this.doc.createElement("div");
302615
303474
  wrapper.classList.add("superdoc-shape-group__child");
302616
303475
  wrapper.style.position = "absolute";
302617
- wrapper.style.left = `${Number(attrs.x ?? 0)}px`;
302618
- wrapper.style.top = `${Number(attrs.y ?? 0)}px`;
303476
+ wrapper.style.left = `${Number(attrs.x ?? 0) - paintExtent.left}px`;
303477
+ wrapper.style.top = `${Number(attrs.y ?? 0) - paintExtent.top}px`;
302619
303478
  const childW = typeof attrs.width === "number" ? attrs.width : block.geometry.width;
302620
303479
  const childH = typeof attrs.height === "number" ? attrs.height : block.geometry.height;
302621
- wrapper.style.width = `${Math.max(1, childW)}px`;
302622
- wrapper.style.height = `${Math.max(1, childH)}px`;
303480
+ wrapper.style.width = `${Math.max(1, childW + paintExtent.left + paintExtent.right)}px`;
303481
+ wrapper.style.height = `${Math.max(1, childH + paintExtent.top + paintExtent.bottom)}px`;
302623
303482
  wrapper.style.transformOrigin = "center";
302624
303483
  const transforms = [];
302625
303484
  if (attrs.rotation)
@@ -302637,20 +303496,63 @@ menclose::after {
302637
303496
  });
302638
303497
  return groupEl;
302639
303498
  }
302640
- createGroupChildContent(child, groupScaleX = 1, groupScaleY = 1, context) {
303499
+ getShapeGroupChildPaintExtent(child) {
303500
+ if (child.shapeType !== "vectorShape" || !("fillColor" in child.attrs))
303501
+ return {
303502
+ left: 0,
303503
+ top: 0,
303504
+ right: 0,
303505
+ bottom: 0
303506
+ };
303507
+ const attrs = child.attrs;
303508
+ const shadowExtent = attrs.effects?.outerShadow ? getOuterShadowPaintExtent(attrs.effects.outerShadow) : {
303509
+ left: 0,
303510
+ top: 0,
303511
+ right: 0,
303512
+ bottom: 0
303513
+ };
303514
+ if (attrs.lineEnds)
303515
+ return {
303516
+ left: 0,
303517
+ top: 0,
303518
+ right: 0,
303519
+ bottom: 0
303520
+ };
303521
+ if (attrs.strokeColor === null)
303522
+ return shadowExtent;
303523
+ const rawStrokeWidth = child.attrs.strokeWidth;
303524
+ const parsedStrokeWidth = typeof rawStrokeWidth === "number" ? rawStrokeWidth : typeof rawStrokeWidth === "string" && rawStrokeWidth.trim() !== "" ? Number(rawStrokeWidth) : undefined;
303525
+ const strokeWidth = parsedStrokeWidth != null && Number.isFinite(parsedStrokeWidth) ? parsedStrokeWidth : 1;
303526
+ if (strokeWidth <= 0)
303527
+ return shadowExtent;
303528
+ const extent = strokeWidth / 2;
303529
+ return {
303530
+ left: Math.max(extent, shadowExtent.left),
303531
+ top: Math.max(extent, shadowExtent.top),
303532
+ right: Math.max(extent, shadowExtent.right),
303533
+ bottom: Math.max(extent, shadowExtent.bottom)
303534
+ };
303535
+ }
303536
+ createGroupChildContent(child, groupScaleX = 1, groupScaleY = 1, context, paintExtent = {
303537
+ left: 0,
303538
+ top: 0,
303539
+ right: 0,
303540
+ bottom: 0
303541
+ }, groupId, childIndex) {
302641
303542
  if (child.shapeType === "vectorShape" && "fillColor" in child.attrs) {
302642
303543
  const attrs = child.attrs;
302643
303544
  const childGeometry = {
302644
- width: attrs.width ?? 0,
302645
- height: attrs.height ?? 0,
303545
+ width: (attrs.width ?? 0) + paintExtent.left + paintExtent.right,
303546
+ height: (attrs.height ?? 0) + paintExtent.top + paintExtent.bottom,
302646
303547
  rotation: attrs.rotation ?? 0,
302647
303548
  flipH: attrs.flipH ?? false,
302648
303549
  flipV: attrs.flipV ?? false
302649
303550
  };
303551
+ const hasPaintExtent = paintExtent.left > 0 || paintExtent.top > 0 || paintExtent.right > 0 || paintExtent.bottom > 0;
302650
303552
  const vectorChild = {
302651
303553
  drawingKind: "vectorShape",
302652
303554
  kind: "drawing",
302653
- id: `${attrs.shapeId ?? child.shapeType}`,
303555
+ id: groupId != null ? `${groupId}-${childIndex ?? 0}-${attrs.shapeId ?? child.shapeType}` : `${attrs.shapeId ?? child.shapeType}`,
302654
303556
  geometry: childGeometry,
302655
303557
  padding: undefined,
302656
303558
  margin: undefined,
@@ -302665,10 +303567,12 @@ menclose::after {
302665
303567
  strokeColor: attrs.strokeColor,
302666
303568
  strokeWidth: attrs.strokeWidth,
302667
303569
  lineEnds: attrs.lineEnds,
303570
+ effects: attrs.effects,
302668
303571
  textContent: attrs.textContent,
302669
303572
  textAlign: attrs.textAlign,
302670
303573
  textVerticalAlign: attrs.textVerticalAlign,
302671
- textInsets: attrs.textInsets
303574
+ textInsets: attrs.textInsets,
303575
+ effectExtent: hasPaintExtent ? paintExtent : undefined
302672
303576
  };
302673
303577
  return this.createVectorShapeElement(vectorChild, childGeometry, false, groupScaleX, groupScaleY, context);
302674
303578
  }
@@ -303300,11 +304204,20 @@ menclose::after {
303300
304204
  if (!attrs || typeof attrs !== "object")
303301
304205
  return "";
303302
304206
  return readClipPathValue(attrs.clipPath);
304207
+ }, resolveShapeClipPathFromAttrs = (attrs) => {
304208
+ if (!attrs || typeof attrs !== "object")
304209
+ return "";
304210
+ return readClipPathValue(attrs.shapeClipPath);
303303
304211
  }, resolveBlockClipPath = (block) => {
303304
304212
  if (!block || typeof block !== "object")
303305
304213
  return "";
303306
304214
  const record3 = block;
303307
304215
  return readClipPathValue(record3.clipPath) || resolveClipPathFromAttrs(record3.attrs);
304216
+ }, resolveBlockShapeClipPath = (block) => {
304217
+ if (!block || typeof block !== "object")
304218
+ return "";
304219
+ const record3 = block;
304220
+ return readClipPathValue(record3.shapeClipPath) || resolveShapeClipPathFromAttrs(record3.attrs);
303308
304221
  }, imageHyperlinkVersion = (hyperlink) => {
303309
304222
  if (!hyperlink)
303310
304223
  return "";
@@ -303343,7 +304256,8 @@ menclose::after {
303343
304256
  image2.flipH ? 1 : 0,
303344
304257
  image2.flipV ? 1 : 0,
303345
304258
  imageHyperlinkVersion(image2.hyperlink),
303346
- resolveBlockClipPath(image2)
304259
+ resolveBlockClipPath(image2),
304260
+ resolveBlockShapeClipPath(image2)
303347
304261
  ].join("|"), renderedInlineImageRunVersion = (image2) => [
303348
304262
  "img",
303349
304263
  image2.src ?? "",
@@ -303352,6 +304266,8 @@ menclose::after {
303352
304266
  image2.alt ?? "",
303353
304267
  image2.title ?? "",
303354
304268
  typeof image2.clipPath === "string" ? image2.clipPath.trim() : "",
304269
+ typeof image2.shapeClipPath === "string" ? image2.shapeClipPath.trim() : "",
304270
+ image2.objectFit ?? "",
303355
304271
  image2.distTop ?? "",
303356
304272
  image2.distBottom ?? "",
303357
304273
  image2.distLeft ?? "",
@@ -303550,7 +304466,9 @@ menclose::after {
303550
304466
  vector.geometry.flipV ? 1 : 0,
303551
304467
  drawingTextVersion(vector),
303552
304468
  block.anchor?.offsetH ?? "",
303553
- block.anchor?.offsetV ?? ""
304469
+ block.anchor?.offsetV ?? "",
304470
+ vector.effects ? JSON.stringify(vector.effects) : "",
304471
+ vector.effectExtent ? JSON.stringify(vector.effectExtent) : ""
303554
304472
  ].join("|");
303555
304473
  }
303556
304474
  if (block.drawingKind === "shapeGroup") {
@@ -303560,6 +304478,7 @@ menclose::after {
303560
304478
  "drawing:group",
303561
304479
  group.geometry.width,
303562
304480
  group.geometry.height,
304481
+ group.effectExtent ? JSON.stringify(group.effectExtent) : "",
303563
304482
  group.groupTransform ? JSON.stringify(group.groupTransform) : "",
303564
304483
  childSignature
303565
304484
  ].join("|");
@@ -304255,6 +305174,7 @@ menclose::after {
304255
305174
  JSON.stringify(block.customGeometry ?? null),
304256
305175
  JSON.stringify(block.lineEnds ?? null),
304257
305176
  JSON.stringify(block.effectExtent ?? null),
305177
+ JSON.stringify(block.effects ?? null),
304258
305178
  JSON.stringify(block.textContent ?? null),
304259
305179
  block.textAlign ?? "",
304260
305180
  block.textVerticalAlign ?? "",
@@ -304418,7 +305338,7 @@ menclose::after {
304418
305338
  return `${block.id}:table:${contentHash}${tableAttrsKey}`;
304419
305339
  }
304420
305340
  if (block.kind !== "paragraph")
304421
- return block.id;
305341
+ return hashNonParagraphCellBlock(block);
304422
305342
  const trackedMode = block.attrs && "trackedChangesMode" in block.attrs && block.attrs.trackedChangesMode || "review";
304423
305343
  const trackedEnabled = resolveTrackedChangesEnabled(block.attrs, true);
304424
305344
  const runsHash = block.runs.map((run2) => {
@@ -305287,7 +306207,7 @@ menclose::after {
305287
306207
  }
305288
306208
  return true;
305289
306209
  }, imageRunsEqual = (a2, b$1) => {
305290
- 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);
306210
+ 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);
305291
306211
  }, imageBlocksEqual = (a2, b$1) => {
305292
306212
  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);
305293
306213
  }, drawingBlocksEqual = (a2, b$1) => {
@@ -305313,10 +306233,10 @@ menclose::after {
305313
306233
  return imageBlocksEqual(a2, b$1);
305314
306234
  if ((a2.drawingKind === "vectorShape" || a2.drawingKind === "textboxShape") && (b$1.drawingKind === "vectorShape" || b$1.drawingKind === "textboxShape")) {
305315
306235
  const textboxContentEqual = a2.drawingKind !== "textboxShape" || b$1.drawingKind !== "textboxShape" || jsonEqual(a2.contentBlocks, b$1.contentBlocks);
305316
- 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;
306236
+ 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;
305317
306237
  }
305318
306238
  if (a2.drawingKind === "shapeGroup" && b$1.drawingKind === "shapeGroup")
305319
- 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);
306239
+ 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);
305320
306240
  if (a2.drawingKind === "chart" && b$1.drawingKind === "chart")
305321
306241
  return drawingGeometryEqual(a2.geometry, b$1.geometry) && a2.chartRelId === b$1.chartRelId && jsonEqual(a2.chartData, b$1.chartData);
305322
306242
  return true;
@@ -305368,7 +306288,7 @@ menclose::after {
305368
306288
  return true;
305369
306289
  if (!a2 || !b$1)
305370
306290
  return !a2 && !b$1;
305371
- 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;
306291
+ 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);
305372
306292
  }, shapeGroupSizeEqual = (a2, b$1) => {
305373
306293
  if (a2 === b$1)
305374
306294
  return true;
@@ -308753,9 +309673,10 @@ menclose::after {
308753
309673
  const visiblePointerSurface = resolveVisibleSurfaceAtPointer(event.target, event.clientX, event.clientY);
308754
309674
  const clickedInsideVisibleActiveSurface = visiblePointerSurface?.kind === "headerFooter" && visiblePointerSurface.surface.closest(activeSurfaceSelector) != null;
308755
309675
  if (visiblePointerSurface?.kind === "bodyContent") {
308756
- const behindDocSection = (event.target instanceof Element ? event.target.closest("[data-behind-doc-section]") : null)?.dataset.behindDocSection;
309676
+ const targetElement = event.target instanceof Element ? event.target : null;
309677
+ const pageLevelSection = targetElement?.closest("[data-behind-doc-section]")?.dataset.behindDocSection ?? targetElement?.closest("[data-header-footer-overlay-section]")?.dataset.headerFooterOverlaySection;
308757
309678
  const sessionMode = session?.session?.mode;
308758
- if (behindDocSection && behindDocSection === sessionMode)
309679
+ if (pageLevelSection && pageLevelSection === sessionMode)
308759
309680
  return false;
308760
309681
  this.#callbacks.exitHeaderFooterMode?.();
308761
309682
  return false;
@@ -310848,6 +311769,11 @@ menclose::after {
310848
311769
  if (this.#activeEditor)
310849
311770
  this.#applyChildEditorDocumentMode(this.#activeEditor, mode);
310850
311771
  }
311772
+ syncEditorDocumentMode(editor) {
311773
+ if (!editor)
311774
+ return;
311775
+ this.#applyChildEditorDocumentMode(editor, this.#documentMode);
311776
+ }
310851
311777
  setTrackedChangesRenderConfig(config3) {
310852
311778
  const nextConfig = {
310853
311779
  mode: config3.mode,
@@ -313041,13 +313967,13 @@ menclose::after {
313041
313967
  return;
313042
313968
  console.log(...args$1);
313043
313969
  }, 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;
313044
- var init_src_CR8eXLKh_es = __esm(() => {
313970
+ var init_src_H1_ZZyp0_es = __esm(() => {
313045
313971
  init_rolldown_runtime_Bg48TavK_es();
313046
- init_SuperConverter_DQ2wMaLK_es();
313972
+ init_SuperConverter_5I229j_D_es();
313047
313973
  init_jszip_C49i9kUs_es();
313048
313974
  init_xml_js_CqGKpaft_es();
313049
313975
  init_uuid_B2wVPhPi_es();
313050
- init_create_headless_toolbar_BhSfQYaO_es();
313976
+ init_create_headless_toolbar_CJ0cxWlH_es();
313051
313977
  init_constants_D9qj59G2_es();
313052
313978
  init_unified_BDuVPlMu_es();
313053
313979
  init_remark_gfm_BUJjZJLy_es();
@@ -325468,6 +326394,14 @@ ${err.toString()}`);
325468
326394
  return { style: style2 };
325469
326395
  }
325470
326396
  },
326397
+ shapeClipPath: {
326398
+ default: null,
326399
+ rendered: false
326400
+ },
326401
+ objectFit: {
326402
+ default: null,
326403
+ rendered: false
326404
+ },
325471
326405
  size: {
325472
326406
  default: {},
325473
326407
  renderDOM: ({ size: size$1, shouldCover }) => {
@@ -326521,6 +327455,10 @@ ${err.toString()}`);
326521
327455
  default: null,
326522
327456
  rendered: false
326523
327457
  },
327458
+ effects: {
327459
+ default: null,
327460
+ rendered: false
327461
+ },
326524
327462
  lineEnds: {
326525
327463
  default: null,
326526
327464
  rendered: false
@@ -329212,32 +330150,419 @@ ${err.toString()}`);
329212
330150
  }]
329213
330151
  }
329214
330152
  };
329215
- F = new Set(["leftRightArrow", "upDownArrow"]);
330153
+ F = new Set([
330154
+ "bentArrow",
330155
+ "bentUpArrow",
330156
+ "downArrow",
330157
+ "leftArrow",
330158
+ "leftRightArrow",
330159
+ "leftRightUpArrow",
330160
+ "leftUpArrow",
330161
+ "quadArrow",
330162
+ "rightArrow",
330163
+ "upArrow",
330164
+ "upDownArrow",
330165
+ "uturnArrow"
330166
+ ]);
329216
330167
  X = {
330168
+ bentArrow: `<bentArrow>
330169
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
330170
+ <path w="588010" h="648335">
330171
+ <moveTo>
330172
+ <pt x="0" y="648335"/>
330173
+ </moveTo>
330174
+ <lnTo>
330175
+ <pt x="0" y="330756"/>
330176
+ </lnTo>
330177
+ <cubicBezTo>
330178
+ <pt x="0" y="188679"/>
330179
+ <pt x="115177" y="73502"/>
330180
+ <pt x="257254" y="73502"/>
330181
+ </cubicBezTo>
330182
+ <lnTo>
330183
+ <pt x="441008" y="73501"/>
330184
+ </lnTo>
330185
+ <lnTo>
330186
+ <pt x="441008" y="0"/>
330187
+ </lnTo>
330188
+ <lnTo>
330189
+ <pt x="588010" y="147003"/>
330190
+ </lnTo>
330191
+ <lnTo>
330192
+ <pt x="441008" y="294005"/>
330193
+ </lnTo>
330194
+ <lnTo>
330195
+ <pt x="441008" y="220504"/>
330196
+ </lnTo>
330197
+ <lnTo>
330198
+ <pt x="257254" y="220504"/>
330199
+ </lnTo>
330200
+ <cubicBezTo>
330201
+ <pt x="196364" y="220504"/>
330202
+ <pt x="147002" y="269866"/>
330203
+ <pt x="147002" y="330756"/>
330204
+ </cubicBezTo>
330205
+ <cubicBezTo>
330206
+ <pt x="147002" y="436616"/>
330207
+ <pt x="147003" y="542475"/>
330208
+ <pt x="147003" y="648335"/>
330209
+ </cubicBezTo>
330210
+ <lnTo>
330211
+ <pt x="0" y="648335"/>
330212
+ </lnTo>
330213
+ <close/>
330214
+ </path>
330215
+ </pathLst>
330216
+ </bentArrow>`,
330217
+ bentUpArrow: `<bentUpArrow>
330218
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
330219
+ <path w="850265" h="731520">
330220
+ <moveTo>
330221
+ <pt x="0" y="548640"/>
330222
+ </moveTo>
330223
+ <lnTo>
330224
+ <pt x="575945" y="548640"/>
330225
+ </lnTo>
330226
+ <lnTo>
330227
+ <pt x="575945" y="182880"/>
330228
+ </lnTo>
330229
+ <lnTo>
330230
+ <pt x="484505" y="182880"/>
330231
+ </lnTo>
330232
+ <lnTo>
330233
+ <pt x="667385" y="0"/>
330234
+ </lnTo>
330235
+ <lnTo>
330236
+ <pt x="850265" y="182880"/>
330237
+ </lnTo>
330238
+ <lnTo>
330239
+ <pt x="758825" y="182880"/>
330240
+ </lnTo>
330241
+ <lnTo>
330242
+ <pt x="758825" y="731520"/>
330243
+ </lnTo>
330244
+ <lnTo>
330245
+ <pt x="0" y="731520"/>
330246
+ </lnTo>
330247
+ <lnTo>
330248
+ <pt x="0" y="548640"/>
330249
+ </lnTo>
330250
+ <close/>
330251
+ </path>
330252
+ </pathLst>
330253
+ </bentUpArrow>`,
330254
+ downArrow: `<downArrow>
330255
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
330256
+ <path w="394970" h="576580">
330257
+ <moveTo>
330258
+ <pt x="0" y="379095"/>
330259
+ </moveTo>
330260
+ <lnTo>
330261
+ <pt x="98743" y="379095"/>
330262
+ </lnTo>
330263
+ <lnTo>
330264
+ <pt x="98743" y="0"/>
330265
+ </lnTo>
330266
+ <lnTo>
330267
+ <pt x="296228" y="0"/>
330268
+ </lnTo>
330269
+ <lnTo>
330270
+ <pt x="296228" y="379095"/>
330271
+ </lnTo>
330272
+ <lnTo>
330273
+ <pt x="394970" y="379095"/>
330274
+ </lnTo>
330275
+ <lnTo>
330276
+ <pt x="197485" y="576580"/>
330277
+ </lnTo>
330278
+ <lnTo>
330279
+ <pt x="0" y="379095"/>
330280
+ </lnTo>
330281
+ <close/>
330282
+ </path>
330283
+ </pathLst>
330284
+ </downArrow>`,
330285
+ leftArrow: `<leftArrow>
330286
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
330287
+ <path w="662549" h="367128">
330288
+ <moveTo>
330289
+ <pt x="0" y="183564"/>
330290
+ </moveTo>
330291
+ <lnTo>
330292
+ <pt x="183564" y="0"/>
330293
+ </lnTo>
330294
+ <lnTo>
330295
+ <pt x="183564" y="91782"/>
330296
+ </lnTo>
330297
+ <lnTo>
330298
+ <pt x="662549" y="91782"/>
330299
+ </lnTo>
330300
+ <lnTo>
330301
+ <pt x="662549" y="275346"/>
330302
+ </lnTo>
330303
+ <lnTo>
330304
+ <pt x="183564" y="275346"/>
330305
+ </lnTo>
330306
+ <lnTo>
330307
+ <pt x="183564" y="367128"/>
330308
+ </lnTo>
330309
+ <lnTo>
330310
+ <pt x="0" y="183564"/>
330311
+ </lnTo>
330312
+ <close/>
330313
+ </path>
330314
+ </pathLst>
330315
+ </leftArrow>`,
329217
330316
  leftRightArrow: `<leftRightArrow>
330317
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
330318
+ <path w="985520" h="379730">
330319
+ <moveTo>
330320
+ <pt x="0" y="189865"/>
330321
+ </moveTo>
330322
+ <lnTo>
330323
+ <pt x="189865" y="0"/>
330324
+ </lnTo>
330325
+ <lnTo>
330326
+ <pt x="189865" y="94933"/>
330327
+ </lnTo>
330328
+ <lnTo>
330329
+ <pt x="795655" y="94933"/>
330330
+ </lnTo>
330331
+ <lnTo>
330332
+ <pt x="795655" y="0"/>
330333
+ </lnTo>
330334
+ <lnTo>
330335
+ <pt x="985520" y="189865"/>
330336
+ </lnTo>
330337
+ <lnTo>
330338
+ <pt x="795655" y="379730"/>
330339
+ </lnTo>
330340
+ <lnTo>
330341
+ <pt x="795655" y="284798"/>
330342
+ </lnTo>
330343
+ <lnTo>
330344
+ <pt x="189865" y="284798"/>
330345
+ </lnTo>
330346
+ <lnTo>
330347
+ <pt x="189865" y="379730"/>
330348
+ </lnTo>
330349
+ <lnTo>
330350
+ <pt x="0" y="189865"/>
330351
+ </lnTo>
330352
+ <close/>
330353
+ </path>
330354
+ </pathLst>
330355
+ </leftRightArrow>`,
330356
+ leftRightUpArrow: `<leftRightUpArrow>
330357
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
330358
+ <path w="928370" h="634365">
330359
+ <moveTo>
330360
+ <pt x="0" y="475774"/>
330361
+ </moveTo>
330362
+ <lnTo>
330363
+ <pt x="158591" y="317183"/>
330364
+ </lnTo>
330365
+ <lnTo>
330366
+ <pt x="158591" y="396478"/>
330367
+ </lnTo>
330368
+ <lnTo>
330369
+ <pt x="384889" y="396478"/>
330370
+ </lnTo>
330371
+ <lnTo>
330372
+ <pt x="384889" y="158591"/>
330373
+ </lnTo>
330374
+ <lnTo>
330375
+ <pt x="305594" y="158591"/>
330376
+ </lnTo>
330377
+ <lnTo>
330378
+ <pt x="464185" y="0"/>
330379
+ </lnTo>
330380
+ <lnTo>
330381
+ <pt x="622776" y="158591"/>
330382
+ </lnTo>
330383
+ <lnTo>
330384
+ <pt x="543481" y="158591"/>
330385
+ </lnTo>
330386
+ <lnTo>
330387
+ <pt x="543481" y="396478"/>
330388
+ </lnTo>
330389
+ <lnTo>
330390
+ <pt x="769779" y="396478"/>
330391
+ </lnTo>
330392
+ <lnTo>
330393
+ <pt x="769779" y="317183"/>
330394
+ </lnTo>
330395
+ <lnTo>
330396
+ <pt x="928370" y="475774"/>
330397
+ </lnTo>
330398
+ <lnTo>
330399
+ <pt x="769779" y="634365"/>
330400
+ </lnTo>
330401
+ <lnTo>
330402
+ <pt x="769779" y="555069"/>
330403
+ </lnTo>
330404
+ <lnTo>
330405
+ <pt x="158591" y="555069"/>
330406
+ </lnTo>
330407
+ <lnTo>
330408
+ <pt x="158591" y="634365"/>
330409
+ </lnTo>
330410
+ <lnTo>
330411
+ <pt x="0" y="475774"/>
330412
+ </lnTo>
330413
+ <close/>
330414
+ </path>
330415
+ </pathLst>
330416
+ </leftRightUpArrow>`,
330417
+ leftUpArrow: `<leftUpArrow>
330418
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
330419
+ <path w="850265" h="850265">
330420
+ <moveTo>
330421
+ <pt x="0" y="637699"/>
330422
+ </moveTo>
330423
+ <lnTo>
330424
+ <pt x="212566" y="425133"/>
330425
+ </lnTo>
330426
+ <lnTo>
330427
+ <pt x="212566" y="531416"/>
330428
+ </lnTo>
330429
+ <lnTo>
330430
+ <pt x="531416" y="531416"/>
330431
+ </lnTo>
330432
+ <lnTo>
330433
+ <pt x="531416" y="212566"/>
330434
+ </lnTo>
330435
+ <lnTo>
330436
+ <pt x="425133" y="212566"/>
330437
+ </lnTo>
330438
+ <lnTo>
330439
+ <pt x="637699" y="0"/>
330440
+ </lnTo>
330441
+ <lnTo>
330442
+ <pt x="850265" y="212566"/>
330443
+ </lnTo>
330444
+ <lnTo>
330445
+ <pt x="743982" y="212566"/>
330446
+ </lnTo>
330447
+ <lnTo>
330448
+ <pt x="743982" y="743982"/>
330449
+ </lnTo>
330450
+ <lnTo>
330451
+ <pt x="212566" y="743982"/>
330452
+ </lnTo>
330453
+ <lnTo>
330454
+ <pt x="212566" y="850265"/>
330455
+ </lnTo>
330456
+ <lnTo>
330457
+ <pt x="0" y="637699"/>
330458
+ </lnTo>
330459
+ <close/>
330460
+ </path>
330461
+ </pathLst>
330462
+ </leftUpArrow>`,
330463
+ quadArrow: `<quadArrow>
330464
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
330465
+ <path w="788670" h="831215">
330466
+ <moveTo>
330467
+ <pt x="0" y="415608"/>
330468
+ </moveTo>
330469
+ <lnTo>
330470
+ <pt x="177451" y="238157"/>
330471
+ </lnTo>
330472
+ <lnTo>
330473
+ <pt x="177451" y="326882"/>
330474
+ </lnTo>
330475
+ <lnTo>
330476
+ <pt x="305610" y="326882"/>
330477
+ </lnTo>
330478
+ <lnTo>
330479
+ <pt x="305610" y="177451"/>
330480
+ </lnTo>
330481
+ <lnTo>
330482
+ <pt x="216884" y="177451"/>
330483
+ </lnTo>
330484
+ <lnTo>
330485
+ <pt x="394335" y="0"/>
330486
+ </lnTo>
330487
+ <lnTo>
330488
+ <pt x="571786" y="177451"/>
330489
+ </lnTo>
330490
+ <lnTo>
330491
+ <pt x="483060" y="177451"/>
330492
+ </lnTo>
330493
+ <lnTo>
330494
+ <pt x="483060" y="326882"/>
330495
+ </lnTo>
330496
+ <lnTo>
330497
+ <pt x="611219" y="326882"/>
330498
+ </lnTo>
330499
+ <lnTo>
330500
+ <pt x="611219" y="238157"/>
330501
+ </lnTo>
330502
+ <lnTo>
330503
+ <pt x="788670" y="415608"/>
330504
+ </lnTo>
330505
+ <lnTo>
330506
+ <pt x="611219" y="593058"/>
330507
+ </lnTo>
330508
+ <lnTo>
330509
+ <pt x="611219" y="504333"/>
330510
+ </lnTo>
330511
+ <lnTo>
330512
+ <pt x="483060" y="504333"/>
330513
+ </lnTo>
330514
+ <lnTo>
330515
+ <pt x="483060" y="653764"/>
330516
+ </lnTo>
330517
+ <lnTo>
330518
+ <pt x="571786" y="653764"/>
330519
+ </lnTo>
330520
+ <lnTo>
330521
+ <pt x="394335" y="831215"/>
330522
+ </lnTo>
330523
+ <lnTo>
330524
+ <pt x="216884" y="653764"/>
330525
+ </lnTo>
330526
+ <lnTo>
330527
+ <pt x="305610" y="653764"/>
330528
+ </lnTo>
330529
+ <lnTo>
330530
+ <pt x="305610" y="504333"/>
330531
+ </lnTo>
330532
+ <lnTo>
330533
+ <pt x="177451" y="504333"/>
330534
+ </lnTo>
330535
+ <lnTo>
330536
+ <pt x="177451" y="593058"/>
330537
+ </lnTo>
330538
+ <lnTo>
330539
+ <pt x="0" y="415608"/>
330540
+ </lnTo>
330541
+ <close/>
330542
+ </path>
330543
+ </pathLst>
330544
+ </quadArrow>`,
330545
+ rightArrow: `<rightArrow>
329218
330546
  <avLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
329219
330547
  <gd name="adj1" fmla="val 50000"/>
329220
330548
  <gd name="adj2" fmla="val 50000"/>
329221
330549
  </avLst>
329222
330550
  <gdLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
329223
- <gd name="maxAdj2" fmla="*/ 50000 w ss"/>
330551
+ <gd name="maxAdj2" fmla="*/ 100000 w ss"/>
329224
330552
  <gd name="a1" fmla="pin 0 adj1 100000"/>
329225
330553
  <gd name="a2" fmla="pin 0 adj2 maxAdj2"/>
329226
- <gd name="x2" fmla="*/ ss a2 100000"/>
329227
- <gd name="x3" fmla="+- r 0 x2"/>
329228
- <gd name="dy" fmla="*/ h a1 200000"/>
329229
- <gd name="y1" fmla="+- vc 0 dy"/>
329230
- <gd name="y2" fmla="+- vc dy 0"/>
329231
- <gd name="dx1" fmla="*/ y1 x2 hd2"/>
329232
- <gd name="x1" fmla="+- x2 0 dx1"/>
329233
- <gd name="x4" fmla="+- x3 dx1 0"/>
330554
+ <gd name="dx1" fmla="*/ ss a2 100000"/>
330555
+ <gd name="x1" fmla="+- r 0 dx1"/>
330556
+ <gd name="dy1" fmla="*/ h a1 200000"/>
330557
+ <gd name="y1" fmla="+- vc 0 dy1"/>
330558
+ <gd name="y2" fmla="+- vc dy1 0"/>
329234
330559
  </gdLst>
329235
330560
  <ahLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
329236
330561
  <ahXY gdRefY="adj1" minY="0" maxY="100000">
329237
- <pos x="x3" y="y1"/>
330562
+ <pos x="x1" y="y1"/>
329238
330563
  </ahXY>
329239
330564
  <ahXY gdRefX="adj2" minX="0" maxX="maxAdj2">
329240
- <pos x="x2" y="t"/>
330565
+ <pos x="x1" y="t"/>
329241
330566
  </ahXY>
329242
330567
  </ahLst>
329243
330568
  <cxnLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
@@ -329245,147 +330570,177 @@ ${err.toString()}`);
329245
330570
  <pos x="r" y="vc"/>
329246
330571
  </cxn>
329247
330572
  <cxn ang="cd4">
329248
- <pos x="x3" y="b"/>
329249
- </cxn>
329250
- <cxn ang="cd4">
329251
- <pos x="x2" y="b"/>
330573
+ <pos x="x1" y="b"/>
329252
330574
  </cxn>
329253
330575
  <cxn ang="cd2">
329254
330576
  <pos x="l" y="vc"/>
329255
330577
  </cxn>
329256
330578
  <cxn ang="3cd4">
329257
- <pos x="x2" y="t"/>
329258
- </cxn>
329259
- <cxn ang="3cd4">
329260
- <pos x="x3" y="t"/>
330579
+ <pos x="x1" y="t"/>
329261
330580
  </cxn>
329262
330581
  </cxnLst>
329263
- <rect l="x1" t="y1" r="x4" b="y2" xmlns="http://schemas.openxmlformats.org/drawingml/2006/main"/>
330582
+ <rect l="l" t="y1" r="x1" b="y2" xmlns="http://schemas.openxmlformats.org/drawingml/2006/main"/>
329264
330583
  <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
329265
330584
  <path>
329266
330585
  <moveTo>
329267
- <pt x="l" y="vc"/>
330586
+ <pt x="l" y="y1"/>
329268
330587
  </moveTo>
329269
330588
  <lnTo>
329270
- <pt x="x2" y="t"/>
330589
+ <pt x="x1" y="y1"/>
329271
330590
  </lnTo>
329272
330591
  <lnTo>
329273
- <pt x="x2" y="y1"/>
330592
+ <pt x="x1" y="t"/>
329274
330593
  </lnTo>
329275
330594
  <lnTo>
329276
- <pt x="x3" y="y1"/>
330595
+ <pt x="r" y="vc"/>
329277
330596
  </lnTo>
329278
330597
  <lnTo>
329279
- <pt x="x3" y="t"/>
330598
+ <pt x="x1" y="b"/>
329280
330599
  </lnTo>
329281
330600
  <lnTo>
329282
- <pt x="r" y="vc"/>
330601
+ <pt x="x1" y="y2"/>
330602
+ </lnTo>
330603
+ <lnTo>
330604
+ <pt x="l" y="y2"/>
330605
+ </lnTo>
330606
+ <close/>
330607
+ </path>
330608
+ </pathLst>
330609
+ </rightArrow>`,
330610
+ upArrow: `<upArrow>
330611
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
330612
+ <path w="367127" h="550008">
330613
+ <moveTo>
330614
+ <pt x="0" y="183564"/>
330615
+ </moveTo>
330616
+ <lnTo>
330617
+ <pt x="183564" y="0"/>
330618
+ </lnTo>
330619
+ <lnTo>
330620
+ <pt x="367127" y="183564"/>
330621
+ </lnTo>
330622
+ <lnTo>
330623
+ <pt x="275345" y="183564"/>
329283
330624
  </lnTo>
329284
330625
  <lnTo>
329285
- <pt x="x3" y="b"/>
330626
+ <pt x="275345" y="550008"/>
329286
330627
  </lnTo>
329287
330628
  <lnTo>
329288
- <pt x="x3" y="y2"/>
330629
+ <pt x="91782" y="550008"/>
329289
330630
  </lnTo>
329290
330631
  <lnTo>
329291
- <pt x="x2" y="y2"/>
330632
+ <pt x="91782" y="183564"/>
329292
330633
  </lnTo>
329293
330634
  <lnTo>
329294
- <pt x="x2" y="b"/>
330635
+ <pt x="0" y="183564"/>
329295
330636
  </lnTo>
329296
330637
  <close/>
329297
330638
  </path>
329298
330639
  </pathLst>
329299
- </leftRightArrow>`,
330640
+ </upArrow>`,
329300
330641
  upDownArrow: `<upDownArrow>
329301
- <avLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
329302
- <gd name="adj1" fmla="val 50000"/>
329303
- <gd name="adj2" fmla="val 50000"/>
329304
- </avLst>
329305
- <gdLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
329306
- <gd name="maxAdj2" fmla="*/ 50000 h ss"/>
329307
- <gd name="a1" fmla="pin 0 adj1 100000"/>
329308
- <gd name="a2" fmla="pin 0 adj2 maxAdj2"/>
329309
- <gd name="y2" fmla="*/ ss a2 100000"/>
329310
- <gd name="y3" fmla="+- b 0 y2"/>
329311
- <gd name="dx1" fmla="*/ w a1 200000"/>
329312
- <gd name="x1" fmla="+- hc 0 dx1"/>
329313
- <gd name="x2" fmla="+- hc dx1 0"/>
329314
- <gd name="dy1" fmla="*/ x1 y2 wd2"/>
329315
- <gd name="y1" fmla="+- y2 0 dy1"/>
329316
- <gd name="y4" fmla="+- y3 dy1 0"/>
329317
- </gdLst>
329318
- <ahLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
329319
- <ahXY gdRefX="adj1" minX="0" maxX="100000">
329320
- <pos x="x1" y="y3"/>
329321
- </ahXY>
329322
- <ahXY gdRefY="adj2" minY="0" maxY="maxAdj2">
329323
- <pos x="l" y="y2"/>
329324
- </ahXY>
329325
- </ahLst>
329326
- <cxnLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
329327
- <cxn ang="3cd4">
329328
- <pos x="hc" y="t"/>
329329
- </cxn>
329330
- <cxn ang="cd2">
329331
- <pos x="l" y="y2"/>
329332
- </cxn>
329333
- <cxn ang="cd2">
329334
- <pos x="x1" y="vc"/>
329335
- </cxn>
329336
- <cxn ang="cd2">
329337
- <pos x="l" y="y3"/>
329338
- </cxn>
329339
- <cxn ang="cd4">
329340
- <pos x="hc" y="b"/>
329341
- </cxn>
329342
- <cxn ang="0">
329343
- <pos x="r" y="y3"/>
329344
- </cxn>
329345
- <cxn ang="0">
329346
- <pos x="x2" y="vc"/>
329347
- </cxn>
329348
- <cxn ang="0">
329349
- <pos x="r" y="y2"/>
329350
- </cxn>
329351
- </cxnLst>
329352
- <rect l="x1" t="y1" r="x2" b="y4" xmlns="http://schemas.openxmlformats.org/drawingml/2006/main"/>
329353
330642
  <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
329354
- <path>
330643
+ <path w="296545" h="746760">
329355
330644
  <moveTo>
329356
- <pt x="l" y="y2"/>
330645
+ <pt x="0" y="148273"/>
329357
330646
  </moveTo>
329358
330647
  <lnTo>
329359
- <pt x="hc" y="t"/>
330648
+ <pt x="148273" y="0"/>
329360
330649
  </lnTo>
329361
330650
  <lnTo>
329362
- <pt x="r" y="y2"/>
330651
+ <pt x="296545" y="148273"/>
329363
330652
  </lnTo>
329364
330653
  <lnTo>
329365
- <pt x="x2" y="y2"/>
330654
+ <pt x="222409" y="148273"/>
329366
330655
  </lnTo>
329367
330656
  <lnTo>
329368
- <pt x="x2" y="y3"/>
330657
+ <pt x="222409" y="598488"/>
329369
330658
  </lnTo>
329370
330659
  <lnTo>
329371
- <pt x="r" y="y3"/>
330660
+ <pt x="296545" y="598488"/>
329372
330661
  </lnTo>
329373
330662
  <lnTo>
329374
- <pt x="hc" y="b"/>
330663
+ <pt x="148273" y="746760"/>
329375
330664
  </lnTo>
329376
330665
  <lnTo>
329377
- <pt x="l" y="y3"/>
330666
+ <pt x="0" y="598488"/>
329378
330667
  </lnTo>
329379
330668
  <lnTo>
329380
- <pt x="x1" y="y3"/>
330669
+ <pt x="74136" y="598488"/>
329381
330670
  </lnTo>
329382
330671
  <lnTo>
329383
- <pt x="x1" y="y2"/>
330672
+ <pt x="74136" y="148273"/>
330673
+ </lnTo>
330674
+ <lnTo>
330675
+ <pt x="0" y="148273"/>
330676
+ </lnTo>
330677
+ <close/>
330678
+ </path>
330679
+ </pathLst>
330680
+ </upDownArrow>`,
330681
+ uturnArrow: `<uturnArrow>
330682
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
330683
+ <path w="886460" h="661035">
330684
+ <moveTo>
330685
+ <pt x="0" y="661035"/>
330686
+ </moveTo>
330687
+ <lnTo>
330688
+ <pt x="0" y="289203"/>
330689
+ </lnTo>
330690
+ <cubicBezTo>
330691
+ <pt x="0" y="129481"/>
330692
+ <pt x="129481" y="0"/>
330693
+ <pt x="289203" y="0"/>
330694
+ </cubicBezTo>
330695
+ <lnTo>
330696
+ <pt x="514628" y="0"/>
330697
+ </lnTo>
330698
+ <cubicBezTo>
330699
+ <pt x="674350" y="0"/>
330700
+ <pt x="803831" y="129481"/>
330701
+ <pt x="803831" y="289203"/>
330702
+ </cubicBezTo>
330703
+ <lnTo>
330704
+ <pt x="803831" y="330518"/>
330705
+ </lnTo>
330706
+ <lnTo>
330707
+ <pt x="886460" y="330518"/>
330708
+ </lnTo>
330709
+ <lnTo>
330710
+ <pt x="721201" y="495776"/>
330711
+ </lnTo>
330712
+ <lnTo>
330713
+ <pt x="555943" y="330518"/>
330714
+ </lnTo>
330715
+ <lnTo>
330716
+ <pt x="638572" y="330518"/>
330717
+ </lnTo>
330718
+ <lnTo>
330719
+ <pt x="638572" y="289203"/>
330720
+ </lnTo>
330721
+ <cubicBezTo>
330722
+ <pt x="638572" y="220751"/>
330723
+ <pt x="583080" y="165259"/>
330724
+ <pt x="514628" y="165259"/>
330725
+ </cubicBezTo>
330726
+ <lnTo>
330727
+ <pt x="289203" y="165259"/>
330728
+ </lnTo>
330729
+ <cubicBezTo>
330730
+ <pt x="220751" y="165259"/>
330731
+ <pt x="165259" y="220751"/>
330732
+ <pt x="165259" y="289203"/>
330733
+ </cubicBezTo>
330734
+ <lnTo>
330735
+ <pt x="165259" y="661035"/>
330736
+ </lnTo>
330737
+ <lnTo>
330738
+ <pt x="0" y="661035"/>
329384
330739
  </lnTo>
329385
330740
  <close/>
329386
330741
  </path>
329387
330742
  </pathLst>
329388
- </upDownArrow>`
330743
+ </uturnArrow>`
329389
330744
  };
329390
330745
  G = {
329391
330746
  darken: "color-mix(in srgb, currentColor 60%, black)",
@@ -329489,6 +330844,10 @@ ${err.toString()}`);
329489
330844
  default: null,
329490
330845
  rendered: false
329491
330846
  },
330847
+ effects: {
330848
+ default: null,
330849
+ rendered: false
330850
+ },
329492
330851
  rotation: {
329493
330852
  default: 0,
329494
330853
  renderDOM: (attrs) => {
@@ -329623,6 +330982,10 @@ ${err.toString()}`);
329623
330982
  return offsetData;
329624
330983
  }
329625
330984
  },
330985
+ effectExtent: {
330986
+ default: null,
330987
+ rendered: false
330988
+ },
329626
330989
  hidden: {
329627
330990
  default: false,
329628
330991
  rendered: false
@@ -352185,7 +353548,14 @@ function print() { __p += __j.call(arguments, '') }
352185
353548
  this.#historyCoordinator?.syncParticipant(participantKey);
352186
353549
  }
352187
353550
  #syncActiveStorySessionDocumentMode(session) {
352188
- if (!session || session.kind !== "note")
353551
+ if (!session)
353552
+ return;
353553
+ if (session.kind === "headerFooter") {
353554
+ this.#headerFooterSession?.setDocumentMode(this.#documentMode);
353555
+ this.#headerFooterSession?.syncEditorDocumentMode(session.editor);
353556
+ return;
353557
+ }
353558
+ if (session.kind !== "note")
352189
353559
  return;
352190
353560
  if (typeof session.editor.setDocumentMode === "function") {
352191
353561
  session.editor.setDocumentMode(this.#documentMode);
@@ -355897,11 +357267,11 @@ function print() { __p += __j.call(arguments, '') }
355897
357267
  ]);
355898
357268
  });
355899
357269
 
355900
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-BjToI9WN.es.js
357270
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-DH0tcWfI.es.js
355901
357271
  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;
355902
- var init_create_super_doc_ui_BjToI9WN_es = __esm(() => {
355903
- init_SuperConverter_DQ2wMaLK_es();
355904
- init_create_headless_toolbar_BhSfQYaO_es();
357272
+ var init_create_super_doc_ui_DH0tcWfI_es = __esm(() => {
357273
+ init_SuperConverter_5I229j_D_es();
357274
+ init_create_headless_toolbar_CJ0cxWlH_es();
355905
357275
  DEFAULT_TEXT_ALIGN_OPTIONS = [
355906
357276
  {
355907
357277
  label: "Left",
@@ -356192,15 +357562,15 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
356192
357562
 
356193
357563
  // ../../packages/superdoc/dist/super-editor.es.js
356194
357564
  var init_super_editor_es = __esm(() => {
356195
- init_src_CR8eXLKh_es();
356196
- init_SuperConverter_DQ2wMaLK_es();
357565
+ init_src_H1_ZZyp0_es();
357566
+ init_SuperConverter_5I229j_D_es();
356197
357567
  init_jszip_C49i9kUs_es();
356198
357568
  init_xml_js_CqGKpaft_es();
356199
- init_create_headless_toolbar_BhSfQYaO_es();
357569
+ init_create_headless_toolbar_CJ0cxWlH_es();
356200
357570
  init_constants_D9qj59G2_es();
356201
357571
  init_unified_BDuVPlMu_es();
356202
357572
  init_DocxZipper_BzS208BW_es();
356203
- init_create_super_doc_ui_BjToI9WN_es();
357573
+ init_create_super_doc_ui_DH0tcWfI_es();
356204
357574
  init_ui_CGB3qmy3_es();
356205
357575
  init_eventemitter3_UwU_CLPU_es();
356206
357576
  init_errors_C_DoKMoN_es();
@@ -380241,7 +381611,6 @@ function resolveFloatingZIndex2(behindDoc, raw, fallback = 1) {
380241
381611
  return Math.max(1, raw);
380242
381612
  }
380243
381613
  var isPlainObject7 = (value) => value !== null && typeof value === "object" && !Array.isArray(value), OOXML_Z_INDEX_BASE3 = 251658240;
380244
-
380245
381614
  // ../../packages/layout-engine/contracts/src/justify-utils.ts
380246
381615
  var SPACE_CHARS2;
380247
381616
  var init_justify_utils = __esm(() => {
@@ -381161,6 +382530,37 @@ function toDrawingContentSnapshot2(value) {
381161
382530
  }
381162
382531
  return snapshot2;
381163
382532
  }
382533
+ function normalizeShapeEffects2(value) {
382534
+ if (!value || typeof value !== "object")
382535
+ return;
382536
+ const maybe = value;
382537
+ const outerShadow = normalizeOuterShadowEffect2(maybe.outerShadow);
382538
+ return outerShadow ? { outerShadow } : undefined;
382539
+ }
382540
+ function normalizeOuterShadowEffect2(value) {
382541
+ if (!value || typeof value !== "object")
382542
+ return;
382543
+ const maybe = value;
382544
+ if (maybe.type !== "outerShadow")
382545
+ return;
382546
+ const blurRadius = coerceNumber2(maybe.blurRadius);
382547
+ const distance = coerceNumber2(maybe.distance);
382548
+ const direction = coerceNumber2(maybe.direction);
382549
+ const opacity = coerceNumber2(maybe.opacity);
382550
+ if (blurRadius == null || blurRadius < 0 || distance == null || distance < 0 || direction == null || opacity == null || typeof maybe.color !== "string") {
382551
+ return;
382552
+ }
382553
+ const clamp2 = (val) => Math.max(0, Math.min(1, val));
382554
+ const normalized = {
382555
+ type: "outerShadow",
382556
+ blurRadius,
382557
+ distance,
382558
+ direction,
382559
+ color: maybe.color,
382560
+ opacity: clamp2(opacity)
382561
+ };
382562
+ return Object.fromEntries(Object.entries(normalized).filter(([, fieldValue]) => fieldValue !== undefined));
382563
+ }
381164
382564
  function isGradientFill2(value) {
381165
382565
  if (!isPlainObject8(value))
381166
382566
  return false;
@@ -381219,6 +382619,26 @@ function normalizeTextContent2(value) {
381219
382619
  if (["left", "center", "right"].includes(value.horizontalAlign)) {
381220
382620
  result.horizontalAlign = value.horizontalAlign;
381221
382621
  }
382622
+ if (Array.isArray(value.paragraphs)) {
382623
+ const normalizedParagraphs = value.paragraphs.map((paragraph3) => {
382624
+ if (!isPlainObject8(paragraph3))
382625
+ return {};
382626
+ const spacing = isPlainObject8(paragraph3.spacing) ? paragraph3.spacing : undefined;
382627
+ const before = Number.isFinite(spacing?.before) ? spacing.before : undefined;
382628
+ const after = Number.isFinite(spacing?.after) ? spacing.after : undefined;
382629
+ if (before === undefined && after === undefined)
382630
+ return {};
382631
+ const out = { spacing: {} };
382632
+ if (before !== undefined)
382633
+ out.spacing.before = before;
382634
+ if (after !== undefined)
382635
+ out.spacing.after = after;
382636
+ return out;
382637
+ });
382638
+ if (normalizedParagraphs.some((paragraph3) => ("spacing" in paragraph3))) {
382639
+ result.paragraphs = normalizedParagraphs;
382640
+ }
382641
+ }
381222
382642
  return result;
381223
382643
  }
381224
382644
  function normalizeTextVerticalAlign2(value) {
@@ -390120,6 +391540,10 @@ function imageNodeToRun2({ node: node3, positions, sdtMetadata }) {
390120
391540
  run2.title = attrs.title;
390121
391541
  if (typeof attrs.clipPath === "string")
390122
391542
  run2.clipPath = attrs.clipPath;
391543
+ if (typeof attrs.shapeClipPath === "string")
391544
+ run2.shapeClipPath = attrs.shapeClipPath;
391545
+ if (isAllowedObjectFit2(attrs.objectFit))
391546
+ run2.objectFit = attrs.objectFit;
390123
391547
  const distTop = pickNumber2(wrapAttrs.distTop ?? wrapAttrs.distT);
390124
391548
  if (distTop != null)
390125
391549
  run2.distTop = distTop;
@@ -390200,7 +391624,7 @@ function isInlineImage2(node3) {
390200
391624
  }
390201
391625
  return false;
390202
391626
  }
390203
- var DEFAULT_IMAGE_DIMENSION_PX2 = 100, isNodeHidden2 = (node3) => {
391627
+ var DEFAULT_IMAGE_DIMENSION_PX2 = 100, ALLOWED_OBJECT_FIT2, isAllowedObjectFit2 = (value) => typeof value === "string" && ALLOWED_OBJECT_FIT2.has(value), isNodeHidden2 = (node3) => {
390204
391628
  const attrs = node3.attrs ?? {};
390205
391629
  if (attrs.hidden === true)
390206
391630
  return true;
@@ -390209,6 +391633,7 @@ var DEFAULT_IMAGE_DIMENSION_PX2 = 100, isNodeHidden2 = (node3) => {
390209
391633
  var init_image = __esm(() => {
390210
391634
  init_utilities();
390211
391635
  init_common();
391636
+ ALLOWED_OBJECT_FIT2 = new Set(["contain", "cover", "fill", "scale-down"]);
390212
391637
  });
390213
391638
 
390214
391639
  // ../../packages/super-editor/src/editors/v1/core/layout-adapter/converters/inline-converters/cross-reference.ts
@@ -390636,6 +392061,7 @@ var WRAP_TYPES2, WRAP_TEXT_VALUES2, H_RELATIVE_VALUES2, V_RELATIVE_VALUES2, H_AL
390636
392061
  fillColor: normalizeFillColor2(rawAttrs.fillColor),
390637
392062
  strokeColor: normalizeStrokeColor2(rawAttrs.strokeColor),
390638
392063
  strokeWidth: coerceNumber2(rawAttrs.strokeWidth),
392064
+ effects: normalizeShapeEffects2(rawAttrs.effects),
390639
392065
  textContent: normalizeTextContent2(rawAttrs.textContent),
390640
392066
  textAlign: typeof rawAttrs.textAlign === "string" ? rawAttrs.textAlign : undefined,
390641
392067
  textVerticalAlign: normalizeTextVerticalAlign2(rawAttrs.textVerticalAlign),
@@ -390645,6 +392071,7 @@ var WRAP_TYPES2, WRAP_TEXT_VALUES2, H_RELATIVE_VALUES2, V_RELATIVE_VALUES2, H_AL
390645
392071
  };
390646
392072
  };
390647
392073
  var init_shapes = __esm(() => {
392074
+ init_src();
390648
392075
  init_utilities();
390649
392076
  init_paragraph2();
390650
392077
  WRAP_TYPES2 = new Set(["None", "Square", "Tight", "Through", "TopAndBottom", "Inline"]);
@@ -390789,7 +392216,7 @@ function imageNodeToBlock2(node3, nextBlockId, positions, _trackedMeta, _tracked
390789
392216
  const lumContrast = pickNumber2(lum?.contrast);
390790
392217
  const alphaModFix = isPlainObject10(attrs.alphaModFix) ? attrs.alphaModFix : undefined;
390791
392218
  const alphaModFixAmt = pickNumber2(alphaModFix?.amt);
390792
- const objectFit = isAllowedObjectFit2(explicitObjectFit) ? explicitObjectFit : shouldCover ? "cover" : display === "inline" ? "scale-down" : isAnchor ? "contain" : "contain";
392219
+ const objectFit = isAllowedObjectFit3(explicitObjectFit) ? explicitObjectFit : shouldCover ? "cover" : display === "inline" ? "scale-down" : isAnchor ? "contain" : "contain";
390793
392220
  const zIndexFromRelativeHeight = normalizeZIndex2(attrs.originalAttributes);
390794
392221
  const zIndex = resolveFloatingZIndex2(anchor?.behindDoc === true, zIndexFromRelativeHeight);
390795
392222
  const transformData = isPlainObject10(attrs.transformData) ? attrs.transformData : undefined;
@@ -390845,7 +392272,7 @@ function handleImageNode2(node3, context) {
390845
392272
  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) => {
390846
392273
  const sourceAnchor = attrs.sourceAnchor;
390847
392274
  return isPlainObject10(sourceAnchor) ? sourceAnchor : undefined;
390848
- }, isAllowedObjectFit2 = (value) => {
392275
+ }, isAllowedObjectFit3 = (value) => {
390849
392276
  return value === "contain" || value === "cover" || value === "fill" || value === "scale-down";
390850
392277
  }, isHiddenDrawing2 = (attrs) => {
390851
392278
  if (toBoolean4(attrs.hidden) === true)
@@ -433196,6 +434623,35 @@ function extractLineEnds2(spPr) {
433196
434623
  return null;
433197
434624
  return { head: headConfig ?? undefined, tail: tailConfig ?? undefined };
433198
434625
  }
434626
+ function extractShapeEffects2(spPr) {
434627
+ const outerShadow = extractOuterShadowEffect2(spPr);
434628
+ if (!outerShadow)
434629
+ return null;
434630
+ return { outerShadow };
434631
+ }
434632
+ function extractOuterShadowEffect2(spPr) {
434633
+ const effectLst = findChildByLocalName2(spPr?.elements, "effectLst");
434634
+ const outerShdw = findChildByLocalName2(effectLst?.elements, "outerShdw");
434635
+ if (!outerShdw)
434636
+ return null;
434637
+ const colorResult = extractColorFromElement2(outerShdw);
434638
+ if (!colorResult)
434639
+ return null;
434640
+ return stripUndefined2({
434641
+ type: "outerShadow",
434642
+ blurRadius: finiteNumberOrZero2(emuToPixels2(outerShdw.attributes?.blurRad)),
434643
+ distance: finiteNumberOrZero2(emuToPixels2(outerShdw.attributes?.dist)),
434644
+ direction: finiteNumberOrZero2(rotToDegrees2(outerShdw.attributes?.dir)),
434645
+ color: colorResult.color,
434646
+ opacity: colorResult.alpha ?? 1
434647
+ });
434648
+ }
434649
+ function finiteNumberOrZero2(value) {
434650
+ return Number.isFinite(value) ? value : 0;
434651
+ }
434652
+ function stripUndefined2(value) {
434653
+ return Object.fromEntries(Object.entries(value).filter(([, fieldValue]) => fieldValue !== undefined));
434654
+ }
433199
434655
  function extractStrokeColor2(spPr, style2) {
433200
434656
  const ln = findChildByLocalName2(spPr?.elements, "ln");
433201
434657
  if (ln) {
@@ -433367,7 +434823,9 @@ function extractGradientFill2(gradFill) {
433367
434823
  }
433368
434824
  return gradient;
433369
434825
  }
433370
- var init_vector_shape_helpers = () => {};
434826
+ var init_vector_shape_helpers = __esm(() => {
434827
+ init_helpers();
434828
+ });
433371
434829
 
433372
434830
  // ../../packages/super-editor/src/editors/v1/core/super-converter/v3/handlers/wp/helpers/rtfjs/util/SVG.ts
433373
434831
  class SVGFilters2 {
@@ -448681,6 +450139,26 @@ function resolveParagraphPropertiesForTextBox2(paragraph4, params3) {
448681
450139
  const inlineParagraphProperties = pPr ? translator108.encode({ ...params3, nodes: [pPr] }) || {} : {};
448682
450140
  return resolveParagraphProperties2(params3, inlineParagraphProperties, false, false, null);
448683
450141
  }
450142
+ function extractTextBoxParagraphSpacing2(paragraphProperties, { paragraphIndex, paragraphCount, spcFirstLastPara } = {}) {
450143
+ const spacing = paragraphProperties?.spacing;
450144
+ if (!spacing)
450145
+ return;
450146
+ const honorFirstLast = spcFirstLastPara === "1" || spcFirstLastPara === 1 || spcFirstLastPara === true || spcFirstLastPara === "true" || spcFirstLastPara === "on";
450147
+ const isFirst = paragraphIndex === 0;
450148
+ const isLast = paragraphCount != null && paragraphIndex === paragraphCount - 1;
450149
+ const result = {};
450150
+ if (typeof spacing.before === "number" && !(isFirst && !honorFirstLast)) {
450151
+ const px = twipsToPixels4(spacing.before);
450152
+ if (typeof px === "number")
450153
+ result.before = px;
450154
+ }
450155
+ if (typeof spacing.after === "number" && !(isLast && !honorFirstLast)) {
450156
+ const px = twipsToPixels4(spacing.after);
450157
+ if (typeof px === "number")
450158
+ result.after = px;
450159
+ }
450160
+ return result.before === undefined && result.after === undefined ? undefined : result;
450161
+ }
448684
450162
  function extractRunFormatting2(rPr, paragraphProperties, params3) {
448685
450163
  const inlineRunProperties = rPr ? translator98.encode({ ...params3, nodes: [rPr] }) || {} : {};
448686
450164
  const resolvedRunProperties = resolveRunProperties2(params3, inlineRunProperties, paragraphProperties || {});
@@ -448745,7 +450223,8 @@ function extractBodyPrProperties2(bodyPr) {
448745
450223
  left: lIns * EMU_TO_PX
448746
450224
  };
448747
450225
  const wrap6 = bodyPrAttrs["wrap"] || "square";
448748
- return { verticalAlign, insets, wrap: wrap6 };
450226
+ const spcFirstLastPara = bodyPrAttrs["spcFirstLastPara"];
450227
+ return { verticalAlign, insets, wrap: wrap6, spcFirstLastPara };
448749
450228
  }
448750
450229
  var HEADER_FOOTER_FILENAME_PATTERN2, DEFAULT_TAB_INTERVAL_TWIPS3 = 720;
448751
450230
  var init_textbox_content_helpers = __esm(() => {
@@ -449309,7 +450788,7 @@ function handleImageNode3(node4, params3, isAnchor) {
449309
450788
  horizontal: positionHValue,
449310
450789
  top: positionVValue
449311
450790
  };
449312
- return handleShapeGroup2(params3, node4, graphicData, size3, padding, shapeMarginOffset, anchorData, wrap6, isHidden);
450791
+ return handleShapeGroup2(params3, node4, graphicData, size3, padding, shapeMarginOffset, anchorData, wrap6, extractEffectExtent2(node4), isHidden);
449313
450792
  }
449314
450793
  if (uri === CHART_URI) {
449315
450794
  return handleChartDrawing2(params3, node4, graphicData, size3, padding, marginOffset, anchorData, wrap6, isAnchor);
@@ -449332,18 +450811,7 @@ function handleImageNode3(node4, params3, isAnchor) {
449332
450811
  ...Number.isFinite(rawContrast) ? { contrast: rawContrast } : {}
449333
450812
  } : undefined;
449334
450813
  const alphaModFix = extractAlphaModFix2(blip);
449335
- const stretch = findChildByLocalName2(blipFill?.elements, "stretch");
449336
- const fillRect = findChildByLocalName2(stretch?.elements, "fillRect");
449337
- const srcRect = findChildByLocalName2(blipFill?.elements, "srcRect");
449338
- const srcRectAttrs = srcRect?.attributes || {};
449339
- const clipPath = buildClipPathFromSrcRect2(srcRectAttrs);
449340
- const srcRectHasNegativeValues = ["l", "t", "r", "b"].some((attr) => {
449341
- const val = srcRectAttrs[attr];
449342
- return val != null && parseFloat(val) < 0;
449343
- });
449344
- const shouldStretch = Boolean(stretch && fillRect);
449345
- const shouldCover = shouldStretch && !srcRectHasNegativeValues && !clipPath;
449346
- const shouldFillClippedStretch = shouldStretch && !srcRectHasNegativeValues && Boolean(clipPath);
450814
+ const { clipPath, rawSrcRect, shouldCover, shouldFillClippedStretch, shouldCoverShapeStretch, shapeClipPath } = extractPicturePresentation2(picture);
449347
450815
  const spPr = picture.elements.find((el) => el.name === "pic:spPr");
449348
450816
  if (spPr) {
449349
450817
  const xfrm = findChildByLocalName2(spPr.elements, "xfrm");
@@ -449474,9 +450942,10 @@ function handleImageNode3(node4, params3, isAnchor) {
449474
450942
  } : {},
449475
450943
  wrapTopAndBottom: wrap6.type === "TopAndBottom",
449476
450944
  shouldCover,
449477
- ...shouldFillClippedStretch ? { objectFit: "fill" } : {},
450945
+ ...shouldFillClippedStretch ? { objectFit: "fill" } : shouldCoverShapeStretch ? { objectFit: "cover" } : {},
449478
450946
  ...clipPath ? { clipPath } : {},
449479
- rawSrcRect: srcRect,
450947
+ ...shapeClipPath ? { shapeClipPath } : {},
450948
+ rawSrcRect,
449480
450949
  originalPadding: {
449481
450950
  distT: attributes["distT"],
449482
450951
  distB: attributes["distB"],
@@ -449523,7 +450992,9 @@ function extractTextFromTextBox2(textBoxContent, bodyPr, params3 = {}) {
449523
450992
  const processedContent = preProcessTextBoxContent2(textBoxContent, params3);
449524
450993
  const paragraphs = collectTextBoxParagraphs2(processedContent?.elements || []);
449525
450994
  const textParts = [];
450995
+ const paragraphMetadata = [];
449526
450996
  let horizontalAlign = null;
450997
+ const { verticalAlign, insets, wrap: wrap6, spcFirstLastPara } = extractBodyPrProperties2(bodyPr);
449527
450998
  const appendFieldPart = (fieldType, node4, paragraphProperties) => {
449528
450999
  const rPr = node4?.elements?.find((el) => el.name === "w:rPr");
449529
451000
  const formatting = extractRunFormatting2(rPr, paragraphProperties, params3);
@@ -449620,6 +451091,13 @@ function extractTextFromTextBox2(textBoxContent, bodyPr, params3 = {}) {
449620
451091
  };
449621
451092
  paragraphs.forEach((paragraph4, paragraphIndex) => {
449622
451093
  const paragraphProperties = resolveParagraphPropertiesForTextBox2(paragraph4, params3);
451094
+ paragraphMetadata.push({
451095
+ spacing: extractTextBoxParagraphSpacing2(paragraphProperties, {
451096
+ paragraphIndex,
451097
+ paragraphCount: paragraphs.length,
451098
+ spcFirstLastPara
451099
+ })
451100
+ });
449623
451101
  if (!horizontalAlign) {
449624
451102
  horizontalAlign = extractParagraphAlignment2(paragraph4);
449625
451103
  }
@@ -449636,19 +451114,21 @@ function extractTextFromTextBox2(textBoxContent, bodyPr, params3 = {}) {
449636
451114
  `,
449637
451115
  formatting: {},
449638
451116
  isLineBreak: true,
449639
- isEmptyParagraph: !paragraphHasText
451117
+ isEmptyParagraph: !paragraphHasText,
451118
+ isParagraphBoundary: true
449640
451119
  });
449641
451120
  }
449642
451121
  });
449643
451122
  if (textParts.length === 0)
449644
451123
  return null;
449645
- const { verticalAlign, insets, wrap: wrap6 } = extractBodyPrProperties2(bodyPr);
451124
+ const hasParagraphSpacing = paragraphMetadata.some((paragraph4) => paragraph4.spacing);
449646
451125
  return {
449647
451126
  parts: textParts,
449648
451127
  horizontalAlign: horizontalAlign || "left",
449649
451128
  verticalAlign,
449650
451129
  insets,
449651
- wrap: wrap6
451130
+ wrap: wrap6,
451131
+ ...hasParagraphSpacing ? { paragraphs: paragraphMetadata } : {}
449652
451132
  };
449653
451133
  }
449654
451134
  function extractFieldInlineNodes2(node4) {
@@ -449785,6 +451265,7 @@ function getVectorShape2({
449785
451265
  const strokeColor = extractStrokeColor2(spPr, style2);
449786
451266
  const strokeWidth = extractStrokeWidth2(spPr);
449787
451267
  const lineEnds = extractLineEnds2(spPr);
451268
+ const effects2 = extractShapeEffects2(spPr);
449788
451269
  const effectExtent = extractEffectExtent2(node4);
449789
451270
  const textBox = wsp.elements?.find((el) => el.name === "wps:txbx");
449790
451271
  const textBoxContent = textBox?.elements?.find((el) => el.name === "w:txbxContent");
@@ -449809,6 +451290,7 @@ function getVectorShape2({
449809
451290
  strokeColor,
449810
451291
  strokeWidth,
449811
451292
  lineEnds,
451293
+ effects: effects2,
449812
451294
  effectExtent,
449813
451295
  marginOffset,
449814
451296
  anchorData,
@@ -449843,6 +451325,7 @@ function getVectorShape2({
449843
451325
  strokeColor,
449844
451326
  strokeWidth,
449845
451327
  lineEnds,
451328
+ effects: effects2,
449846
451329
  effectExtent,
449847
451330
  marginOffset,
449848
451331
  anchorData,
@@ -449928,6 +451411,36 @@ var DRAWING_XML_TAG2 = "w:drawing", SHAPE_URI2 = "http://schemas.microsoft.com/o
449928
451411
  const alphaModFix = findChildByLocalName2(blip?.elements, "alphaModFix");
449929
451412
  const amt = Number(alphaModFix?.attributes?.amt);
449930
451413
  return Number.isFinite(amt) ? { amt } : undefined;
451414
+ }, buildShapeClipPathFromPreset2 = (preset) => {
451415
+ if (preset === "ellipse")
451416
+ return "ellipse(50% 50% at 50% 50%)";
451417
+ return null;
451418
+ }, extractPicturePresentation2 = (picture) => {
451419
+ const blipFill = picture?.elements?.find((el) => el.name === "pic:blipFill");
451420
+ const stretch = findChildByLocalName2(blipFill?.elements, "stretch");
451421
+ const fillRect = findChildByLocalName2(stretch?.elements, "fillRect");
451422
+ const srcRect = findChildByLocalName2(blipFill?.elements, "srcRect");
451423
+ const srcRectAttrs = srcRect?.attributes || {};
451424
+ const clipPath = buildClipPathFromSrcRect2(srcRectAttrs);
451425
+ const srcRectHasNegativeValues = ["l", "t", "r", "b"].some((attr) => {
451426
+ const val = srcRectAttrs[attr];
451427
+ return val != null && parseFloat(val) < 0;
451428
+ });
451429
+ const spPr = picture?.elements?.find((el) => el.name === "pic:spPr");
451430
+ const prstGeom = findChildByLocalName2(spPr?.elements, "prstGeom");
451431
+ const shapeClipPath = buildShapeClipPathFromPreset2(prstGeom?.attributes?.["prst"]);
451432
+ const shouldStretch = Boolean(stretch && fillRect);
451433
+ const shouldCover = shouldStretch && !srcRectHasNegativeValues && !clipPath;
451434
+ const shouldFillClippedStretch = shouldStretch && !srcRectHasNegativeValues && Boolean(clipPath);
451435
+ const shouldCoverShapeStretch = shouldStretch && Boolean(shapeClipPath) && !clipPath;
451436
+ return {
451437
+ clipPath,
451438
+ rawSrcRect: srcRect,
451439
+ shouldCover,
451440
+ shouldFillClippedStretch,
451441
+ shouldCoverShapeStretch,
451442
+ shapeClipPath
451443
+ };
449931
451444
  }, mergeAnchorPaddingIntoWrapDistances2 = (wrap6, padding) => {
449932
451445
  if (!wrap6?.attrs || !padding)
449933
451446
  return;
@@ -450010,7 +451523,294 @@ var DRAWING_XML_TAG2 = "w:drawing", SHAPE_URI2 = "http://schemas.microsoft.com/o
450010
451523
  placeholder.attrs.hidden = true;
450011
451524
  }
450012
451525
  return placeholder;
450013
- }, handleShapeGroup2 = (params3, node4, graphicData, size3, padding, marginOffset, anchorData, wrap6, isHidden) => {
451526
+ }, parseEmuNumber2 = (value, fallback = 0) => {
451527
+ const numeric = Number(value);
451528
+ return Number.isFinite(numeric) ? numeric : fallback;
451529
+ }, getGroupXfrm2 = (groupNode) => {
451530
+ const grpSpPr = findChildByLocalName2(groupNode?.elements, "grpSpPr");
451531
+ return findChildByLocalName2(grpSpPr?.elements, "xfrm");
451532
+ }, buildShapeGroupTransformAttrs2 = (xfrm) => {
451533
+ const groupTransform = {};
451534
+ if (!xfrm)
451535
+ return groupTransform;
451536
+ if (xfrm.attributes?.["rot"]) {
451537
+ groupTransform.rotation = rotToDegrees2(xfrm.attributes["rot"]);
451538
+ }
451539
+ if (xfrm.attributes?.["flipH"] === "1") {
451540
+ groupTransform.flipH = true;
451541
+ }
451542
+ if (xfrm.attributes?.["flipV"] === "1") {
451543
+ groupTransform.flipV = true;
451544
+ }
451545
+ const off = findChildByLocalName2(xfrm.elements, "off");
451546
+ const ext = findChildByLocalName2(xfrm.elements, "ext");
451547
+ const chOff = findChildByLocalName2(xfrm.elements, "chOff");
451548
+ const chExt = findChildByLocalName2(xfrm.elements, "chExt");
451549
+ if (off) {
451550
+ groupTransform.x = emuToPixels2(off.attributes?.["x"] || 0);
451551
+ groupTransform.y = emuToPixels2(off.attributes?.["y"] || 0);
451552
+ }
451553
+ if (ext) {
451554
+ groupTransform.width = emuToPixels2(ext.attributes?.["cx"] || 0);
451555
+ groupTransform.height = emuToPixels2(ext.attributes?.["cy"] || 0);
451556
+ }
451557
+ if (chOff) {
451558
+ groupTransform.childX = emuToPixels2(chOff.attributes?.["x"] || 0);
451559
+ groupTransform.childY = emuToPixels2(chOff.attributes?.["y"] || 0);
451560
+ groupTransform.childOriginXEmu = parseEmuNumber2(chOff.attributes?.["x"]);
451561
+ groupTransform.childOriginYEmu = parseEmuNumber2(chOff.attributes?.["y"]);
451562
+ }
451563
+ if (chExt) {
451564
+ groupTransform.childWidth = emuToPixels2(chExt.attributes?.["cx"] || 0);
451565
+ groupTransform.childHeight = emuToPixels2(chExt.attributes?.["cy"] || 0);
451566
+ }
451567
+ return groupTransform;
451568
+ }, identityMatrix2 = () => ({ a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 }), multiplyMatrix2 = (left2, right2) => ({
451569
+ a: left2.a * right2.a + left2.c * right2.b,
451570
+ b: left2.b * right2.a + left2.d * right2.b,
451571
+ c: left2.a * right2.c + left2.c * right2.d,
451572
+ d: left2.b * right2.c + left2.d * right2.d,
451573
+ e: left2.a * right2.e + left2.c * right2.f + left2.e,
451574
+ f: left2.b * right2.e + left2.d * right2.f + left2.f
451575
+ }), transformPoint2 = (matrix, x, y2) => ({
451576
+ x: matrix.a * x + matrix.c * y2 + matrix.e,
451577
+ y: matrix.b * x + matrix.d * y2 + matrix.f
451578
+ }), normalizeDegrees2 = (degrees) => {
451579
+ const normalized = (degrees % 360 + 360) % 360;
451580
+ return Object.is(normalized, -0) ? 0 : normalized;
451581
+ }, decomposeMatrixOrientation2 = (matrix) => {
451582
+ const determinant = matrix.a * matrix.d - matrix.b * matrix.c;
451583
+ if (determinant < 0) {
451584
+ return {
451585
+ rotation: normalizeDegrees2(Math.atan2(-matrix.b, -matrix.a) * 180 / Math.PI),
451586
+ flipH: true,
451587
+ flipV: false
451588
+ };
451589
+ }
451590
+ return {
451591
+ rotation: normalizeDegrees2(Math.atan2(matrix.b, matrix.a) * 180 / Math.PI),
451592
+ flipH: false,
451593
+ flipV: false
451594
+ };
451595
+ }, getVisualOrientationMatrix2 = ({ rotation = 0, flipH = false, flipV = false } = {}) => {
451596
+ const radians = rotation * Math.PI / 180;
451597
+ const cos = Math.cos(radians);
451598
+ const sin = Math.sin(radians);
451599
+ const flipScaleX = flipH ? -1 : 1;
451600
+ const flipScaleY = flipV ? -1 : 1;
451601
+ return {
451602
+ a: cos * flipScaleX,
451603
+ b: sin * flipScaleX,
451604
+ c: -sin * flipScaleY,
451605
+ d: cos * flipScaleY,
451606
+ e: 0,
451607
+ f: 0
451608
+ };
451609
+ }, getGroupAffineTransform2 = (xfrm, { includeVisualTransform = false } = {}) => {
451610
+ if (!xfrm) {
451611
+ return { matrix: identityMatrix2(), rotation: 0, flipH: false, flipV: false };
451612
+ }
451613
+ const off = findChildByLocalName2(xfrm.elements, "off");
451614
+ const ext = findChildByLocalName2(xfrm.elements, "ext");
451615
+ const chOff = findChildByLocalName2(xfrm.elements, "chOff");
451616
+ const chExt = findChildByLocalName2(xfrm.elements, "chExt");
451617
+ const childWidth = parseEmuNumber2(chExt?.attributes?.["cx"]);
451618
+ const childHeight = parseEmuNumber2(chExt?.attributes?.["cy"]);
451619
+ const width = parseEmuNumber2(ext?.attributes?.["cx"], childWidth || 0);
451620
+ const height = parseEmuNumber2(ext?.attributes?.["cy"], childHeight || 0);
451621
+ const childX = parseEmuNumber2(chOff?.attributes?.["x"]);
451622
+ const childY = parseEmuNumber2(chOff?.attributes?.["y"]);
451623
+ const x = parseEmuNumber2(off?.attributes?.["x"]);
451624
+ const y2 = parseEmuNumber2(off?.attributes?.["y"]);
451625
+ const scaleX = childWidth !== 0 ? width / childWidth : 1;
451626
+ const scaleY = childHeight !== 0 ? height / childHeight : 1;
451627
+ const rotation = xfrm.attributes?.["rot"] ? rotToDegrees2(xfrm.attributes["rot"]) : 0;
451628
+ const flipH = xfrm.attributes?.["flipH"] === "1";
451629
+ const flipV = xfrm.attributes?.["flipV"] === "1";
451630
+ const baseMatrix = {
451631
+ a: scaleX,
451632
+ b: 0,
451633
+ c: 0,
451634
+ d: scaleY,
451635
+ e: x - childX * scaleX,
451636
+ f: y2 - childY * scaleY
451637
+ };
451638
+ if (!includeVisualTransform || !rotation && !flipH && !flipV) {
451639
+ return { matrix: baseMatrix, rotation: 0, flipH: false, flipV: false };
451640
+ }
451641
+ const radians = rotation * Math.PI / 180;
451642
+ const cos = Math.cos(radians);
451643
+ const sin = Math.sin(radians);
451644
+ const flipScaleX = flipH ? -1 : 1;
451645
+ const flipScaleY = flipV ? -1 : 1;
451646
+ const centerX = x + width / 2;
451647
+ const centerY = y2 + height / 2;
451648
+ const visualMatrix = {
451649
+ a: cos * flipScaleX,
451650
+ b: sin * flipScaleX,
451651
+ c: -sin * flipScaleY,
451652
+ d: cos * flipScaleY,
451653
+ e: centerX - (cos * flipScaleX * centerX + -sin * flipScaleY * centerY),
451654
+ f: centerY - (sin * flipScaleX * centerX + cos * flipScaleY * centerY)
451655
+ };
451656
+ return { matrix: multiplyMatrix2(visualMatrix, baseMatrix), rotation, flipH, flipV };
451657
+ }, composeShapeGroupTransform2 = (parent, child) => {
451658
+ const matrix = multiplyMatrix2(parent.matrix, child.matrix);
451659
+ return {
451660
+ matrix,
451661
+ ...decomposeMatrixOrientation2(matrix)
451662
+ };
451663
+ }, composeShapeGroupChildOrientation2 = (rect, xfrm) => {
451664
+ const parentMatrix = getVisualOrientationMatrix2({
451665
+ rotation: rect.rotation ?? 0,
451666
+ flipH: Boolean(rect.flipH),
451667
+ flipV: Boolean(rect.flipV)
451668
+ });
451669
+ const childMatrix = getVisualOrientationMatrix2({
451670
+ rotation: xfrm?.attributes?.["rot"] ? rotToDegrees2(xfrm.attributes["rot"]) : 0,
451671
+ flipH: xfrm?.attributes?.["flipH"] === "1",
451672
+ flipV: xfrm?.attributes?.["flipV"] === "1"
451673
+ });
451674
+ return decomposeMatrixOrientation2(multiplyMatrix2(parentMatrix, childMatrix));
451675
+ }, transformShapeGroupChildRect2 = (transform2, rawX, rawY, rawWidth, rawHeight) => {
451676
+ const matrix = transform2.matrix ?? identityMatrix2();
451677
+ const width = Math.hypot(matrix.a, matrix.b) * rawWidth;
451678
+ const height = Math.hypot(matrix.c, matrix.d) * rawHeight;
451679
+ const center = transformPoint2(matrix, rawX + rawWidth / 2, rawY + rawHeight / 2);
451680
+ return {
451681
+ x: emuToPixels2(center.x - width / 2),
451682
+ y: emuToPixels2(center.y - height / 2),
451683
+ width: emuToPixels2(width),
451684
+ height: emuToPixels2(height),
451685
+ rotation: transform2.rotation ?? 0,
451686
+ flipH: Boolean(transform2.flipH),
451687
+ flipV: Boolean(transform2.flipV)
451688
+ };
451689
+ }, resolveShapeGroupPicturePath2 = (pic, params3) => {
451690
+ const blipFill = findChildByLocalName2(pic.elements, "blipFill");
451691
+ const blip = findChildByLocalName2(blipFill?.elements, "blip");
451692
+ if (!blip)
451693
+ return null;
451694
+ const rEmbed = blip.attributes?.["r:embed"];
451695
+ if (!rEmbed)
451696
+ return null;
451697
+ const currentFile = params3.filename || "document.xml";
451698
+ let rels = params3.docx[`word/_rels/${currentFile}.rels`];
451699
+ if (!rels)
451700
+ rels = params3.docx[`word/_rels/document.xml.rels`];
451701
+ const relationships = rels?.elements.find((el) => el.name === "Relationships");
451702
+ const elements = relationships?.elements;
451703
+ const rel = elements?.find((el) => el.attributes["Id"] === rEmbed);
451704
+ if (!rel)
451705
+ return null;
451706
+ return normalizeTargetPath2(rel.attributes?.["Target"]);
451707
+ }, parseShapeGroupVectorChild2 = (wsp, transform2, params3) => {
451708
+ const spPr = findChildByLocalName2(wsp.elements, "spPr");
451709
+ if (!spPr)
451710
+ return null;
451711
+ const prstGeom = findChildByLocalName2(spPr.elements, "prstGeom");
451712
+ const shapeKind = prstGeom?.attributes?.["prst"];
451713
+ const customGeom = !shapeKind ? extractCustomGeometry2(spPr) : null;
451714
+ const shapeXfrm = findChildByLocalName2(spPr.elements, "xfrm");
451715
+ const shapeOff = findChildByLocalName2(shapeXfrm?.elements, "off");
451716
+ const shapeExt = findChildByLocalName2(shapeXfrm?.elements, "ext");
451717
+ const rawX = parseEmuNumber2(shapeOff?.attributes?.["x"]);
451718
+ const rawY = parseEmuNumber2(shapeOff?.attributes?.["y"]);
451719
+ const rawWidth = parseEmuNumber2(shapeExt?.attributes?.["cx"], 914400);
451720
+ const rawHeight = parseEmuNumber2(shapeExt?.attributes?.["cy"], 914400);
451721
+ const rect = transformShapeGroupChildRect2(transform2, rawX, rawY, rawWidth, rawHeight);
451722
+ const orientation = composeShapeGroupChildOrientation2(rect, shapeXfrm);
451723
+ const style2 = findChildByLocalName2(wsp.elements, "style");
451724
+ const fillColor = extractFillColor2(spPr, style2);
451725
+ const strokeColor = extractStrokeColor2(spPr, style2);
451726
+ const strokeWidth = extractStrokeWidth2(spPr);
451727
+ const lineEnds = extractLineEnds2(spPr);
451728
+ const effects2 = extractShapeEffects2(spPr);
451729
+ const cNvPr = findChildByLocalName2(wsp.elements, "cNvPr");
451730
+ const shapeId = cNvPr?.attributes?.["id"];
451731
+ const shapeName = cNvPr?.attributes?.["name"];
451732
+ const textBox = findChildByLocalName2(wsp.elements, "txbx");
451733
+ const textBoxContent = findChildByLocalName2(textBox?.elements, "txbxContent");
451734
+ const bodyPr = findChildByLocalName2(wsp.elements, "bodyPr");
451735
+ const textContent2 = textBoxContent ? extractTextFromTextBox2(textBoxContent, bodyPr, params3) : null;
451736
+ const textAlign = textContent2?.horizontalAlign || "left";
451737
+ return {
451738
+ shapeType: "vectorShape",
451739
+ attrs: {
451740
+ kind: shapeKind,
451741
+ customGeometry: customGeom || undefined,
451742
+ ...rect,
451743
+ ...orientation,
451744
+ fillColor,
451745
+ strokeColor,
451746
+ strokeWidth,
451747
+ lineEnds,
451748
+ effects: effects2,
451749
+ shapeId,
451750
+ shapeName,
451751
+ textContent: textContent2,
451752
+ textAlign,
451753
+ textVerticalAlign: textContent2?.verticalAlign,
451754
+ textInsets: textContent2?.insets
451755
+ }
451756
+ };
451757
+ }, parseShapeGroupImageChild2 = (pic, transform2, params3) => {
451758
+ const spPr = findChildByLocalName2(pic.elements, "spPr");
451759
+ if (!spPr)
451760
+ return null;
451761
+ const xfrm = findChildByLocalName2(spPr.elements, "xfrm");
451762
+ const off = findChildByLocalName2(xfrm?.elements, "off");
451763
+ const ext = findChildByLocalName2(xfrm?.elements, "ext");
451764
+ const rawX = parseEmuNumber2(off?.attributes?.["x"]);
451765
+ const rawY = parseEmuNumber2(off?.attributes?.["y"]);
451766
+ const rawWidth = parseEmuNumber2(ext?.attributes?.["cx"], 914400);
451767
+ const rawHeight = parseEmuNumber2(ext?.attributes?.["cy"], 914400);
451768
+ const rect = transformShapeGroupChildRect2(transform2, rawX, rawY, rawWidth, rawHeight);
451769
+ const orientation = composeShapeGroupChildOrientation2(rect, xfrm);
451770
+ const path3 = resolveShapeGroupPicturePath2(pic, params3);
451771
+ if (!path3)
451772
+ return null;
451773
+ const blipFill = findChildByLocalName2(pic.elements, "blipFill");
451774
+ const blip = findChildByLocalName2(blipFill?.elements, "blip");
451775
+ const alphaModFix = extractAlphaModFix2(blip);
451776
+ const nvPicPr = findChildByLocalName2(pic.elements, "nvPicPr");
451777
+ const cNvPr = findChildByLocalName2(nvPicPr?.elements, "cNvPr");
451778
+ const picId = cNvPr?.attributes?.["id"];
451779
+ const picName = cNvPr?.attributes?.["name"];
451780
+ const { clipPath, shouldCover, shouldFillClippedStretch, shouldCoverShapeStretch, shapeClipPath } = extractPicturePresentation2(pic);
451781
+ return {
451782
+ shapeType: "image",
451783
+ attrs: {
451784
+ ...rect,
451785
+ ...orientation,
451786
+ src: path3,
451787
+ imageId: picId,
451788
+ imageName: picName,
451789
+ ...alphaModFix ? { alphaModFix } : {},
451790
+ ...clipPath ? { clipPath } : {},
451791
+ ...shapeClipPath ? { shapeClipPath } : {},
451792
+ ...shouldFillClippedStretch || shouldCoverShapeStretch ? { objectFit: shouldFillClippedStretch ? "fill" : "cover" } : shouldCover ? { objectFit: "cover" } : {}
451793
+ }
451794
+ };
451795
+ }, collectShapeGroupChildren2 = (groupNode, transform2, params3) => {
451796
+ const children = [];
451797
+ for (const child of groupNode?.elements || []) {
451798
+ const localName2 = getLocalName3(child?.name);
451799
+ if (localName2 === "wsp") {
451800
+ const shape = parseShapeGroupVectorChild2(child, transform2, params3);
451801
+ if (shape)
451802
+ children.push(shape);
451803
+ } else if (localName2 === "pic") {
451804
+ const picture = parseShapeGroupImageChild2(child, transform2, params3);
451805
+ if (picture)
451806
+ children.push(picture);
451807
+ } else if (localName2 === "grpSp") {
451808
+ const nestedTransform = composeShapeGroupTransform2(transform2, getGroupAffineTransform2(getGroupXfrm2(child), { includeVisualTransform: true }));
451809
+ children.push(...collectShapeGroupChildren2(child, nestedTransform, params3));
451810
+ }
451811
+ }
451812
+ return children;
451813
+ }, handleShapeGroup2 = (params3, node4, graphicData, size3, padding, marginOffset, anchorData, wrap6, effectExtent, isHidden) => {
450014
451814
  const wgp = graphicData.elements.find((el) => el.name === "wpg:wgp");
450015
451815
  if (!wgp) {
450016
451816
  const placeholder = buildShapePlaceholder2(node4, size3, padding, marginOffset, "group");
@@ -450019,174 +451819,9 @@ var DRAWING_XML_TAG2 = "w:drawing", SHAPE_URI2 = "http://schemas.microsoft.com/o
450019
451819
  }
450020
451820
  return placeholder;
450021
451821
  }
450022
- const grpSpPr = wgp.elements.find((el) => el.name === "wpg:grpSpPr");
450023
- const xfrm = findChildByLocalName2(grpSpPr?.elements, "xfrm");
450024
- const groupTransform = {};
450025
- if (xfrm) {
450026
- const off = findChildByLocalName2(xfrm.elements, "off");
450027
- const ext = findChildByLocalName2(xfrm.elements, "ext");
450028
- const chOff = findChildByLocalName2(xfrm.elements, "chOff");
450029
- const chExt = findChildByLocalName2(xfrm.elements, "chExt");
450030
- if (off) {
450031
- groupTransform.x = emuToPixels2(off.attributes?.["x"] || 0);
450032
- groupTransform.y = emuToPixels2(off.attributes?.["y"] || 0);
450033
- }
450034
- if (ext) {
450035
- groupTransform.width = emuToPixels2(ext.attributes?.["cx"] || 0);
450036
- groupTransform.height = emuToPixels2(ext.attributes?.["cy"] || 0);
450037
- }
450038
- if (chOff) {
450039
- groupTransform.childX = emuToPixels2(chOff.attributes?.["x"] || 0);
450040
- groupTransform.childY = emuToPixels2(chOff.attributes?.["y"] || 0);
450041
- groupTransform.childOriginXEmu = parseFloat(chOff.attributes?.["x"] || 0);
450042
- groupTransform.childOriginYEmu = parseFloat(chOff.attributes?.["y"] || 0);
450043
- }
450044
- if (chExt) {
450045
- groupTransform.childWidth = emuToPixels2(chExt.attributes?.["cx"] || 0);
450046
- groupTransform.childHeight = emuToPixels2(chExt.attributes?.["cy"] || 0);
450047
- }
450048
- }
450049
- const childShapes = wgp.elements.filter((el) => el.name === "wps:wsp");
450050
- const childPictures = wgp.elements.filter((el) => el.name === "pic:pic");
450051
- const shapes = childShapes.map((wsp) => {
450052
- const spPr = wsp.elements?.find((el) => el.name === "wps:spPr");
450053
- if (!spPr)
450054
- return null;
450055
- const prstGeom = findChildByLocalName2(spPr.elements, "prstGeom");
450056
- const shapeKind = prstGeom?.attributes?.["prst"];
450057
- const customGeom = !shapeKind ? extractCustomGeometry2(spPr) : null;
450058
- const shapeXfrm = findChildByLocalName2(spPr.elements, "xfrm");
450059
- const shapeOff = findChildByLocalName2(shapeXfrm?.elements, "off");
450060
- const shapeExt = findChildByLocalName2(shapeXfrm?.elements, "ext");
450061
- const rawX = shapeOff?.attributes?.["x"] ? parseFloat(shapeOff.attributes["x"]) : 0;
450062
- const rawY = shapeOff?.attributes?.["y"] ? parseFloat(shapeOff.attributes["y"]) : 0;
450063
- const rawWidth = shapeExt?.attributes?.["cx"] ? parseFloat(shapeExt.attributes["cx"]) : 914400;
450064
- const rawHeight = shapeExt?.attributes?.["cy"] ? parseFloat(shapeExt.attributes["cy"]) : 914400;
450065
- let x, y2, width, height;
450066
- if (groupTransform.childWidth && groupTransform.childHeight) {
450067
- const scaleX = groupTransform.width / groupTransform.childWidth;
450068
- const scaleY = groupTransform.height / groupTransform.childHeight;
450069
- const childOriginX = groupTransform.childOriginXEmu || 0;
450070
- const childOriginY = groupTransform.childOriginYEmu || 0;
450071
- x = groupTransform.x + emuToPixels2((rawX - childOriginX) * scaleX);
450072
- y2 = groupTransform.y + emuToPixels2((rawY - childOriginY) * scaleY);
450073
- width = emuToPixels2(rawWidth * scaleX);
450074
- height = emuToPixels2(rawHeight * scaleY);
450075
- } else {
450076
- x = emuToPixels2(rawX);
450077
- y2 = emuToPixels2(rawY);
450078
- width = emuToPixels2(rawWidth);
450079
- height = emuToPixels2(rawHeight);
450080
- }
450081
- const rotation = shapeXfrm?.attributes?.["rot"] ? rotToDegrees2(shapeXfrm.attributes["rot"]) : 0;
450082
- const flipH = shapeXfrm?.attributes?.["flipH"] === "1";
450083
- const flipV = shapeXfrm?.attributes?.["flipV"] === "1";
450084
- const style2 = wsp.elements?.find((el) => el.name === "wps:style");
450085
- const fillColor = extractFillColor2(spPr, style2);
450086
- const strokeColor = extractStrokeColor2(spPr, style2);
450087
- const strokeWidth = extractStrokeWidth2(spPr);
450088
- const lineEnds = extractLineEnds2(spPr);
450089
- const cNvPr = wsp.elements?.find((el) => el.name === "wps:cNvPr");
450090
- const shapeId = cNvPr?.attributes?.["id"];
450091
- const shapeName = cNvPr?.attributes?.["name"];
450092
- const textBox = wsp.elements?.find((el) => el.name === "wps:txbx");
450093
- const textBoxContent = textBox?.elements?.find((el) => el.name === "w:txbxContent");
450094
- const bodyPr = wsp.elements?.find((el) => el.name === "wps:bodyPr");
450095
- let textContent2 = null;
450096
- if (textBoxContent) {
450097
- textContent2 = extractTextFromTextBox2(textBoxContent, bodyPr, params3);
450098
- }
450099
- const textAlign = textContent2?.horizontalAlign || "left";
450100
- return {
450101
- shapeType: "vectorShape",
450102
- attrs: {
450103
- kind: shapeKind,
450104
- customGeometry: customGeom || undefined,
450105
- x,
450106
- y: y2,
450107
- width,
450108
- height,
450109
- rotation,
450110
- flipH,
450111
- flipV,
450112
- fillColor,
450113
- strokeColor,
450114
- strokeWidth,
450115
- lineEnds,
450116
- shapeId,
450117
- shapeName,
450118
- textContent: textContent2,
450119
- textAlign,
450120
- textVerticalAlign: textContent2?.verticalAlign,
450121
- textInsets: textContent2?.insets
450122
- }
450123
- };
450124
- }).filter(Boolean);
450125
- const pictures = childPictures.map((pic) => {
450126
- const spPr = pic.elements?.find((el) => el.name === "pic:spPr");
450127
- if (!spPr)
450128
- return null;
450129
- const xfrm2 = findChildByLocalName2(spPr.elements, "xfrm");
450130
- const off = findChildByLocalName2(xfrm2?.elements, "off");
450131
- const ext = findChildByLocalName2(xfrm2?.elements, "ext");
450132
- const rawX = off?.attributes?.["x"] ? parseFloat(off.attributes["x"]) : 0;
450133
- const rawY = off?.attributes?.["y"] ? parseFloat(off.attributes["y"]) : 0;
450134
- const rawWidth = ext?.attributes?.["cx"] ? parseFloat(ext.attributes["cx"]) : 914400;
450135
- const rawHeight = ext?.attributes?.["cy"] ? parseFloat(ext.attributes["cy"]) : 914400;
450136
- let x, y2, width, height;
450137
- if (groupTransform.childWidth && groupTransform.childHeight) {
450138
- const scaleX = groupTransform.width / groupTransform.childWidth;
450139
- const scaleY = groupTransform.height / groupTransform.childHeight;
450140
- const childOriginX = groupTransform.childOriginXEmu || 0;
450141
- const childOriginY = groupTransform.childOriginYEmu || 0;
450142
- x = groupTransform.x + emuToPixels2((rawX - childOriginX) * scaleX);
450143
- y2 = groupTransform.y + emuToPixels2((rawY - childOriginY) * scaleY);
450144
- width = emuToPixels2(rawWidth * scaleX);
450145
- height = emuToPixels2(rawHeight * scaleY);
450146
- } else {
450147
- x = emuToPixels2(rawX);
450148
- y2 = emuToPixels2(rawY);
450149
- width = emuToPixels2(rawWidth);
450150
- height = emuToPixels2(rawHeight);
450151
- }
450152
- const blipFill = pic.elements?.find((el) => el.name === "pic:blipFill");
450153
- const blip = findChildByLocalName2(blipFill?.elements, "blip");
450154
- if (!blip)
450155
- return null;
450156
- const alphaModFix = extractAlphaModFix2(blip);
450157
- const rEmbed = blip.attributes?.["r:embed"];
450158
- if (!rEmbed)
450159
- return null;
450160
- const currentFile = params3.filename || "document.xml";
450161
- let rels = params3.docx[`word/_rels/${currentFile}.rels`];
450162
- if (!rels)
450163
- rels = params3.docx[`word/_rels/document.xml.rels`];
450164
- const relationships = rels?.elements.find((el) => el.name === "Relationships");
450165
- const { elements } = relationships || [];
450166
- const rel = elements?.find((el) => el.attributes["Id"] === rEmbed);
450167
- if (!rel)
450168
- return null;
450169
- const targetPath = normalizeTargetPath2(rel.attributes?.["Target"]);
450170
- const path3 = targetPath;
450171
- const nvPicPr = pic.elements?.find((el) => el.name === "pic:nvPicPr");
450172
- const cNvPr = nvPicPr?.elements?.find((el) => el.name === "pic:cNvPr");
450173
- const picId = cNvPr?.attributes?.["id"];
450174
- const picName = cNvPr?.attributes?.["name"];
450175
- return {
450176
- shapeType: "image",
450177
- attrs: {
450178
- x,
450179
- y: y2,
450180
- width,
450181
- height,
450182
- src: path3,
450183
- imageId: picId,
450184
- imageName: picName,
450185
- ...alphaModFix ? { alphaModFix } : {}
450186
- }
450187
- };
450188
- }).filter(Boolean);
450189
- const allShapes = [...pictures, ...shapes];
451822
+ const groupXfrm = getGroupXfrm2(wgp);
451823
+ const groupTransform = buildShapeGroupTransformAttrs2(groupXfrm);
451824
+ const allShapes = collectShapeGroupChildren2(wgp, getGroupAffineTransform2(groupXfrm), params3);
450190
451825
  const schemaAttrs = {};
450191
451826
  const drawingNode = params3.nodes?.[0];
450192
451827
  if (drawingNode?.name === DRAWING_XML_TAG2) {
@@ -450202,6 +451837,7 @@ var DRAWING_XML_TAG2 = "w:drawing", SHAPE_URI2 = "http://schemas.microsoft.com/o
450202
451837
  size: size3,
450203
451838
  padding,
450204
451839
  marginOffset,
451840
+ effectExtent,
450205
451841
  anchorData,
450206
451842
  wrap: wrap6,
450207
451843
  originalAttributes: node4?.attributes