@superdoc-dev/mcp 0.14.0 → 0.15.1

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 +2303 -633
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -50479,7 +50479,7 @@ var init_remark_gfm_BUJjZJLy_es = __esm(() => {
50479
50479
  emptyOptions2 = {};
50480
50480
  });
50481
50481
 
50482
- // ../../packages/superdoc/dist/chunks/SuperConverter-DQ2wMaLK.es.js
50482
+ // ../../packages/superdoc/dist/chunks/SuperConverter-DJEK5GYX.es.js
50483
50483
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
50484
50484
  const fieldValue = extension$1.config[field];
50485
50485
  if (typeof fieldValue === "function")
@@ -65160,6 +65160,34 @@ function extractLineEnds(spPr) {
65160
65160
  tail: tailConfig ?? undefined
65161
65161
  };
65162
65162
  }
65163
+ function extractShapeEffects(spPr) {
65164
+ const outerShadow = extractOuterShadowEffect(spPr);
65165
+ if (!outerShadow)
65166
+ return null;
65167
+ return { outerShadow };
65168
+ }
65169
+ function extractOuterShadowEffect(spPr) {
65170
+ const outerShdw = findChildByLocalName(findChildByLocalName(spPr?.elements, "effectLst")?.elements, "outerShdw");
65171
+ if (!outerShdw)
65172
+ return null;
65173
+ const colorResult = extractColorFromElement(outerShdw);
65174
+ if (!colorResult)
65175
+ return null;
65176
+ return stripUndefined({
65177
+ type: "outerShadow",
65178
+ blurRadius: finiteNumberOrZero(emuToPixels(outerShdw.attributes?.blurRad)),
65179
+ distance: finiteNumberOrZero(emuToPixels(outerShdw.attributes?.dist)),
65180
+ direction: finiteNumberOrZero(rotToDegrees(outerShdw.attributes?.dir)),
65181
+ color: colorResult.color,
65182
+ opacity: colorResult.alpha ?? 1
65183
+ });
65184
+ }
65185
+ function finiteNumberOrZero(value) {
65186
+ return Number.isFinite(value) ? value : 0;
65187
+ }
65188
+ function stripUndefined(value) {
65189
+ return Object.fromEntries(Object.entries(value).filter(([, fieldValue]) => fieldValue !== undefined));
65190
+ }
65163
65191
  function extractStrokeColor(spPr, style) {
65164
65192
  const ln = findChildByLocalName(spPr?.elements, "ln");
65165
65193
  if (ln) {
@@ -66801,6 +66829,26 @@ function resolveParagraphPropertiesForTextBox(paragraph2, params) {
66801
66829
  nodes: [pPr]
66802
66830
  }) || {} : {}, false, false, null);
66803
66831
  }
66832
+ function extractTextBoxParagraphSpacing(paragraphProperties, { paragraphIndex, paragraphCount, spcFirstLastPara } = {}) {
66833
+ const spacing = paragraphProperties?.spacing;
66834
+ if (!spacing)
66835
+ return;
66836
+ const honorFirstLast = spcFirstLastPara === "1" || spcFirstLastPara === 1 || spcFirstLastPara === true || spcFirstLastPara === "true" || spcFirstLastPara === "on";
66837
+ const isFirst = paragraphIndex === 0;
66838
+ const isLast = paragraphCount != null && paragraphIndex === paragraphCount - 1;
66839
+ const result = {};
66840
+ if (typeof spacing.before === "number" && !(isFirst && !honorFirstLast)) {
66841
+ const px = twipsToPixels(spacing.before);
66842
+ if (typeof px === "number")
66843
+ result.before = px;
66844
+ }
66845
+ if (typeof spacing.after === "number" && !(isLast && !honorFirstLast)) {
66846
+ const px = twipsToPixels(spacing.after);
66847
+ if (typeof px === "number")
66848
+ result.after = px;
66849
+ }
66850
+ return result.before === undefined && result.after === undefined ? undefined : result;
66851
+ }
66804
66852
  function extractRunFormatting(rPr, paragraphProperties, params) {
66805
66853
  const resolvedRunProperties = resolveRunProperties(params, rPr ? translator$133.encode({
66806
66854
  ...params,
@@ -66864,10 +66912,12 @@ function extractBodyPrProperties(bodyPr) {
66864
66912
  left: lIns * EMU_TO_PX
66865
66913
  };
66866
66914
  const wrap$1 = bodyPrAttrs["wrap"] || "square";
66915
+ const spcFirstLastPara = bodyPrAttrs["spcFirstLastPara"];
66867
66916
  return {
66868
66917
  verticalAlign,
66869
66918
  insets,
66870
- wrap: wrap$1
66919
+ wrap: wrap$1,
66920
+ spcFirstLastPara
66871
66921
  };
66872
66922
  }
66873
66923
  function isValidRelativeHeight(value) {
@@ -67257,14 +67307,13 @@ function handleImageNode$1(node2, params, isAnchor) {
67257
67307
  left: positionHValue,
67258
67308
  horizontal: positionHValue,
67259
67309
  top: positionVValue
67260
- }, anchorData, wrap$1, isHidden);
67310
+ }, anchorData, wrap$1, extractEffectExtent(node2), isHidden);
67261
67311
  if (uri === "http://schemas.openxmlformats.org/drawingml/2006/chart")
67262
67312
  return handleChartDrawing(params, node2, graphicData, size, padding, marginOffset, anchorData, wrap$1, isAnchor);
67263
67313
  const picture = graphicData?.elements.find((el) => el.name === "pic:pic");
67264
67314
  if (!picture || !picture.elements)
67265
67315
  return null;
67266
- const blipFill = picture.elements.find((el) => el.name === "pic:blipFill");
67267
- const blip = findChildByLocalName(blipFill?.elements, "blip");
67316
+ const blip = findChildByLocalName(picture.elements.find((el) => el.name === "pic:blipFill")?.elements, "blip");
67268
67317
  if (!blip)
67269
67318
  return null;
67270
67319
  const hasGrayscale = someChildHasLocalName(blip.elements, "grayscl");
@@ -67276,23 +67325,7 @@ function handleImageNode$1(node2, params, isAnchor) {
67276
67325
  ...Number.isFinite(rawContrast) ? { contrast: rawContrast } : {}
67277
67326
  } : undefined;
67278
67327
  const alphaModFix = extractAlphaModFix(blip);
67279
- const stretch = findChildByLocalName(blipFill?.elements, "stretch");
67280
- const fillRect = findChildByLocalName(stretch?.elements, "fillRect");
67281
- const srcRect = findChildByLocalName(blipFill?.elements, "srcRect");
67282
- const srcRectAttrs = srcRect?.attributes || {};
67283
- const clipPath = buildClipPathFromSrcRect(srcRectAttrs);
67284
- const srcRectHasNegativeValues = [
67285
- "l",
67286
- "t",
67287
- "r",
67288
- "b"
67289
- ].some((attr) => {
67290
- const val = srcRectAttrs[attr];
67291
- return val != null && parseFloat(val) < 0;
67292
- });
67293
- const shouldStretch = Boolean(stretch && fillRect);
67294
- const shouldCover = shouldStretch && !srcRectHasNegativeValues && !clipPath;
67295
- const shouldFillClippedStretch = shouldStretch && !srcRectHasNegativeValues && Boolean(clipPath);
67328
+ const { clipPath, rawSrcRect, shouldCover, shouldFillClippedStretch, shouldCoverShapeStretch, shapeClipPath } = extractPicturePresentation(picture);
67296
67329
  const spPr = picture.elements.find((el) => el.name === "pic:spPr");
67297
67330
  if (spPr) {
67298
67331
  const xfrm = findChildByLocalName(spPr.elements, "xfrm");
@@ -67412,9 +67445,10 @@ function handleImageNode$1(node2, params, isAnchor) {
67412
67445
  ...wrap$1.type === "Square" && wrap$1.attrs.wrapText ? { wrapText: wrap$1.attrs.wrapText } : {},
67413
67446
  wrapTopAndBottom: wrap$1.type === "TopAndBottom",
67414
67447
  shouldCover,
67415
- ...shouldFillClippedStretch ? { objectFit: "fill" } : {},
67448
+ ...shouldFillClippedStretch ? { objectFit: "fill" } : shouldCoverShapeStretch ? { objectFit: "cover" } : {},
67416
67449
  ...clipPath ? { clipPath } : {},
67417
- rawSrcRect: srcRect,
67450
+ ...shapeClipPath ? { shapeClipPath } : {},
67451
+ rawSrcRect,
67418
67452
  originalPadding: {
67419
67453
  distT: attributes["distT"],
67420
67454
  distB: attributes["distB"],
@@ -67462,7 +67496,9 @@ function extractTextFromTextBox(textBoxContent, bodyPr, params = {}) {
67462
67496
  return null;
67463
67497
  const paragraphs = collectTextBoxParagraphs(preProcessTextBoxContent(textBoxContent, params)?.elements || []);
67464
67498
  const textParts = [];
67499
+ const paragraphMetadata = [];
67465
67500
  let horizontalAlign = null;
67501
+ const { verticalAlign, insets, wrap: wrap$1, spcFirstLastPara } = extractBodyPrProperties(bodyPr);
67466
67502
  const appendFieldPart = (fieldType, node2, paragraphProperties) => {
67467
67503
  const rPr = node2?.elements?.find((el) => el.name === "w:rPr");
67468
67504
  const formatting = extractRunFormatting(rPr, paragraphProperties, params);
@@ -67569,6 +67605,11 @@ function extractTextFromTextBox(textBoxContent, bodyPr, params = {}) {
67569
67605
  };
67570
67606
  paragraphs.forEach((paragraph2, paragraphIndex) => {
67571
67607
  const paragraphProperties = resolveParagraphPropertiesForTextBox(paragraph2, params);
67608
+ paragraphMetadata.push({ spacing: extractTextBoxParagraphSpacing(paragraphProperties, {
67609
+ paragraphIndex,
67610
+ paragraphCount: paragraphs.length,
67611
+ spcFirstLastPara
67612
+ }) });
67572
67613
  if (!horizontalAlign)
67573
67614
  horizontalAlign = extractParagraphAlignment(paragraph2);
67574
67615
  let paragraphHasText = false;
@@ -67582,18 +67623,20 @@ function extractTextFromTextBox(textBoxContent, bodyPr, params = {}) {
67582
67623
  `,
67583
67624
  formatting: {},
67584
67625
  isLineBreak: true,
67585
- isEmptyParagraph: !paragraphHasText
67626
+ isEmptyParagraph: !paragraphHasText,
67627
+ isParagraphBoundary: true
67586
67628
  });
67587
67629
  });
67588
67630
  if (textParts.length === 0)
67589
67631
  return null;
67590
- const { verticalAlign, insets, wrap: wrap$1 } = extractBodyPrProperties(bodyPr);
67632
+ const hasParagraphSpacing = paragraphMetadata.some((paragraph2) => paragraph2.spacing);
67591
67633
  return {
67592
67634
  parts: textParts,
67593
67635
  horizontalAlign: horizontalAlign || "left",
67594
67636
  verticalAlign,
67595
67637
  insets,
67596
- wrap: wrap$1
67638
+ wrap: wrap$1,
67639
+ ...hasParagraphSpacing ? { paragraphs: paragraphMetadata } : {}
67597
67640
  };
67598
67641
  }
67599
67642
  function extractFieldInlineNodes(node2) {
@@ -67743,6 +67786,7 @@ function getVectorShape({ params, node: node2, graphicData, size, marginOffset,
67743
67786
  const strokeColor = extractStrokeColor(spPr, style);
67744
67787
  const strokeWidth = extractStrokeWidth(spPr);
67745
67788
  const lineEnds = extractLineEnds(spPr);
67789
+ const effects2 = extractShapeEffects(spPr);
67746
67790
  const effectExtent = extractEffectExtent(node2);
67747
67791
  const textBoxContent = wsp.elements?.find((el) => el.name === "wps:txbx")?.elements?.find((el) => el.name === "w:txbxContent");
67748
67792
  const bodyPr = wsp.elements?.find((el) => el.name === "wps:bodyPr");
@@ -67766,6 +67810,7 @@ function getVectorShape({ params, node: node2, graphicData, size, marginOffset,
67766
67810
  strokeColor,
67767
67811
  strokeWidth,
67768
67812
  lineEnds,
67813
+ effects: effects2,
67769
67814
  effectExtent,
67770
67815
  marginOffset,
67771
67816
  anchorData,
@@ -67799,6 +67844,7 @@ function getVectorShape({ params, node: node2, graphicData, size, marginOffset,
67799
67844
  strokeColor,
67800
67845
  strokeWidth,
67801
67846
  lineEnds,
67847
+ effects: effects2,
67802
67848
  effectExtent,
67803
67849
  marginOffset,
67804
67850
  anchorData,
@@ -87029,7 +87075,7 @@ function isShapeGroupTransform(value) {
87029
87075
  if (!value || typeof value !== "object")
87030
87076
  return false;
87031
87077
  const maybe = value;
87032
- return isFiniteNumber(maybe.x) || isFiniteNumber(maybe.y) || isFiniteNumber(maybe.width) || isFiniteNumber(maybe.height) || isFiniteNumber(maybe.childWidth) || isFiniteNumber(maybe.childHeight) || isFiniteNumber(maybe.childX) || isFiniteNumber(maybe.childY);
87078
+ return isFiniteNumber(maybe.x) || isFiniteNumber(maybe.y) || isFiniteNumber(maybe.width) || isFiniteNumber(maybe.height) || isFiniteNumber(maybe.childWidth) || isFiniteNumber(maybe.childHeight) || isFiniteNumber(maybe.childX) || isFiniteNumber(maybe.childY) || isFiniteNumber(maybe.rotation) || maybe.flipH === true || maybe.flipV === true;
87033
87079
  }
87034
87080
  function normalizeShapeSize(value) {
87035
87081
  if (!value || typeof value !== "object")
@@ -87077,13 +87123,73 @@ function normalizeEffectExtent(value) {
87077
87123
  bottom: clamp(bottom)
87078
87124
  };
87079
87125
  }
87126
+ function normalizeShapeEffects(value) {
87127
+ if (!value || typeof value !== "object")
87128
+ return;
87129
+ const outerShadow = normalizeOuterShadowEffect(value.outerShadow);
87130
+ return outerShadow ? { outerShadow } : undefined;
87131
+ }
87132
+ function normalizeOuterShadowEffect(value) {
87133
+ if (!value || typeof value !== "object")
87134
+ return;
87135
+ const maybe = value;
87136
+ if (maybe.type !== "outerShadow")
87137
+ return;
87138
+ const blurRadius = coerceNumber(maybe.blurRadius);
87139
+ const distance = coerceNumber(maybe.distance);
87140
+ const direction = coerceNumber(maybe.direction);
87141
+ const opacity = coerceNumber(maybe.opacity);
87142
+ if (blurRadius == null || blurRadius < 0 || distance == null || distance < 0 || direction == null || opacity == null || typeof maybe.color !== "string")
87143
+ return;
87144
+ const clamp = (val) => Math.max(0, Math.min(1, val));
87145
+ const normalized = {
87146
+ type: "outerShadow",
87147
+ blurRadius,
87148
+ distance,
87149
+ direction,
87150
+ color: maybe.color,
87151
+ opacity: clamp(opacity)
87152
+ };
87153
+ return Object.fromEntries(Object.entries(normalized).filter(([, fieldValue]) => fieldValue !== undefined));
87154
+ }
87080
87155
  function normalizeShapeGroupChildren(value) {
87081
87156
  if (!Array.isArray(value))
87082
87157
  return [];
87083
- return value.filter((child) => {
87158
+ return value.flatMap((child) => {
87084
87159
  if (!child || typeof child !== "object")
87085
- return false;
87086
- return typeof child.shapeType === "string";
87160
+ return [];
87161
+ if (typeof child.shapeType !== "string")
87162
+ return [];
87163
+ const shapeChild = child;
87164
+ if (shapeChild.shapeType !== "vectorShape")
87165
+ return [shapeChild];
87166
+ const attrs = shapeChild.attrs;
87167
+ if (!attrs || typeof attrs !== "object")
87168
+ return [shapeChild];
87169
+ const rawAttrs = attrs;
87170
+ const normalizedAttrs = { ...rawAttrs };
87171
+ const normalizeAttr = (key, normalize$1) => {
87172
+ if (!(key in rawAttrs))
87173
+ return;
87174
+ const normalized = normalize$1(rawAttrs[key]);
87175
+ if (normalized !== undefined)
87176
+ normalizedAttrs[key] = normalized;
87177
+ else
87178
+ delete normalizedAttrs[key];
87179
+ };
87180
+ normalizeAttr("fillColor", normalizeFillColor);
87181
+ normalizeAttr("strokeColor", normalizeStrokeColor);
87182
+ normalizeAttr("strokeWidth", coerceNumber);
87183
+ normalizeAttr("lineEnds", normalizeLineEnds);
87184
+ normalizeAttr("effects", normalizeShapeEffects);
87185
+ normalizeAttr("textContent", normalizeTextContent);
87186
+ normalizeAttr("textAlign", (value$1) => typeof value$1 === "string" ? value$1 : undefined);
87187
+ normalizeAttr("textVerticalAlign", normalizeTextVerticalAlign);
87188
+ normalizeAttr("textInsets", normalizeTextInsets);
87189
+ return [{
87190
+ ...shapeChild,
87191
+ attrs: normalizedAttrs
87192
+ }];
87087
87193
  });
87088
87194
  }
87089
87195
  function normalizeMediaKey(value) {
@@ -87372,6 +87478,25 @@ function normalizeTextContent(value) {
87372
87478
  "right"
87373
87479
  ].includes(value.horizontalAlign))
87374
87480
  result.horizontalAlign = value.horizontalAlign;
87481
+ if (Array.isArray(value.paragraphs)) {
87482
+ const normalizedParagraphs = value.paragraphs.map((paragraph2) => {
87483
+ if (!isPlainObject4(paragraph2))
87484
+ return {};
87485
+ const spacing = isPlainObject4(paragraph2.spacing) ? paragraph2.spacing : undefined;
87486
+ const before = Number.isFinite(spacing?.before) ? spacing.before : undefined;
87487
+ const after = Number.isFinite(spacing?.after) ? spacing.after : undefined;
87488
+ if (before === undefined && after === undefined)
87489
+ return {};
87490
+ const out = { spacing: {} };
87491
+ if (before !== undefined)
87492
+ out.spacing.before = before;
87493
+ if (after !== undefined)
87494
+ out.spacing.after = after;
87495
+ return out;
87496
+ });
87497
+ if (normalizedParagraphs.some((paragraph2) => ("spacing" in paragraph2)))
87498
+ result.paragraphs = normalizedParagraphs;
87499
+ }
87375
87500
  return result;
87376
87501
  }
87377
87502
  function normalizeTextVerticalAlign(value) {
@@ -89044,6 +89169,10 @@ function imageNodeToRun({ node: node2, positions, sdtMetadata }) {
89044
89169
  run$1.title = attrs.title;
89045
89170
  if (typeof attrs.clipPath === "string")
89046
89171
  run$1.clipPath = attrs.clipPath;
89172
+ if (typeof attrs.shapeClipPath === "string")
89173
+ run$1.shapeClipPath = attrs.shapeClipPath;
89174
+ if (isAllowedObjectFit$1(attrs.objectFit))
89175
+ run$1.objectFit = attrs.objectFit;
89047
89176
  const distTop = pickNumber(wrapAttrs.distTop ?? wrapAttrs.distT);
89048
89177
  if (distTop != null)
89049
89178
  run$1.distTop = distTop;
@@ -89318,7 +89447,7 @@ function vectorShapeNodeToDrawingBlock(node2, nextBlockId, positions) {
89318
89447
  const rawAttrs = getAttrs$2(node2);
89319
89448
  if (isHiddenDrawing$1(rawAttrs))
89320
89449
  return null;
89321
- const effectExtent = normalizeEffectExtent(rawAttrs.effectExtent);
89450
+ const effectExtent = mergeEffectExtents(normalizeEffectExtent(rawAttrs.effectExtent), getRequiredVectorShapeEffectExtent(rawAttrs));
89322
89451
  const baseWidth = coercePositiveNumber(rawAttrs.width, 1);
89323
89452
  const baseHeight = coercePositiveNumber(rawAttrs.height, 1);
89324
89453
  const extraWidth = (effectExtent?.left ?? 0) + (effectExtent?.right ?? 0);
@@ -89342,16 +89471,23 @@ function shapeGroupNodeToDrawingBlock(node2, nextBlockId, positions) {
89342
89471
  const size = normalizeShapeSize(rawAttrs.size);
89343
89472
  const width = size?.width ?? groupTransform?.width ?? 1;
89344
89473
  const height = size?.height ?? groupTransform?.height ?? 1;
89474
+ const childCoordinateWidth = groupTransform?.width ?? width;
89475
+ const childCoordinateHeight = groupTransform?.height ?? height;
89476
+ const shapes = normalizeShapeGroupChildren(rawAttrs.shapes);
89477
+ const effectExtent = mergeEffectExtents(normalizeEffectExtent(rawAttrs.effectExtent), getRequiredGroupEffectExtentFromChildren(shapes, childCoordinateWidth, childCoordinateHeight));
89478
+ const extraWidth = (effectExtent?.left ?? 0) + (effectExtent?.right ?? 0);
89479
+ const extraHeight = (effectExtent?.top ?? 0) + (effectExtent?.bottom ?? 0);
89345
89480
  return buildDrawingBlock(rawAttrs, nextBlockId, positions, node2, {
89346
- width: coercePositiveNumber(width, 1),
89347
- height: coercePositiveNumber(height, 1),
89481
+ width: coercePositiveNumber(width + extraWidth, 1),
89482
+ height: coercePositiveNumber(height + extraHeight, 1),
89348
89483
  rotation: coerceNumber(rawAttrs.rotation) ?? 0,
89349
89484
  flipH: coerceBoolean(rawAttrs.flipH) ?? false,
89350
89485
  flipV: coerceBoolean(rawAttrs.flipV) ?? false
89351
89486
  }, "shapeGroup", {
89352
89487
  groupTransform,
89353
- shapes: normalizeShapeGroupChildren(rawAttrs.shapes),
89354
- size
89488
+ shapes,
89489
+ size,
89490
+ effectExtent
89355
89491
  });
89356
89492
  }
89357
89493
  function shapeContainerNodeToDrawingBlock(node2, nextBlockId, positions) {
@@ -90199,7 +90335,13 @@ function paragraphToFlowBlocks({ para, nextBlockId, positions, storyKey, tracked
90199
90335
  visitNode(child, [], undefined, undefined);
90200
90336
  });
90201
90337
  flushParagraph();
90202
- if (!blocks.some((block) => block.kind === "paragraph") && !suppressedByVanish && !paragraphProps.runProperties?.vanish)
90338
+ if (!blocks.some((block) => block.kind === "paragraph") && !suppressedByVanish && !paragraphProps.runProperties?.vanish) {
90339
+ let syntheticParagraphAttrs = deepClone(paragraphAttrs);
90340
+ if (isSectPrMarker)
90341
+ if (syntheticParagraphAttrs)
90342
+ syntheticParagraphAttrs.sectPrMarker = true;
90343
+ else
90344
+ syntheticParagraphAttrs = { sectPrMarker: true };
90203
90345
  blocks.push({
90204
90346
  kind: "paragraph",
90205
90347
  id: baseBlockId,
@@ -90208,9 +90350,10 @@ function paragraphToFlowBlocks({ para, nextBlockId, positions, storyKey, tracked
90208
90350
  fontFamily: defaultFont,
90209
90351
  fontSize: defaultSize
90210
90352
  }],
90211
- attrs: deepClone(paragraphAttrs),
90353
+ attrs: syntheticParagraphAttrs,
90212
90354
  sourceAnchor
90213
90355
  });
90356
+ }
90214
90357
  blocks.forEach((block) => {
90215
90358
  if (block.kind === "paragraph" && block.runs.length > 1)
90216
90359
  block.runs = mergeAdjacentRuns(block.runs);
@@ -99482,7 +99625,24 @@ var isRegExp = (value) => {
99482
99625
  return true;
99483
99626
  }, areAttrsEqual = (attrsA = {}, attrsB = {}) => {
99484
99627
  return objectIncludes(attrsA, attrsB);
99485
- }, TrackInsertMarkName = "trackInsert", TrackDeleteMarkName = "trackDelete", TrackFormatMarkName = "trackFormat", TrackedFormatMarkNames, TAB_POSITION_TOLERANCE_TWIPS = 20, OOXML_PCT_DIVISOR = 5000, TWIPS_PER_PX = 15, isPlainObject$3 = (value) => value !== null && typeof value === "object" && !Array.isArray(value), OOXML_Z_INDEX_BASE = 251658240, SPACE_CHARS, SUBSCRIPT_SUPERSCRIPT_SCALE = 0.65, BASELINE_SHIFT_EPSILON = 0.000001, isAtomicRunKind = (kind) => kind === "image" || kind === "lineBreak" || kind === "break" || kind === "tab" || kind === "fieldAnnotation", isImageLikeRun = (run$1) => {
99628
+ }, TrackInsertMarkName = "trackInsert", TrackDeleteMarkName = "trackDelete", TrackFormatMarkName = "trackFormat", TrackedFormatMarkNames, TAB_POSITION_TOLERANCE_TWIPS = 20, OOXML_PCT_DIVISOR = 5000, TWIPS_PER_PX = 15, isPlainObject$3 = (value) => value !== null && typeof value === "object" && !Array.isArray(value), OOXML_Z_INDEX_BASE = 251658240, resolveOuterShadowOffset = (shadow) => {
99629
+ const radians = shadow.direction * Math.PI / 180;
99630
+ return {
99631
+ dx: shadow.distance * Math.cos(radians),
99632
+ dy: shadow.distance * Math.sin(radians)
99633
+ };
99634
+ }, getOuterShadowStdDeviation = (shadow) => {
99635
+ return Math.max(0, shadow.blurRadius / 2);
99636
+ }, getOuterShadowPaintExtent = (shadow) => {
99637
+ const { dx, dy } = resolveOuterShadowOffset(shadow);
99638
+ const spread = getOuterShadowStdDeviation(shadow) * 3;
99639
+ return {
99640
+ left: Math.max(0, spread - dx),
99641
+ top: Math.max(0, spread - dy),
99642
+ right: Math.max(0, spread + dx),
99643
+ bottom: Math.max(0, spread + dy)
99644
+ };
99645
+ }, SPACE_CHARS, SUBSCRIPT_SUPERSCRIPT_SCALE = 0.65, BASELINE_SHIFT_EPSILON = 0.000001, isAtomicRunKind = (kind) => kind === "image" || kind === "lineBreak" || kind === "break" || kind === "tab" || kind === "fieldAnnotation", isImageLikeRun = (run$1) => {
99486
99646
  if (!run$1 || typeof run$1 !== "object")
99487
99647
  return false;
99488
99648
  return typeof run$1.src === "string";
@@ -106000,6 +106160,37 @@ var isRegExp = (value) => {
106000
106160
  const alphaModFix = findChildByLocalName(blip?.elements, "alphaModFix");
106001
106161
  const amt = Number(alphaModFix?.attributes?.amt);
106002
106162
  return Number.isFinite(amt) ? { amt } : undefined;
106163
+ }, buildShapeClipPathFromPreset = (preset) => {
106164
+ if (preset === "ellipse")
106165
+ return "ellipse(50% 50% at 50% 50%)";
106166
+ return null;
106167
+ }, extractPicturePresentation = (picture) => {
106168
+ const blipFill = picture?.elements?.find((el) => el.name === "pic:blipFill");
106169
+ const stretch = findChildByLocalName(blipFill?.elements, "stretch");
106170
+ const fillRect = findChildByLocalName(stretch?.elements, "fillRect");
106171
+ const srcRect = findChildByLocalName(blipFill?.elements, "srcRect");
106172
+ const srcRectAttrs = srcRect?.attributes || {};
106173
+ const clipPath = buildClipPathFromSrcRect(srcRectAttrs);
106174
+ const srcRectHasNegativeValues = [
106175
+ "l",
106176
+ "t",
106177
+ "r",
106178
+ "b"
106179
+ ].some((attr) => {
106180
+ const val = srcRectAttrs[attr];
106181
+ return val != null && parseFloat(val) < 0;
106182
+ });
106183
+ const spPr = picture?.elements?.find((el) => el.name === "pic:spPr");
106184
+ const shapeClipPath = buildShapeClipPathFromPreset(findChildByLocalName(spPr?.elements, "prstGeom")?.attributes?.["prst"]);
106185
+ const shouldStretch = Boolean(stretch && fillRect);
106186
+ return {
106187
+ clipPath,
106188
+ rawSrcRect: srcRect,
106189
+ shouldCover: shouldStretch && !srcRectHasNegativeValues && !clipPath,
106190
+ shouldFillClippedStretch: shouldStretch && !srcRectHasNegativeValues && Boolean(clipPath),
106191
+ shouldCoverShapeStretch: shouldStretch && Boolean(shapeClipPath) && !clipPath,
106192
+ shapeClipPath
106193
+ };
106003
106194
  }, mergeAnchorPaddingIntoWrapDistances = (wrap$1, padding) => {
106004
106195
  if (!wrap$1?.attrs || !padding)
106005
106196
  return;
@@ -106070,7 +106261,289 @@ var isRegExp = (value) => {
106070
106261
  if (placeholder?.attrs && isHidden)
106071
106262
  placeholder.attrs.hidden = true;
106072
106263
  return placeholder;
106073
- }, handleShapeGroup = (params, node2, graphicData, size, padding, marginOffset, anchorData, wrap$1, isHidden) => {
106264
+ }, parseEmuNumber = (value, fallback = 0) => {
106265
+ const numeric = Number(value);
106266
+ return Number.isFinite(numeric) ? numeric : fallback;
106267
+ }, getGroupXfrm = (groupNode) => {
106268
+ return findChildByLocalName(findChildByLocalName(groupNode?.elements, "grpSpPr")?.elements, "xfrm");
106269
+ }, buildShapeGroupTransformAttrs = (xfrm) => {
106270
+ const groupTransform = {};
106271
+ if (!xfrm)
106272
+ return groupTransform;
106273
+ if (xfrm.attributes?.["rot"])
106274
+ groupTransform.rotation = rotToDegrees(xfrm.attributes["rot"]);
106275
+ if (xfrm.attributes?.["flipH"] === "1")
106276
+ groupTransform.flipH = true;
106277
+ if (xfrm.attributes?.["flipV"] === "1")
106278
+ groupTransform.flipV = true;
106279
+ const off = findChildByLocalName(xfrm.elements, "off");
106280
+ const ext = findChildByLocalName(xfrm.elements, "ext");
106281
+ const chOff = findChildByLocalName(xfrm.elements, "chOff");
106282
+ const chExt = findChildByLocalName(xfrm.elements, "chExt");
106283
+ if (off) {
106284
+ groupTransform.x = emuToPixels(off.attributes?.["x"] || 0);
106285
+ groupTransform.y = emuToPixels(off.attributes?.["y"] || 0);
106286
+ }
106287
+ if (ext) {
106288
+ groupTransform.width = emuToPixels(ext.attributes?.["cx"] || 0);
106289
+ groupTransform.height = emuToPixels(ext.attributes?.["cy"] || 0);
106290
+ }
106291
+ if (chOff) {
106292
+ groupTransform.childX = emuToPixels(chOff.attributes?.["x"] || 0);
106293
+ groupTransform.childY = emuToPixels(chOff.attributes?.["y"] || 0);
106294
+ groupTransform.childOriginXEmu = parseEmuNumber(chOff.attributes?.["x"]);
106295
+ groupTransform.childOriginYEmu = parseEmuNumber(chOff.attributes?.["y"]);
106296
+ }
106297
+ if (chExt) {
106298
+ groupTransform.childWidth = emuToPixels(chExt.attributes?.["cx"] || 0);
106299
+ groupTransform.childHeight = emuToPixels(chExt.attributes?.["cy"] || 0);
106300
+ }
106301
+ return groupTransform;
106302
+ }, identityMatrix = () => ({
106303
+ a: 1,
106304
+ b: 0,
106305
+ c: 0,
106306
+ d: 1,
106307
+ e: 0,
106308
+ f: 0
106309
+ }), multiplyMatrix = (left, right) => ({
106310
+ a: left.a * right.a + left.c * right.b,
106311
+ b: left.b * right.a + left.d * right.b,
106312
+ c: left.a * right.c + left.c * right.d,
106313
+ d: left.b * right.c + left.d * right.d,
106314
+ e: left.a * right.e + left.c * right.f + left.e,
106315
+ f: left.b * right.e + left.d * right.f + left.f
106316
+ }), transformPoint = (matrix, x, y) => ({
106317
+ x: matrix.a * x + matrix.c * y + matrix.e,
106318
+ y: matrix.b * x + matrix.d * y + matrix.f
106319
+ }), normalizeDegrees = (degrees) => {
106320
+ const normalized = (degrees % 360 + 360) % 360;
106321
+ return Object.is(normalized, -0) ? 0 : normalized;
106322
+ }, decomposeMatrixOrientation = (matrix) => {
106323
+ if (matrix.a * matrix.d - matrix.b * matrix.c < 0)
106324
+ return {
106325
+ rotation: normalizeDegrees(Math.atan2(-matrix.b, -matrix.a) * 180 / Math.PI),
106326
+ flipH: true,
106327
+ flipV: false
106328
+ };
106329
+ return {
106330
+ rotation: normalizeDegrees(Math.atan2(matrix.b, matrix.a) * 180 / Math.PI),
106331
+ flipH: false,
106332
+ flipV: false
106333
+ };
106334
+ }, getVisualOrientationMatrix = ({ rotation = 0, flipH = false, flipV = false } = {}) => {
106335
+ const radians = rotation * Math.PI / 180;
106336
+ const cos = Math.cos(radians);
106337
+ const sin = Math.sin(radians);
106338
+ const flipScaleX = flipH ? -1 : 1;
106339
+ const flipScaleY = flipV ? -1 : 1;
106340
+ return {
106341
+ a: cos * flipScaleX,
106342
+ b: sin * flipScaleX,
106343
+ c: -sin * flipScaleY,
106344
+ d: cos * flipScaleY,
106345
+ e: 0,
106346
+ f: 0
106347
+ };
106348
+ }, getGroupAffineTransform = (xfrm, { includeVisualTransform = false } = {}) => {
106349
+ if (!xfrm)
106350
+ return {
106351
+ matrix: identityMatrix(),
106352
+ rotation: 0,
106353
+ flipH: false,
106354
+ flipV: false
106355
+ };
106356
+ const off = findChildByLocalName(xfrm.elements, "off");
106357
+ const ext = findChildByLocalName(xfrm.elements, "ext");
106358
+ const chOff = findChildByLocalName(xfrm.elements, "chOff");
106359
+ const chExt = findChildByLocalName(xfrm.elements, "chExt");
106360
+ const childWidth = parseEmuNumber(chExt?.attributes?.["cx"]);
106361
+ const childHeight = parseEmuNumber(chExt?.attributes?.["cy"]);
106362
+ const width = parseEmuNumber(ext?.attributes?.["cx"], childWidth || 0);
106363
+ const height = parseEmuNumber(ext?.attributes?.["cy"], childHeight || 0);
106364
+ const childX = parseEmuNumber(chOff?.attributes?.["x"]);
106365
+ const childY = parseEmuNumber(chOff?.attributes?.["y"]);
106366
+ const x = parseEmuNumber(off?.attributes?.["x"]);
106367
+ const y = parseEmuNumber(off?.attributes?.["y"]);
106368
+ const scaleX = childWidth !== 0 ? width / childWidth : 1;
106369
+ const scaleY = childHeight !== 0 ? height / childHeight : 1;
106370
+ const rotation = xfrm.attributes?.["rot"] ? rotToDegrees(xfrm.attributes["rot"]) : 0;
106371
+ const flipH = xfrm.attributes?.["flipH"] === "1";
106372
+ const flipV = xfrm.attributes?.["flipV"] === "1";
106373
+ const baseMatrix = {
106374
+ a: scaleX,
106375
+ b: 0,
106376
+ c: 0,
106377
+ d: scaleY,
106378
+ e: x - childX * scaleX,
106379
+ f: y - childY * scaleY
106380
+ };
106381
+ if (!includeVisualTransform || !rotation && !flipH && !flipV)
106382
+ return {
106383
+ matrix: baseMatrix,
106384
+ rotation: 0,
106385
+ flipH: false,
106386
+ flipV: false
106387
+ };
106388
+ const radians = rotation * Math.PI / 180;
106389
+ const cos = Math.cos(radians);
106390
+ const sin = Math.sin(radians);
106391
+ const flipScaleX = flipH ? -1 : 1;
106392
+ const flipScaleY = flipV ? -1 : 1;
106393
+ const centerX = x + width / 2;
106394
+ const centerY = y + height / 2;
106395
+ return {
106396
+ matrix: multiplyMatrix({
106397
+ a: cos * flipScaleX,
106398
+ b: sin * flipScaleX,
106399
+ c: -sin * flipScaleY,
106400
+ d: cos * flipScaleY,
106401
+ e: centerX - (cos * flipScaleX * centerX + -sin * flipScaleY * centerY),
106402
+ f: centerY - (sin * flipScaleX * centerX + cos * flipScaleY * centerY)
106403
+ }, baseMatrix),
106404
+ rotation,
106405
+ flipH,
106406
+ flipV
106407
+ };
106408
+ }, composeShapeGroupTransform = (parent, child) => {
106409
+ const matrix = multiplyMatrix(parent.matrix, child.matrix);
106410
+ return {
106411
+ matrix,
106412
+ ...decomposeMatrixOrientation(matrix)
106413
+ };
106414
+ }, composeShapeGroupChildOrientation = (rect, xfrm) => {
106415
+ return decomposeMatrixOrientation(multiplyMatrix(getVisualOrientationMatrix({
106416
+ rotation: rect.rotation ?? 0,
106417
+ flipH: Boolean(rect.flipH),
106418
+ flipV: Boolean(rect.flipV)
106419
+ }), getVisualOrientationMatrix({
106420
+ rotation: xfrm?.attributes?.["rot"] ? rotToDegrees(xfrm.attributes["rot"]) : 0,
106421
+ flipH: xfrm?.attributes?.["flipH"] === "1",
106422
+ flipV: xfrm?.attributes?.["flipV"] === "1"
106423
+ })));
106424
+ }, transformShapeGroupChildRect = (transform2, rawX, rawY, rawWidth, rawHeight) => {
106425
+ const matrix = transform2.matrix ?? identityMatrix();
106426
+ const width = Math.hypot(matrix.a, matrix.b) * rawWidth;
106427
+ const height = Math.hypot(matrix.c, matrix.d) * rawHeight;
106428
+ const center = transformPoint(matrix, rawX + rawWidth / 2, rawY + rawHeight / 2);
106429
+ return {
106430
+ x: emuToPixels(center.x - width / 2),
106431
+ y: emuToPixels(center.y - height / 2),
106432
+ width: emuToPixels(width),
106433
+ height: emuToPixels(height),
106434
+ rotation: transform2.rotation ?? 0,
106435
+ flipH: Boolean(transform2.flipH),
106436
+ flipV: Boolean(transform2.flipV)
106437
+ };
106438
+ }, resolveShapeGroupPicturePath = (pic, params) => {
106439
+ const blip = findChildByLocalName(findChildByLocalName(pic.elements, "blipFill")?.elements, "blip");
106440
+ if (!blip)
106441
+ return null;
106442
+ const rEmbed = blip.attributes?.["r:embed"];
106443
+ if (!rEmbed)
106444
+ return null;
106445
+ const currentFile = params.filename || "document.xml";
106446
+ let rels = params.docx[`word/_rels/${currentFile}.rels`];
106447
+ if (!rels)
106448
+ rels = params.docx[`word/_rels/document.xml.rels`];
106449
+ const rel = rels?.elements.find((el) => el.name === "Relationships")?.elements?.find((el) => el.attributes["Id"] === rEmbed);
106450
+ if (!rel)
106451
+ return null;
106452
+ return normalizeTargetPath$1(rel.attributes?.["Target"]);
106453
+ }, parseShapeGroupVectorChild = (wsp, transform2, params) => {
106454
+ const spPr = findChildByLocalName(wsp.elements, "spPr");
106455
+ if (!spPr)
106456
+ return null;
106457
+ const shapeKind = findChildByLocalName(spPr.elements, "prstGeom")?.attributes?.["prst"];
106458
+ const customGeom = !shapeKind ? extractCustomGeometry(spPr) : null;
106459
+ const shapeXfrm = findChildByLocalName(spPr.elements, "xfrm");
106460
+ const shapeOff = findChildByLocalName(shapeXfrm?.elements, "off");
106461
+ const shapeExt = findChildByLocalName(shapeXfrm?.elements, "ext");
106462
+ const rect = transformShapeGroupChildRect(transform2, parseEmuNumber(shapeOff?.attributes?.["x"]), parseEmuNumber(shapeOff?.attributes?.["y"]), parseEmuNumber(shapeExt?.attributes?.["cx"], 914400), parseEmuNumber(shapeExt?.attributes?.["cy"], 914400));
106463
+ const orientation = composeShapeGroupChildOrientation(rect, shapeXfrm);
106464
+ const style = findChildByLocalName(wsp.elements, "style");
106465
+ const fillColor = extractFillColor(spPr, style);
106466
+ const strokeColor = extractStrokeColor(spPr, style);
106467
+ const strokeWidth = extractStrokeWidth(spPr);
106468
+ const lineEnds = extractLineEnds(spPr);
106469
+ const effects2 = extractShapeEffects(spPr);
106470
+ const cNvPr = findChildByLocalName(wsp.elements, "cNvPr");
106471
+ const shapeId = cNvPr?.attributes?.["id"];
106472
+ const shapeName = cNvPr?.attributes?.["name"];
106473
+ const textBoxContent = findChildByLocalName(findChildByLocalName(wsp.elements, "txbx")?.elements, "txbxContent");
106474
+ const bodyPr = findChildByLocalName(wsp.elements, "bodyPr");
106475
+ const textContent = textBoxContent ? extractTextFromTextBox(textBoxContent, bodyPr, params) : null;
106476
+ const textAlign = textContent?.horizontalAlign || "left";
106477
+ return {
106478
+ shapeType: "vectorShape",
106479
+ attrs: {
106480
+ kind: shapeKind,
106481
+ customGeometry: customGeom || undefined,
106482
+ ...rect,
106483
+ ...orientation,
106484
+ fillColor,
106485
+ strokeColor,
106486
+ strokeWidth,
106487
+ lineEnds,
106488
+ effects: effects2,
106489
+ shapeId,
106490
+ shapeName,
106491
+ textContent,
106492
+ textAlign,
106493
+ textVerticalAlign: textContent?.verticalAlign,
106494
+ textInsets: textContent?.insets
106495
+ }
106496
+ };
106497
+ }, parseShapeGroupImageChild = (pic, transform2, params) => {
106498
+ const spPr = findChildByLocalName(pic.elements, "spPr");
106499
+ if (!spPr)
106500
+ return null;
106501
+ const xfrm = findChildByLocalName(spPr.elements, "xfrm");
106502
+ const off = findChildByLocalName(xfrm?.elements, "off");
106503
+ const ext = findChildByLocalName(xfrm?.elements, "ext");
106504
+ const rect = transformShapeGroupChildRect(transform2, parseEmuNumber(off?.attributes?.["x"]), parseEmuNumber(off?.attributes?.["y"]), parseEmuNumber(ext?.attributes?.["cx"], 914400), parseEmuNumber(ext?.attributes?.["cy"], 914400));
106505
+ const orientation = composeShapeGroupChildOrientation(rect, xfrm);
106506
+ const path2 = resolveShapeGroupPicturePath(pic, params);
106507
+ if (!path2)
106508
+ return null;
106509
+ const alphaModFix = extractAlphaModFix(findChildByLocalName(findChildByLocalName(pic.elements, "blipFill")?.elements, "blip"));
106510
+ const cNvPr = findChildByLocalName(findChildByLocalName(pic.elements, "nvPicPr")?.elements, "cNvPr");
106511
+ const picId = cNvPr?.attributes?.["id"];
106512
+ const picName = cNvPr?.attributes?.["name"];
106513
+ const { clipPath, shouldCover, shouldFillClippedStretch, shouldCoverShapeStretch, shapeClipPath } = extractPicturePresentation(pic);
106514
+ return {
106515
+ shapeType: "image",
106516
+ attrs: {
106517
+ ...rect,
106518
+ ...orientation,
106519
+ src: path2,
106520
+ imageId: picId,
106521
+ imageName: picName,
106522
+ ...alphaModFix ? { alphaModFix } : {},
106523
+ ...clipPath ? { clipPath } : {},
106524
+ ...shapeClipPath ? { shapeClipPath } : {},
106525
+ ...shouldFillClippedStretch || shouldCoverShapeStretch ? { objectFit: shouldFillClippedStretch ? "fill" : "cover" } : shouldCover ? { objectFit: "cover" } : {}
106526
+ }
106527
+ };
106528
+ }, collectShapeGroupChildren = (groupNode, transform2, params) => {
106529
+ const children = [];
106530
+ for (const child of groupNode?.elements || []) {
106531
+ const localName = getLocalName$1(child?.name);
106532
+ if (localName === "wsp") {
106533
+ const shape = parseShapeGroupVectorChild(child, transform2, params);
106534
+ if (shape)
106535
+ children.push(shape);
106536
+ } else if (localName === "pic") {
106537
+ const picture = parseShapeGroupImageChild(child, transform2, params);
106538
+ if (picture)
106539
+ children.push(picture);
106540
+ } else if (localName === "grpSp") {
106541
+ const nestedTransform = composeShapeGroupTransform(transform2, getGroupAffineTransform(getGroupXfrm(child), { includeVisualTransform: true }));
106542
+ children.push(...collectShapeGroupChildren(child, nestedTransform, params));
106543
+ }
106544
+ }
106545
+ return children;
106546
+ }, handleShapeGroup = (params, node2, graphicData, size, padding, marginOffset, anchorData, wrap$1, effectExtent, isHidden) => {
106074
106547
  const wgp = graphicData.elements.find((el) => el.name === "wpg:wgp");
106075
106548
  if (!wgp) {
106076
106549
  const placeholder = buildShapePlaceholder(node2, size, padding, marginOffset, "group");
@@ -106078,166 +106551,9 @@ var isRegExp = (value) => {
106078
106551
  placeholder.attrs.hidden = true;
106079
106552
  return placeholder;
106080
106553
  }
106081
- const xfrm = findChildByLocalName(wgp.elements.find((el) => el.name === "wpg:grpSpPr")?.elements, "xfrm");
106082
- const groupTransform = {};
106083
- if (xfrm) {
106084
- const off = findChildByLocalName(xfrm.elements, "off");
106085
- const ext = findChildByLocalName(xfrm.elements, "ext");
106086
- const chOff = findChildByLocalName(xfrm.elements, "chOff");
106087
- const chExt = findChildByLocalName(xfrm.elements, "chExt");
106088
- if (off) {
106089
- groupTransform.x = emuToPixels(off.attributes?.["x"] || 0);
106090
- groupTransform.y = emuToPixels(off.attributes?.["y"] || 0);
106091
- }
106092
- if (ext) {
106093
- groupTransform.width = emuToPixels(ext.attributes?.["cx"] || 0);
106094
- groupTransform.height = emuToPixels(ext.attributes?.["cy"] || 0);
106095
- }
106096
- if (chOff) {
106097
- groupTransform.childX = emuToPixels(chOff.attributes?.["x"] || 0);
106098
- groupTransform.childY = emuToPixels(chOff.attributes?.["y"] || 0);
106099
- groupTransform.childOriginXEmu = parseFloat(chOff.attributes?.["x"] || 0);
106100
- groupTransform.childOriginYEmu = parseFloat(chOff.attributes?.["y"] || 0);
106101
- }
106102
- if (chExt) {
106103
- groupTransform.childWidth = emuToPixels(chExt.attributes?.["cx"] || 0);
106104
- groupTransform.childHeight = emuToPixels(chExt.attributes?.["cy"] || 0);
106105
- }
106106
- }
106107
- const childShapes = wgp.elements.filter((el) => el.name === "wps:wsp");
106108
- const childPictures = wgp.elements.filter((el) => el.name === "pic:pic");
106109
- const shapes = childShapes.map((wsp) => {
106110
- const spPr = wsp.elements?.find((el) => el.name === "wps:spPr");
106111
- if (!spPr)
106112
- return null;
106113
- const shapeKind = findChildByLocalName(spPr.elements, "prstGeom")?.attributes?.["prst"];
106114
- const customGeom = !shapeKind ? extractCustomGeometry(spPr) : null;
106115
- const shapeXfrm = findChildByLocalName(spPr.elements, "xfrm");
106116
- const shapeOff = findChildByLocalName(shapeXfrm?.elements, "off");
106117
- const shapeExt = findChildByLocalName(shapeXfrm?.elements, "ext");
106118
- const rawX = shapeOff?.attributes?.["x"] ? parseFloat(shapeOff.attributes["x"]) : 0;
106119
- const rawY = shapeOff?.attributes?.["y"] ? parseFloat(shapeOff.attributes["y"]) : 0;
106120
- const rawWidth = shapeExt?.attributes?.["cx"] ? parseFloat(shapeExt.attributes["cx"]) : 914400;
106121
- const rawHeight = shapeExt?.attributes?.["cy"] ? parseFloat(shapeExt.attributes["cy"]) : 914400;
106122
- let x, y, width, height;
106123
- if (groupTransform.childWidth && groupTransform.childHeight) {
106124
- const scaleX = groupTransform.width / groupTransform.childWidth;
106125
- const scaleY = groupTransform.height / groupTransform.childHeight;
106126
- const childOriginX = groupTransform.childOriginXEmu || 0;
106127
- const childOriginY = groupTransform.childOriginYEmu || 0;
106128
- x = groupTransform.x + emuToPixels((rawX - childOriginX) * scaleX);
106129
- y = groupTransform.y + emuToPixels((rawY - childOriginY) * scaleY);
106130
- width = emuToPixels(rawWidth * scaleX);
106131
- height = emuToPixels(rawHeight * scaleY);
106132
- } else {
106133
- x = emuToPixels(rawX);
106134
- y = emuToPixels(rawY);
106135
- width = emuToPixels(rawWidth);
106136
- height = emuToPixels(rawHeight);
106137
- }
106138
- const rotation = shapeXfrm?.attributes?.["rot"] ? rotToDegrees(shapeXfrm.attributes["rot"]) : 0;
106139
- const flipH = shapeXfrm?.attributes?.["flipH"] === "1";
106140
- const flipV = shapeXfrm?.attributes?.["flipV"] === "1";
106141
- const style = wsp.elements?.find((el) => el.name === "wps:style");
106142
- const fillColor = extractFillColor(spPr, style);
106143
- const strokeColor = extractStrokeColor(spPr, style);
106144
- const strokeWidth = extractStrokeWidth(spPr);
106145
- const lineEnds = extractLineEnds(spPr);
106146
- const cNvPr = wsp.elements?.find((el) => el.name === "wps:cNvPr");
106147
- const shapeId = cNvPr?.attributes?.["id"];
106148
- const shapeName = cNvPr?.attributes?.["name"];
106149
- const textBoxContent = wsp.elements?.find((el) => el.name === "wps:txbx")?.elements?.find((el) => el.name === "w:txbxContent");
106150
- const bodyPr = wsp.elements?.find((el) => el.name === "wps:bodyPr");
106151
- let textContent = null;
106152
- if (textBoxContent)
106153
- textContent = extractTextFromTextBox(textBoxContent, bodyPr, params);
106154
- const textAlign = textContent?.horizontalAlign || "left";
106155
- return {
106156
- shapeType: "vectorShape",
106157
- attrs: {
106158
- kind: shapeKind,
106159
- customGeometry: customGeom || undefined,
106160
- x,
106161
- y,
106162
- width,
106163
- height,
106164
- rotation,
106165
- flipH,
106166
- flipV,
106167
- fillColor,
106168
- strokeColor,
106169
- strokeWidth,
106170
- lineEnds,
106171
- shapeId,
106172
- shapeName,
106173
- textContent,
106174
- textAlign,
106175
- textVerticalAlign: textContent?.verticalAlign,
106176
- textInsets: textContent?.insets
106177
- }
106178
- };
106179
- }).filter(Boolean);
106180
- const allShapes = [...childPictures.map((pic) => {
106181
- const spPr = pic.elements?.find((el) => el.name === "pic:spPr");
106182
- if (!spPr)
106183
- return null;
106184
- const xfrm$1 = findChildByLocalName(spPr.elements, "xfrm");
106185
- const off = findChildByLocalName(xfrm$1?.elements, "off");
106186
- const ext = findChildByLocalName(xfrm$1?.elements, "ext");
106187
- const rawX = off?.attributes?.["x"] ? parseFloat(off.attributes["x"]) : 0;
106188
- const rawY = off?.attributes?.["y"] ? parseFloat(off.attributes["y"]) : 0;
106189
- const rawWidth = ext?.attributes?.["cx"] ? parseFloat(ext.attributes["cx"]) : 914400;
106190
- const rawHeight = ext?.attributes?.["cy"] ? parseFloat(ext.attributes["cy"]) : 914400;
106191
- let x, y, width, height;
106192
- if (groupTransform.childWidth && groupTransform.childHeight) {
106193
- const scaleX = groupTransform.width / groupTransform.childWidth;
106194
- const scaleY = groupTransform.height / groupTransform.childHeight;
106195
- const childOriginX = groupTransform.childOriginXEmu || 0;
106196
- const childOriginY = groupTransform.childOriginYEmu || 0;
106197
- x = groupTransform.x + emuToPixels((rawX - childOriginX) * scaleX);
106198
- y = groupTransform.y + emuToPixels((rawY - childOriginY) * scaleY);
106199
- width = emuToPixels(rawWidth * scaleX);
106200
- height = emuToPixels(rawHeight * scaleY);
106201
- } else {
106202
- x = emuToPixels(rawX);
106203
- y = emuToPixels(rawY);
106204
- width = emuToPixels(rawWidth);
106205
- height = emuToPixels(rawHeight);
106206
- }
106207
- const blipFill = pic.elements?.find((el) => el.name === "pic:blipFill");
106208
- const blip = findChildByLocalName(blipFill?.elements, "blip");
106209
- if (!blip)
106210
- return null;
106211
- const alphaModFix = extractAlphaModFix(blip);
106212
- const rEmbed = blip.attributes?.["r:embed"];
106213
- if (!rEmbed)
106214
- return null;
106215
- const currentFile = params.filename || "document.xml";
106216
- let rels = params.docx[`word/_rels/${currentFile}.rels`];
106217
- if (!rels)
106218
- rels = params.docx[`word/_rels/document.xml.rels`];
106219
- const { elements } = rels?.elements.find((el) => el.name === "Relationships") || [];
106220
- const rel = elements?.find((el) => el.attributes["Id"] === rEmbed);
106221
- if (!rel)
106222
- return null;
106223
- const path2 = normalizeTargetPath$1(rel.attributes?.["Target"]);
106224
- const cNvPr = pic.elements?.find((el) => el.name === "pic:nvPicPr")?.elements?.find((el) => el.name === "pic:cNvPr");
106225
- const picId = cNvPr?.attributes?.["id"];
106226
- const picName = cNvPr?.attributes?.["name"];
106227
- return {
106228
- shapeType: "image",
106229
- attrs: {
106230
- x,
106231
- y,
106232
- width,
106233
- height,
106234
- src: path2,
106235
- imageId: picId,
106236
- imageName: picName,
106237
- ...alphaModFix ? { alphaModFix } : {}
106238
- }
106239
- };
106240
- }).filter(Boolean), ...shapes];
106554
+ const groupXfrm = getGroupXfrm(wgp);
106555
+ const groupTransform = buildShapeGroupTransformAttrs(groupXfrm);
106556
+ const allShapes = collectShapeGroupChildren(wgp, getGroupAffineTransform(groupXfrm), params);
106241
106557
  const schemaAttrs = {};
106242
106558
  const drawingNode = params.nodes?.[0];
106243
106559
  if (drawingNode?.name === DRAWING_XML_TAG)
@@ -106252,6 +106568,7 @@ var isRegExp = (value) => {
106252
106568
  size,
106253
106569
  padding,
106254
106570
  marginOffset,
106571
+ effectExtent,
106255
106572
  anchorData,
106256
106573
  wrap: wrap$1,
106257
106574
  originalAttributes: node2?.attributes
@@ -117007,7 +117324,7 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
117007
117324
  return children;
117008
117325
  }
117009
117326
  return [];
117010
- }, NON_RENDERED_STRUCTURAL_INLINE_TYPES, PARAGRAPH_CONTAINER_TYPES, NON_BREAKING_HYPHEN = "‑", DEFAULT_IMAGE_DIMENSION_PX = 100, isNodeHidden = (node2) => {
117327
+ }, NON_RENDERED_STRUCTURAL_INLINE_TYPES, PARAGRAPH_CONTAINER_TYPES, NON_BREAKING_HYPHEN = "‑", DEFAULT_IMAGE_DIMENSION_PX = 100, ALLOWED_OBJECT_FIT, isAllowedObjectFit$1 = (value) => typeof value === "string" && ALLOWED_OBJECT_FIT.has(value), isNodeHidden = (node2) => {
117011
117328
  const attrs = node2.attrs ?? {};
117012
117329
  if (attrs.hidden === true)
117013
117330
  return true;
@@ -117329,6 +117646,7 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
117329
117646
  fillColor: normalizeFillColor(rawAttrs.fillColor),
117330
117647
  strokeColor: normalizeStrokeColor(rawAttrs.strokeColor),
117331
117648
  strokeWidth: coerceNumber(rawAttrs.strokeWidth),
117649
+ effects: normalizeShapeEffects(rawAttrs.effects),
117332
117650
  textContent: normalizeTextContent(rawAttrs.textContent),
117333
117651
  textAlign: typeof rawAttrs.textAlign === "string" ? rawAttrs.textAlign : undefined,
117334
117652
  textVerticalAlign: normalizeTextVerticalAlign(rawAttrs.textVerticalAlign),
@@ -117336,6 +117654,77 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
117336
117654
  sourceAnchor,
117337
117655
  ...extraProps
117338
117656
  };
117657
+ }, mergeEffectExtents = (base$1, supplement) => {
117658
+ if (!base$1)
117659
+ return supplement;
117660
+ if (!supplement)
117661
+ return base$1;
117662
+ return {
117663
+ left: Math.max(base$1.left, supplement.left),
117664
+ top: Math.max(base$1.top, supplement.top),
117665
+ right: Math.max(base$1.right, supplement.right),
117666
+ bottom: Math.max(base$1.bottom, supplement.bottom)
117667
+ };
117668
+ }, hasEffectExtent = (extent) => {
117669
+ return !!extent && (extent.left > 0 || extent.top > 0 || extent.right > 0 || extent.bottom > 0);
117670
+ }, getCenteredStrokeHalfExtent = (attrs) => {
117671
+ if (!("fillColor" in attrs))
117672
+ return 0;
117673
+ if ("lineEnds" in attrs && attrs.lineEnds)
117674
+ return 0;
117675
+ if (attrs.strokeColor === null)
117676
+ return 0;
117677
+ const strokeWidth = pickNumber(attrs.strokeWidth) ?? 1;
117678
+ return strokeWidth > 0 ? strokeWidth / 2 : 0;
117679
+ }, getShapeGroupChildStrokeExtent = (child) => {
117680
+ if (child.shapeType !== "vectorShape" || !isPlainObject4(child.attrs))
117681
+ return 0;
117682
+ return getCenteredStrokeHalfExtent(child.attrs);
117683
+ }, getOuterShadowPaintExtent$1 = (attrs) => {
117684
+ if ("lineEnds" in attrs && attrs.lineEnds)
117685
+ return;
117686
+ const shadow = normalizeShapeEffects(attrs.effects)?.outerShadow;
117687
+ if (!shadow)
117688
+ return;
117689
+ const extent = getOuterShadowPaintExtent(shadow);
117690
+ return hasEffectExtent(extent) ? extent : undefined;
117691
+ }, getRequiredVectorShapeEffectExtent = (attrs) => {
117692
+ const strokeExtent = getCenteredStrokeHalfExtent(attrs);
117693
+ return mergeEffectExtents(strokeExtent > 0 ? {
117694
+ left: strokeExtent,
117695
+ top: strokeExtent,
117696
+ right: strokeExtent,
117697
+ bottom: strokeExtent
117698
+ } : undefined, getOuterShadowPaintExtent$1(attrs));
117699
+ }, getRequiredGroupEffectExtentFromChildren = (children, width, height) => {
117700
+ const required2 = {
117701
+ left: 0,
117702
+ top: 0,
117703
+ right: 0,
117704
+ bottom: 0
117705
+ };
117706
+ for (const child of children) {
117707
+ if (child.shapeType !== "vectorShape" || !isPlainObject4(child.attrs))
117708
+ continue;
117709
+ const strokeExtent = getShapeGroupChildStrokeExtent(child);
117710
+ const paintExtent = mergeEffectExtents(strokeExtent > 0 ? {
117711
+ left: strokeExtent,
117712
+ top: strokeExtent,
117713
+ right: strokeExtent,
117714
+ bottom: strokeExtent
117715
+ } : undefined, getOuterShadowPaintExtent$1(child.attrs));
117716
+ if (!paintExtent)
117717
+ continue;
117718
+ const childX = pickNumber(child.attrs.x) ?? 0;
117719
+ const childY = pickNumber(child.attrs.y) ?? 0;
117720
+ const childWidth = pickNumber(child.attrs.width) ?? 0;
117721
+ const childHeight = pickNumber(child.attrs.height) ?? 0;
117722
+ required2.left = Math.max(required2.left, Math.max(0, paintExtent.left - childX));
117723
+ required2.top = Math.max(required2.top, Math.max(0, paintExtent.top - childY));
117724
+ required2.right = Math.max(required2.right, Math.max(0, childX + childWidth + paintExtent.right - width));
117725
+ required2.bottom = Math.max(required2.bottom, Math.max(0, childY + childHeight + paintExtent.bottom - height));
117726
+ }
117727
+ return hasEffectExtent(required2) ? required2 : undefined;
117339
117728
  }, getAttrs$1 = (node2) => {
117340
117729
  return isPlainObject4(node2.attrs) ? { ...node2.attrs } : {};
117341
117730
  }, parseFullWidth = (value) => {
@@ -118604,7 +118993,7 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
118604
118993
  "data-track-change-date": change.date || ""
118605
118994
  }));
118606
118995
  }
118607
- }, NOTE_REFERENCE_NODE_TYPES, storeByEditor, liveSessionsByHost, cacheByHost, hostStoreSyncedKeys, BODY_LOCATOR, groupedCache, SDT_NODE_NAMES, SDT_BLOCK_NAME = "structuredContentBlock", SDT_INLINE_NAME = "structuredContent", SDT_NODE_TYPES, VALID_CONTROL_TYPES, VALID_LOCK_MODES, VALID_APPEARANCES, FIELD_LIKE_SDT_TYPES, liveDocumentCountsCache, BIBLIOGRAPHY_NAMESPACE_URI = "http://schemas.openxmlformats.org/officeDocument/2006/bibliography", CUSTOM_XML_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", CUSTOM_XML_PROPS_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", DEFAULT_SELECTED_STYLE = "/APA.XSL", DEFAULT_STYLE_NAME = "APA", DEFAULT_VERSION = "6", API_TO_OOXML_SOURCE_TYPE, OOXML_TO_API_SOURCE_TYPE, SIMPLE_FIELD_TO_XML_TAG, XML_TAG_TO_SIMPLE_FIELD, import_lib2, FONT_FAMILY_FALLBACKS, DEFAULT_GENERIC_FALLBACK = "sans-serif", DEFAULT_FONT_SIZE_PT = 10, CURRENT_APP_VERSION = "1.41.0", SUPERDOC_DOCUMENT_ORIGIN_PROPERTY = "SuperdocDocumentOrigin", STORED_DOCUMENT_ORIGINS, collectRunDefaultProperties = (runProps, { allowOverrideTypeface = true, allowOverrideSize = true, themeResolver, state }) => {
118996
+ }, NOTE_REFERENCE_NODE_TYPES, storeByEditor, liveSessionsByHost, cacheByHost, hostStoreSyncedKeys, BODY_LOCATOR, groupedCache, SDT_NODE_NAMES, SDT_BLOCK_NAME = "structuredContentBlock", SDT_INLINE_NAME = "structuredContent", SDT_NODE_TYPES, VALID_CONTROL_TYPES, VALID_LOCK_MODES, VALID_APPEARANCES, FIELD_LIKE_SDT_TYPES, liveDocumentCountsCache, BIBLIOGRAPHY_NAMESPACE_URI = "http://schemas.openxmlformats.org/officeDocument/2006/bibliography", CUSTOM_XML_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", CUSTOM_XML_PROPS_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", DEFAULT_SELECTED_STYLE = "/APA.XSL", DEFAULT_STYLE_NAME = "APA", DEFAULT_VERSION = "6", API_TO_OOXML_SOURCE_TYPE, OOXML_TO_API_SOURCE_TYPE, SIMPLE_FIELD_TO_XML_TAG, XML_TAG_TO_SIMPLE_FIELD, import_lib2, FONT_FAMILY_FALLBACKS, DEFAULT_GENERIC_FALLBACK = "sans-serif", DEFAULT_FONT_SIZE_PT = 10, CURRENT_APP_VERSION = "1.43.0", SUPERDOC_DOCUMENT_ORIGIN_PROPERTY = "SuperdocDocumentOrigin", STORED_DOCUMENT_ORIGINS, collectRunDefaultProperties = (runProps, { allowOverrideTypeface = true, allowOverrideSize = true, themeResolver, state }) => {
118608
118997
  if (!runProps?.elements?.length || !state)
118609
118998
  return;
118610
118999
  const fontsNode = runProps.elements.find((el) => el.name === "w:rFonts");
@@ -118638,7 +119027,7 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
118638
119027
  state.kern = kernNode.attributes["w:val"];
118639
119028
  }
118640
119029
  }, SuperConverter;
118641
- var init_SuperConverter_DQ2wMaLK_es = __esm(() => {
119030
+ var init_SuperConverter_DJEK5GYX_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-BYe9VWHO.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_BYe9VWHO_es = __esm(() => {
158394
158789
  init_rolldown_runtime_Bg48TavK_es();
158395
- init_SuperConverter_DQ2wMaLK_es();
158790
+ init_SuperConverter_DJEK5GYX_es();
158396
158791
  init_jszip_C49i9kUs_es();
158397
158792
  init_uuid_B2wVPhPi_es();
158398
158793
  init_constants_D9qj59G2_es();
@@ -214008,7 +214403,7 @@ var init_remark_gfm_DCND_V_3_es = __esm(() => {
214008
214403
  init_remark_gfm_BUJjZJLy_es();
214009
214404
  });
214010
214405
 
214011
- // ../../packages/superdoc/dist/chunks/src-CkxGCnVm.es.js
214406
+ // ../../packages/superdoc/dist/chunks/src-q2d5WRO-.es.js
214012
214407
  function deleteProps(obj, propOrProps) {
214013
214408
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
214014
214409
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -214155,7 +214550,7 @@ function prosemirrorToYXmlFragment(doc$12, xmlFragment) {
214155
214550
  }
214156
214551
  function getSuperdocVersion() {
214157
214552
  try {
214158
- return "1.41.0";
214553
+ return "1.43.0";
214159
214554
  } catch {
214160
214555
  return "unknown";
214161
214556
  }
@@ -220274,11 +220669,25 @@ function x0(t, n, o) {
220274
220669
  paths: l.paths
220275
220670
  } : null;
220276
220671
  }
220672
+ function W0(t, n, o) {
220673
+ let L = Math.max(0, Number(t) || 0), e = Math.max(0, Number(n) || 0), l = Math.min(L, e) * (16667 / 1e5), r$1 = Math.max(0, L - l), i3 = Math.max(0, e - l);
220674
+ return {
220675
+ preset: "roundRect",
220676
+ viewBox: `0 0 ${L} ${e}`,
220677
+ paths: l0([{
220678
+ d: `M 0 ${l} A ${l} ${l} 0 0 1 ${l} 0 L ${r$1} 0 A ${l} ${l} 0 0 1 ${L} ${l} L ${L} ${i3} A ${l} ${l} 0 0 1 ${r$1} ${e} L ${l} ${e} A ${l} ${l} 0 0 1 0 ${i3} Z`,
220679
+ fill: "#000000",
220680
+ stroke: "#000000"
220681
+ }], o)
220682
+ };
220683
+ }
220277
220684
  function i0(t) {
220278
220685
  let { preset: n, styleOverrides: o, width: L, height: e } = t;
220279
220686
  if (!n)
220280
220687
  throw new Error("createPresetShape requires a preset name.");
220281
- if (F.has(n) && L != null && e != null && L !== e) {
220688
+ if (n === "roundRect" && L != null && e != null)
220689
+ return W0(L, e, o);
220690
+ if (F.has(n) && L != null && e != null && (L !== e || n === "leftUpArrow")) {
220282
220691
  let i3 = x0(n, L, e);
220283
220692
  if (i3)
220284
220693
  return {
@@ -258188,6 +258597,19 @@ function calculateFirstLineIndent(block, measure) {
258188
258597
  const gutterWidthRaw = measure.marker.gutterWidth ?? 0;
258189
258598
  return markerWidth + (Number.isFinite(gutterWidthRaw) && gutterWidthRaw >= 0 ? gutterWidthRaw : 0);
258190
258599
  }
258600
+ function getSuppressedMarkerImageGroupAnchorOffset(entry, suppressVisibleSectPrMarkerParagraph, hasPageRelativeAnchorForParagraph, markerSpacingBefore) {
258601
+ if (!suppressVisibleSectPrMarkerParagraph || !hasPageRelativeAnchorForParagraph)
258602
+ return 0;
258603
+ if (entry.block.kind !== "drawing" || entry.block.drawingKind !== "shapeGroup")
258604
+ return 0;
258605
+ if (!entry.block.shapes?.some((child) => child.shapeType === "image"))
258606
+ return 0;
258607
+ if ((entry.block.anchor?.vRelativeFrom ?? "paragraph") !== "paragraph")
258608
+ return 0;
258609
+ if (entry.block.anchor?.alignV && entry.block.anchor.alignV !== "top")
258610
+ return 0;
258611
+ return Math.max(0, markerSpacingBefore / 2);
258612
+ }
258191
258613
  function layoutParagraphBlock(ctx$1, anchors) {
258192
258614
  const { block, measure, columnWidth, ensurePage, advanceColumn, columnX, floatManager } = ctx$1;
258193
258615
  const remeasureParagraph$1 = ctx$1.remeasureParagraph;
@@ -258224,6 +258646,13 @@ function layoutParagraphBlock(ctx$1, anchors) {
258224
258646
  if (!spacingExplicit.after)
258225
258647
  spacingAfter = 0;
258226
258648
  }
258649
+ const markerSpacingBefore = spacingBefore;
258650
+ const hasAnchoredObjects = Boolean(anchors?.anchoredDrawings?.length || anchors?.anchoredTables?.length);
258651
+ const suppressVisibleSectPrMarkerParagraph = attrs?.sectPrMarker === true && emptyTextParagraph && hasAnchoredObjects;
258652
+ if (suppressVisibleSectPrMarkerParagraph) {
258653
+ spacingBefore = 0;
258654
+ spacingAfter = 0;
258655
+ }
258227
258656
  const baseSpacingBefore = spacingBefore;
258228
258657
  let appliedSpacingBefore = spacingBefore === 0;
258229
258658
  let lastState = null;
@@ -258242,7 +258671,11 @@ function layoutParagraphBlock(ctx$1, anchors) {
258242
258671
  suppressSpacingBefore: shouldSuppressOwnSpacing(styleId$1, contextualSpacing, previewState.lastParagraphStyleId),
258243
258672
  rewindTrailingFromPrevious: shouldSuppressOwnSpacing(previewState.lastParagraphStyleId, previewState.lastParagraphContextualSpacing, styleId$1)
258244
258673
  }) + borderExpansion.top - (inBorderGroup ? rawBorderExpansion.bottom : 0);
258674
+ const sectionBaseTopMargin = anchors?.sectionBaseTopMargin;
258675
+ const sectionHeaderDistance = typeof anchors?.sectionHeaderDistance === "number" ? Math.max(0, anchors.sectionHeaderDistance) : 0;
258676
+ const effectiveParagraphAnchorBaseY = suppressVisibleSectPrMarkerParagraph && typeof sectionBaseTopMargin === "number" && anchors?.hasPageRelativeAnchorForParagraph !== true && Math.abs(previewState.cursorY - previewState.topMargin) < 0.001 && Math.abs(paragraphAnchorBaseY - previewState.topMargin) < 0.001 ? Math.min(sectionBaseTopMargin + sectionHeaderDistance, paragraphAnchorBaseY) : paragraphAnchorBaseY;
258245
258677
  let paragraphContentEndY = paragraphAnchorBaseY;
258678
+ const anchorFirstLineHeight = suppressVisibleSectPrMarkerParagraph ? 0 : measure.lines?.[0]?.lineHeight ?? 0;
258246
258679
  const registerAnchoredDrawingsAt = (paragraphContentStartY) => {
258247
258680
  if (!anchors?.anchoredDrawings?.length)
258248
258681
  return;
@@ -258252,14 +258685,15 @@ function layoutParagraphBlock(ctx$1, anchors) {
258252
258685
  const state = ensurePage();
258253
258686
  const contentTop = state.topMargin;
258254
258687
  const contentBottom = state.contentBottom;
258688
+ const anchorParagraphY = paragraphContentStartY + getSuppressedMarkerImageGroupAnchorOffset(entry, suppressVisibleSectPrMarkerParagraph, anchors.hasPageRelativeAnchorForParagraph === true, markerSpacingBefore);
258255
258689
  const anchorY = resolveAnchoredGraphicY({
258256
258690
  anchor: entry.block.anchor,
258257
258691
  objectHeight: entry.measure.height,
258258
258692
  contentTop,
258259
258693
  contentBottom,
258260
258694
  pageBottomMargin: anchors.pageMargins.bottom ?? 0,
258261
- anchorParagraphY: paragraphContentStartY,
258262
- firstLineHeight: measure.lines?.[0]?.lineHeight ?? 0
258695
+ anchorParagraphY,
258696
+ firstLineHeight: anchorFirstLineHeight
258263
258697
  });
258264
258698
  floatManager.registerDrawing(entry.block, entry.measure, anchorY, state.columnIndex, state.page.number);
258265
258699
  const anchorX = entry.block.anchor ? resolveAnchoredGraphicX(entry.block.anchor, state.columnIndex, anchors.columns, entry.measure.width, {
@@ -258338,7 +258772,7 @@ function layoutParagraphBlock(ctx$1, anchors) {
258338
258772
  anchors.placedAnchoredIds.add(entry.block.id);
258339
258773
  }
258340
258774
  };
258341
- registerAnchoredDrawingsAt(paragraphAnchorBaseY);
258775
+ registerAnchoredDrawingsAt(effectiveParagraphAnchorBaseY);
258342
258776
  const registerAnchoredTablesAt = (paragraphContentStartY, entries) => {
258343
258777
  if (!entries.length)
258344
258778
  return;
@@ -258354,7 +258788,7 @@ function layoutParagraphBlock(ctx$1, anchors) {
258354
258788
  const contentTop = state.topMargin;
258355
258789
  const contentBottom = state.contentBottom;
258356
258790
  const layoutOffsetV = entry.layoutOffsetV;
258357
- const firstLineHeight = measure.lines?.[0]?.lineHeight ?? 0;
258791
+ const firstLineHeight = anchorFirstLineHeight;
258358
258792
  const wrapType = entry.block.wrap?.type ?? "None";
258359
258793
  const anchorY = resolveAnchoredGraphicY({
258360
258794
  anchor: graphicAnchorY(anchorForLineScopedFormField(layoutOffsetV != null && entry.block.anchor ? {
@@ -258366,7 +258800,7 @@ function layoutParagraphBlock(ctx$1, anchors) {
258366
258800
  contentBottom,
258367
258801
  pageBottomMargin: anchors.pageMargins.bottom ?? 0,
258368
258802
  anchorParagraphY: nextStackY,
258369
- firstLineHeight: measure.lines?.[0]?.lineHeight ?? 0
258803
+ firstLineHeight: anchorFirstLineHeight
258370
258804
  });
258371
258805
  floatManager.registerTable(entry.block, entry.measure, anchorY, state.columnIndex, state.page.number);
258372
258806
  const anchorX = entry.block.anchor ? resolveAnchoredGraphicX(graphicAnchorH(entry.block.anchor), state.columnIndex, anchors.columns, totalWidth, {
@@ -258387,11 +258821,15 @@ function layoutParagraphBlock(ctx$1, anchors) {
258387
258821
  const remainingHeightOnStartPage = previewState.contentBottom - paragraphAnchorBaseY;
258388
258822
  const paragraphWillSpanPages = lines.length > 1 && totalLineHeight > remainingHeightOnStartPage;
258389
258823
  const shouldPreLayoutSquareTable = (entry) => entry.lineScopedOnAnchor === true && !paragraphWillSpanPages;
258390
- registerAnchoredTablesAt(paragraphAnchorBaseY, anchoredTablesForPara.filter((entry) => {
258824
+ registerAnchoredTablesAt(effectiveParagraphAnchorBaseY, anchoredTablesForPara.filter((entry) => {
258391
258825
  if ((entry.block.wrap?.type ?? "None") === "None")
258392
258826
  return true;
258393
258827
  return shouldPreLayoutSquareTable(entry);
258394
258828
  }));
258829
+ if (suppressVisibleSectPrMarkerParagraph) {
258830
+ registerAnchoredTablesAt(effectiveParagraphAnchorBaseY, anchors?.anchoredTables ?? []);
258831
+ return;
258832
+ }
258395
258833
  if (frame?.wrap === "none") {
258396
258834
  let state = ensurePage();
258397
258835
  if (state.cursorY >= state.contentBottom)
@@ -258852,6 +259290,34 @@ function collectPreRegisteredAnchors(blocks2, measures) {
258852
259290
  }
258853
259291
  return result;
258854
259292
  }
259293
+ function collectPageRelativeAnchorsByParagraph(blocks2, measures) {
259294
+ const map$12 = /* @__PURE__ */ new Map;
259295
+ const len2 = Math.min(blocks2.length, measures.length);
259296
+ const paragraphIndexById = buildParagraphIndexById(blocks2, len2);
259297
+ for (let i3 = 0;i3 < len2; i3 += 1) {
259298
+ const block = blocks2[i3];
259299
+ const measure = measures[i3];
259300
+ const isImage = block.kind === "image" && measure?.kind === "image";
259301
+ const isDrawing = block.kind === "drawing" && measure?.kind === "drawing";
259302
+ if (!isImage && !isDrawing)
259303
+ continue;
259304
+ const drawingBlock = block;
259305
+ const drawingMeasure = measure;
259306
+ if (!drawingBlock.anchor?.isAnchored || !isPageRelativeAnchor(drawingBlock))
259307
+ continue;
259308
+ const anchorParagraphId = typeof drawingBlock.attrs === "object" && drawingBlock.attrs ? drawingBlock.attrs.anchorParagraphId : undefined;
259309
+ const anchorParaIndex = resolveAnchorParagraphIndex(blocks2, len2, paragraphIndexById, i3, anchorParagraphId);
259310
+ if (anchorParaIndex == null)
259311
+ continue;
259312
+ const list5 = map$12.get(anchorParaIndex) ?? [];
259313
+ list5.push({
259314
+ block: drawingBlock,
259315
+ measure: drawingMeasure
259316
+ });
259317
+ map$12.set(anchorParaIndex, list5);
259318
+ }
259319
+ return map$12;
259320
+ }
258855
259321
  function collectAnchoredDrawings(blocks2, measures) {
258856
259322
  const byParagraph = /* @__PURE__ */ new Map;
258857
259323
  const withoutParagraph = [];
@@ -260794,7 +261260,58 @@ function layoutDocument(blocks2, measures, options = {}) {
260794
261260
  const paragraphlessAnchoredTables = anchoredTables.withoutParagraph;
260795
261261
  const placedAnchoredIds = /* @__PURE__ */ new Set;
260796
261262
  const preRegisteredAnchors = collectPreRegisteredAnchors(blocks2, measures);
260797
- const preRegisteredPositions = /* @__PURE__ */ new Map;
261263
+ const pageRelativeAnchorsByParagraph = collectPageRelativeAnchorsByParagraph(blocks2, measures);
261264
+ const preRegisteredAnchorIds = /* @__PURE__ */ new Set;
261265
+ const blockIndexById = new Map(blocks2.map((candidateBlock, candidateIndex) => [candidateBlock.id, candidateIndex]));
261266
+ const hasHardBreakBetween = (startIndex, endIndex) => {
261267
+ const first$1 = Math.min(startIndex, endIndex) + 1;
261268
+ const last2 = Math.max(startIndex, endIndex);
261269
+ for (let candidateIndex = first$1;candidateIndex < last2; candidateIndex += 1) {
261270
+ const candidateBlock = blocks2[candidateIndex];
261271
+ if (candidateBlock.kind === "pageBreak" || candidateBlock.kind === "sectionBreak" || candidateBlock.kind === "columnBreak")
261272
+ return true;
261273
+ }
261274
+ return false;
261275
+ };
261276
+ const shouldWrapParagraphWithPageRelativeAnchor = (anchorBlock, paragraphIndex, paragraphId) => {
261277
+ const anchorParagraphId = anchorBlock.attrs != null && typeof anchorBlock.attrs === "object" ? anchorBlock.attrs.anchorParagraphId : undefined;
261278
+ if (typeof anchorParagraphId === "string")
261279
+ return anchorParagraphId === paragraphId;
261280
+ const anchorIndex = blockIndexById.get(anchorBlock.id);
261281
+ if (anchorIndex == null || anchorIndex === paragraphIndex)
261282
+ return false;
261283
+ return !hasHardBreakBetween(paragraphIndex, anchorIndex);
261284
+ };
261285
+ const isWrappingDrawingAnchor = (anchorBlock) => {
261286
+ const wrapType = anchorBlock.wrap?.type ?? "None";
261287
+ return wrapType !== "None" && wrapType !== "Inline";
261288
+ };
261289
+ const collectLaterPageRelativeAnchorsForParagraph = (paragraphIndex, paragraphId) => {
261290
+ const anchors = [];
261291
+ for (const entry of preRegisteredAnchors) {
261292
+ const anchorIndex = blockIndexById.get(entry.block.id);
261293
+ if (anchorIndex == null || anchorIndex <= paragraphIndex)
261294
+ continue;
261295
+ if (!isWrappingDrawingAnchor(entry.block))
261296
+ continue;
261297
+ if (!shouldWrapParagraphWithPageRelativeAnchor(entry.block, paragraphIndex, paragraphId))
261298
+ continue;
261299
+ anchors.push(entry);
261300
+ }
261301
+ return anchors.length > 0 ? anchors : undefined;
261302
+ };
261303
+ const mergeAnchoredDrawings = (...groups) => {
261304
+ const merged = [];
261305
+ const seen = /* @__PURE__ */ new Set;
261306
+ for (const group of groups)
261307
+ for (const entry of group ?? []) {
261308
+ if (seen.has(entry.block.id))
261309
+ continue;
261310
+ seen.add(entry.block.id);
261311
+ merged.push(entry);
261312
+ }
261313
+ return merged.length > 0 ? merged : undefined;
261314
+ };
260798
261315
  const resolveParagraphlessAnchoredTableY = (block, measure, state) => {
260799
261316
  const contentTop = state.topMargin;
260800
261317
  const contentBottom = state.contentBottom;
@@ -260808,40 +261325,36 @@ function layoutDocument(blocks2, measures, options = {}) {
260808
261325
  preRegisteredFallbackToContentTop: true
260809
261326
  });
260810
261327
  };
260811
- const resolveParagraphlessAnchoredDrawingY = (block, measure, state) => resolveAnchoredGraphicY({
260812
- anchor: block.anchor,
260813
- objectHeight: measure.height ?? 0,
260814
- contentTop: state.topMargin,
260815
- contentBottom: state.contentBottom,
260816
- pageBottomMargin: state.page.margins?.bottom ?? activeBottomMargin,
260817
- preRegisteredFallbackToContentTop: true
260818
- });
260819
- const resolveParagraphlessAnchoredDrawingX = (block, measure, state) => block.anchor ? computeAnchorX(block.anchor, state.columnIndex, normalizeColumns(activeColumns, activePageSize.w - (activeLeftMargin + activeRightMargin)), measure.width, {
260820
- left: activeLeftMargin,
260821
- right: activeRightMargin
260822
- }, activePageSize.w) : columnX(state);
260823
- for (const entry of preRegisteredAnchors) {
260824
- const state = paginator.ensurePage();
261328
+ const resolveAnchoredDrawingPosition = (block, measure, state) => {
260825
261329
  const contentTop = state.topMargin;
260826
261330
  const contentBottom = state.contentBottom;
260827
261331
  const anchorY = resolveAnchoredGraphicY({
260828
- anchor: entry.block.anchor,
260829
- objectHeight: entry.measure.height ?? 0,
261332
+ anchor: block.anchor,
261333
+ objectHeight: measure.height ?? 0,
260830
261334
  contentTop,
260831
261335
  contentBottom,
260832
261336
  pageBottomMargin: state.page.margins?.bottom ?? activeBottomMargin,
260833
261337
  preRegisteredFallbackToContentTop: true
260834
261338
  });
260835
- const anchorX = entry.block.anchor ? computeAnchorX(entry.block.anchor, state.columnIndex, normalizeColumns(activeColumns, activePageSize.w - (activeLeftMargin + activeRightMargin)), entry.measure.width, {
260836
- left: activeLeftMargin,
260837
- right: activeRightMargin
260838
- }, activePageSize.w) : activeLeftMargin;
260839
- floatManager.registerDrawing(entry.block, entry.measure, anchorY, state.columnIndex, state.page.number);
260840
- preRegisteredPositions.set(entry.block.id, {
260841
- anchorX,
261339
+ const columns = getActiveColumnsForState(state);
261340
+ const pageMargins = {
261341
+ top: state.page.margins?.top ?? activeTopMargin,
261342
+ bottom: state.page.margins?.bottom ?? activeBottomMargin,
261343
+ left: state.page.margins?.left ?? activeLeftMargin,
261344
+ right: state.page.margins?.right ?? activeRightMargin
261345
+ };
261346
+ const pageWidth = state.page.size?.w ?? activePageSize.w;
261347
+ const contentWidth = pageWidth - ((pageMargins.left ?? 0) + (pageMargins.right ?? 0));
261348
+ return {
261349
+ anchorX: block.anchor ? computeAnchorX(block.anchor, state.columnIndex, normalizeColumns(columns, contentWidth), measure.width, {
261350
+ left: pageMargins.left,
261351
+ right: pageMargins.right
261352
+ }, pageWidth) : pageMargins.left ?? activeLeftMargin,
260842
261353
  anchorY
260843
- });
260844
- }
261354
+ };
261355
+ };
261356
+ for (const entry of preRegisteredAnchors)
261357
+ preRegisteredAnchorIds.add(entry.block.id);
260845
261358
  const keepNextChains = computeKeepNextChains(blocks2);
260846
261359
  const midChainIndices = /* @__PURE__ */ new Set;
260847
261360
  for (const chain of keepNextChains.values())
@@ -261053,20 +261566,25 @@ function layoutDocument(blocks2, measures, options = {}) {
261053
261566
  if (measure.kind !== "paragraph")
261054
261567
  throw new Error(`layoutDocument: expected paragraph measure for block ${block.id}`);
261055
261568
  const paraBlock = block;
261056
- if (!paraBlock.runs || paraBlock.runs.length === 0 || paraBlock.runs.length === 1 && (!paraBlock.runs[0].kind || paraBlock.runs[0].kind === "text") && (!paraBlock.runs[0].text || paraBlock.runs[0].text === "")) {
261569
+ const isEmpty3 = !paraBlock.runs || paraBlock.runs.length === 0 || paraBlock.runs.length === 1 && (!paraBlock.runs[0].kind || paraBlock.runs[0].kind === "text") && (!paraBlock.runs[0].text || paraBlock.runs[0].text === "");
261570
+ const drawingAnchorsForPara = anchoredByParagraph.get(index2);
261571
+ const wrappingPageRelativeAnchorsForPara = pageRelativeAnchorsByParagraph.get(index2)?.filter(({ block: anchorBlock }) => shouldWrapParagraphWithPageRelativeAnchor(anchorBlock, index2, paraBlock.id));
261572
+ const laterPageRelativeAnchorsForPara = collectLaterPageRelativeAnchorsForParagraph(index2, paraBlock.id);
261573
+ const anchorsForPara = mergeAnchoredDrawings(drawingAnchorsForPara, wrappingPageRelativeAnchorsForPara, laterPageRelativeAnchorsForPara);
261574
+ const tablesForPara = anchoredTablesByParagraph.get(index2);
261575
+ if (isEmpty3) {
261057
261576
  const isSectPrMarker = paraBlock.attrs?.sectPrMarker === true;
261058
261577
  const prevBlock = index2 > 0 ? blocks2[index2 - 1] : null;
261059
261578
  const nextBlock = index2 < blocks2.length - 1 ? blocks2[index2 + 1] : null;
261060
261579
  const nextSectionBreak = nextBlock?.kind === "sectionBreak" ? nextBlock : null;
261061
261580
  const nextBreakType = nextSectionBreak?.type ?? (nextSectionBreak?.attrs?.source === "sectPr" ? "nextPage" : undefined);
261062
261581
  const nextBreakForcesPage = nextSectionBreak && (nextBreakType === "nextPage" || nextBreakType === "evenPage" || nextBreakType === "oddPage" || nextSectionBreak.attrs?.requirePageBoundary === true);
261063
- if (isSectPrMarker && nextBreakForcesPage)
261582
+ const hasAnchoredObjectsForMarker = Boolean(anchorsForPara?.length || tablesForPara?.length);
261583
+ if (isSectPrMarker && nextBreakForcesPage && !hasAnchoredObjectsForMarker)
261064
261584
  continue;
261065
- if (prevBlock?.kind === "pageBreak" && nextBlock?.kind === "sectionBreak")
261585
+ if (prevBlock?.kind === "pageBreak" && nextBlock?.kind === "sectionBreak" && !hasAnchoredObjectsForMarker)
261066
261586
  continue;
261067
261587
  }
261068
- const anchorsForPara = anchoredByParagraph.get(index2);
261069
- const tablesForPara = anchoredTablesByParagraph.get(index2);
261070
261588
  const chain = keepNextChains.get(index2);
261071
261589
  if (midChainIndices.has(index2)) {} else if (chain) {
261072
261590
  let state = paginator.ensurePage();
@@ -261137,6 +261655,10 @@ function layoutDocument(blocks2, measures, options = {}) {
261137
261655
  overrideSpacingAfter = 0;
261138
261656
  }
261139
261657
  }
261658
+ const hasPageRelativeAnchorForPara = Boolean(pageRelativeAnchorsByParagraph.get(index2)?.length || laterPageRelativeAnchorsForPara?.length || tablesForPara?.some(({ block: tableBlock }) => {
261659
+ const vRelativeFrom = tableBlock.anchor?.vRelativeFrom;
261660
+ return vRelativeFrom === "page" || vRelativeFrom === "margin";
261661
+ }));
261140
261662
  layoutParagraphBlock({
261141
261663
  block,
261142
261664
  measure,
@@ -261162,6 +261684,9 @@ function layoutDocument(blocks2, measures, options = {}) {
261162
261684
  left: activeLeftMargin,
261163
261685
  right: activeRightMargin
261164
261686
  },
261687
+ sectionBaseTopMargin: activeSectionBaseTopMargin,
261688
+ sectionHeaderDistance: activeHeaderDistance,
261689
+ hasPageRelativeAnchorForParagraph: hasPageRelativeAnchorForPara,
261165
261690
  columns: getCurrentColumns(),
261166
261691
  placedAnchoredIds
261167
261692
  } : undefined);
@@ -261189,11 +261714,14 @@ function layoutDocument(blocks2, measures, options = {}) {
261189
261714
  if (block.kind === "image") {
261190
261715
  if (measure.kind !== "image")
261191
261716
  throw new Error(`layoutDocument: expected image measure for block ${block.id}`);
261192
- const preRegPos = preRegisteredPositions.get(block.id);
261193
- if (preRegPos && Number.isFinite(preRegPos.anchorX) && Number.isFinite(preRegPos.anchorY)) {
261717
+ if (placedAnchoredIds.has(block.id))
261718
+ continue;
261719
+ if (preRegisteredAnchorIds.has(block.id)) {
261194
261720
  const state = paginator.ensurePage();
261195
261721
  const imgBlock = block;
261196
261722
  const imgMeasure = measure;
261723
+ const { anchorX, anchorY } = resolveAnchoredDrawingPosition(imgBlock, imgMeasure, state);
261724
+ floatManager.registerDrawing(imgBlock, imgMeasure, anchorY, state.columnIndex, state.page.number);
261197
261725
  const pageContentHeight = Math.max(0, state.contentBottom - state.topMargin);
261198
261726
  const relativeFrom = imgBlock.anchor?.hRelativeFrom ?? "column";
261199
261727
  const cols = getCurrentColumns();
@@ -261219,8 +261747,8 @@ function layoutDocument(blocks2, measures, options = {}) {
261219
261747
  const fragment = {
261220
261748
  kind: "image",
261221
261749
  blockId: imgBlock.id,
261222
- x: preRegPos.anchorX,
261223
- y: preRegPos.anchorY,
261750
+ x: anchorX,
261751
+ y: anchorY,
261224
261752
  width: imgMeasure.width,
261225
261753
  height: imgMeasure.height,
261226
261754
  isAnchored: true,
@@ -261251,18 +261779,21 @@ function layoutDocument(blocks2, measures, options = {}) {
261251
261779
  if (block.kind === "drawing") {
261252
261780
  if (measure.kind !== "drawing")
261253
261781
  throw new Error(`layoutDocument: expected drawing measure for block ${block.id}`);
261254
- const preRegPos = preRegisteredPositions.get(block.id);
261255
- if (preRegPos && Number.isFinite(preRegPos.anchorX) && Number.isFinite(preRegPos.anchorY)) {
261782
+ if (placedAnchoredIds.has(block.id))
261783
+ continue;
261784
+ if (preRegisteredAnchorIds.has(block.id)) {
261256
261785
  const state = paginator.ensurePage();
261257
261786
  const drawBlock = block;
261258
261787
  const drawMeasure = measure;
261788
+ const { anchorX, anchorY } = resolveAnchoredDrawingPosition(drawBlock, drawMeasure, state);
261789
+ floatManager.registerDrawing(drawBlock, drawMeasure, anchorY, state.columnIndex, state.page.number);
261259
261790
  const contentMeasures = drawBlock.drawingKind === "textboxShape" && typeof options.remeasureParagraph === "function" ? layoutTextboxContent(drawBlock, options.remeasureParagraph) : undefined;
261260
261791
  const fragment = {
261261
261792
  kind: "drawing",
261262
261793
  blockId: drawBlock.id,
261263
261794
  drawingKind: drawBlock.drawingKind,
261264
- x: preRegPos.anchorX,
261265
- y: preRegPos.anchorY,
261795
+ x: anchorX,
261796
+ y: anchorY,
261266
261797
  width: drawMeasure.width,
261267
261798
  height: drawMeasure.height,
261268
261799
  geometry: drawMeasure.geometry,
@@ -261344,8 +261875,7 @@ function layoutDocument(blocks2, measures, options = {}) {
261344
261875
  for (const { block, measure } of paragraphlessAnchoredDrawings) {
261345
261876
  if (placedAnchoredIds.has(block.id))
261346
261877
  continue;
261347
- const anchorX = resolveParagraphlessAnchoredDrawingX(block, measure, state);
261348
- const anchorY = resolveParagraphlessAnchoredDrawingY(block, measure, state);
261878
+ const { anchorX, anchorY } = resolveAnchoredDrawingPosition(block, measure, state);
261349
261879
  if (block.kind === "image" && measure.kind === "image") {
261350
261880
  const pageContentHeight = Math.max(0, state.contentBottom - state.topMargin);
261351
261881
  const aspectRatio = measure.width > 0 && measure.height > 0 ? measure.width / measure.height : 1;
@@ -261613,6 +262143,15 @@ function getPageRelativeMeasurementBand(kind, constraints) {
261613
262143
  end: bandSize
261614
262144
  };
261615
262145
  }
262146
+ function isHeaderFooterAbsoluteOverlay(block, kind, fragment, fragmentBottom, canvasHeight) {
262147
+ if (!kind)
262148
+ return false;
262149
+ if (block.anchor?.isAnchored !== true)
262150
+ return false;
262151
+ if (block.wrap?.type !== "None")
262152
+ return false;
262153
+ return fragment.y < 0 || fragmentBottom > canvasHeight;
262154
+ }
261616
262155
  function shouldExcludeFromMeasurement(fragment, block, fragmentBottom, canvasHeight, kind, constraints) {
261617
262156
  if (!((fragment.kind === "image" || fragment.kind === "drawing") && fragment.isAnchored === true))
261618
262157
  return false;
@@ -261621,6 +262160,8 @@ function shouldExcludeFromMeasurement(fragment, block, fragmentBottom, canvasHei
261621
262160
  const anchoredBlock = block;
261622
262161
  if (anchoredBlock.anchor?.behindDoc)
261623
262162
  return true;
262163
+ if (isHeaderFooterAbsoluteOverlay(anchoredBlock, kind, fragment, fragmentBottom, canvasHeight))
262164
+ return true;
261624
262165
  if (isPageRelativeAnchor(anchoredBlock)) {
261625
262166
  const fragmentTop = fragment.y;
261626
262167
  if (fragmentBottom <= 0 || fragmentTop >= canvasHeight)
@@ -261631,13 +262172,6 @@ function shouldExcludeFromMeasurement(fragment, block, fragmentBottom, canvasHei
261631
262172
  if (measurementBand && !rangesIntersect(fragment.y, fragmentBottom, measurementBand.start, measurementBand.end))
261632
262173
  return true;
261633
262174
  }
261634
- const fragmentHeight = typeof fragment.height === "number" ? fragment.height : fragmentBottom - fragment.y;
261635
- const fragmentWidth = typeof fragment.width === "number" ? fragment.width : 0;
261636
- const heightCoversCanvas = Number.isFinite(fragmentHeight) && fragmentHeight >= canvasHeight;
261637
- const widthCoversCanvas = Number.isFinite(constraints.width) && constraints.width > 0 && fragmentWidth >= constraints.width;
261638
- const isOverlayWrap = anchoredBlock.wrap?.type === "None";
261639
- if (kind && heightCoversCanvas && widthCoversCanvas && isOverlayWrap)
261640
- return true;
261641
262175
  return false;
261642
262176
  }
261643
262177
  function layoutHeaderFooter(blocks2, measures, constraints, kind, remeasureParagraph$1) {
@@ -273678,13 +274212,17 @@ async function buildMeasuredAutoFitContentMetrics(block, workingInput, fixedLayo
273678
274212
  cellMetricKeys: contentMetrics.cellMetricKeys
273679
274213
  };
273680
274214
  }
274215
+ function isBehindDocOverlay(block) {
274216
+ return block.anchor?.behindDoc === true || block.wrap?.type === "None" && block.wrap?.behindDoc === true;
274217
+ }
274218
+ function hasNegativeVerticalPosition(block) {
274219
+ return block.anchor?.isAnchored === true && (typeof block.anchor?.offsetV === "number" && block.anchor.offsetV < 0 || typeof block.margin?.top === "number" && block.margin.top < 0);
274220
+ }
273681
274221
  async function measureImageBlock(block, constraints) {
273682
274222
  const intrinsic = getIntrinsicImageSize(block, constraints.maxWidth);
273683
- const isBlockBehindDoc = block.anchor?.behindDoc;
273684
- const isBlockWrapBehindDoc = block.wrap?.type === "None" && block.wrap?.behindDoc;
273685
274223
  const isPageRelativeAnchor$1 = block.anchor?.isAnchored && (block.anchor?.hRelativeFrom === "page" || block.anchor?.hRelativeFrom === "margin");
273686
- const maxWidth = isBlockBehindDoc || isBlockWrapBehindDoc || isPageRelativeAnchor$1 || constraints.maxWidth <= 0 ? intrinsic.width : constraints.maxWidth;
273687
- const maxHeight = block.anchor?.isAnchored && (typeof block.anchor?.offsetV === "number" && block.anchor.offsetV < 0 || typeof block.margin?.top === "number" && block.margin.top < 0) || block.objectFit === "cover" || !constraints.maxHeight || constraints.maxHeight <= 0 ? Infinity : constraints.maxHeight;
274224
+ const maxWidth = isBehindDocOverlay(block) || isPageRelativeAnchor$1 || constraints.maxWidth <= 0 ? intrinsic.width : constraints.maxWidth;
274225
+ const maxHeight = isBehindDocOverlay(block) || hasNegativeVerticalPosition(block) || block.objectFit === "cover" || !constraints.maxHeight || constraints.maxHeight <= 0 ? Infinity : constraints.maxHeight;
273688
274226
  const widthScale = maxWidth / intrinsic.width;
273689
274227
  const heightScale = maxHeight / intrinsic.height;
273690
274228
  const scale = Math.min(1, widthScale, heightScale);
@@ -273697,8 +274235,9 @@ async function measureImageBlock(block, constraints) {
273697
274235
  async function measureDrawingBlock(block, constraints) {
273698
274236
  if (block.drawingKind === "image") {
273699
274237
  const intrinsic = getIntrinsicSizeFromDims(block.width, block.height, constraints.maxWidth);
273700
- const maxWidth$1 = constraints.maxWidth > 0 ? constraints.maxWidth : intrinsic.width;
273701
- const maxHeight$1 = constraints.maxHeight && constraints.maxHeight > 0 ? constraints.maxHeight : Infinity;
274238
+ const isPageRelativeAnchor$1 = block.anchor?.isAnchored === true && (block.anchor.hRelativeFrom === "page" || block.anchor.hRelativeFrom === "margin");
274239
+ const maxWidth$1 = isBehindDocOverlay(block) || isPageRelativeAnchor$1 || constraints.maxWidth <= 0 ? intrinsic.width : constraints.maxWidth;
274240
+ const maxHeight$1 = isBehindDocOverlay(block) || hasNegativeVerticalPosition(block) || !constraints.maxHeight || constraints.maxHeight <= 0 ? Infinity : constraints.maxHeight;
273702
274241
  const widthScale$1 = maxWidth$1 / intrinsic.width;
273703
274242
  const heightScale$1 = maxHeight$1 / intrinsic.height;
273704
274243
  const scale$1 = Math.min(1, widthScale$1, heightScale$1);
@@ -273720,6 +274259,21 @@ async function measureDrawingBlock(block, constraints) {
273720
274259
  };
273721
274260
  }
273722
274261
  const geometry = ensureDrawingGeometry(block.geometry);
274262
+ if (block.drawingKind === "shapeGroup" && block.groupTransform) {
274263
+ const effectExtent = block.effectExtent ?? {
274264
+ left: 0,
274265
+ top: 0,
274266
+ right: 0,
274267
+ bottom: 0
274268
+ };
274269
+ const groupWidth = block.groupTransform.width ?? geometry.width;
274270
+ const groupHeight = block.groupTransform.height ?? geometry.height;
274271
+ geometry.width = Math.max(1, geometry.width, groupWidth + effectExtent.left + effectExtent.right);
274272
+ geometry.height = Math.max(1, geometry.height, groupHeight + effectExtent.top + effectExtent.bottom);
274273
+ geometry.rotation = normalizeRotation(block.groupTransform.rotation ?? geometry.rotation ?? 0);
274274
+ geometry.flipH = Boolean(block.groupTransform.flipH ?? geometry.flipH);
274275
+ geometry.flipV = Boolean(block.groupTransform.flipV ?? geometry.flipV);
274276
+ }
273723
274277
  const attrs = block.attrs;
273724
274278
  const indentLeft = typeof attrs?.hrIndentLeft === "number" ? attrs.hrIndentLeft : 0;
273725
274279
  const indentRight = typeof attrs?.hrIndentRight === "number" ? attrs.hrIndentRight : 0;
@@ -273731,7 +274285,7 @@ async function measureDrawingBlock(block, constraints) {
273731
274285
  const naturalHeight = Math.max(1, rotatedBounds.height);
273732
274286
  const isFloating = block.wrap?.type === "None" || block.anchor?.isAnchored === true;
273733
274287
  const maxWidth = fullWidthMax ?? (constraints.maxWidth > 0 && !isFloating ? constraints.maxWidth : naturalWidth);
273734
- const maxHeight = block.anchor?.isAnchored && (typeof block.anchor?.offsetV === "number" && block.anchor.offsetV < 0 || typeof block.margin?.top === "number" && block.margin.top < 0) || !constraints.maxHeight || constraints.maxHeight <= 0 ? Infinity : constraints.maxHeight;
274288
+ const maxHeight = isBehindDocOverlay(block) || hasNegativeVerticalPosition(block) || !constraints.maxHeight || constraints.maxHeight <= 0 ? Infinity : constraints.maxHeight;
273735
274289
  const widthScale = maxWidth / naturalWidth;
273736
274290
  const heightScale = maxHeight / naturalHeight;
273737
274291
  const normalizedScale = Math.min(1, widthScale, heightScale);
@@ -274319,15 +274873,17 @@ function shiftResolvedPaintItemY(item, yOffset) {
274319
274873
  y: item.y + yOffset
274320
274874
  };
274321
274875
  }
274322
- function isExplicitBehindDocMediaFragment(fragment) {
274323
- return (fragment.kind === "image" || fragment.kind === "drawing") && fragment.behindDoc === true;
274876
+ function isExcludedFromDecorationNormalization(fragment) {
274877
+ if (fragment.kind !== "image" && fragment.kind !== "drawing")
274878
+ return false;
274879
+ return fragment.behindDoc === true || fragment.isAnchored === true || fragment.sourceAnchor != null;
274324
274880
  }
274325
274881
  function getDecorationNormalizationMinY(fragments, layoutMinY) {
274326
274882
  if (!Number.isFinite(layoutMinY) || layoutMinY >= 0)
274327
274883
  return 0;
274328
274884
  let minY = Infinity;
274329
274885
  for (const fragment of fragments) {
274330
- if (isExplicitBehindDocMediaFragment(fragment))
274886
+ if (isExcludedFromDecorationNormalization(fragment))
274331
274887
  continue;
274332
274888
  if (Number.isFinite(fragment.y))
274333
274889
  minY = Math.min(minY, fragment.y);
@@ -292039,7 +292595,7 @@ var Node$13 = class Node$14 {
292039
292595
  domAvailabilityCache = false;
292040
292596
  return false;
292041
292597
  }
292042
- }, summaryVersion = "1.41.0", nodeKeys, markKeys, transformListsInCopiedContent = (html3) => {
292598
+ }, summaryVersion = "1.43.0", nodeKeys, markKeys, transformListsInCopiedContent = (html3) => {
292043
292599
  const container = document.createElement("div");
292044
292600
  container.innerHTML = html3;
292045
292601
  const result = [];
@@ -293225,7 +293781,7 @@ var Node$13 = class Node$14 {
293225
293781
  return () => {};
293226
293782
  const handle3 = setInterval(callback, intervalMs);
293227
293783
  return () => clearInterval(handle3);
293228
- }, HISTORY_UNSAFE_OPS, CANONICAL_COMMENT_IGNORED_KEYS, INITIAL_HASH, ROUND_CONSTANTS, V1_COVERAGE, V2_COVERAGE, SNAPSHOT_VERSION_V2 = "sd-diff-snapshot/v2", PAYLOAD_VERSION_V1 = "sd-diff-payload/v1", PAYLOAD_VERSION_V2 = "sd-diff-payload/v2", ENGINE_ID = "super-editor", STAGED_CONVERTER_KEYS, DiffServiceError, TC_LEVEL_MIN = 1, TC_LEVEL_MAX = 9, ALLOWED_WRAP_ATTRS, WRAP_TYPES_SUPPORTING_SIDE, WRAP_TYPES_SUPPORTING_DISTANCES, RELATIVE_HEIGHT_MIN = 0, RELATIVE_HEIGHT_MAX = 4294967295, FORBIDDEN_RAW_PATCH_NAMES, CONTROL_TYPE_SDT_PR_ELEMENTS, DEFAULT_CHECKBOX_SYMBOL_FONT2 = "MS Gothic", DEFAULT_CHECKBOX_CHECKED_HEX2 = "2612", DEFAULT_CHECKBOX_UNCHECKED_HEX2 = "2610", VARIANT_ORDER, KIND_ORDER, HEADER_RELATIONSHIP_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", DOCUMENT_RELS_PATH2 = "word/_rels/document.xml.rels", HEADER_FILE_PATTERN2, FOOTER_FILE_PATTERN2, BOOKMARK_SCAN_REVISION_PREFIX = "bookmark-scan:", import_lib4, CUSTOM_XML_DATA_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", CUSTOM_XML_PROPS_RELATIONSHIP_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", CUSTOM_XML_DATASTORE_NAMESPACE = "http://schemas.openxmlformats.org/officeDocument/2006/customXml", SETTINGS_PART, VALID_DISPLAYS, REFERENCE_BLOCK_PREFIX, CAPTION_STYLE_NAMES, CAPTION_PARAGRAPH_STYLE_ID = "Caption", CAPTION_FORMAT_TO_OOXML, DOCUMENT_STAT_FIELD_TYPES, TOA_LEADER_REVERSE_MAP, EDGE_NODE_TYPES, CONTENT_TYPES_PART_ID = "[Content_Types].xml", CONTENT_TYPES_NS = "http://schemas.openxmlformats.org/package/2006/content-types", contentTypesPartDescriptor, empty_exports, init_empty, CURRENT_APP_VERSION2 = "1.41.0", PIXELS_PER_INCH2 = 96, MAX_HEIGHT_BUFFER_PX = 50, MAX_WIDTH_BUFFER_PX = 20, TRACKED_REVIEW_MARK_NAMES2, isTrackedReviewMark = (mark2) => Boolean(mark2?.type?.name && TRACKED_REVIEW_MARK_NAMES2.has(mark2.type.name)), trackedReviewMarkKey = (mark2) => {
293784
+ }, HISTORY_UNSAFE_OPS, CANONICAL_COMMENT_IGNORED_KEYS, INITIAL_HASH, ROUND_CONSTANTS, V1_COVERAGE, V2_COVERAGE, SNAPSHOT_VERSION_V2 = "sd-diff-snapshot/v2", PAYLOAD_VERSION_V1 = "sd-diff-payload/v1", PAYLOAD_VERSION_V2 = "sd-diff-payload/v2", ENGINE_ID = "super-editor", STAGED_CONVERTER_KEYS, DiffServiceError, TC_LEVEL_MIN = 1, TC_LEVEL_MAX = 9, ALLOWED_WRAP_ATTRS, WRAP_TYPES_SUPPORTING_SIDE, WRAP_TYPES_SUPPORTING_DISTANCES, RELATIVE_HEIGHT_MIN = 0, RELATIVE_HEIGHT_MAX = 4294967295, FORBIDDEN_RAW_PATCH_NAMES, CONTROL_TYPE_SDT_PR_ELEMENTS, DEFAULT_CHECKBOX_SYMBOL_FONT2 = "MS Gothic", DEFAULT_CHECKBOX_CHECKED_HEX2 = "2612", DEFAULT_CHECKBOX_UNCHECKED_HEX2 = "2610", VARIANT_ORDER, KIND_ORDER, HEADER_RELATIONSHIP_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", DOCUMENT_RELS_PATH2 = "word/_rels/document.xml.rels", HEADER_FILE_PATTERN2, FOOTER_FILE_PATTERN2, BOOKMARK_SCAN_REVISION_PREFIX = "bookmark-scan:", import_lib4, CUSTOM_XML_DATA_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", CUSTOM_XML_PROPS_RELATIONSHIP_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", CUSTOM_XML_DATASTORE_NAMESPACE = "http://schemas.openxmlformats.org/officeDocument/2006/customXml", SETTINGS_PART, VALID_DISPLAYS, REFERENCE_BLOCK_PREFIX, CAPTION_STYLE_NAMES, CAPTION_PARAGRAPH_STYLE_ID = "Caption", CAPTION_FORMAT_TO_OOXML, DOCUMENT_STAT_FIELD_TYPES, TOA_LEADER_REVERSE_MAP, EDGE_NODE_TYPES, CONTENT_TYPES_PART_ID = "[Content_Types].xml", CONTENT_TYPES_NS = "http://schemas.openxmlformats.org/package/2006/content-types", contentTypesPartDescriptor, empty_exports, init_empty, CURRENT_APP_VERSION2 = "1.43.0", PIXELS_PER_INCH2 = 96, MAX_HEIGHT_BUFFER_PX = 50, MAX_WIDTH_BUFFER_PX = 20, TRACKED_REVIEW_MARK_NAMES2, isTrackedReviewMark = (mark2) => Boolean(mark2?.type?.name && TRACKED_REVIEW_MARK_NAMES2.has(mark2.type.name)), trackedReviewMarkKey = (mark2) => {
293229
293785
  if (!isTrackedReviewMark(mark2))
293230
293786
  return null;
293231
293787
  const id2 = typeof mark2.attrs?.id === "string" ? mark2.attrs.id : "";
@@ -293384,6 +293940,8 @@ var Node$13 = class Node$14 {
293384
293940
  return false;
293385
293941
  if (step2.from === step2.to && step2.slice.content.size > 0 && collapsedInsertionExtendsTrackedInsertion(doc$12, step2.from, step2.slice))
293386
293942
  return false;
293943
+ if (step2.from === step2.to && step2.slice.content.size > 0 && collapsedPositionIsInsideTrackedReviewMark(doc$12, step2.from))
293944
+ return false;
293387
293945
  if (rangeHasTrackedReviewMark(doc$12, step2.from, step2.to))
293388
293946
  return true;
293389
293947
  if (step2.from === step2.to && step2.slice.content.size > 0)
@@ -293400,6 +293958,35 @@ var Node$13 = class Node$14 {
293400
293958
  return false;
293401
293959
  const docs = tr.docs ?? [];
293402
293960
  return tr.steps.some((step2, index2) => stepTouchesTrackedReviewState(step2, docs[index2] ?? state.doc));
293961
+ }, enclosingTrackedReviewMarksAtCollapsedPosition = (doc$12, pos) => {
293962
+ const boundedPos = Math.max(0, Math.min(doc$12.content.size, pos));
293963
+ const $pos = doc$12.resolve(boundedPos);
293964
+ const afterKeys = trackedReviewMarkKeysForNode($pos.nodeAfter);
293965
+ if (!afterKeys.size)
293966
+ return [];
293967
+ const enclosing = [];
293968
+ for (const mark2 of $pos.nodeBefore?.marks ?? []) {
293969
+ const key2 = trackedReviewMarkKey(mark2);
293970
+ if (key2 && afterKeys.has(key2))
293971
+ enclosing.push(mark2);
293972
+ }
293973
+ return enclosing;
293974
+ }, collapsedInsertInsideTrackedReviewMarkRange = (state, tr) => {
293975
+ if (!tr.docChanged || tr.steps.length !== 1)
293976
+ return null;
293977
+ const [step2] = tr.steps;
293978
+ if (!(step2 instanceof ReplaceStep))
293979
+ return null;
293980
+ if (step2.from !== step2.to || step2.slice.content.size === 0)
293981
+ return null;
293982
+ const marks = enclosingTrackedReviewMarksAtCollapsedPosition((tr.docs ?? [])[0] ?? state.doc, step2.from);
293983
+ if (!marks.length)
293984
+ return null;
293985
+ return {
293986
+ from: step2.from,
293987
+ to: step2.from + step2.slice.size,
293988
+ marks
293989
+ };
293403
293990
  }, CONTENT_CONTROL_POINTER_WINDOW_MS = 800, cloneExtensionInstance = (extension2) => {
293404
293991
  const extensionLike = extension2;
293405
293992
  const config3 = extensionLike?.config;
@@ -295890,6 +296477,12 @@ menclose::after {
295890
296477
  if (!SUPPORTED_IMAGE_CLIP_PATH_PREFIXES.some((prefix2) => lower.startsWith(prefix2)))
295891
296478
  return "";
295892
296479
  return normalized;
296480
+ }, applyImageObjectFit = (img2, objectFit) => {
296481
+ img2.style.objectFit = objectFit;
296482
+ if (objectFit === "cover")
296483
+ img2.style.objectPosition = "left top";
296484
+ else
296485
+ img2.style.removeProperty("object-position");
295893
296486
  }, applyRunDataAttributes = (element3, dataAttrs) => {
295894
296487
  if (!dataAttrs)
295895
296488
  return;
@@ -296177,7 +296770,10 @@ menclose::after {
296177
296770
  }, renderImageRun = (run2, context) => {
296178
296771
  if (!run2.src)
296179
296772
  return null;
296180
- const hasClipPath = typeof run2.clipPath === "string" && run2.clipPath.trim().length > 0;
296773
+ const runClipPath = readImageClipPathValue(run2.clipPath);
296774
+ const shapeClipPath = readImageClipPathValue(run2.shapeClipPath);
296775
+ const hasClipPath = runClipPath.length > 0;
296776
+ const hasShapeClipPath = shapeClipPath.length > 0;
296181
296777
  const img2 = context.doc.createElement("img");
296182
296778
  img2.classList.add(DOM_CLASS_NAMES.INLINE_IMAGE);
296183
296779
  if (typeof run2.src === "string" && run2.src.startsWith("data:")) {
@@ -296191,7 +296787,7 @@ menclose::after {
296191
296787
  else
296192
296788
  return null;
296193
296789
  }
296194
- if (!hasClipPath) {
296790
+ if (!hasClipPath && !hasShapeClipPath) {
296195
296791
  img2.width = run2.width;
296196
296792
  img2.height = run2.height;
296197
296793
  } else
@@ -296204,7 +296800,9 @@ menclose::after {
296204
296800
  minWidth: "0",
296205
296801
  minHeight: "0"
296206
296802
  });
296207
- applyImageClipPath(img2, run2.clipPath);
296803
+ applyImageClipPath(img2, runClipPath);
296804
+ if (run2.objectFit)
296805
+ applyImageObjectFit(img2, run2.objectFit);
296208
296806
  if (run2.width > 0 && run2.height > 0) {
296209
296807
  const aspectRatio = run2.width / run2.height;
296210
296808
  const inlineImageMetadata = {
@@ -296222,7 +296820,7 @@ menclose::after {
296222
296820
  if (run2.title)
296223
296821
  img2.title = run2.title;
296224
296822
  img2.style.display = "inline-block";
296225
- const useWrapper = hasClipPath && run2.width > 0 && run2.height > 0;
296823
+ const useWrapper = (hasClipPath || hasShapeClipPath) && run2.width > 0 && run2.height > 0;
296226
296824
  if (!useWrapper) {
296227
296825
  img2.style.verticalAlign = run2.verticalAlign ?? "top";
296228
296826
  if (run2.distTop)
@@ -296283,6 +296881,8 @@ menclose::after {
296283
296881
  wrapper.style.marginRight = `${run2.distRight}px`;
296284
296882
  wrapper.style.position = "relative";
296285
296883
  wrapper.style.zIndex = "1";
296884
+ if (shapeClipPath)
296885
+ wrapper.style.clipPath = shapeClipPath;
296286
296886
  if (run2.pmStart != null)
296287
296887
  wrapper.dataset.pmStart = String(run2.pmStart);
296288
296888
  if (run2.pmEnd != null)
@@ -296302,7 +296902,6 @@ menclose::after {
296302
296902
  context.applySdtDataset(img2, run2.sdt);
296303
296903
  if (run2.dataAttrs)
296304
296904
  applyRunDataAttributes(img2, run2.dataAttrs);
296305
- const runClipPath = readImageClipPathValue(run2.clipPath);
296306
296905
  if (runClipPath) {
296307
296906
  img2.style.clipPath = runClipPath;
296308
296907
  img2.style.display = "block";
@@ -296348,6 +296947,12 @@ menclose::after {
296348
296947
  return "";
296349
296948
  const record3 = block;
296350
296949
  return readImageClipPathValue(record3.clipPath) || resolveClipPathFromAttrs$1(record3.attrs);
296950
+ }, resolveBlockImageShapeClipPath = (block) => {
296951
+ if (!block || typeof block !== "object")
296952
+ return "";
296953
+ const record3 = block;
296954
+ const attrs = record3.attrs && typeof record3.attrs === "object" ? record3.attrs : undefined;
296955
+ return readImageClipPathValue(record3.shapeClipPath) || readImageClipPathValue(attrs?.shapeClipPath);
296351
296956
  }, createBlockImageContent = ({ doc: doc$12, block, className, clipContainer, imageDisplay, hyperlinkDisplay = "block", buildImageHyperlinkAnchor: buildImageHyperlinkAnchor$1 }) => {
296352
296957
  const img2 = doc$12.createElement("img");
296353
296958
  if (className)
@@ -296357,10 +296962,19 @@ menclose::after {
296357
296962
  img2.alt = block.alt ?? "";
296358
296963
  img2.style.width = "100%";
296359
296964
  img2.style.height = "100%";
296360
- img2.style.objectFit = block.objectFit ?? "contain";
296361
- if (block.objectFit === "cover")
296362
- img2.style.objectPosition = "left top";
296363
- applyImageClipPath(img2, resolveBlockImageClipPath(block), clipContainer ? { clipContainer } : undefined);
296965
+ applyImageObjectFit(img2, block.objectFit ?? "contain");
296966
+ const shapeClipPath = resolveBlockImageShapeClipPath(block);
296967
+ const ownShapeClipContainer = shapeClipPath && !clipContainer ? doc$12.createElement("div") : undefined;
296968
+ if (ownShapeClipContainer) {
296969
+ ownShapeClipContainer.style.width = "100%";
296970
+ ownShapeClipContainer.style.height = "100%";
296971
+ }
296972
+ const shapeClipContainer = clipContainer ?? ownShapeClipContainer;
296973
+ if (shapeClipPath && shapeClipContainer) {
296974
+ shapeClipContainer.style.clipPath = shapeClipPath;
296975
+ shapeClipContainer.style.overflow = "hidden";
296976
+ }
296977
+ applyImageClipPath(img2, resolveBlockImageClipPath(block), shapeClipContainer ? { clipContainer: shapeClipContainer } : undefined);
296364
296978
  img2.style.display = imageDisplay ?? (block.display === "inline" ? "inline-block" : "block");
296365
296979
  const filters = buildImageFilters(block);
296366
296980
  if (filters.length > 0)
@@ -296368,7 +296982,12 @@ menclose::after {
296368
296982
  const opacity = resolveImageOpacity(block);
296369
296983
  if (opacity != null)
296370
296984
  img2.style.opacity = opacity;
296371
- return buildImageHyperlinkAnchor$1?.(img2, block.hyperlink, hyperlinkDisplay) ?? img2;
296985
+ const content3 = buildImageHyperlinkAnchor$1?.(img2, block.hyperlink, hyperlinkDisplay) ?? img2;
296986
+ if (ownShapeClipContainer) {
296987
+ ownShapeClipContainer.appendChild(content3);
296988
+ return ownShapeClipContainer;
296989
+ }
296990
+ return content3;
296372
296991
  }, buildImageHyperlinkAnchor = (doc$12, imageEl, hyperlink, display) => {
296373
296992
  if (!hyperlink?.url)
296374
296993
  return imageEl;
@@ -300504,13 +301123,24 @@ menclose::after {
300504
301123
  const img2 = doc$12.createElement("img");
300505
301124
  img2.src = attrs.src;
300506
301125
  img2.alt = attrs.alt ?? "";
300507
- img2.style.objectFit = "contain";
301126
+ applyImageObjectFit(img2, attrs.objectFit ?? "contain");
300508
301127
  img2.style.display = "block";
300509
- applyImageClipPath(img2, attrs.clipPath);
300510
301128
  const opacity = resolveImageOpacity(attrs);
300511
301129
  if (opacity != null)
300512
301130
  img2.style.opacity = opacity;
300513
- return img2;
301131
+ img2.style.width = "100%";
301132
+ img2.style.height = "100%";
301133
+ if (!attrs.clipPath && !attrs.shapeClipPath)
301134
+ return img2;
301135
+ const clipContainer = doc$12.createElement("div");
301136
+ clipContainer.style.width = "100%";
301137
+ clipContainer.style.height = "100%";
301138
+ clipContainer.style.overflow = "hidden";
301139
+ if (attrs.shapeClipPath)
301140
+ clipContainer.style.clipPath = attrs.shapeClipPath;
301141
+ applyImageClipPath(img2, attrs.clipPath, { clipContainer });
301142
+ clipContainer.appendChild(img2);
301143
+ return clipContainer;
300514
301144
  }, createShapeTextImageElement = (doc$12, part) => {
300515
301145
  const img2 = doc$12.createElement("img");
300516
301146
  img2.src = part.src;
@@ -300601,7 +301231,7 @@ menclose::after {
300601
301231
  });
300602
301232
  return createErrorPlaceholder(fragment.blockId, error48);
300603
301233
  }
300604
- }, ACTIVE_HEADER_FOOTER_WATERMARK_PREVIEW_OPACITY = "1", INACTIVE_HEADER_FOOTER_WATERMARK_PREVIEW_OPACITY = "0.5", resolveOrBuildFragmentIdentity = (fragment, story, existing) => buildLayoutSourceIdentityForFragment(existing ? {
301234
+ }, ACTIVE_HEADER_FOOTER_WATERMARK_PREVIEW_OPACITY = "1", INACTIVE_HEADER_FOOTER_WATERMARK_PREVIEW_OPACITY = "0.5", normalizeRotationDegrees = (rotation) => (rotation % 360 + 360) % 360, resolveOrBuildFragmentIdentity = (fragment, story, existing) => buildLayoutSourceIdentityForFragment(existing ? {
300605
301235
  ...fragment,
300606
301236
  layoutSourceIdentity: existing,
300607
301237
  sourceAnchor: fragment.sourceAnchor ?? existing.sourceAnchor
@@ -300615,7 +301245,7 @@ menclose::after {
300615
301245
  kind,
300616
301246
  id: id2
300617
301247
  } : { kind };
300618
- }, DEFAULT_PAGE_HEIGHT_PX = 1056, DEFAULT_VIRTUALIZED_PAGE_GAP = 72, SVG_NS = "http://www.w3.org/2000/svg", WORDART_LINE_FILL_RATIO = 0.9, DomPainter = class {
301248
+ }, DEFAULT_PAGE_HEIGHT_PX = 1056, DEFAULT_VIRTUALIZED_PAGE_GAP = 72, PAGE_BACKGROUND_OVERLAY_Z_ORDER_OFFSET = 1e6, SVG_NS = "http://www.w3.org/2000/svg", WORDART_LINE_FILL_RATIO = 0.9, DomPainter = class {
300619
301249
  constructor(options = {}) {
300620
301250
  this.mount = null;
300621
301251
  this.doc = null;
@@ -301446,6 +302076,63 @@ menclose::after {
301446
302076
  return false;
301447
302077
  return block.anchor?.vRelativeFrom === "page";
301448
302078
  }
302079
+ isHorizontallyPageRelativeAnchoredFragment(fragment, resolvedItem) {
302080
+ if (fragment.kind !== "image" && fragment.kind !== "drawing")
302081
+ return false;
302082
+ const block = resolvedItem && "block" in resolvedItem ? resolvedItem.block : undefined;
302083
+ if (!block || block.kind !== "image" && block.kind !== "drawing")
302084
+ return false;
302085
+ return block.anchor?.hRelativeFrom === "page";
302086
+ }
302087
+ isHeaderFooterAbsoluteOverlayFragment(fragment, kind, resolvedItem) {
302088
+ if (kind !== "header" && kind !== "footer")
302089
+ return false;
302090
+ if (fragment.kind !== "image" && fragment.kind !== "drawing")
302091
+ return false;
302092
+ if (fragment.isAnchored !== true)
302093
+ return false;
302094
+ const block = resolvedItem && "block" in resolvedItem ? resolvedItem.block : undefined;
302095
+ if (!block || block.kind !== "image" && block.kind !== "drawing")
302096
+ return false;
302097
+ if (block.anchor?.isAnchored !== true)
302098
+ return false;
302099
+ if (block.wrap?.type !== "None")
302100
+ return false;
302101
+ if (fragment.behindDoc === true || block.anchor?.behindDoc === true)
302102
+ return false;
302103
+ return true;
302104
+ }
302105
+ getPageBackgroundDecorationZOrder(fragment, resolvedItem) {
302106
+ const block = resolvedItem && "block" in resolvedItem ? resolvedItem.block : undefined;
302107
+ const isDrawingBlock = block?.kind === "image" || block?.kind === "drawing";
302108
+ const normalizedZIndex = normalizeZIndex(isDrawingBlock ? block.attrs?.originalAttributes : undefined);
302109
+ const isBehindDoc = (fragment.kind === "image" || fragment.kind === "drawing") && fragment.behindDoc === true || isDrawingBlock && block.anchor?.behindDoc === true;
302110
+ if (isBehindDoc && normalizedZIndex != null)
302111
+ return normalizedZIndex;
302112
+ if ((fragment.kind === "image" || fragment.kind === "drawing") && typeof fragment.zIndex === "number")
302113
+ return isBehindDoc ? fragment.zIndex : PAGE_BACKGROUND_OVERLAY_Z_ORDER_OFFSET + Math.max(1, fragment.zIndex);
302114
+ if (normalizedZIndex != null)
302115
+ return PAGE_BACKGROUND_OVERLAY_Z_ORDER_OFFSET + Math.max(1, normalizedZIndex);
302116
+ return 0;
302117
+ }
302118
+ insertPageBackgroundDecoration(pageEl, fragEl, zOrder) {
302119
+ fragEl.dataset.pageBackgroundZIndex = String(zOrder);
302120
+ let lastBackgroundDecoration = null;
302121
+ let insertBefore = null;
302122
+ for (const child of Array.from(pageEl.children)) {
302123
+ const el = child;
302124
+ if (el.dataset.behindDocSection != null || el.dataset.headerFooterOverlaySection != null) {
302125
+ if (Number(el.dataset.pageBackgroundZIndex ?? 0) > zOrder) {
302126
+ insertBefore = el;
302127
+ break;
302128
+ }
302129
+ lastBackgroundDecoration = el;
302130
+ continue;
302131
+ }
302132
+ break;
302133
+ }
302134
+ pageEl.insertBefore(fragEl, insertBefore ?? lastBackgroundDecoration?.nextSibling ?? pageEl.firstChild);
302135
+ }
301449
302136
  getDecorationAnchorPageOriginY(page, kind, effectiveOffset) {
301450
302137
  if (kind === "header")
301451
302138
  return effectiveOffset;
@@ -301470,8 +302157,12 @@ menclose::after {
301470
302157
  const className = kind === "header" ? CLASS_NAMES$1.pageHeader : CLASS_NAMES$1.pageFooter;
301471
302158
  const existing = pageEl.querySelector(`.${className}`);
301472
302159
  const data = provider ? provider(page.number, page.margins, page) : null;
302160
+ const behindDocSelector = `[data-behind-doc-section="${kind}"]`;
302161
+ const overlaySelector = `[data-header-footer-overlay-section="${kind}"]`;
301473
302162
  if (!data || data.fragments.length === 0) {
301474
302163
  existing?.remove();
302164
+ pageEl.querySelectorAll(behindDocSelector).forEach((el) => el.remove());
302165
+ pageEl.querySelectorAll(overlaySelector).forEach((el) => el.remove());
301475
302166
  return;
301476
302167
  }
301477
302168
  const container = existing ?? this.doc.createElement("div");
@@ -301533,27 +302224,34 @@ menclose::after {
301533
302224
  const decorationItems = data.items ?? [];
301534
302225
  const betweenBorderFlags = computeBetweenBorderFlags(decorationItems);
301535
302226
  const behindDocFragments = [];
302227
+ const absoluteOverlayFragments = [];
301536
302228
  const normalFragments = [];
301537
302229
  for (let fi = 0;fi < data.fragments.length; fi += 1) {
301538
302230
  const fragment = data.fragments[fi];
302231
+ const resolvedItem = decorationItems[fi];
301539
302232
  let isBehindDoc = false;
301540
302233
  if (fragment.kind === "image" || fragment.kind === "drawing") {
301541
- const resolvedItem = decorationItems[fi];
301542
- isBehindDoc = fragment.behindDoc === true || fragment.behindDoc == null && "zIndex" in fragment && fragment.zIndex === 0 || this.shouldRenderBehindPageContent(fragment, kind, resolvedItem);
302234
+ const resolvedMediaItem = resolvedItem;
302235
+ isBehindDoc = fragment.behindDoc === true || fragment.behindDoc == null && "zIndex" in fragment && fragment.zIndex === 0 || this.shouldRenderBehindPageContent(fragment, kind, resolvedMediaItem);
301543
302236
  }
301544
302237
  if (isBehindDoc)
301545
302238
  behindDocFragments.push({
301546
302239
  fragment,
301547
302240
  originalIndex: fi
301548
302241
  });
302242
+ else if (this.isHeaderFooterAbsoluteOverlayFragment(fragment, kind, resolvedItem))
302243
+ absoluteOverlayFragments.push({
302244
+ fragment,
302245
+ originalIndex: fi
302246
+ });
301549
302247
  else
301550
302248
  normalFragments.push({
301551
302249
  fragment,
301552
302250
  originalIndex: fi
301553
302251
  });
301554
302252
  }
301555
- const behindDocSelector = `[data-behind-doc-section="${kind}"]`;
301556
302253
  pageEl.querySelectorAll(behindDocSelector).forEach((el) => el.remove());
302254
+ pageEl.querySelectorAll(overlaySelector).forEach((el) => el.remove());
301557
302255
  behindDocFragments.forEach(({ fragment, originalIndex }) => {
301558
302256
  const resolvedItem = data.items?.[originalIndex];
301559
302257
  const fragEl = this.renderFragment(fragment, context, undefined, betweenBorderFlags.get(originalIndex), resolvedItem);
@@ -301566,11 +302264,12 @@ menclose::after {
301566
302264
  pageY = fragment.y;
301567
302265
  else
301568
302266
  pageY = effectiveOffset + fragment.y + (kind === "footer" ? footerYOffset : 0);
302267
+ const isHorizontallyPageRelative = this.isHorizontallyPageRelativeAnchoredFragment(fragment, resolvedItem);
301569
302268
  fragEl.style.top = `${pageY}px`;
301570
- fragEl.style.left = `${isPageRelative ? fragment.x : marginLeft + fragment.x}px`;
302269
+ fragEl.style.left = `${isHorizontallyPageRelative ? fragment.x : marginLeft + fragment.x}px`;
301571
302270
  fragEl.style.zIndex = "0";
301572
302271
  fragEl.dataset.behindDocSection = kind;
301573
- pageEl.insertBefore(fragEl, pageEl.firstChild);
302272
+ this.insertPageBackgroundDecoration(pageEl, fragEl, this.getPageBackgroundDecorationZOrder(fragment, resolvedItem));
301574
302273
  });
301575
302274
  normalFragments.forEach(({ fragment, originalIndex }) => {
301576
302275
  const resolvedItem = data.items?.[originalIndex];
@@ -301589,6 +302288,27 @@ menclose::after {
301589
302288
  });
301590
302289
  if (!existing)
301591
302290
  pageEl.appendChild(container);
302291
+ absoluteOverlayFragments.forEach(({ fragment, originalIndex }) => {
302292
+ const resolvedItem = data.items?.[originalIndex];
302293
+ const fragEl = this.renderFragment(fragment, context, undefined, betweenBorderFlags.get(originalIndex), resolvedItem);
302294
+ const isPageRelative = this.isPageRelativeAnchoredFragment(fragment, resolvedItem);
302295
+ this.applyHeaderFooterTextWatermarkPreviewOpacity(fragEl, data.isActiveHeaderFooter === true);
302296
+ let pageY;
302297
+ if (isPageRelative && kind === "footer")
302298
+ pageY = footerAnchorPageOriginY + fragment.y;
302299
+ else if (isPageRelative)
302300
+ pageY = fragment.y;
302301
+ else
302302
+ pageY = effectiveOffset + fragment.y + (kind === "footer" ? footerYOffset : 0);
302303
+ const isHorizontallyPageRelative = this.isHorizontallyPageRelativeAnchoredFragment(fragment, resolvedItem);
302304
+ fragEl.style.top = `${pageY}px`;
302305
+ fragEl.style.left = `${isHorizontallyPageRelative ? fragment.x : marginLeft + fragment.x}px`;
302306
+ fragEl.style.zIndex = "0";
302307
+ if (data.isActiveHeaderFooter !== true)
302308
+ fragEl.style.pointerEvents = "none";
302309
+ fragEl.dataset.headerFooterOverlaySection = kind;
302310
+ this.insertPageBackgroundDecoration(pageEl, fragEl, this.getPageBackgroundDecorationZOrder(fragment, resolvedItem));
302311
+ });
301592
302312
  }
301593
302313
  resetState() {
301594
302314
  if (this.mount) {
@@ -302013,6 +302733,19 @@ menclose::after {
302013
302733
  innerWrapper.style.width = `${fragment.geometry.width}px`;
302014
302734
  innerWrapper.style.height = `${fragment.geometry.height}px`;
302015
302735
  innerWrapper.style.transformOrigin = "center";
302736
+ if (block.drawingKind === "shapeGroup" && block.groupTransform) {
302737
+ const effectExtent = block.effectExtent ?? {
302738
+ left: 0,
302739
+ top: 0,
302740
+ right: 0,
302741
+ bottom: 0
302742
+ };
302743
+ const groupWidth = block.groupTransform.width ?? Math.max(0, block.geometry.width - effectExtent.left - effectExtent.right);
302744
+ const groupHeight = block.groupTransform.height ?? Math.max(0, block.geometry.height - effectExtent.top - effectExtent.bottom);
302745
+ const originX = effectExtent.left + groupWidth / 2;
302746
+ const originY = effectExtent.top + groupHeight / 2;
302747
+ innerWrapper.style.transformOrigin = `${originX}px ${originY}px`;
302748
+ }
302016
302749
  const scale = fragment.scale ?? 1;
302017
302750
  const transforms = ["translate(-50%, -50%)"];
302018
302751
  transforms.push(`rotate(${fragment.geometry.rotation ?? 0}deg)`);
@@ -302039,7 +302772,7 @@ menclose::after {
302039
302772
  if (block.drawingKind === "vectorShape" || block.drawingKind === "textboxShape")
302040
302773
  return this.createVectorShapeElement(block, fragment.geometry, false, 1, 1, context, fragment);
302041
302774
  if (block.drawingKind === "shapeGroup")
302042
- return this.createShapeGroupElement(block, context);
302775
+ return this.createShapeGroupElement(block, context, fragment.geometry);
302043
302776
  if (block.drawingKind === "chart")
302044
302777
  return this.createChartElement(block);
302045
302778
  return this.createDrawingPlaceholder();
@@ -302071,12 +302804,14 @@ menclose::after {
302071
302804
  svgElement.setAttribute("width", "100%");
302072
302805
  svgElement.setAttribute("height", "100%");
302073
302806
  svgElement.style.display = "block";
302807
+ svgElement.style.overflow = "visible";
302074
302808
  if (block.fillColor && typeof block.fillColor === "object") {
302075
302809
  if ("type" in block.fillColor && block.fillColor.type === "gradient")
302076
302810
  applyGradientToSVG(svgElement, block.fillColor);
302077
302811
  else if ("type" in block.fillColor && block.fillColor.type === "solidWithAlpha")
302078
302812
  applyAlphaToSVG(svgElement, block.fillColor);
302079
302813
  }
302814
+ this.applyShapeEffects(svgElement, block);
302080
302815
  this.applyLineEnds(svgElement, block);
302081
302816
  contentContainer.appendChild(svgElement);
302082
302817
  if (block.drawingKind === "textboxShape" || this.hasShapeTextContent(block.textContent)) {
@@ -302327,19 +303062,40 @@ menclose::after {
302327
303062
  textDiv.style.textAlign = "right";
302328
303063
  else
302329
303064
  textDiv.style.textAlign = "left";
302330
- let currentParagraph = this.doc.createElement("div");
302331
- currentParagraph.style.width = "100%";
302332
- currentParagraph.style.minWidth = "0";
302333
- currentParagraph.style.whiteSpace = "normal";
303065
+ const paragraphSpacing = textContent$1.paragraphs;
303066
+ const spacingBefore = (index2) => paragraphSpacing?.[index2]?.spacing?.before;
303067
+ const spacingAfter = (index2) => paragraphSpacing?.[index2]?.spacing?.after;
303068
+ const createParagraphElement = () => {
303069
+ const paragraph2 = this.doc.createElement("div");
303070
+ paragraph2.style.width = "100%";
303071
+ paragraph2.style.minWidth = "0";
303072
+ paragraph2.style.whiteSpace = "normal";
303073
+ paragraph2.style.marginLeft = "0";
303074
+ paragraph2.style.marginRight = "0";
303075
+ return paragraph2;
303076
+ };
303077
+ let logicalParagraphIndex = 0;
303078
+ let currentParagraph = createParagraphElement();
303079
+ const firstParagraphBefore = spacingBefore(logicalParagraphIndex);
303080
+ if (typeof firstParagraphBefore === "number")
303081
+ currentParagraph.style.marginTop = `${firstParagraphBefore}px`;
302334
303082
  textContent$1.parts.forEach((part) => {
302335
303083
  if (part.isLineBreak) {
303084
+ if (part.isParagraphBoundary) {
303085
+ const currentParagraphAfter = spacingAfter(logicalParagraphIndex);
303086
+ if (typeof currentParagraphAfter === "number")
303087
+ currentParagraph.style.marginBottom = `${currentParagraphAfter}px`;
303088
+ }
302336
303089
  textDiv.appendChild(currentParagraph);
302337
- currentParagraph = this.doc.createElement("div");
302338
- currentParagraph.style.width = "100%";
302339
- currentParagraph.style.minWidth = "0";
302340
- currentParagraph.style.whiteSpace = "normal";
303090
+ currentParagraph = createParagraphElement();
302341
303091
  if (part.isEmptyParagraph)
302342
303092
  currentParagraph.style.minHeight = "1em";
303093
+ if (part.isParagraphBoundary) {
303094
+ logicalParagraphIndex += 1;
303095
+ const nextParagraphBefore = spacingBefore(logicalParagraphIndex);
303096
+ if (typeof nextParagraphBefore === "number")
303097
+ currentParagraph.style.marginTop = `${nextParagraphBefore}px`;
303098
+ }
302343
303099
  } else if (part.kind === "image" && part.src)
302344
303100
  currentParagraph.appendChild(createShapeTextImageElement(this.doc, part));
302345
303101
  else {
@@ -302365,6 +303121,9 @@ menclose::after {
302365
303121
  currentParagraph.appendChild(span);
302366
303122
  }
302367
303123
  });
303124
+ const finalParagraphAfter = spacingAfter(logicalParagraphIndex);
303125
+ if (typeof finalParagraphAfter === "number")
303126
+ currentParagraph.style.marginBottom = `${finalParagraphAfter}px`;
302368
303127
  textDiv.appendChild(currentParagraph);
302369
303128
  return textDiv;
302370
303129
  }
@@ -302416,6 +303175,7 @@ menclose::after {
302416
303175
  const viewH = firstPath.h || height;
302417
303176
  if (viewW === 0 || viewH === 0)
302418
303177
  return null;
303178
+ const explicitStrokeEffect = viewW / width > 10 || viewH / height > 10 ? ' vector-effect="non-scaling-stroke"' : "";
302419
303179
  const edgeStroke = fillColor !== "none" && strokeColor === "none" ? ` stroke="${fillColor}" stroke-width="0.5" vector-effect="non-scaling-stroke"` : "";
302420
303180
  return `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${viewW} ${viewH}" preserveAspectRatio="none">
302421
303181
  ${custGeom.paths.map((p$12) => {
@@ -302425,7 +303185,7 @@ menclose::after {
302425
303185
  const scaleX = viewW / pathW;
302426
303186
  const scaleY = viewH / pathH;
302427
303187
  const transform2 = needsTransform ? ` transform="scale(${scaleX}, ${scaleY})"` : "";
302428
- const strokeAttr = strokeColor !== "none" ? ` stroke="${strokeColor}" stroke-width="${strokeWidth}"` : edgeStroke;
303188
+ const strokeAttr = strokeColor !== "none" ? ` stroke="${strokeColor}" stroke-width="${strokeWidth}"${explicitStrokeEffect}` : edgeStroke;
302429
303189
  return `<path d="${p$12.d}" fill="${fillColor}" fill-rule="evenodd"${strokeAttr}${transform2} />`;
302430
303190
  }).join(`
302431
303191
  `)}
@@ -302499,6 +303259,112 @@ menclose::after {
302499
303259
  target.setAttribute("marker-end", `url(#${id2})`);
302500
303260
  }
302501
303261
  }
303262
+ applyShapeEffects(svgElement, block) {
303263
+ const outerShadow = block.effects?.outerShadow;
303264
+ if (!outerShadow)
303265
+ return;
303266
+ this.applyOuterShadowEffect(svgElement, block.id, outerShadow);
303267
+ }
303268
+ applyOuterShadowEffect(svgElement, blockId, shadow) {
303269
+ const targets = this.findShapeEffectTargets(svgElement);
303270
+ if (!targets.length)
303271
+ return;
303272
+ const defs = this.ensureSvgDefs(svgElement);
303273
+ const filterId = this.sanitizeSvgId(`sd-shadow-${blockId}`);
303274
+ const outlineFilterId = this.sanitizeSvgId(`sd-shadow-outline-${blockId}`);
303275
+ if (!defs.querySelector(`#${filterId}`)) {
303276
+ const filter = this.doc.createElementNS("http://www.w3.org/2000/svg", "filter");
303277
+ filter.setAttribute("id", filterId);
303278
+ filter.setAttribute("x", "-50%");
303279
+ filter.setAttribute("y", "-50%");
303280
+ filter.setAttribute("width", "200%");
303281
+ filter.setAttribute("height", "200%");
303282
+ const { dx, dy } = resolveOuterShadowOffset(shadow);
303283
+ const dropShadow = this.doc.createElementNS("http://www.w3.org/2000/svg", "feDropShadow");
303284
+ dropShadow.setAttribute("dx", this.formatSvgNumber(dx));
303285
+ dropShadow.setAttribute("dy", this.formatSvgNumber(dy));
303286
+ dropShadow.setAttribute("stdDeviation", this.formatSvgNumber(getOuterShadowStdDeviation(shadow)));
303287
+ dropShadow.setAttribute("flood-color", shadow.color);
303288
+ dropShadow.setAttribute("flood-opacity", this.formatSvgNumber(shadow.opacity));
303289
+ filter.appendChild(dropShadow);
303290
+ defs.appendChild(filter);
303291
+ }
303292
+ targets.forEach((target) => {
303293
+ if (this.shouldRenderFilledShadowClone(target)) {
303294
+ this.appendFilledShadowClone(svgElement, defs, target, outlineFilterId, shadow);
303295
+ return;
303296
+ }
303297
+ target.setAttribute("filter", `url(#${filterId})`);
303298
+ });
303299
+ }
303300
+ findShapeEffectTargets(svgElement) {
303301
+ return Array.from(svgElement.querySelectorAll("path, line, polyline, polygon, rect, ellipse, circle")).filter((target) => !target.closest("defs") && !target.hasAttribute("data-sd-shadow-clone"));
303302
+ }
303303
+ shouldRenderFilledShadowClone(target) {
303304
+ if (target.getAttribute("fill") !== "none")
303305
+ return false;
303306
+ if (target.tagName.toLowerCase() === "path")
303307
+ return /z\s*$/i.test(target.getAttribute("d") ?? "");
303308
+ return [
303309
+ "polygon",
303310
+ "rect",
303311
+ "ellipse",
303312
+ "circle"
303313
+ ].includes(target.tagName.toLowerCase());
303314
+ }
303315
+ appendFilledShadowClone(svgElement, defs, target, filterId, shadow) {
303316
+ this.ensureOuterShadowOnlyFilter(defs, filterId, shadow);
303317
+ const clone$1 = target.cloneNode(false);
303318
+ clone$1.setAttribute("data-sd-shadow-clone", filterId);
303319
+ clone$1.setAttribute("aria-hidden", "true");
303320
+ clone$1.setAttribute("fill", "#000000");
303321
+ clone$1.setAttribute("stroke", "none");
303322
+ clone$1.setAttribute("filter", `url(#${filterId})`);
303323
+ target.parentNode?.insertBefore(clone$1, target);
303324
+ }
303325
+ ensureOuterShadowOnlyFilter(defs, filterId, shadow) {
303326
+ if (defs.querySelector(`#${filterId}`))
303327
+ return;
303328
+ const filter = this.doc.createElementNS("http://www.w3.org/2000/svg", "filter");
303329
+ filter.setAttribute("id", filterId);
303330
+ filter.setAttribute("x", "-50%");
303331
+ filter.setAttribute("y", "-50%");
303332
+ filter.setAttribute("width", "200%");
303333
+ filter.setAttribute("height", "200%");
303334
+ const blur = this.doc.createElementNS("http://www.w3.org/2000/svg", "feGaussianBlur");
303335
+ blur.setAttribute("in", "SourceAlpha");
303336
+ blur.setAttribute("stdDeviation", this.formatSvgNumber(getOuterShadowStdDeviation(shadow)));
303337
+ blur.setAttribute("result", "blur");
303338
+ const { dx, dy } = resolveOuterShadowOffset(shadow);
303339
+ const offset$1 = this.doc.createElementNS("http://www.w3.org/2000/svg", "feOffset");
303340
+ offset$1.setAttribute("in", "blur");
303341
+ offset$1.setAttribute("dx", this.formatSvgNumber(dx));
303342
+ offset$1.setAttribute("dy", this.formatSvgNumber(dy));
303343
+ offset$1.setAttribute("result", "offsetBlur");
303344
+ const flood = this.doc.createElementNS("http://www.w3.org/2000/svg", "feFlood");
303345
+ flood.setAttribute("flood-color", shadow.color);
303346
+ flood.setAttribute("flood-opacity", this.formatSvgNumber(shadow.opacity));
303347
+ flood.setAttribute("result", "shadowColor");
303348
+ const composite = this.doc.createElementNS("http://www.w3.org/2000/svg", "feComposite");
303349
+ composite.setAttribute("in", "shadowColor");
303350
+ composite.setAttribute("in2", "offsetBlur");
303351
+ composite.setAttribute("operator", "in");
303352
+ composite.setAttribute("result", "shadow");
303353
+ const outsideOnly = this.doc.createElementNS("http://www.w3.org/2000/svg", "feComposite");
303354
+ outsideOnly.setAttribute("in", "shadow");
303355
+ outsideOnly.setAttribute("in2", "SourceAlpha");
303356
+ outsideOnly.setAttribute("operator", "out");
303357
+ outsideOnly.setAttribute("result", "outerShadow");
303358
+ filter.appendChild(blur);
303359
+ filter.appendChild(offset$1);
303360
+ filter.appendChild(flood);
303361
+ filter.appendChild(composite);
303362
+ filter.appendChild(outsideOnly);
303363
+ defs.appendChild(filter);
303364
+ }
303365
+ formatSvgNumber(value) {
303366
+ return Number.isFinite(value) ? Number(value.toFixed(4)).toString() : "0";
303367
+ }
302502
303368
  findLineEndTarget(svgElement) {
302503
303369
  const line = svgElement.querySelector("line");
302504
303370
  if (line)
@@ -302587,7 +303453,7 @@ menclose::after {
302587
303453
  target.style.removeProperty("transform-origin");
302588
303454
  }
302589
303455
  }
302590
- createShapeGroupElement(block, context) {
303456
+ createShapeGroupElement(block, context, fragmentGeometry) {
302591
303457
  const groupEl = this.doc.createElement("div");
302592
303458
  groupEl.classList.add("superdoc-shape-group");
302593
303459
  groupEl.style.position = "relative";
@@ -302595,32 +303461,56 @@ menclose::after {
302595
303461
  groupEl.style.height = "100%";
302596
303462
  const groupTransform = block.groupTransform;
302597
303463
  let contentContainer = groupEl;
302598
- const visibleWidth = groupTransform?.width ?? block.geometry.width ?? 0;
302599
- const visibleHeight = groupTransform?.height ?? block.geometry.height ?? 0;
302600
- if (groupTransform) {
303464
+ const groupEffectExtent = block.effectExtent ?? {
303465
+ left: 0,
303466
+ top: 0,
303467
+ right: 0,
303468
+ bottom: 0
303469
+ };
303470
+ const hasGroupEffectExtent = groupEffectExtent.left > 0 || groupEffectExtent.top > 0 || groupEffectExtent.right > 0 || groupEffectExtent.bottom > 0;
303471
+ const visibleWidth = groupTransform?.width ?? Math.max(0, (block.geometry.width ?? 0) - groupEffectExtent.left - groupEffectExtent.right);
303472
+ const visibleHeight = groupTransform?.height ?? Math.max(0, (block.geometry.height ?? 0) - groupEffectExtent.top - groupEffectExtent.bottom);
303473
+ if (groupTransform || hasGroupEffectExtent) {
302601
303474
  const inner = this.doc.createElement("div");
302602
303475
  inner.style.position = "absolute";
302603
- inner.style.left = "0";
302604
- inner.style.top = "0";
303476
+ inner.style.left = `${groupEffectExtent.left}px`;
303477
+ inner.style.top = `${groupEffectExtent.top}px`;
302605
303478
  inner.style.width = `${Math.max(1, visibleWidth)}px`;
302606
303479
  inner.style.height = `${Math.max(1, visibleHeight)}px`;
303480
+ const groupTransforms = [];
303481
+ const normalizedGroupRotation = typeof groupTransform?.rotation === "number" ? normalizeRotationDegrees(groupTransform.rotation) : 0;
303482
+ const normalizedFragmentRotation = typeof fragmentGeometry?.rotation === "number" ? normalizeRotationDegrees(fragmentGeometry.rotation) : 0;
303483
+ const groupRotation = normalizedGroupRotation && normalizedGroupRotation !== normalizedFragmentRotation ? groupTransform?.rotation ?? 0 : 0;
303484
+ const groupFlipH = groupTransform?.flipH && groupTransform.flipH !== fragmentGeometry?.flipH;
303485
+ const groupFlipV = groupTransform?.flipV && groupTransform.flipV !== fragmentGeometry?.flipV;
303486
+ if (groupRotation)
303487
+ groupTransforms.push(`rotate(${groupRotation}deg)`);
303488
+ if (groupFlipH)
303489
+ groupTransforms.push("scaleX(-1)");
303490
+ if (groupFlipV)
303491
+ groupTransforms.push("scaleY(-1)");
303492
+ if (groupTransforms.length > 0) {
303493
+ inner.style.transformOrigin = "center";
303494
+ inner.style.transform = groupTransforms.join(" ");
303495
+ }
302607
303496
  groupEl.appendChild(inner);
302608
303497
  contentContainer = inner;
302609
303498
  }
302610
- block.shapes.forEach((child) => {
302611
- const childContent = this.createGroupChildContent(child, 1, 1, context);
303499
+ block.shapes.forEach((child, childIndex) => {
303500
+ const attrs = child.attrs ?? {};
303501
+ const paintExtent = this.getShapeGroupChildPaintExtent(child);
303502
+ const childContent = this.createGroupChildContent(child, 1, 1, context, paintExtent, block.id, childIndex);
302612
303503
  if (!childContent)
302613
303504
  return;
302614
- const attrs = child.attrs ?? {};
302615
303505
  const wrapper = this.doc.createElement("div");
302616
303506
  wrapper.classList.add("superdoc-shape-group__child");
302617
303507
  wrapper.style.position = "absolute";
302618
- wrapper.style.left = `${Number(attrs.x ?? 0)}px`;
302619
- wrapper.style.top = `${Number(attrs.y ?? 0)}px`;
303508
+ wrapper.style.left = `${Number(attrs.x ?? 0) - paintExtent.left}px`;
303509
+ wrapper.style.top = `${Number(attrs.y ?? 0) - paintExtent.top}px`;
302620
303510
  const childW = typeof attrs.width === "number" ? attrs.width : block.geometry.width;
302621
303511
  const childH = typeof attrs.height === "number" ? attrs.height : block.geometry.height;
302622
- wrapper.style.width = `${Math.max(1, childW)}px`;
302623
- wrapper.style.height = `${Math.max(1, childH)}px`;
303512
+ wrapper.style.width = `${Math.max(1, childW + paintExtent.left + paintExtent.right)}px`;
303513
+ wrapper.style.height = `${Math.max(1, childH + paintExtent.top + paintExtent.bottom)}px`;
302624
303514
  wrapper.style.transformOrigin = "center";
302625
303515
  const transforms = [];
302626
303516
  if (attrs.rotation)
@@ -302638,20 +303528,63 @@ menclose::after {
302638
303528
  });
302639
303529
  return groupEl;
302640
303530
  }
302641
- createGroupChildContent(child, groupScaleX = 1, groupScaleY = 1, context) {
303531
+ getShapeGroupChildPaintExtent(child) {
303532
+ if (child.shapeType !== "vectorShape" || !("fillColor" in child.attrs))
303533
+ return {
303534
+ left: 0,
303535
+ top: 0,
303536
+ right: 0,
303537
+ bottom: 0
303538
+ };
303539
+ const attrs = child.attrs;
303540
+ const shadowExtent = attrs.effects?.outerShadow ? getOuterShadowPaintExtent(attrs.effects.outerShadow) : {
303541
+ left: 0,
303542
+ top: 0,
303543
+ right: 0,
303544
+ bottom: 0
303545
+ };
303546
+ if (attrs.lineEnds)
303547
+ return {
303548
+ left: 0,
303549
+ top: 0,
303550
+ right: 0,
303551
+ bottom: 0
303552
+ };
303553
+ if (attrs.strokeColor === null)
303554
+ return shadowExtent;
303555
+ const rawStrokeWidth = child.attrs.strokeWidth;
303556
+ const parsedStrokeWidth = typeof rawStrokeWidth === "number" ? rawStrokeWidth : typeof rawStrokeWidth === "string" && rawStrokeWidth.trim() !== "" ? Number(rawStrokeWidth) : undefined;
303557
+ const strokeWidth = parsedStrokeWidth != null && Number.isFinite(parsedStrokeWidth) ? parsedStrokeWidth : 1;
303558
+ if (strokeWidth <= 0)
303559
+ return shadowExtent;
303560
+ const extent = strokeWidth / 2;
303561
+ return {
303562
+ left: Math.max(extent, shadowExtent.left),
303563
+ top: Math.max(extent, shadowExtent.top),
303564
+ right: Math.max(extent, shadowExtent.right),
303565
+ bottom: Math.max(extent, shadowExtent.bottom)
303566
+ };
303567
+ }
303568
+ createGroupChildContent(child, groupScaleX = 1, groupScaleY = 1, context, paintExtent = {
303569
+ left: 0,
303570
+ top: 0,
303571
+ right: 0,
303572
+ bottom: 0
303573
+ }, groupId, childIndex) {
302642
303574
  if (child.shapeType === "vectorShape" && "fillColor" in child.attrs) {
302643
303575
  const attrs = child.attrs;
302644
303576
  const childGeometry = {
302645
- width: attrs.width ?? 0,
302646
- height: attrs.height ?? 0,
303577
+ width: (attrs.width ?? 0) + paintExtent.left + paintExtent.right,
303578
+ height: (attrs.height ?? 0) + paintExtent.top + paintExtent.bottom,
302647
303579
  rotation: attrs.rotation ?? 0,
302648
303580
  flipH: attrs.flipH ?? false,
302649
303581
  flipV: attrs.flipV ?? false
302650
303582
  };
303583
+ const hasPaintExtent = paintExtent.left > 0 || paintExtent.top > 0 || paintExtent.right > 0 || paintExtent.bottom > 0;
302651
303584
  const vectorChild = {
302652
303585
  drawingKind: "vectorShape",
302653
303586
  kind: "drawing",
302654
- id: `${attrs.shapeId ?? child.shapeType}`,
303587
+ id: groupId != null ? `${groupId}-${childIndex ?? 0}-${attrs.shapeId ?? child.shapeType}` : `${attrs.shapeId ?? child.shapeType}`,
302655
303588
  geometry: childGeometry,
302656
303589
  padding: undefined,
302657
303590
  margin: undefined,
@@ -302666,10 +303599,12 @@ menclose::after {
302666
303599
  strokeColor: attrs.strokeColor,
302667
303600
  strokeWidth: attrs.strokeWidth,
302668
303601
  lineEnds: attrs.lineEnds,
303602
+ effects: attrs.effects,
302669
303603
  textContent: attrs.textContent,
302670
303604
  textAlign: attrs.textAlign,
302671
303605
  textVerticalAlign: attrs.textVerticalAlign,
302672
- textInsets: attrs.textInsets
303606
+ textInsets: attrs.textInsets,
303607
+ effectExtent: hasPaintExtent ? paintExtent : undefined
302673
303608
  };
302674
303609
  return this.createVectorShapeElement(vectorChild, childGeometry, false, groupScaleX, groupScaleY, context);
302675
303610
  }
@@ -303301,11 +304236,20 @@ menclose::after {
303301
304236
  if (!attrs || typeof attrs !== "object")
303302
304237
  return "";
303303
304238
  return readClipPathValue(attrs.clipPath);
304239
+ }, resolveShapeClipPathFromAttrs = (attrs) => {
304240
+ if (!attrs || typeof attrs !== "object")
304241
+ return "";
304242
+ return readClipPathValue(attrs.shapeClipPath);
303304
304243
  }, resolveBlockClipPath = (block) => {
303305
304244
  if (!block || typeof block !== "object")
303306
304245
  return "";
303307
304246
  const record3 = block;
303308
304247
  return readClipPathValue(record3.clipPath) || resolveClipPathFromAttrs(record3.attrs);
304248
+ }, resolveBlockShapeClipPath = (block) => {
304249
+ if (!block || typeof block !== "object")
304250
+ return "";
304251
+ const record3 = block;
304252
+ return readClipPathValue(record3.shapeClipPath) || resolveShapeClipPathFromAttrs(record3.attrs);
303309
304253
  }, imageHyperlinkVersion = (hyperlink) => {
303310
304254
  if (!hyperlink)
303311
304255
  return "";
@@ -303344,7 +304288,8 @@ menclose::after {
303344
304288
  image2.flipH ? 1 : 0,
303345
304289
  image2.flipV ? 1 : 0,
303346
304290
  imageHyperlinkVersion(image2.hyperlink),
303347
- resolveBlockClipPath(image2)
304291
+ resolveBlockClipPath(image2),
304292
+ resolveBlockShapeClipPath(image2)
303348
304293
  ].join("|"), renderedInlineImageRunVersion = (image2) => [
303349
304294
  "img",
303350
304295
  image2.src ?? "",
@@ -303353,6 +304298,8 @@ menclose::after {
303353
304298
  image2.alt ?? "",
303354
304299
  image2.title ?? "",
303355
304300
  typeof image2.clipPath === "string" ? image2.clipPath.trim() : "",
304301
+ typeof image2.shapeClipPath === "string" ? image2.shapeClipPath.trim() : "",
304302
+ image2.objectFit ?? "",
303356
304303
  image2.distTop ?? "",
303357
304304
  image2.distBottom ?? "",
303358
304305
  image2.distLeft ?? "",
@@ -303551,7 +304498,9 @@ menclose::after {
303551
304498
  vector.geometry.flipV ? 1 : 0,
303552
304499
  drawingTextVersion(vector),
303553
304500
  block.anchor?.offsetH ?? "",
303554
- block.anchor?.offsetV ?? ""
304501
+ block.anchor?.offsetV ?? "",
304502
+ vector.effects ? JSON.stringify(vector.effects) : "",
304503
+ vector.effectExtent ? JSON.stringify(vector.effectExtent) : ""
303555
304504
  ].join("|");
303556
304505
  }
303557
304506
  if (block.drawingKind === "shapeGroup") {
@@ -303561,6 +304510,7 @@ menclose::after {
303561
304510
  "drawing:group",
303562
304511
  group.geometry.width,
303563
304512
  group.geometry.height,
304513
+ group.effectExtent ? JSON.stringify(group.effectExtent) : "",
303564
304514
  group.groupTransform ? JSON.stringify(group.groupTransform) : "",
303565
304515
  childSignature
303566
304516
  ].join("|");
@@ -304256,6 +305206,7 @@ menclose::after {
304256
305206
  JSON.stringify(block.customGeometry ?? null),
304257
305207
  JSON.stringify(block.lineEnds ?? null),
304258
305208
  JSON.stringify(block.effectExtent ?? null),
305209
+ JSON.stringify(block.effects ?? null),
304259
305210
  JSON.stringify(block.textContent ?? null),
304260
305211
  block.textAlign ?? "",
304261
305212
  block.textVerticalAlign ?? "",
@@ -304419,7 +305370,7 @@ menclose::after {
304419
305370
  return `${block.id}:table:${contentHash}${tableAttrsKey}`;
304420
305371
  }
304421
305372
  if (block.kind !== "paragraph")
304422
- return block.id;
305373
+ return hashNonParagraphCellBlock(block);
304423
305374
  const trackedMode = block.attrs && "trackedChangesMode" in block.attrs && block.attrs.trackedChangesMode || "review";
304424
305375
  const trackedEnabled = resolveTrackedChangesEnabled(block.attrs, true);
304425
305376
  const runsHash = block.runs.map((run2) => {
@@ -305288,7 +306239,7 @@ menclose::after {
305288
306239
  }
305289
306240
  return true;
305290
306241
  }, imageRunsEqual = (a2, b$1) => {
305291
- return a2.src === b$1.src && a2.width === b$1.width && a2.height === b$1.height && a2.alt === b$1.alt && a2.title === b$1.title && a2.clipPath === b$1.clipPath && a2.distTop === b$1.distTop && a2.distBottom === b$1.distBottom && a2.distLeft === b$1.distLeft && a2.distRight === b$1.distRight && a2.verticalAlign === b$1.verticalAlign && a2.rotation === b$1.rotation && a2.flipH === b$1.flipH && a2.flipV === b$1.flipV && a2.gain === b$1.gain && a2.blacklevel === b$1.blacklevel && a2.grayscale === b$1.grayscale && jsonEqual(a2.lum, b$1.lum) && jsonEqual(a2.hyperlink, b$1.hyperlink) && jsonEqual(a2.sdt, b$1.sdt) && shallowRecordEqual(a2.dataAttrs, b$1.dataAttrs);
306242
+ return a2.src === b$1.src && a2.width === b$1.width && a2.height === b$1.height && a2.alt === b$1.alt && a2.title === b$1.title && a2.clipPath === b$1.clipPath && a2.shapeClipPath === b$1.shapeClipPath && a2.objectFit === b$1.objectFit && a2.distTop === b$1.distTop && a2.distBottom === b$1.distBottom && a2.distLeft === b$1.distLeft && a2.distRight === b$1.distRight && a2.verticalAlign === b$1.verticalAlign && a2.rotation === b$1.rotation && a2.flipH === b$1.flipH && a2.flipV === b$1.flipV && a2.gain === b$1.gain && a2.blacklevel === b$1.blacklevel && a2.grayscale === b$1.grayscale && jsonEqual(a2.lum, b$1.lum) && jsonEqual(a2.hyperlink, b$1.hyperlink) && jsonEqual(a2.sdt, b$1.sdt) && shallowRecordEqual(a2.dataAttrs, b$1.dataAttrs);
305292
306243
  }, imageBlocksEqual = (a2, b$1) => {
305293
306244
  return a2.src === b$1.src && a2.width === b$1.width && a2.height === b$1.height && a2.alt === b$1.alt && a2.title === b$1.title && a2.objectFit === b$1.objectFit && a2.display === b$1.display && boxSpacingEqual(a2.margin, b$1.margin) && boxSpacingEqual(a2.padding, b$1.padding) && imageAnchorEqual(a2.anchor, b$1.anchor) && imageWrapEqual(a2.wrap, b$1.wrap) && shallowRecordEqual(a2.attrs, b$1.attrs);
305294
306245
  }, drawingBlocksEqual = (a2, b$1) => {
@@ -305314,10 +306265,10 @@ menclose::after {
305314
306265
  return imageBlocksEqual(a2, b$1);
305315
306266
  if ((a2.drawingKind === "vectorShape" || a2.drawingKind === "textboxShape") && (b$1.drawingKind === "vectorShape" || b$1.drawingKind === "textboxShape")) {
305316
306267
  const textboxContentEqual = a2.drawingKind !== "textboxShape" || b$1.drawingKind !== "textboxShape" || jsonEqual(a2.contentBlocks, b$1.contentBlocks);
305317
- return drawingGeometryEqual(a2.geometry, b$1.geometry) && a2.shapeKind === b$1.shapeKind && a2.fillColor === b$1.fillColor && a2.strokeColor === b$1.strokeColor && a2.strokeWidth === b$1.strokeWidth && a2.textAlign === b$1.textAlign && a2.textVerticalAlign === b$1.textVerticalAlign && jsonEqual(a2.textInsets, b$1.textInsets) && jsonEqual(a2.textContent, b$1.textContent) && jsonEqual(a2.customGeometry, b$1.customGeometry) && jsonEqual(a2.lineEnds, b$1.lineEnds) && jsonEqual(a2.effectExtent, b$1.effectExtent) && textboxContentEqual;
306268
+ return drawingGeometryEqual(a2.geometry, b$1.geometry) && a2.shapeKind === b$1.shapeKind && jsonEqual(a2.customGeometry, b$1.customGeometry) && a2.fillColor === b$1.fillColor && a2.strokeColor === b$1.strokeColor && a2.strokeWidth === b$1.strokeWidth && a2.textAlign === b$1.textAlign && a2.textVerticalAlign === b$1.textVerticalAlign && jsonEqual(a2.textInsets, b$1.textInsets) && jsonEqual(a2.textContent, b$1.textContent) && jsonEqual(a2.lineEnds, b$1.lineEnds) && jsonEqual(a2.effects, b$1.effects) && jsonEqual(a2.effectExtent, b$1.effectExtent) && textboxContentEqual;
305318
306269
  }
305319
306270
  if (a2.drawingKind === "shapeGroup" && b$1.drawingKind === "shapeGroup")
305320
- return drawingGeometryEqual(a2.geometry, b$1.geometry) && shapeGroupTransformEqual(a2.groupTransform, b$1.groupTransform) && shapeGroupSizeEqual(a2.size, b$1.size) && shapeGroupChildrenEqual(a2.shapes, b$1.shapes);
306271
+ return drawingGeometryEqual(a2.geometry, b$1.geometry) && jsonEqual(a2.effectExtent, b$1.effectExtent) && shapeGroupTransformEqual(a2.groupTransform, b$1.groupTransform) && shapeGroupSizeEqual(a2.size, b$1.size) && shapeGroupChildrenEqual(a2.shapes, b$1.shapes);
305321
306272
  if (a2.drawingKind === "chart" && b$1.drawingKind === "chart")
305322
306273
  return drawingGeometryEqual(a2.geometry, b$1.geometry) && a2.chartRelId === b$1.chartRelId && jsonEqual(a2.chartData, b$1.chartData);
305323
306274
  return true;
@@ -305369,7 +306320,7 @@ menclose::after {
305369
306320
  return true;
305370
306321
  if (!a2 || !b$1)
305371
306322
  return !a2 && !b$1;
305372
- return a2.x === b$1.x && a2.y === b$1.y && a2.width === b$1.width && a2.height === b$1.height && a2.childX === b$1.childX && a2.childY === b$1.childY && a2.childWidth === b$1.childWidth && a2.childHeight === b$1.childHeight && a2.childOriginXEmu === b$1.childOriginXEmu && a2.childOriginYEmu === b$1.childOriginYEmu;
306323
+ return a2.x === b$1.x && a2.y === b$1.y && a2.width === b$1.width && a2.height === b$1.height && a2.childX === b$1.childX && a2.childY === b$1.childY && a2.childWidth === b$1.childWidth && a2.childHeight === b$1.childHeight && a2.childOriginXEmu === b$1.childOriginXEmu && a2.childOriginYEmu === b$1.childOriginYEmu && (a2.rotation ?? 0) === (b$1.rotation ?? 0) && Boolean(a2.flipH) === Boolean(b$1.flipH) && Boolean(a2.flipV) === Boolean(b$1.flipV);
305373
306324
  }, shapeGroupSizeEqual = (a2, b$1) => {
305374
306325
  if (a2 === b$1)
305375
306326
  return true;
@@ -308754,9 +309705,10 @@ menclose::after {
308754
309705
  const visiblePointerSurface = resolveVisibleSurfaceAtPointer(event.target, event.clientX, event.clientY);
308755
309706
  const clickedInsideVisibleActiveSurface = visiblePointerSurface?.kind === "headerFooter" && visiblePointerSurface.surface.closest(activeSurfaceSelector) != null;
308756
309707
  if (visiblePointerSurface?.kind === "bodyContent") {
308757
- const behindDocSection = (event.target instanceof Element ? event.target.closest("[data-behind-doc-section]") : null)?.dataset.behindDocSection;
309708
+ const targetElement = event.target instanceof Element ? event.target : null;
309709
+ const pageLevelSection = targetElement?.closest("[data-behind-doc-section]")?.dataset.behindDocSection ?? targetElement?.closest("[data-header-footer-overlay-section]")?.dataset.headerFooterOverlaySection;
308758
309710
  const sessionMode = session?.session?.mode;
308759
- if (behindDocSection && behindDocSection === sessionMode)
309711
+ if (pageLevelSection && pageLevelSection === sessionMode)
308760
309712
  return false;
308761
309713
  this.#callbacks.exitHeaderFooterMode?.();
308762
309714
  return false;
@@ -313047,13 +313999,13 @@ menclose::after {
313047
313999
  return;
313048
314000
  console.log(...args$1);
313049
314001
  }, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions, TRACKED_MARK_NAMES;
313050
- var init_src_CkxGCnVm_es = __esm(() => {
314002
+ var init_src_q2d5WRO_es = __esm(() => {
313051
314003
  init_rolldown_runtime_Bg48TavK_es();
313052
- init_SuperConverter_DQ2wMaLK_es();
314004
+ init_SuperConverter_DJEK5GYX_es();
313053
314005
  init_jszip_C49i9kUs_es();
313054
314006
  init_xml_js_CqGKpaft_es();
313055
314007
  init_uuid_B2wVPhPi_es();
313056
- init_create_headless_toolbar_BhSfQYaO_es();
314008
+ init_create_headless_toolbar_BYe9VWHO_es();
313057
314009
  init_constants_D9qj59G2_es();
313058
314010
  init_unified_BDuVPlMu_es();
313059
314011
  init_remark_gfm_BUJjZJLy_es();
@@ -325474,6 +326426,14 @@ ${err.toString()}`);
325474
326426
  return { style: style2 };
325475
326427
  }
325476
326428
  },
326429
+ shapeClipPath: {
326430
+ default: null,
326431
+ rendered: false
326432
+ },
326433
+ objectFit: {
326434
+ default: null,
326435
+ rendered: false
326436
+ },
325477
326437
  size: {
325478
326438
  default: {},
325479
326439
  renderDOM: ({ size: size$1, shouldCover }) => {
@@ -326527,6 +327487,10 @@ ${err.toString()}`);
326527
327487
  default: null,
326528
327488
  rendered: false
326529
327489
  },
327490
+ effects: {
327491
+ default: null,
327492
+ rendered: false
327493
+ },
326530
327494
  lineEnds: {
326531
327495
  default: null,
326532
327496
  rendered: false
@@ -329218,32 +330182,419 @@ ${err.toString()}`);
329218
330182
  }]
329219
330183
  }
329220
330184
  };
329221
- F = new Set(["leftRightArrow", "upDownArrow"]);
330185
+ F = new Set([
330186
+ "bentArrow",
330187
+ "bentUpArrow",
330188
+ "downArrow",
330189
+ "leftArrow",
330190
+ "leftRightArrow",
330191
+ "leftRightUpArrow",
330192
+ "leftUpArrow",
330193
+ "quadArrow",
330194
+ "rightArrow",
330195
+ "upArrow",
330196
+ "upDownArrow",
330197
+ "uturnArrow"
330198
+ ]);
329222
330199
  X = {
330200
+ bentArrow: `<bentArrow>
330201
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
330202
+ <path w="588010" h="648335">
330203
+ <moveTo>
330204
+ <pt x="0" y="648335"/>
330205
+ </moveTo>
330206
+ <lnTo>
330207
+ <pt x="0" y="330756"/>
330208
+ </lnTo>
330209
+ <cubicBezTo>
330210
+ <pt x="0" y="188679"/>
330211
+ <pt x="115177" y="73502"/>
330212
+ <pt x="257254" y="73502"/>
330213
+ </cubicBezTo>
330214
+ <lnTo>
330215
+ <pt x="441008" y="73501"/>
330216
+ </lnTo>
330217
+ <lnTo>
330218
+ <pt x="441008" y="0"/>
330219
+ </lnTo>
330220
+ <lnTo>
330221
+ <pt x="588010" y="147003"/>
330222
+ </lnTo>
330223
+ <lnTo>
330224
+ <pt x="441008" y="294005"/>
330225
+ </lnTo>
330226
+ <lnTo>
330227
+ <pt x="441008" y="220504"/>
330228
+ </lnTo>
330229
+ <lnTo>
330230
+ <pt x="257254" y="220504"/>
330231
+ </lnTo>
330232
+ <cubicBezTo>
330233
+ <pt x="196364" y="220504"/>
330234
+ <pt x="147002" y="269866"/>
330235
+ <pt x="147002" y="330756"/>
330236
+ </cubicBezTo>
330237
+ <cubicBezTo>
330238
+ <pt x="147002" y="436616"/>
330239
+ <pt x="147003" y="542475"/>
330240
+ <pt x="147003" y="648335"/>
330241
+ </cubicBezTo>
330242
+ <lnTo>
330243
+ <pt x="0" y="648335"/>
330244
+ </lnTo>
330245
+ <close/>
330246
+ </path>
330247
+ </pathLst>
330248
+ </bentArrow>`,
330249
+ bentUpArrow: `<bentUpArrow>
330250
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
330251
+ <path w="850265" h="731520">
330252
+ <moveTo>
330253
+ <pt x="0" y="548640"/>
330254
+ </moveTo>
330255
+ <lnTo>
330256
+ <pt x="575945" y="548640"/>
330257
+ </lnTo>
330258
+ <lnTo>
330259
+ <pt x="575945" y="182880"/>
330260
+ </lnTo>
330261
+ <lnTo>
330262
+ <pt x="484505" y="182880"/>
330263
+ </lnTo>
330264
+ <lnTo>
330265
+ <pt x="667385" y="0"/>
330266
+ </lnTo>
330267
+ <lnTo>
330268
+ <pt x="850265" y="182880"/>
330269
+ </lnTo>
330270
+ <lnTo>
330271
+ <pt x="758825" y="182880"/>
330272
+ </lnTo>
330273
+ <lnTo>
330274
+ <pt x="758825" y="731520"/>
330275
+ </lnTo>
330276
+ <lnTo>
330277
+ <pt x="0" y="731520"/>
330278
+ </lnTo>
330279
+ <lnTo>
330280
+ <pt x="0" y="548640"/>
330281
+ </lnTo>
330282
+ <close/>
330283
+ </path>
330284
+ </pathLst>
330285
+ </bentUpArrow>`,
330286
+ downArrow: `<downArrow>
330287
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
330288
+ <path w="394970" h="576580">
330289
+ <moveTo>
330290
+ <pt x="0" y="379095"/>
330291
+ </moveTo>
330292
+ <lnTo>
330293
+ <pt x="98743" y="379095"/>
330294
+ </lnTo>
330295
+ <lnTo>
330296
+ <pt x="98743" y="0"/>
330297
+ </lnTo>
330298
+ <lnTo>
330299
+ <pt x="296228" y="0"/>
330300
+ </lnTo>
330301
+ <lnTo>
330302
+ <pt x="296228" y="379095"/>
330303
+ </lnTo>
330304
+ <lnTo>
330305
+ <pt x="394970" y="379095"/>
330306
+ </lnTo>
330307
+ <lnTo>
330308
+ <pt x="197485" y="576580"/>
330309
+ </lnTo>
330310
+ <lnTo>
330311
+ <pt x="0" y="379095"/>
330312
+ </lnTo>
330313
+ <close/>
330314
+ </path>
330315
+ </pathLst>
330316
+ </downArrow>`,
330317
+ leftArrow: `<leftArrow>
330318
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
330319
+ <path w="662549" h="367128">
330320
+ <moveTo>
330321
+ <pt x="0" y="183564"/>
330322
+ </moveTo>
330323
+ <lnTo>
330324
+ <pt x="183564" y="0"/>
330325
+ </lnTo>
330326
+ <lnTo>
330327
+ <pt x="183564" y="91782"/>
330328
+ </lnTo>
330329
+ <lnTo>
330330
+ <pt x="662549" y="91782"/>
330331
+ </lnTo>
330332
+ <lnTo>
330333
+ <pt x="662549" y="275346"/>
330334
+ </lnTo>
330335
+ <lnTo>
330336
+ <pt x="183564" y="275346"/>
330337
+ </lnTo>
330338
+ <lnTo>
330339
+ <pt x="183564" y="367128"/>
330340
+ </lnTo>
330341
+ <lnTo>
330342
+ <pt x="0" y="183564"/>
330343
+ </lnTo>
330344
+ <close/>
330345
+ </path>
330346
+ </pathLst>
330347
+ </leftArrow>`,
329223
330348
  leftRightArrow: `<leftRightArrow>
330349
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
330350
+ <path w="985520" h="379730">
330351
+ <moveTo>
330352
+ <pt x="0" y="189865"/>
330353
+ </moveTo>
330354
+ <lnTo>
330355
+ <pt x="189865" y="0"/>
330356
+ </lnTo>
330357
+ <lnTo>
330358
+ <pt x="189865" y="94933"/>
330359
+ </lnTo>
330360
+ <lnTo>
330361
+ <pt x="795655" y="94933"/>
330362
+ </lnTo>
330363
+ <lnTo>
330364
+ <pt x="795655" y="0"/>
330365
+ </lnTo>
330366
+ <lnTo>
330367
+ <pt x="985520" y="189865"/>
330368
+ </lnTo>
330369
+ <lnTo>
330370
+ <pt x="795655" y="379730"/>
330371
+ </lnTo>
330372
+ <lnTo>
330373
+ <pt x="795655" y="284798"/>
330374
+ </lnTo>
330375
+ <lnTo>
330376
+ <pt x="189865" y="284798"/>
330377
+ </lnTo>
330378
+ <lnTo>
330379
+ <pt x="189865" y="379730"/>
330380
+ </lnTo>
330381
+ <lnTo>
330382
+ <pt x="0" y="189865"/>
330383
+ </lnTo>
330384
+ <close/>
330385
+ </path>
330386
+ </pathLst>
330387
+ </leftRightArrow>`,
330388
+ leftRightUpArrow: `<leftRightUpArrow>
330389
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
330390
+ <path w="928370" h="634365">
330391
+ <moveTo>
330392
+ <pt x="0" y="475774"/>
330393
+ </moveTo>
330394
+ <lnTo>
330395
+ <pt x="158591" y="317183"/>
330396
+ </lnTo>
330397
+ <lnTo>
330398
+ <pt x="158591" y="396478"/>
330399
+ </lnTo>
330400
+ <lnTo>
330401
+ <pt x="384889" y="396478"/>
330402
+ </lnTo>
330403
+ <lnTo>
330404
+ <pt x="384889" y="158591"/>
330405
+ </lnTo>
330406
+ <lnTo>
330407
+ <pt x="305594" y="158591"/>
330408
+ </lnTo>
330409
+ <lnTo>
330410
+ <pt x="464185" y="0"/>
330411
+ </lnTo>
330412
+ <lnTo>
330413
+ <pt x="622776" y="158591"/>
330414
+ </lnTo>
330415
+ <lnTo>
330416
+ <pt x="543481" y="158591"/>
330417
+ </lnTo>
330418
+ <lnTo>
330419
+ <pt x="543481" y="396478"/>
330420
+ </lnTo>
330421
+ <lnTo>
330422
+ <pt x="769779" y="396478"/>
330423
+ </lnTo>
330424
+ <lnTo>
330425
+ <pt x="769779" y="317183"/>
330426
+ </lnTo>
330427
+ <lnTo>
330428
+ <pt x="928370" y="475774"/>
330429
+ </lnTo>
330430
+ <lnTo>
330431
+ <pt x="769779" y="634365"/>
330432
+ </lnTo>
330433
+ <lnTo>
330434
+ <pt x="769779" y="555069"/>
330435
+ </lnTo>
330436
+ <lnTo>
330437
+ <pt x="158591" y="555069"/>
330438
+ </lnTo>
330439
+ <lnTo>
330440
+ <pt x="158591" y="634365"/>
330441
+ </lnTo>
330442
+ <lnTo>
330443
+ <pt x="0" y="475774"/>
330444
+ </lnTo>
330445
+ <close/>
330446
+ </path>
330447
+ </pathLst>
330448
+ </leftRightUpArrow>`,
330449
+ leftUpArrow: `<leftUpArrow>
330450
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
330451
+ <path w="850265" h="850265">
330452
+ <moveTo>
330453
+ <pt x="0" y="637699"/>
330454
+ </moveTo>
330455
+ <lnTo>
330456
+ <pt x="212566" y="425133"/>
330457
+ </lnTo>
330458
+ <lnTo>
330459
+ <pt x="212566" y="531416"/>
330460
+ </lnTo>
330461
+ <lnTo>
330462
+ <pt x="531416" y="531416"/>
330463
+ </lnTo>
330464
+ <lnTo>
330465
+ <pt x="531416" y="212566"/>
330466
+ </lnTo>
330467
+ <lnTo>
330468
+ <pt x="425133" y="212566"/>
330469
+ </lnTo>
330470
+ <lnTo>
330471
+ <pt x="637699" y="0"/>
330472
+ </lnTo>
330473
+ <lnTo>
330474
+ <pt x="850265" y="212566"/>
330475
+ </lnTo>
330476
+ <lnTo>
330477
+ <pt x="743982" y="212566"/>
330478
+ </lnTo>
330479
+ <lnTo>
330480
+ <pt x="743982" y="743982"/>
330481
+ </lnTo>
330482
+ <lnTo>
330483
+ <pt x="212566" y="743982"/>
330484
+ </lnTo>
330485
+ <lnTo>
330486
+ <pt x="212566" y="850265"/>
330487
+ </lnTo>
330488
+ <lnTo>
330489
+ <pt x="0" y="637699"/>
330490
+ </lnTo>
330491
+ <close/>
330492
+ </path>
330493
+ </pathLst>
330494
+ </leftUpArrow>`,
330495
+ quadArrow: `<quadArrow>
330496
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
330497
+ <path w="788670" h="831215">
330498
+ <moveTo>
330499
+ <pt x="0" y="415608"/>
330500
+ </moveTo>
330501
+ <lnTo>
330502
+ <pt x="177451" y="238157"/>
330503
+ </lnTo>
330504
+ <lnTo>
330505
+ <pt x="177451" y="326882"/>
330506
+ </lnTo>
330507
+ <lnTo>
330508
+ <pt x="305610" y="326882"/>
330509
+ </lnTo>
330510
+ <lnTo>
330511
+ <pt x="305610" y="177451"/>
330512
+ </lnTo>
330513
+ <lnTo>
330514
+ <pt x="216884" y="177451"/>
330515
+ </lnTo>
330516
+ <lnTo>
330517
+ <pt x="394335" y="0"/>
330518
+ </lnTo>
330519
+ <lnTo>
330520
+ <pt x="571786" y="177451"/>
330521
+ </lnTo>
330522
+ <lnTo>
330523
+ <pt x="483060" y="177451"/>
330524
+ </lnTo>
330525
+ <lnTo>
330526
+ <pt x="483060" y="326882"/>
330527
+ </lnTo>
330528
+ <lnTo>
330529
+ <pt x="611219" y="326882"/>
330530
+ </lnTo>
330531
+ <lnTo>
330532
+ <pt x="611219" y="238157"/>
330533
+ </lnTo>
330534
+ <lnTo>
330535
+ <pt x="788670" y="415608"/>
330536
+ </lnTo>
330537
+ <lnTo>
330538
+ <pt x="611219" y="593058"/>
330539
+ </lnTo>
330540
+ <lnTo>
330541
+ <pt x="611219" y="504333"/>
330542
+ </lnTo>
330543
+ <lnTo>
330544
+ <pt x="483060" y="504333"/>
330545
+ </lnTo>
330546
+ <lnTo>
330547
+ <pt x="483060" y="653764"/>
330548
+ </lnTo>
330549
+ <lnTo>
330550
+ <pt x="571786" y="653764"/>
330551
+ </lnTo>
330552
+ <lnTo>
330553
+ <pt x="394335" y="831215"/>
330554
+ </lnTo>
330555
+ <lnTo>
330556
+ <pt x="216884" y="653764"/>
330557
+ </lnTo>
330558
+ <lnTo>
330559
+ <pt x="305610" y="653764"/>
330560
+ </lnTo>
330561
+ <lnTo>
330562
+ <pt x="305610" y="504333"/>
330563
+ </lnTo>
330564
+ <lnTo>
330565
+ <pt x="177451" y="504333"/>
330566
+ </lnTo>
330567
+ <lnTo>
330568
+ <pt x="177451" y="593058"/>
330569
+ </lnTo>
330570
+ <lnTo>
330571
+ <pt x="0" y="415608"/>
330572
+ </lnTo>
330573
+ <close/>
330574
+ </path>
330575
+ </pathLst>
330576
+ </quadArrow>`,
330577
+ rightArrow: `<rightArrow>
329224
330578
  <avLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
329225
330579
  <gd name="adj1" fmla="val 50000"/>
329226
330580
  <gd name="adj2" fmla="val 50000"/>
329227
330581
  </avLst>
329228
330582
  <gdLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
329229
- <gd name="maxAdj2" fmla="*/ 50000 w ss"/>
330583
+ <gd name="maxAdj2" fmla="*/ 100000 w ss"/>
329230
330584
  <gd name="a1" fmla="pin 0 adj1 100000"/>
329231
330585
  <gd name="a2" fmla="pin 0 adj2 maxAdj2"/>
329232
- <gd name="x2" fmla="*/ ss a2 100000"/>
329233
- <gd name="x3" fmla="+- r 0 x2"/>
329234
- <gd name="dy" fmla="*/ h a1 200000"/>
329235
- <gd name="y1" fmla="+- vc 0 dy"/>
329236
- <gd name="y2" fmla="+- vc dy 0"/>
329237
- <gd name="dx1" fmla="*/ y1 x2 hd2"/>
329238
- <gd name="x1" fmla="+- x2 0 dx1"/>
329239
- <gd name="x4" fmla="+- x3 dx1 0"/>
330586
+ <gd name="dx1" fmla="*/ ss a2 100000"/>
330587
+ <gd name="x1" fmla="+- r 0 dx1"/>
330588
+ <gd name="dy1" fmla="*/ h a1 200000"/>
330589
+ <gd name="y1" fmla="+- vc 0 dy1"/>
330590
+ <gd name="y2" fmla="+- vc dy1 0"/>
329240
330591
  </gdLst>
329241
330592
  <ahLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
329242
330593
  <ahXY gdRefY="adj1" minY="0" maxY="100000">
329243
- <pos x="x3" y="y1"/>
330594
+ <pos x="x1" y="y1"/>
329244
330595
  </ahXY>
329245
330596
  <ahXY gdRefX="adj2" minX="0" maxX="maxAdj2">
329246
- <pos x="x2" y="t"/>
330597
+ <pos x="x1" y="t"/>
329247
330598
  </ahXY>
329248
330599
  </ahLst>
329249
330600
  <cxnLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
@@ -329251,147 +330602,177 @@ ${err.toString()}`);
329251
330602
  <pos x="r" y="vc"/>
329252
330603
  </cxn>
329253
330604
  <cxn ang="cd4">
329254
- <pos x="x3" y="b"/>
329255
- </cxn>
329256
- <cxn ang="cd4">
329257
- <pos x="x2" y="b"/>
330605
+ <pos x="x1" y="b"/>
329258
330606
  </cxn>
329259
330607
  <cxn ang="cd2">
329260
330608
  <pos x="l" y="vc"/>
329261
330609
  </cxn>
329262
330610
  <cxn ang="3cd4">
329263
- <pos x="x2" y="t"/>
329264
- </cxn>
329265
- <cxn ang="3cd4">
329266
- <pos x="x3" y="t"/>
330611
+ <pos x="x1" y="t"/>
329267
330612
  </cxn>
329268
330613
  </cxnLst>
329269
- <rect l="x1" t="y1" r="x4" b="y2" xmlns="http://schemas.openxmlformats.org/drawingml/2006/main"/>
330614
+ <rect l="l" t="y1" r="x1" b="y2" xmlns="http://schemas.openxmlformats.org/drawingml/2006/main"/>
329270
330615
  <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
329271
330616
  <path>
329272
330617
  <moveTo>
329273
- <pt x="l" y="vc"/>
330618
+ <pt x="l" y="y1"/>
329274
330619
  </moveTo>
329275
330620
  <lnTo>
329276
- <pt x="x2" y="t"/>
330621
+ <pt x="x1" y="y1"/>
330622
+ </lnTo>
330623
+ <lnTo>
330624
+ <pt x="x1" y="t"/>
329277
330625
  </lnTo>
329278
330626
  <lnTo>
329279
- <pt x="x2" y="y1"/>
330627
+ <pt x="r" y="vc"/>
329280
330628
  </lnTo>
329281
330629
  <lnTo>
329282
- <pt x="x3" y="y1"/>
330630
+ <pt x="x1" y="b"/>
329283
330631
  </lnTo>
329284
330632
  <lnTo>
329285
- <pt x="x3" y="t"/>
330633
+ <pt x="x1" y="y2"/>
329286
330634
  </lnTo>
329287
330635
  <lnTo>
329288
- <pt x="r" y="vc"/>
330636
+ <pt x="l" y="y2"/>
329289
330637
  </lnTo>
330638
+ <close/>
330639
+ </path>
330640
+ </pathLst>
330641
+ </rightArrow>`,
330642
+ upArrow: `<upArrow>
330643
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
330644
+ <path w="367127" h="550008">
330645
+ <moveTo>
330646
+ <pt x="0" y="183564"/>
330647
+ </moveTo>
329290
330648
  <lnTo>
329291
- <pt x="x3" y="b"/>
330649
+ <pt x="183564" y="0"/>
329292
330650
  </lnTo>
329293
330651
  <lnTo>
329294
- <pt x="x3" y="y2"/>
330652
+ <pt x="367127" y="183564"/>
329295
330653
  </lnTo>
329296
330654
  <lnTo>
329297
- <pt x="x2" y="y2"/>
330655
+ <pt x="275345" y="183564"/>
329298
330656
  </lnTo>
329299
330657
  <lnTo>
329300
- <pt x="x2" y="b"/>
330658
+ <pt x="275345" y="550008"/>
330659
+ </lnTo>
330660
+ <lnTo>
330661
+ <pt x="91782" y="550008"/>
330662
+ </lnTo>
330663
+ <lnTo>
330664
+ <pt x="91782" y="183564"/>
330665
+ </lnTo>
330666
+ <lnTo>
330667
+ <pt x="0" y="183564"/>
329301
330668
  </lnTo>
329302
330669
  <close/>
329303
330670
  </path>
329304
330671
  </pathLst>
329305
- </leftRightArrow>`,
330672
+ </upArrow>`,
329306
330673
  upDownArrow: `<upDownArrow>
329307
- <avLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
329308
- <gd name="adj1" fmla="val 50000"/>
329309
- <gd name="adj2" fmla="val 50000"/>
329310
- </avLst>
329311
- <gdLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
329312
- <gd name="maxAdj2" fmla="*/ 50000 h ss"/>
329313
- <gd name="a1" fmla="pin 0 adj1 100000"/>
329314
- <gd name="a2" fmla="pin 0 adj2 maxAdj2"/>
329315
- <gd name="y2" fmla="*/ ss a2 100000"/>
329316
- <gd name="y3" fmla="+- b 0 y2"/>
329317
- <gd name="dx1" fmla="*/ w a1 200000"/>
329318
- <gd name="x1" fmla="+- hc 0 dx1"/>
329319
- <gd name="x2" fmla="+- hc dx1 0"/>
329320
- <gd name="dy1" fmla="*/ x1 y2 wd2"/>
329321
- <gd name="y1" fmla="+- y2 0 dy1"/>
329322
- <gd name="y4" fmla="+- y3 dy1 0"/>
329323
- </gdLst>
329324
- <ahLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
329325
- <ahXY gdRefX="adj1" minX="0" maxX="100000">
329326
- <pos x="x1" y="y3"/>
329327
- </ahXY>
329328
- <ahXY gdRefY="adj2" minY="0" maxY="maxAdj2">
329329
- <pos x="l" y="y2"/>
329330
- </ahXY>
329331
- </ahLst>
329332
- <cxnLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
329333
- <cxn ang="3cd4">
329334
- <pos x="hc" y="t"/>
329335
- </cxn>
329336
- <cxn ang="cd2">
329337
- <pos x="l" y="y2"/>
329338
- </cxn>
329339
- <cxn ang="cd2">
329340
- <pos x="x1" y="vc"/>
329341
- </cxn>
329342
- <cxn ang="cd2">
329343
- <pos x="l" y="y3"/>
329344
- </cxn>
329345
- <cxn ang="cd4">
329346
- <pos x="hc" y="b"/>
329347
- </cxn>
329348
- <cxn ang="0">
329349
- <pos x="r" y="y3"/>
329350
- </cxn>
329351
- <cxn ang="0">
329352
- <pos x="x2" y="vc"/>
329353
- </cxn>
329354
- <cxn ang="0">
329355
- <pos x="r" y="y2"/>
329356
- </cxn>
329357
- </cxnLst>
329358
- <rect l="x1" t="y1" r="x2" b="y4" xmlns="http://schemas.openxmlformats.org/drawingml/2006/main"/>
329359
330674
  <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
329360
- <path>
330675
+ <path w="296545" h="746760">
329361
330676
  <moveTo>
329362
- <pt x="l" y="y2"/>
330677
+ <pt x="0" y="148273"/>
329363
330678
  </moveTo>
329364
330679
  <lnTo>
329365
- <pt x="hc" y="t"/>
330680
+ <pt x="148273" y="0"/>
329366
330681
  </lnTo>
329367
330682
  <lnTo>
329368
- <pt x="r" y="y2"/>
330683
+ <pt x="296545" y="148273"/>
329369
330684
  </lnTo>
329370
330685
  <lnTo>
329371
- <pt x="x2" y="y2"/>
330686
+ <pt x="222409" y="148273"/>
329372
330687
  </lnTo>
329373
330688
  <lnTo>
329374
- <pt x="x2" y="y3"/>
330689
+ <pt x="222409" y="598488"/>
329375
330690
  </lnTo>
329376
330691
  <lnTo>
329377
- <pt x="r" y="y3"/>
330692
+ <pt x="296545" y="598488"/>
329378
330693
  </lnTo>
329379
330694
  <lnTo>
329380
- <pt x="hc" y="b"/>
330695
+ <pt x="148273" y="746760"/>
329381
330696
  </lnTo>
329382
330697
  <lnTo>
329383
- <pt x="l" y="y3"/>
330698
+ <pt x="0" y="598488"/>
329384
330699
  </lnTo>
329385
330700
  <lnTo>
329386
- <pt x="x1" y="y3"/>
330701
+ <pt x="74136" y="598488"/>
329387
330702
  </lnTo>
329388
330703
  <lnTo>
329389
- <pt x="x1" y="y2"/>
330704
+ <pt x="74136" y="148273"/>
330705
+ </lnTo>
330706
+ <lnTo>
330707
+ <pt x="0" y="148273"/>
329390
330708
  </lnTo>
329391
330709
  <close/>
329392
330710
  </path>
329393
330711
  </pathLst>
329394
- </upDownArrow>`
330712
+ </upDownArrow>`,
330713
+ uturnArrow: `<uturnArrow>
330714
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
330715
+ <path w="886460" h="661035">
330716
+ <moveTo>
330717
+ <pt x="0" y="661035"/>
330718
+ </moveTo>
330719
+ <lnTo>
330720
+ <pt x="0" y="289203"/>
330721
+ </lnTo>
330722
+ <cubicBezTo>
330723
+ <pt x="0" y="129481"/>
330724
+ <pt x="129481" y="0"/>
330725
+ <pt x="289203" y="0"/>
330726
+ </cubicBezTo>
330727
+ <lnTo>
330728
+ <pt x="514628" y="0"/>
330729
+ </lnTo>
330730
+ <cubicBezTo>
330731
+ <pt x="674350" y="0"/>
330732
+ <pt x="803831" y="129481"/>
330733
+ <pt x="803831" y="289203"/>
330734
+ </cubicBezTo>
330735
+ <lnTo>
330736
+ <pt x="803831" y="330518"/>
330737
+ </lnTo>
330738
+ <lnTo>
330739
+ <pt x="886460" y="330518"/>
330740
+ </lnTo>
330741
+ <lnTo>
330742
+ <pt x="721201" y="495776"/>
330743
+ </lnTo>
330744
+ <lnTo>
330745
+ <pt x="555943" y="330518"/>
330746
+ </lnTo>
330747
+ <lnTo>
330748
+ <pt x="638572" y="330518"/>
330749
+ </lnTo>
330750
+ <lnTo>
330751
+ <pt x="638572" y="289203"/>
330752
+ </lnTo>
330753
+ <cubicBezTo>
330754
+ <pt x="638572" y="220751"/>
330755
+ <pt x="583080" y="165259"/>
330756
+ <pt x="514628" y="165259"/>
330757
+ </cubicBezTo>
330758
+ <lnTo>
330759
+ <pt x="289203" y="165259"/>
330760
+ </lnTo>
330761
+ <cubicBezTo>
330762
+ <pt x="220751" y="165259"/>
330763
+ <pt x="165259" y="220751"/>
330764
+ <pt x="165259" y="289203"/>
330765
+ </cubicBezTo>
330766
+ <lnTo>
330767
+ <pt x="165259" y="661035"/>
330768
+ </lnTo>
330769
+ <lnTo>
330770
+ <pt x="0" y="661035"/>
330771
+ </lnTo>
330772
+ <close/>
330773
+ </path>
330774
+ </pathLst>
330775
+ </uturnArrow>`
329395
330776
  };
329396
330777
  G = {
329397
330778
  darken: "color-mix(in srgb, currentColor 60%, black)",
@@ -329495,6 +330876,10 @@ ${err.toString()}`);
329495
330876
  default: null,
329496
330877
  rendered: false
329497
330878
  },
330879
+ effects: {
330880
+ default: null,
330881
+ rendered: false
330882
+ },
329498
330883
  rotation: {
329499
330884
  default: 0,
329500
330885
  renderDOM: (attrs) => {
@@ -329629,6 +331014,10 @@ ${err.toString()}`);
329629
331014
  return offsetData;
329630
331015
  }
329631
331016
  },
331017
+ effectExtent: {
331018
+ default: null,
331019
+ rendered: false
331020
+ },
329632
331021
  hidden: {
329633
331022
  default: false,
329634
331023
  rendered: false
@@ -346155,8 +347544,23 @@ function print() { __p += __j.call(arguments, '') }
346155
347544
  transactionToApply.setMeta("protectTrackedReviewState", true);
346156
347545
  const shouldTrackForComposition = (isTrackChangesActive$1 || forceTrackChanges) && !skipTrackChanges;
346157
347546
  const shouldTrack = shouldTrackForComposition || protectsExistingTrackedReviewState;
346158
- if (!shouldTrack && directInsertionMutationCommentMeta && !transactionToApply.getMeta(TrackChangesBasePluginKey))
347547
+ const plainInsertRange = !shouldTrack ? collapsedInsertInsideTrackedReviewMarkRange(prevState, transactionToApply) : null;
347548
+ if (!shouldTrack && !plainInsertRange && directInsertionMutationCommentMeta && !transactionToApply.getMeta(TrackChangesBasePluginKey))
346159
347549
  transactionToApply.setMeta(TrackChangesBasePluginKey, directInsertionMutationCommentMeta);
347550
+ if (plainInsertRange) {
347551
+ for (const mark2 of plainInsertRange.marks)
347552
+ transactionToApply.removeMark(plainInsertRange.from, plainInsertRange.to, mark2);
347553
+ const schemaMarks = prevState.schema.marks;
347554
+ for (const markName of [
347555
+ TrackInsertMarkName,
347556
+ TrackDeleteMarkName,
347557
+ TrackFormatMarkName
347558
+ ]) {
347559
+ const markType = schemaMarks[markName];
347560
+ if (markType)
347561
+ transactionToApply.removeStoredMark(markType);
347562
+ }
347563
+ }
346160
347564
  if (shouldTrack && forceTrackChanges && !this.options.user)
346161
347565
  throw new Error("forceTrackChanges requires a user to be configured on the editor instance.");
346162
347566
  const deferTrackingForComposition = shouldTrackForComposition && (isCompositionTransaction(transactionToApply) || this.view?.composing === true && this.#replacesWithinDeferredRange(transactionToApply)) && this.#canDeferCompositionTracking(transactionToApply, prevState);
@@ -355910,11 +357314,11 @@ function print() { __p += __j.call(arguments, '') }
355910
357314
  ]);
355911
357315
  });
355912
357316
 
355913
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-BjToI9WN.es.js
357317
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-3od8qYhB.es.js
355914
357318
  var DEFAULT_TEXT_ALIGN_OPTIONS, DEFAULT_LINE_HEIGHT_OPTIONS, DEFAULT_ZOOM_OPTIONS, DEFAULT_DOCUMENT_MODE_OPTIONS, DEFAULT_FONT_SIZE_OPTIONS, headlessToolbarConstants, MOD_ALIASES, ALT_ALIASES, CTRL_ALIASES, SHIFT_ALIASES, BUILTIN_CONTEXT_MENU_GROUPS, BUILTIN_GROUP_ORDER, RESERVED_PROXY_PROPERTY_NAMES, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS, FONT_SIZE_OPTIONS;
355915
- var init_create_super_doc_ui_BjToI9WN_es = __esm(() => {
355916
- init_SuperConverter_DQ2wMaLK_es();
355917
- init_create_headless_toolbar_BhSfQYaO_es();
357319
+ var init_create_super_doc_ui_3od8qYhB_es = __esm(() => {
357320
+ init_SuperConverter_DJEK5GYX_es();
357321
+ init_create_headless_toolbar_BYe9VWHO_es();
355918
357322
  DEFAULT_TEXT_ALIGN_OPTIONS = [
355919
357323
  {
355920
357324
  label: "Left",
@@ -356205,15 +357609,15 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
356205
357609
 
356206
357610
  // ../../packages/superdoc/dist/super-editor.es.js
356207
357611
  var init_super_editor_es = __esm(() => {
356208
- init_src_CkxGCnVm_es();
356209
- init_SuperConverter_DQ2wMaLK_es();
357612
+ init_src_q2d5WRO_es();
357613
+ init_SuperConverter_DJEK5GYX_es();
356210
357614
  init_jszip_C49i9kUs_es();
356211
357615
  init_xml_js_CqGKpaft_es();
356212
- init_create_headless_toolbar_BhSfQYaO_es();
357616
+ init_create_headless_toolbar_BYe9VWHO_es();
356213
357617
  init_constants_D9qj59G2_es();
356214
357618
  init_unified_BDuVPlMu_es();
356215
357619
  init_DocxZipper_BzS208BW_es();
356216
- init_create_super_doc_ui_BjToI9WN_es();
357620
+ init_create_super_doc_ui_3od8qYhB_es();
356217
357621
  init_ui_CGB3qmy3_es();
356218
357622
  init_eventemitter3_UwU_CLPU_es();
356219
357623
  init_errors_C_DoKMoN_es();
@@ -380254,7 +381658,6 @@ function resolveFloatingZIndex2(behindDoc, raw, fallback = 1) {
380254
381658
  return Math.max(1, raw);
380255
381659
  }
380256
381660
  var isPlainObject7 = (value) => value !== null && typeof value === "object" && !Array.isArray(value), OOXML_Z_INDEX_BASE3 = 251658240;
380257
-
380258
381661
  // ../../packages/layout-engine/contracts/src/justify-utils.ts
380259
381662
  var SPACE_CHARS2;
380260
381663
  var init_justify_utils = __esm(() => {
@@ -381174,6 +382577,37 @@ function toDrawingContentSnapshot2(value) {
381174
382577
  }
381175
382578
  return snapshot2;
381176
382579
  }
382580
+ function normalizeShapeEffects2(value) {
382581
+ if (!value || typeof value !== "object")
382582
+ return;
382583
+ const maybe = value;
382584
+ const outerShadow = normalizeOuterShadowEffect2(maybe.outerShadow);
382585
+ return outerShadow ? { outerShadow } : undefined;
382586
+ }
382587
+ function normalizeOuterShadowEffect2(value) {
382588
+ if (!value || typeof value !== "object")
382589
+ return;
382590
+ const maybe = value;
382591
+ if (maybe.type !== "outerShadow")
382592
+ return;
382593
+ const blurRadius = coerceNumber2(maybe.blurRadius);
382594
+ const distance = coerceNumber2(maybe.distance);
382595
+ const direction = coerceNumber2(maybe.direction);
382596
+ const opacity = coerceNumber2(maybe.opacity);
382597
+ if (blurRadius == null || blurRadius < 0 || distance == null || distance < 0 || direction == null || opacity == null || typeof maybe.color !== "string") {
382598
+ return;
382599
+ }
382600
+ const clamp2 = (val) => Math.max(0, Math.min(1, val));
382601
+ const normalized = {
382602
+ type: "outerShadow",
382603
+ blurRadius,
382604
+ distance,
382605
+ direction,
382606
+ color: maybe.color,
382607
+ opacity: clamp2(opacity)
382608
+ };
382609
+ return Object.fromEntries(Object.entries(normalized).filter(([, fieldValue]) => fieldValue !== undefined));
382610
+ }
381177
382611
  function isGradientFill2(value) {
381178
382612
  if (!isPlainObject8(value))
381179
382613
  return false;
@@ -381232,6 +382666,26 @@ function normalizeTextContent2(value) {
381232
382666
  if (["left", "center", "right"].includes(value.horizontalAlign)) {
381233
382667
  result.horizontalAlign = value.horizontalAlign;
381234
382668
  }
382669
+ if (Array.isArray(value.paragraphs)) {
382670
+ const normalizedParagraphs = value.paragraphs.map((paragraph3) => {
382671
+ if (!isPlainObject8(paragraph3))
382672
+ return {};
382673
+ const spacing = isPlainObject8(paragraph3.spacing) ? paragraph3.spacing : undefined;
382674
+ const before = Number.isFinite(spacing?.before) ? spacing.before : undefined;
382675
+ const after = Number.isFinite(spacing?.after) ? spacing.after : undefined;
382676
+ if (before === undefined && after === undefined)
382677
+ return {};
382678
+ const out = { spacing: {} };
382679
+ if (before !== undefined)
382680
+ out.spacing.before = before;
382681
+ if (after !== undefined)
382682
+ out.spacing.after = after;
382683
+ return out;
382684
+ });
382685
+ if (normalizedParagraphs.some((paragraph3) => ("spacing" in paragraph3))) {
382686
+ result.paragraphs = normalizedParagraphs;
382687
+ }
382688
+ }
381235
382689
  return result;
381236
382690
  }
381237
382691
  function normalizeTextVerticalAlign2(value) {
@@ -390133,6 +391587,10 @@ function imageNodeToRun2({ node: node3, positions, sdtMetadata }) {
390133
391587
  run2.title = attrs.title;
390134
391588
  if (typeof attrs.clipPath === "string")
390135
391589
  run2.clipPath = attrs.clipPath;
391590
+ if (typeof attrs.shapeClipPath === "string")
391591
+ run2.shapeClipPath = attrs.shapeClipPath;
391592
+ if (isAllowedObjectFit2(attrs.objectFit))
391593
+ run2.objectFit = attrs.objectFit;
390136
391594
  const distTop = pickNumber2(wrapAttrs.distTop ?? wrapAttrs.distT);
390137
391595
  if (distTop != null)
390138
391596
  run2.distTop = distTop;
@@ -390213,7 +391671,7 @@ function isInlineImage2(node3) {
390213
391671
  }
390214
391672
  return false;
390215
391673
  }
390216
- var DEFAULT_IMAGE_DIMENSION_PX2 = 100, isNodeHidden2 = (node3) => {
391674
+ var DEFAULT_IMAGE_DIMENSION_PX2 = 100, ALLOWED_OBJECT_FIT2, isAllowedObjectFit2 = (value) => typeof value === "string" && ALLOWED_OBJECT_FIT2.has(value), isNodeHidden2 = (node3) => {
390217
391675
  const attrs = node3.attrs ?? {};
390218
391676
  if (attrs.hidden === true)
390219
391677
  return true;
@@ -390222,6 +391680,7 @@ var DEFAULT_IMAGE_DIMENSION_PX2 = 100, isNodeHidden2 = (node3) => {
390222
391680
  var init_image = __esm(() => {
390223
391681
  init_utilities();
390224
391682
  init_common();
391683
+ ALLOWED_OBJECT_FIT2 = new Set(["contain", "cover", "fill", "scale-down"]);
390225
391684
  });
390226
391685
 
390227
391686
  // ../../packages/super-editor/src/editors/v1/core/layout-adapter/converters/inline-converters/cross-reference.ts
@@ -390649,6 +392108,7 @@ var WRAP_TYPES2, WRAP_TEXT_VALUES2, H_RELATIVE_VALUES2, V_RELATIVE_VALUES2, H_AL
390649
392108
  fillColor: normalizeFillColor2(rawAttrs.fillColor),
390650
392109
  strokeColor: normalizeStrokeColor2(rawAttrs.strokeColor),
390651
392110
  strokeWidth: coerceNumber2(rawAttrs.strokeWidth),
392111
+ effects: normalizeShapeEffects2(rawAttrs.effects),
390652
392112
  textContent: normalizeTextContent2(rawAttrs.textContent),
390653
392113
  textAlign: typeof rawAttrs.textAlign === "string" ? rawAttrs.textAlign : undefined,
390654
392114
  textVerticalAlign: normalizeTextVerticalAlign2(rawAttrs.textVerticalAlign),
@@ -390658,6 +392118,7 @@ var WRAP_TYPES2, WRAP_TEXT_VALUES2, H_RELATIVE_VALUES2, V_RELATIVE_VALUES2, H_AL
390658
392118
  };
390659
392119
  };
390660
392120
  var init_shapes = __esm(() => {
392121
+ init_src();
390661
392122
  init_utilities();
390662
392123
  init_paragraph2();
390663
392124
  WRAP_TYPES2 = new Set(["None", "Square", "Tight", "Through", "TopAndBottom", "Inline"]);
@@ -390802,7 +392263,7 @@ function imageNodeToBlock2(node3, nextBlockId, positions, _trackedMeta, _tracked
390802
392263
  const lumContrast = pickNumber2(lum?.contrast);
390803
392264
  const alphaModFix = isPlainObject10(attrs.alphaModFix) ? attrs.alphaModFix : undefined;
390804
392265
  const alphaModFixAmt = pickNumber2(alphaModFix?.amt);
390805
- const objectFit = isAllowedObjectFit2(explicitObjectFit) ? explicitObjectFit : shouldCover ? "cover" : display === "inline" ? "scale-down" : isAnchor ? "contain" : "contain";
392266
+ const objectFit = isAllowedObjectFit3(explicitObjectFit) ? explicitObjectFit : shouldCover ? "cover" : display === "inline" ? "scale-down" : isAnchor ? "contain" : "contain";
390806
392267
  const zIndexFromRelativeHeight = normalizeZIndex2(attrs.originalAttributes);
390807
392268
  const zIndex = resolveFloatingZIndex2(anchor?.behindDoc === true, zIndexFromRelativeHeight);
390808
392269
  const transformData = isPlainObject10(attrs.transformData) ? attrs.transformData : undefined;
@@ -390858,7 +392319,7 @@ function handleImageNode2(node3, context) {
390858
392319
  var WRAP_TYPES3, WRAP_TEXT_VALUES3, H_RELATIVE_VALUES3, V_RELATIVE_VALUES3, H_ALIGN_VALUES3, V_ALIGN_VALUES3, isPlainObject10 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), sourceAnchorFromAttrs2 = (attrs) => {
390859
392320
  const sourceAnchor = attrs.sourceAnchor;
390860
392321
  return isPlainObject10(sourceAnchor) ? sourceAnchor : undefined;
390861
- }, isAllowedObjectFit2 = (value) => {
392322
+ }, isAllowedObjectFit3 = (value) => {
390862
392323
  return value === "contain" || value === "cover" || value === "fill" || value === "scale-down";
390863
392324
  }, isHiddenDrawing2 = (attrs) => {
390864
392325
  if (toBoolean4(attrs.hidden) === true)
@@ -433209,6 +434670,35 @@ function extractLineEnds2(spPr) {
433209
434670
  return null;
433210
434671
  return { head: headConfig ?? undefined, tail: tailConfig ?? undefined };
433211
434672
  }
434673
+ function extractShapeEffects2(spPr) {
434674
+ const outerShadow = extractOuterShadowEffect2(spPr);
434675
+ if (!outerShadow)
434676
+ return null;
434677
+ return { outerShadow };
434678
+ }
434679
+ function extractOuterShadowEffect2(spPr) {
434680
+ const effectLst = findChildByLocalName2(spPr?.elements, "effectLst");
434681
+ const outerShdw = findChildByLocalName2(effectLst?.elements, "outerShdw");
434682
+ if (!outerShdw)
434683
+ return null;
434684
+ const colorResult = extractColorFromElement2(outerShdw);
434685
+ if (!colorResult)
434686
+ return null;
434687
+ return stripUndefined2({
434688
+ type: "outerShadow",
434689
+ blurRadius: finiteNumberOrZero2(emuToPixels2(outerShdw.attributes?.blurRad)),
434690
+ distance: finiteNumberOrZero2(emuToPixels2(outerShdw.attributes?.dist)),
434691
+ direction: finiteNumberOrZero2(rotToDegrees2(outerShdw.attributes?.dir)),
434692
+ color: colorResult.color,
434693
+ opacity: colorResult.alpha ?? 1
434694
+ });
434695
+ }
434696
+ function finiteNumberOrZero2(value) {
434697
+ return Number.isFinite(value) ? value : 0;
434698
+ }
434699
+ function stripUndefined2(value) {
434700
+ return Object.fromEntries(Object.entries(value).filter(([, fieldValue]) => fieldValue !== undefined));
434701
+ }
433212
434702
  function extractStrokeColor2(spPr, style2) {
433213
434703
  const ln = findChildByLocalName2(spPr?.elements, "ln");
433214
434704
  if (ln) {
@@ -433380,7 +434870,9 @@ function extractGradientFill2(gradFill) {
433380
434870
  }
433381
434871
  return gradient;
433382
434872
  }
433383
- var init_vector_shape_helpers = () => {};
434873
+ var init_vector_shape_helpers = __esm(() => {
434874
+ init_helpers();
434875
+ });
433384
434876
 
433385
434877
  // ../../packages/super-editor/src/editors/v1/core/super-converter/v3/handlers/wp/helpers/rtfjs/util/SVG.ts
433386
434878
  class SVGFilters2 {
@@ -448694,6 +450186,26 @@ function resolveParagraphPropertiesForTextBox2(paragraph4, params3) {
448694
450186
  const inlineParagraphProperties = pPr ? translator108.encode({ ...params3, nodes: [pPr] }) || {} : {};
448695
450187
  return resolveParagraphProperties2(params3, inlineParagraphProperties, false, false, null);
448696
450188
  }
450189
+ function extractTextBoxParagraphSpacing2(paragraphProperties, { paragraphIndex, paragraphCount, spcFirstLastPara } = {}) {
450190
+ const spacing = paragraphProperties?.spacing;
450191
+ if (!spacing)
450192
+ return;
450193
+ const honorFirstLast = spcFirstLastPara === "1" || spcFirstLastPara === 1 || spcFirstLastPara === true || spcFirstLastPara === "true" || spcFirstLastPara === "on";
450194
+ const isFirst = paragraphIndex === 0;
450195
+ const isLast = paragraphCount != null && paragraphIndex === paragraphCount - 1;
450196
+ const result = {};
450197
+ if (typeof spacing.before === "number" && !(isFirst && !honorFirstLast)) {
450198
+ const px = twipsToPixels4(spacing.before);
450199
+ if (typeof px === "number")
450200
+ result.before = px;
450201
+ }
450202
+ if (typeof spacing.after === "number" && !(isLast && !honorFirstLast)) {
450203
+ const px = twipsToPixels4(spacing.after);
450204
+ if (typeof px === "number")
450205
+ result.after = px;
450206
+ }
450207
+ return result.before === undefined && result.after === undefined ? undefined : result;
450208
+ }
448697
450209
  function extractRunFormatting2(rPr, paragraphProperties, params3) {
448698
450210
  const inlineRunProperties = rPr ? translator98.encode({ ...params3, nodes: [rPr] }) || {} : {};
448699
450211
  const resolvedRunProperties = resolveRunProperties2(params3, inlineRunProperties, paragraphProperties || {});
@@ -448758,7 +450270,8 @@ function extractBodyPrProperties2(bodyPr) {
448758
450270
  left: lIns * EMU_TO_PX
448759
450271
  };
448760
450272
  const wrap6 = bodyPrAttrs["wrap"] || "square";
448761
- return { verticalAlign, insets, wrap: wrap6 };
450273
+ const spcFirstLastPara = bodyPrAttrs["spcFirstLastPara"];
450274
+ return { verticalAlign, insets, wrap: wrap6, spcFirstLastPara };
448762
450275
  }
448763
450276
  var HEADER_FOOTER_FILENAME_PATTERN2, DEFAULT_TAB_INTERVAL_TWIPS3 = 720;
448764
450277
  var init_textbox_content_helpers = __esm(() => {
@@ -449322,7 +450835,7 @@ function handleImageNode3(node4, params3, isAnchor) {
449322
450835
  horizontal: positionHValue,
449323
450836
  top: positionVValue
449324
450837
  };
449325
- return handleShapeGroup2(params3, node4, graphicData, size3, padding, shapeMarginOffset, anchorData, wrap6, isHidden);
450838
+ return handleShapeGroup2(params3, node4, graphicData, size3, padding, shapeMarginOffset, anchorData, wrap6, extractEffectExtent2(node4), isHidden);
449326
450839
  }
449327
450840
  if (uri === CHART_URI) {
449328
450841
  return handleChartDrawing2(params3, node4, graphicData, size3, padding, marginOffset, anchorData, wrap6, isAnchor);
@@ -449345,18 +450858,7 @@ function handleImageNode3(node4, params3, isAnchor) {
449345
450858
  ...Number.isFinite(rawContrast) ? { contrast: rawContrast } : {}
449346
450859
  } : undefined;
449347
450860
  const alphaModFix = extractAlphaModFix2(blip);
449348
- const stretch = findChildByLocalName2(blipFill?.elements, "stretch");
449349
- const fillRect = findChildByLocalName2(stretch?.elements, "fillRect");
449350
- const srcRect = findChildByLocalName2(blipFill?.elements, "srcRect");
449351
- const srcRectAttrs = srcRect?.attributes || {};
449352
- const clipPath = buildClipPathFromSrcRect2(srcRectAttrs);
449353
- const srcRectHasNegativeValues = ["l", "t", "r", "b"].some((attr) => {
449354
- const val = srcRectAttrs[attr];
449355
- return val != null && parseFloat(val) < 0;
449356
- });
449357
- const shouldStretch = Boolean(stretch && fillRect);
449358
- const shouldCover = shouldStretch && !srcRectHasNegativeValues && !clipPath;
449359
- const shouldFillClippedStretch = shouldStretch && !srcRectHasNegativeValues && Boolean(clipPath);
450861
+ const { clipPath, rawSrcRect, shouldCover, shouldFillClippedStretch, shouldCoverShapeStretch, shapeClipPath } = extractPicturePresentation2(picture);
449360
450862
  const spPr = picture.elements.find((el) => el.name === "pic:spPr");
449361
450863
  if (spPr) {
449362
450864
  const xfrm = findChildByLocalName2(spPr.elements, "xfrm");
@@ -449487,9 +450989,10 @@ function handleImageNode3(node4, params3, isAnchor) {
449487
450989
  } : {},
449488
450990
  wrapTopAndBottom: wrap6.type === "TopAndBottom",
449489
450991
  shouldCover,
449490
- ...shouldFillClippedStretch ? { objectFit: "fill" } : {},
450992
+ ...shouldFillClippedStretch ? { objectFit: "fill" } : shouldCoverShapeStretch ? { objectFit: "cover" } : {},
449491
450993
  ...clipPath ? { clipPath } : {},
449492
- rawSrcRect: srcRect,
450994
+ ...shapeClipPath ? { shapeClipPath } : {},
450995
+ rawSrcRect,
449493
450996
  originalPadding: {
449494
450997
  distT: attributes["distT"],
449495
450998
  distB: attributes["distB"],
@@ -449536,7 +451039,9 @@ function extractTextFromTextBox2(textBoxContent, bodyPr, params3 = {}) {
449536
451039
  const processedContent = preProcessTextBoxContent2(textBoxContent, params3);
449537
451040
  const paragraphs = collectTextBoxParagraphs2(processedContent?.elements || []);
449538
451041
  const textParts = [];
451042
+ const paragraphMetadata = [];
449539
451043
  let horizontalAlign = null;
451044
+ const { verticalAlign, insets, wrap: wrap6, spcFirstLastPara } = extractBodyPrProperties2(bodyPr);
449540
451045
  const appendFieldPart = (fieldType, node4, paragraphProperties) => {
449541
451046
  const rPr = node4?.elements?.find((el) => el.name === "w:rPr");
449542
451047
  const formatting = extractRunFormatting2(rPr, paragraphProperties, params3);
@@ -449633,6 +451138,13 @@ function extractTextFromTextBox2(textBoxContent, bodyPr, params3 = {}) {
449633
451138
  };
449634
451139
  paragraphs.forEach((paragraph4, paragraphIndex) => {
449635
451140
  const paragraphProperties = resolveParagraphPropertiesForTextBox2(paragraph4, params3);
451141
+ paragraphMetadata.push({
451142
+ spacing: extractTextBoxParagraphSpacing2(paragraphProperties, {
451143
+ paragraphIndex,
451144
+ paragraphCount: paragraphs.length,
451145
+ spcFirstLastPara
451146
+ })
451147
+ });
449636
451148
  if (!horizontalAlign) {
449637
451149
  horizontalAlign = extractParagraphAlignment2(paragraph4);
449638
451150
  }
@@ -449649,19 +451161,21 @@ function extractTextFromTextBox2(textBoxContent, bodyPr, params3 = {}) {
449649
451161
  `,
449650
451162
  formatting: {},
449651
451163
  isLineBreak: true,
449652
- isEmptyParagraph: !paragraphHasText
451164
+ isEmptyParagraph: !paragraphHasText,
451165
+ isParagraphBoundary: true
449653
451166
  });
449654
451167
  }
449655
451168
  });
449656
451169
  if (textParts.length === 0)
449657
451170
  return null;
449658
- const { verticalAlign, insets, wrap: wrap6 } = extractBodyPrProperties2(bodyPr);
451171
+ const hasParagraphSpacing = paragraphMetadata.some((paragraph4) => paragraph4.spacing);
449659
451172
  return {
449660
451173
  parts: textParts,
449661
451174
  horizontalAlign: horizontalAlign || "left",
449662
451175
  verticalAlign,
449663
451176
  insets,
449664
- wrap: wrap6
451177
+ wrap: wrap6,
451178
+ ...hasParagraphSpacing ? { paragraphs: paragraphMetadata } : {}
449665
451179
  };
449666
451180
  }
449667
451181
  function extractFieldInlineNodes2(node4) {
@@ -449798,6 +451312,7 @@ function getVectorShape2({
449798
451312
  const strokeColor = extractStrokeColor2(spPr, style2);
449799
451313
  const strokeWidth = extractStrokeWidth2(spPr);
449800
451314
  const lineEnds = extractLineEnds2(spPr);
451315
+ const effects2 = extractShapeEffects2(spPr);
449801
451316
  const effectExtent = extractEffectExtent2(node4);
449802
451317
  const textBox = wsp.elements?.find((el) => el.name === "wps:txbx");
449803
451318
  const textBoxContent = textBox?.elements?.find((el) => el.name === "w:txbxContent");
@@ -449822,6 +451337,7 @@ function getVectorShape2({
449822
451337
  strokeColor,
449823
451338
  strokeWidth,
449824
451339
  lineEnds,
451340
+ effects: effects2,
449825
451341
  effectExtent,
449826
451342
  marginOffset,
449827
451343
  anchorData,
@@ -449856,6 +451372,7 @@ function getVectorShape2({
449856
451372
  strokeColor,
449857
451373
  strokeWidth,
449858
451374
  lineEnds,
451375
+ effects: effects2,
449859
451376
  effectExtent,
449860
451377
  marginOffset,
449861
451378
  anchorData,
@@ -449941,6 +451458,36 @@ var DRAWING_XML_TAG2 = "w:drawing", SHAPE_URI2 = "http://schemas.microsoft.com/o
449941
451458
  const alphaModFix = findChildByLocalName2(blip?.elements, "alphaModFix");
449942
451459
  const amt = Number(alphaModFix?.attributes?.amt);
449943
451460
  return Number.isFinite(amt) ? { amt } : undefined;
451461
+ }, buildShapeClipPathFromPreset2 = (preset) => {
451462
+ if (preset === "ellipse")
451463
+ return "ellipse(50% 50% at 50% 50%)";
451464
+ return null;
451465
+ }, extractPicturePresentation2 = (picture) => {
451466
+ const blipFill = picture?.elements?.find((el) => el.name === "pic:blipFill");
451467
+ const stretch = findChildByLocalName2(blipFill?.elements, "stretch");
451468
+ const fillRect = findChildByLocalName2(stretch?.elements, "fillRect");
451469
+ const srcRect = findChildByLocalName2(blipFill?.elements, "srcRect");
451470
+ const srcRectAttrs = srcRect?.attributes || {};
451471
+ const clipPath = buildClipPathFromSrcRect2(srcRectAttrs);
451472
+ const srcRectHasNegativeValues = ["l", "t", "r", "b"].some((attr) => {
451473
+ const val = srcRectAttrs[attr];
451474
+ return val != null && parseFloat(val) < 0;
451475
+ });
451476
+ const spPr = picture?.elements?.find((el) => el.name === "pic:spPr");
451477
+ const prstGeom = findChildByLocalName2(spPr?.elements, "prstGeom");
451478
+ const shapeClipPath = buildShapeClipPathFromPreset2(prstGeom?.attributes?.["prst"]);
451479
+ const shouldStretch = Boolean(stretch && fillRect);
451480
+ const shouldCover = shouldStretch && !srcRectHasNegativeValues && !clipPath;
451481
+ const shouldFillClippedStretch = shouldStretch && !srcRectHasNegativeValues && Boolean(clipPath);
451482
+ const shouldCoverShapeStretch = shouldStretch && Boolean(shapeClipPath) && !clipPath;
451483
+ return {
451484
+ clipPath,
451485
+ rawSrcRect: srcRect,
451486
+ shouldCover,
451487
+ shouldFillClippedStretch,
451488
+ shouldCoverShapeStretch,
451489
+ shapeClipPath
451490
+ };
449944
451491
  }, mergeAnchorPaddingIntoWrapDistances2 = (wrap6, padding) => {
449945
451492
  if (!wrap6?.attrs || !padding)
449946
451493
  return;
@@ -450023,7 +451570,294 @@ var DRAWING_XML_TAG2 = "w:drawing", SHAPE_URI2 = "http://schemas.microsoft.com/o
450023
451570
  placeholder.attrs.hidden = true;
450024
451571
  }
450025
451572
  return placeholder;
450026
- }, handleShapeGroup2 = (params3, node4, graphicData, size3, padding, marginOffset, anchorData, wrap6, isHidden) => {
451573
+ }, parseEmuNumber2 = (value, fallback = 0) => {
451574
+ const numeric = Number(value);
451575
+ return Number.isFinite(numeric) ? numeric : fallback;
451576
+ }, getGroupXfrm2 = (groupNode) => {
451577
+ const grpSpPr = findChildByLocalName2(groupNode?.elements, "grpSpPr");
451578
+ return findChildByLocalName2(grpSpPr?.elements, "xfrm");
451579
+ }, buildShapeGroupTransformAttrs2 = (xfrm) => {
451580
+ const groupTransform = {};
451581
+ if (!xfrm)
451582
+ return groupTransform;
451583
+ if (xfrm.attributes?.["rot"]) {
451584
+ groupTransform.rotation = rotToDegrees2(xfrm.attributes["rot"]);
451585
+ }
451586
+ if (xfrm.attributes?.["flipH"] === "1") {
451587
+ groupTransform.flipH = true;
451588
+ }
451589
+ if (xfrm.attributes?.["flipV"] === "1") {
451590
+ groupTransform.flipV = true;
451591
+ }
451592
+ const off = findChildByLocalName2(xfrm.elements, "off");
451593
+ const ext = findChildByLocalName2(xfrm.elements, "ext");
451594
+ const chOff = findChildByLocalName2(xfrm.elements, "chOff");
451595
+ const chExt = findChildByLocalName2(xfrm.elements, "chExt");
451596
+ if (off) {
451597
+ groupTransform.x = emuToPixels2(off.attributes?.["x"] || 0);
451598
+ groupTransform.y = emuToPixels2(off.attributes?.["y"] || 0);
451599
+ }
451600
+ if (ext) {
451601
+ groupTransform.width = emuToPixels2(ext.attributes?.["cx"] || 0);
451602
+ groupTransform.height = emuToPixels2(ext.attributes?.["cy"] || 0);
451603
+ }
451604
+ if (chOff) {
451605
+ groupTransform.childX = emuToPixels2(chOff.attributes?.["x"] || 0);
451606
+ groupTransform.childY = emuToPixels2(chOff.attributes?.["y"] || 0);
451607
+ groupTransform.childOriginXEmu = parseEmuNumber2(chOff.attributes?.["x"]);
451608
+ groupTransform.childOriginYEmu = parseEmuNumber2(chOff.attributes?.["y"]);
451609
+ }
451610
+ if (chExt) {
451611
+ groupTransform.childWidth = emuToPixels2(chExt.attributes?.["cx"] || 0);
451612
+ groupTransform.childHeight = emuToPixels2(chExt.attributes?.["cy"] || 0);
451613
+ }
451614
+ return groupTransform;
451615
+ }, identityMatrix2 = () => ({ a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 }), multiplyMatrix2 = (left2, right2) => ({
451616
+ a: left2.a * right2.a + left2.c * right2.b,
451617
+ b: left2.b * right2.a + left2.d * right2.b,
451618
+ c: left2.a * right2.c + left2.c * right2.d,
451619
+ d: left2.b * right2.c + left2.d * right2.d,
451620
+ e: left2.a * right2.e + left2.c * right2.f + left2.e,
451621
+ f: left2.b * right2.e + left2.d * right2.f + left2.f
451622
+ }), transformPoint2 = (matrix, x, y2) => ({
451623
+ x: matrix.a * x + matrix.c * y2 + matrix.e,
451624
+ y: matrix.b * x + matrix.d * y2 + matrix.f
451625
+ }), normalizeDegrees2 = (degrees) => {
451626
+ const normalized = (degrees % 360 + 360) % 360;
451627
+ return Object.is(normalized, -0) ? 0 : normalized;
451628
+ }, decomposeMatrixOrientation2 = (matrix) => {
451629
+ const determinant = matrix.a * matrix.d - matrix.b * matrix.c;
451630
+ if (determinant < 0) {
451631
+ return {
451632
+ rotation: normalizeDegrees2(Math.atan2(-matrix.b, -matrix.a) * 180 / Math.PI),
451633
+ flipH: true,
451634
+ flipV: false
451635
+ };
451636
+ }
451637
+ return {
451638
+ rotation: normalizeDegrees2(Math.atan2(matrix.b, matrix.a) * 180 / Math.PI),
451639
+ flipH: false,
451640
+ flipV: false
451641
+ };
451642
+ }, getVisualOrientationMatrix2 = ({ rotation = 0, flipH = false, flipV = false } = {}) => {
451643
+ const radians = rotation * Math.PI / 180;
451644
+ const cos = Math.cos(radians);
451645
+ const sin = Math.sin(radians);
451646
+ const flipScaleX = flipH ? -1 : 1;
451647
+ const flipScaleY = flipV ? -1 : 1;
451648
+ return {
451649
+ a: cos * flipScaleX,
451650
+ b: sin * flipScaleX,
451651
+ c: -sin * flipScaleY,
451652
+ d: cos * flipScaleY,
451653
+ e: 0,
451654
+ f: 0
451655
+ };
451656
+ }, getGroupAffineTransform2 = (xfrm, { includeVisualTransform = false } = {}) => {
451657
+ if (!xfrm) {
451658
+ return { matrix: identityMatrix2(), rotation: 0, flipH: false, flipV: false };
451659
+ }
451660
+ const off = findChildByLocalName2(xfrm.elements, "off");
451661
+ const ext = findChildByLocalName2(xfrm.elements, "ext");
451662
+ const chOff = findChildByLocalName2(xfrm.elements, "chOff");
451663
+ const chExt = findChildByLocalName2(xfrm.elements, "chExt");
451664
+ const childWidth = parseEmuNumber2(chExt?.attributes?.["cx"]);
451665
+ const childHeight = parseEmuNumber2(chExt?.attributes?.["cy"]);
451666
+ const width = parseEmuNumber2(ext?.attributes?.["cx"], childWidth || 0);
451667
+ const height = parseEmuNumber2(ext?.attributes?.["cy"], childHeight || 0);
451668
+ const childX = parseEmuNumber2(chOff?.attributes?.["x"]);
451669
+ const childY = parseEmuNumber2(chOff?.attributes?.["y"]);
451670
+ const x = parseEmuNumber2(off?.attributes?.["x"]);
451671
+ const y2 = parseEmuNumber2(off?.attributes?.["y"]);
451672
+ const scaleX = childWidth !== 0 ? width / childWidth : 1;
451673
+ const scaleY = childHeight !== 0 ? height / childHeight : 1;
451674
+ const rotation = xfrm.attributes?.["rot"] ? rotToDegrees2(xfrm.attributes["rot"]) : 0;
451675
+ const flipH = xfrm.attributes?.["flipH"] === "1";
451676
+ const flipV = xfrm.attributes?.["flipV"] === "1";
451677
+ const baseMatrix = {
451678
+ a: scaleX,
451679
+ b: 0,
451680
+ c: 0,
451681
+ d: scaleY,
451682
+ e: x - childX * scaleX,
451683
+ f: y2 - childY * scaleY
451684
+ };
451685
+ if (!includeVisualTransform || !rotation && !flipH && !flipV) {
451686
+ return { matrix: baseMatrix, rotation: 0, flipH: false, flipV: false };
451687
+ }
451688
+ const radians = rotation * Math.PI / 180;
451689
+ const cos = Math.cos(radians);
451690
+ const sin = Math.sin(radians);
451691
+ const flipScaleX = flipH ? -1 : 1;
451692
+ const flipScaleY = flipV ? -1 : 1;
451693
+ const centerX = x + width / 2;
451694
+ const centerY = y2 + height / 2;
451695
+ const visualMatrix = {
451696
+ a: cos * flipScaleX,
451697
+ b: sin * flipScaleX,
451698
+ c: -sin * flipScaleY,
451699
+ d: cos * flipScaleY,
451700
+ e: centerX - (cos * flipScaleX * centerX + -sin * flipScaleY * centerY),
451701
+ f: centerY - (sin * flipScaleX * centerX + cos * flipScaleY * centerY)
451702
+ };
451703
+ return { matrix: multiplyMatrix2(visualMatrix, baseMatrix), rotation, flipH, flipV };
451704
+ }, composeShapeGroupTransform2 = (parent, child) => {
451705
+ const matrix = multiplyMatrix2(parent.matrix, child.matrix);
451706
+ return {
451707
+ matrix,
451708
+ ...decomposeMatrixOrientation2(matrix)
451709
+ };
451710
+ }, composeShapeGroupChildOrientation2 = (rect, xfrm) => {
451711
+ const parentMatrix = getVisualOrientationMatrix2({
451712
+ rotation: rect.rotation ?? 0,
451713
+ flipH: Boolean(rect.flipH),
451714
+ flipV: Boolean(rect.flipV)
451715
+ });
451716
+ const childMatrix = getVisualOrientationMatrix2({
451717
+ rotation: xfrm?.attributes?.["rot"] ? rotToDegrees2(xfrm.attributes["rot"]) : 0,
451718
+ flipH: xfrm?.attributes?.["flipH"] === "1",
451719
+ flipV: xfrm?.attributes?.["flipV"] === "1"
451720
+ });
451721
+ return decomposeMatrixOrientation2(multiplyMatrix2(parentMatrix, childMatrix));
451722
+ }, transformShapeGroupChildRect2 = (transform2, rawX, rawY, rawWidth, rawHeight) => {
451723
+ const matrix = transform2.matrix ?? identityMatrix2();
451724
+ const width = Math.hypot(matrix.a, matrix.b) * rawWidth;
451725
+ const height = Math.hypot(matrix.c, matrix.d) * rawHeight;
451726
+ const center = transformPoint2(matrix, rawX + rawWidth / 2, rawY + rawHeight / 2);
451727
+ return {
451728
+ x: emuToPixels2(center.x - width / 2),
451729
+ y: emuToPixels2(center.y - height / 2),
451730
+ width: emuToPixels2(width),
451731
+ height: emuToPixels2(height),
451732
+ rotation: transform2.rotation ?? 0,
451733
+ flipH: Boolean(transform2.flipH),
451734
+ flipV: Boolean(transform2.flipV)
451735
+ };
451736
+ }, resolveShapeGroupPicturePath2 = (pic, params3) => {
451737
+ const blipFill = findChildByLocalName2(pic.elements, "blipFill");
451738
+ const blip = findChildByLocalName2(blipFill?.elements, "blip");
451739
+ if (!blip)
451740
+ return null;
451741
+ const rEmbed = blip.attributes?.["r:embed"];
451742
+ if (!rEmbed)
451743
+ return null;
451744
+ const currentFile = params3.filename || "document.xml";
451745
+ let rels = params3.docx[`word/_rels/${currentFile}.rels`];
451746
+ if (!rels)
451747
+ rels = params3.docx[`word/_rels/document.xml.rels`];
451748
+ const relationships = rels?.elements.find((el) => el.name === "Relationships");
451749
+ const elements = relationships?.elements;
451750
+ const rel = elements?.find((el) => el.attributes["Id"] === rEmbed);
451751
+ if (!rel)
451752
+ return null;
451753
+ return normalizeTargetPath2(rel.attributes?.["Target"]);
451754
+ }, parseShapeGroupVectorChild2 = (wsp, transform2, params3) => {
451755
+ const spPr = findChildByLocalName2(wsp.elements, "spPr");
451756
+ if (!spPr)
451757
+ return null;
451758
+ const prstGeom = findChildByLocalName2(spPr.elements, "prstGeom");
451759
+ const shapeKind = prstGeom?.attributes?.["prst"];
451760
+ const customGeom = !shapeKind ? extractCustomGeometry2(spPr) : null;
451761
+ const shapeXfrm = findChildByLocalName2(spPr.elements, "xfrm");
451762
+ const shapeOff = findChildByLocalName2(shapeXfrm?.elements, "off");
451763
+ const shapeExt = findChildByLocalName2(shapeXfrm?.elements, "ext");
451764
+ const rawX = parseEmuNumber2(shapeOff?.attributes?.["x"]);
451765
+ const rawY = parseEmuNumber2(shapeOff?.attributes?.["y"]);
451766
+ const rawWidth = parseEmuNumber2(shapeExt?.attributes?.["cx"], 914400);
451767
+ const rawHeight = parseEmuNumber2(shapeExt?.attributes?.["cy"], 914400);
451768
+ const rect = transformShapeGroupChildRect2(transform2, rawX, rawY, rawWidth, rawHeight);
451769
+ const orientation = composeShapeGroupChildOrientation2(rect, shapeXfrm);
451770
+ const style2 = findChildByLocalName2(wsp.elements, "style");
451771
+ const fillColor = extractFillColor2(spPr, style2);
451772
+ const strokeColor = extractStrokeColor2(spPr, style2);
451773
+ const strokeWidth = extractStrokeWidth2(spPr);
451774
+ const lineEnds = extractLineEnds2(spPr);
451775
+ const effects2 = extractShapeEffects2(spPr);
451776
+ const cNvPr = findChildByLocalName2(wsp.elements, "cNvPr");
451777
+ const shapeId = cNvPr?.attributes?.["id"];
451778
+ const shapeName = cNvPr?.attributes?.["name"];
451779
+ const textBox = findChildByLocalName2(wsp.elements, "txbx");
451780
+ const textBoxContent = findChildByLocalName2(textBox?.elements, "txbxContent");
451781
+ const bodyPr = findChildByLocalName2(wsp.elements, "bodyPr");
451782
+ const textContent2 = textBoxContent ? extractTextFromTextBox2(textBoxContent, bodyPr, params3) : null;
451783
+ const textAlign = textContent2?.horizontalAlign || "left";
451784
+ return {
451785
+ shapeType: "vectorShape",
451786
+ attrs: {
451787
+ kind: shapeKind,
451788
+ customGeometry: customGeom || undefined,
451789
+ ...rect,
451790
+ ...orientation,
451791
+ fillColor,
451792
+ strokeColor,
451793
+ strokeWidth,
451794
+ lineEnds,
451795
+ effects: effects2,
451796
+ shapeId,
451797
+ shapeName,
451798
+ textContent: textContent2,
451799
+ textAlign,
451800
+ textVerticalAlign: textContent2?.verticalAlign,
451801
+ textInsets: textContent2?.insets
451802
+ }
451803
+ };
451804
+ }, parseShapeGroupImageChild2 = (pic, transform2, params3) => {
451805
+ const spPr = findChildByLocalName2(pic.elements, "spPr");
451806
+ if (!spPr)
451807
+ return null;
451808
+ const xfrm = findChildByLocalName2(spPr.elements, "xfrm");
451809
+ const off = findChildByLocalName2(xfrm?.elements, "off");
451810
+ const ext = findChildByLocalName2(xfrm?.elements, "ext");
451811
+ const rawX = parseEmuNumber2(off?.attributes?.["x"]);
451812
+ const rawY = parseEmuNumber2(off?.attributes?.["y"]);
451813
+ const rawWidth = parseEmuNumber2(ext?.attributes?.["cx"], 914400);
451814
+ const rawHeight = parseEmuNumber2(ext?.attributes?.["cy"], 914400);
451815
+ const rect = transformShapeGroupChildRect2(transform2, rawX, rawY, rawWidth, rawHeight);
451816
+ const orientation = composeShapeGroupChildOrientation2(rect, xfrm);
451817
+ const path3 = resolveShapeGroupPicturePath2(pic, params3);
451818
+ if (!path3)
451819
+ return null;
451820
+ const blipFill = findChildByLocalName2(pic.elements, "blipFill");
451821
+ const blip = findChildByLocalName2(blipFill?.elements, "blip");
451822
+ const alphaModFix = extractAlphaModFix2(blip);
451823
+ const nvPicPr = findChildByLocalName2(pic.elements, "nvPicPr");
451824
+ const cNvPr = findChildByLocalName2(nvPicPr?.elements, "cNvPr");
451825
+ const picId = cNvPr?.attributes?.["id"];
451826
+ const picName = cNvPr?.attributes?.["name"];
451827
+ const { clipPath, shouldCover, shouldFillClippedStretch, shouldCoverShapeStretch, shapeClipPath } = extractPicturePresentation2(pic);
451828
+ return {
451829
+ shapeType: "image",
451830
+ attrs: {
451831
+ ...rect,
451832
+ ...orientation,
451833
+ src: path3,
451834
+ imageId: picId,
451835
+ imageName: picName,
451836
+ ...alphaModFix ? { alphaModFix } : {},
451837
+ ...clipPath ? { clipPath } : {},
451838
+ ...shapeClipPath ? { shapeClipPath } : {},
451839
+ ...shouldFillClippedStretch || shouldCoverShapeStretch ? { objectFit: shouldFillClippedStretch ? "fill" : "cover" } : shouldCover ? { objectFit: "cover" } : {}
451840
+ }
451841
+ };
451842
+ }, collectShapeGroupChildren2 = (groupNode, transform2, params3) => {
451843
+ const children = [];
451844
+ for (const child of groupNode?.elements || []) {
451845
+ const localName2 = getLocalName3(child?.name);
451846
+ if (localName2 === "wsp") {
451847
+ const shape = parseShapeGroupVectorChild2(child, transform2, params3);
451848
+ if (shape)
451849
+ children.push(shape);
451850
+ } else if (localName2 === "pic") {
451851
+ const picture = parseShapeGroupImageChild2(child, transform2, params3);
451852
+ if (picture)
451853
+ children.push(picture);
451854
+ } else if (localName2 === "grpSp") {
451855
+ const nestedTransform = composeShapeGroupTransform2(transform2, getGroupAffineTransform2(getGroupXfrm2(child), { includeVisualTransform: true }));
451856
+ children.push(...collectShapeGroupChildren2(child, nestedTransform, params3));
451857
+ }
451858
+ }
451859
+ return children;
451860
+ }, handleShapeGroup2 = (params3, node4, graphicData, size3, padding, marginOffset, anchorData, wrap6, effectExtent, isHidden) => {
450027
451861
  const wgp = graphicData.elements.find((el) => el.name === "wpg:wgp");
450028
451862
  if (!wgp) {
450029
451863
  const placeholder = buildShapePlaceholder2(node4, size3, padding, marginOffset, "group");
@@ -450032,174 +451866,9 @@ var DRAWING_XML_TAG2 = "w:drawing", SHAPE_URI2 = "http://schemas.microsoft.com/o
450032
451866
  }
450033
451867
  return placeholder;
450034
451868
  }
450035
- const grpSpPr = wgp.elements.find((el) => el.name === "wpg:grpSpPr");
450036
- const xfrm = findChildByLocalName2(grpSpPr?.elements, "xfrm");
450037
- const groupTransform = {};
450038
- if (xfrm) {
450039
- const off = findChildByLocalName2(xfrm.elements, "off");
450040
- const ext = findChildByLocalName2(xfrm.elements, "ext");
450041
- const chOff = findChildByLocalName2(xfrm.elements, "chOff");
450042
- const chExt = findChildByLocalName2(xfrm.elements, "chExt");
450043
- if (off) {
450044
- groupTransform.x = emuToPixels2(off.attributes?.["x"] || 0);
450045
- groupTransform.y = emuToPixels2(off.attributes?.["y"] || 0);
450046
- }
450047
- if (ext) {
450048
- groupTransform.width = emuToPixels2(ext.attributes?.["cx"] || 0);
450049
- groupTransform.height = emuToPixels2(ext.attributes?.["cy"] || 0);
450050
- }
450051
- if (chOff) {
450052
- groupTransform.childX = emuToPixels2(chOff.attributes?.["x"] || 0);
450053
- groupTransform.childY = emuToPixels2(chOff.attributes?.["y"] || 0);
450054
- groupTransform.childOriginXEmu = parseFloat(chOff.attributes?.["x"] || 0);
450055
- groupTransform.childOriginYEmu = parseFloat(chOff.attributes?.["y"] || 0);
450056
- }
450057
- if (chExt) {
450058
- groupTransform.childWidth = emuToPixels2(chExt.attributes?.["cx"] || 0);
450059
- groupTransform.childHeight = emuToPixels2(chExt.attributes?.["cy"] || 0);
450060
- }
450061
- }
450062
- const childShapes = wgp.elements.filter((el) => el.name === "wps:wsp");
450063
- const childPictures = wgp.elements.filter((el) => el.name === "pic:pic");
450064
- const shapes = childShapes.map((wsp) => {
450065
- const spPr = wsp.elements?.find((el) => el.name === "wps:spPr");
450066
- if (!spPr)
450067
- return null;
450068
- const prstGeom = findChildByLocalName2(spPr.elements, "prstGeom");
450069
- const shapeKind = prstGeom?.attributes?.["prst"];
450070
- const customGeom = !shapeKind ? extractCustomGeometry2(spPr) : null;
450071
- const shapeXfrm = findChildByLocalName2(spPr.elements, "xfrm");
450072
- const shapeOff = findChildByLocalName2(shapeXfrm?.elements, "off");
450073
- const shapeExt = findChildByLocalName2(shapeXfrm?.elements, "ext");
450074
- const rawX = shapeOff?.attributes?.["x"] ? parseFloat(shapeOff.attributes["x"]) : 0;
450075
- const rawY = shapeOff?.attributes?.["y"] ? parseFloat(shapeOff.attributes["y"]) : 0;
450076
- const rawWidth = shapeExt?.attributes?.["cx"] ? parseFloat(shapeExt.attributes["cx"]) : 914400;
450077
- const rawHeight = shapeExt?.attributes?.["cy"] ? parseFloat(shapeExt.attributes["cy"]) : 914400;
450078
- let x, y2, width, height;
450079
- if (groupTransform.childWidth && groupTransform.childHeight) {
450080
- const scaleX = groupTransform.width / groupTransform.childWidth;
450081
- const scaleY = groupTransform.height / groupTransform.childHeight;
450082
- const childOriginX = groupTransform.childOriginXEmu || 0;
450083
- const childOriginY = groupTransform.childOriginYEmu || 0;
450084
- x = groupTransform.x + emuToPixels2((rawX - childOriginX) * scaleX);
450085
- y2 = groupTransform.y + emuToPixels2((rawY - childOriginY) * scaleY);
450086
- width = emuToPixels2(rawWidth * scaleX);
450087
- height = emuToPixels2(rawHeight * scaleY);
450088
- } else {
450089
- x = emuToPixels2(rawX);
450090
- y2 = emuToPixels2(rawY);
450091
- width = emuToPixels2(rawWidth);
450092
- height = emuToPixels2(rawHeight);
450093
- }
450094
- const rotation = shapeXfrm?.attributes?.["rot"] ? rotToDegrees2(shapeXfrm.attributes["rot"]) : 0;
450095
- const flipH = shapeXfrm?.attributes?.["flipH"] === "1";
450096
- const flipV = shapeXfrm?.attributes?.["flipV"] === "1";
450097
- const style2 = wsp.elements?.find((el) => el.name === "wps:style");
450098
- const fillColor = extractFillColor2(spPr, style2);
450099
- const strokeColor = extractStrokeColor2(spPr, style2);
450100
- const strokeWidth = extractStrokeWidth2(spPr);
450101
- const lineEnds = extractLineEnds2(spPr);
450102
- const cNvPr = wsp.elements?.find((el) => el.name === "wps:cNvPr");
450103
- const shapeId = cNvPr?.attributes?.["id"];
450104
- const shapeName = cNvPr?.attributes?.["name"];
450105
- const textBox = wsp.elements?.find((el) => el.name === "wps:txbx");
450106
- const textBoxContent = textBox?.elements?.find((el) => el.name === "w:txbxContent");
450107
- const bodyPr = wsp.elements?.find((el) => el.name === "wps:bodyPr");
450108
- let textContent2 = null;
450109
- if (textBoxContent) {
450110
- textContent2 = extractTextFromTextBox2(textBoxContent, bodyPr, params3);
450111
- }
450112
- const textAlign = textContent2?.horizontalAlign || "left";
450113
- return {
450114
- shapeType: "vectorShape",
450115
- attrs: {
450116
- kind: shapeKind,
450117
- customGeometry: customGeom || undefined,
450118
- x,
450119
- y: y2,
450120
- width,
450121
- height,
450122
- rotation,
450123
- flipH,
450124
- flipV,
450125
- fillColor,
450126
- strokeColor,
450127
- strokeWidth,
450128
- lineEnds,
450129
- shapeId,
450130
- shapeName,
450131
- textContent: textContent2,
450132
- textAlign,
450133
- textVerticalAlign: textContent2?.verticalAlign,
450134
- textInsets: textContent2?.insets
450135
- }
450136
- };
450137
- }).filter(Boolean);
450138
- const pictures = childPictures.map((pic) => {
450139
- const spPr = pic.elements?.find((el) => el.name === "pic:spPr");
450140
- if (!spPr)
450141
- return null;
450142
- const xfrm2 = findChildByLocalName2(spPr.elements, "xfrm");
450143
- const off = findChildByLocalName2(xfrm2?.elements, "off");
450144
- const ext = findChildByLocalName2(xfrm2?.elements, "ext");
450145
- const rawX = off?.attributes?.["x"] ? parseFloat(off.attributes["x"]) : 0;
450146
- const rawY = off?.attributes?.["y"] ? parseFloat(off.attributes["y"]) : 0;
450147
- const rawWidth = ext?.attributes?.["cx"] ? parseFloat(ext.attributes["cx"]) : 914400;
450148
- const rawHeight = ext?.attributes?.["cy"] ? parseFloat(ext.attributes["cy"]) : 914400;
450149
- let x, y2, width, height;
450150
- if (groupTransform.childWidth && groupTransform.childHeight) {
450151
- const scaleX = groupTransform.width / groupTransform.childWidth;
450152
- const scaleY = groupTransform.height / groupTransform.childHeight;
450153
- const childOriginX = groupTransform.childOriginXEmu || 0;
450154
- const childOriginY = groupTransform.childOriginYEmu || 0;
450155
- x = groupTransform.x + emuToPixels2((rawX - childOriginX) * scaleX);
450156
- y2 = groupTransform.y + emuToPixels2((rawY - childOriginY) * scaleY);
450157
- width = emuToPixels2(rawWidth * scaleX);
450158
- height = emuToPixels2(rawHeight * scaleY);
450159
- } else {
450160
- x = emuToPixels2(rawX);
450161
- y2 = emuToPixels2(rawY);
450162
- width = emuToPixels2(rawWidth);
450163
- height = emuToPixels2(rawHeight);
450164
- }
450165
- const blipFill = pic.elements?.find((el) => el.name === "pic:blipFill");
450166
- const blip = findChildByLocalName2(blipFill?.elements, "blip");
450167
- if (!blip)
450168
- return null;
450169
- const alphaModFix = extractAlphaModFix2(blip);
450170
- const rEmbed = blip.attributes?.["r:embed"];
450171
- if (!rEmbed)
450172
- return null;
450173
- const currentFile = params3.filename || "document.xml";
450174
- let rels = params3.docx[`word/_rels/${currentFile}.rels`];
450175
- if (!rels)
450176
- rels = params3.docx[`word/_rels/document.xml.rels`];
450177
- const relationships = rels?.elements.find((el) => el.name === "Relationships");
450178
- const { elements } = relationships || [];
450179
- const rel = elements?.find((el) => el.attributes["Id"] === rEmbed);
450180
- if (!rel)
450181
- return null;
450182
- const targetPath = normalizeTargetPath2(rel.attributes?.["Target"]);
450183
- const path3 = targetPath;
450184
- const nvPicPr = pic.elements?.find((el) => el.name === "pic:nvPicPr");
450185
- const cNvPr = nvPicPr?.elements?.find((el) => el.name === "pic:cNvPr");
450186
- const picId = cNvPr?.attributes?.["id"];
450187
- const picName = cNvPr?.attributes?.["name"];
450188
- return {
450189
- shapeType: "image",
450190
- attrs: {
450191
- x,
450192
- y: y2,
450193
- width,
450194
- height,
450195
- src: path3,
450196
- imageId: picId,
450197
- imageName: picName,
450198
- ...alphaModFix ? { alphaModFix } : {}
450199
- }
450200
- };
450201
- }).filter(Boolean);
450202
- const allShapes = [...pictures, ...shapes];
451869
+ const groupXfrm = getGroupXfrm2(wgp);
451870
+ const groupTransform = buildShapeGroupTransformAttrs2(groupXfrm);
451871
+ const allShapes = collectShapeGroupChildren2(wgp, getGroupAffineTransform2(groupXfrm), params3);
450203
451872
  const schemaAttrs = {};
450204
451873
  const drawingNode = params3.nodes?.[0];
450205
451874
  if (drawingNode?.name === DRAWING_XML_TAG2) {
@@ -450215,6 +451884,7 @@ var DRAWING_XML_TAG2 = "w:drawing", SHAPE_URI2 = "http://schemas.microsoft.com/o
450215
451884
  size: size3,
450216
451885
  padding,
450217
451886
  marginOffset,
451887
+ effectExtent,
450218
451888
  anchorData,
450219
451889
  wrap: wrap6,
450220
451890
  originalAttributes: node4?.attributes