@superdoc-dev/cli 0.19.0 → 0.20.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 +1844 -440
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -69157,7 +69157,7 @@ var init_remark_gfm_BUJjZJLy_es = __esm(() => {
69157
69157
  emptyOptions2 = {};
69158
69158
  });
69159
69159
 
69160
- // ../../packages/superdoc/dist/chunks/SuperConverter-DQ2wMaLK.es.js
69160
+ // ../../packages/superdoc/dist/chunks/SuperConverter-DJEK5GYX.es.js
69161
69161
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
69162
69162
  const fieldValue = extension$1.config[field];
69163
69163
  if (typeof fieldValue === "function")
@@ -83838,6 +83838,34 @@ function extractLineEnds(spPr) {
83838
83838
  tail: tailConfig ?? undefined
83839
83839
  };
83840
83840
  }
83841
+ function extractShapeEffects(spPr) {
83842
+ const outerShadow = extractOuterShadowEffect(spPr);
83843
+ if (!outerShadow)
83844
+ return null;
83845
+ return { outerShadow };
83846
+ }
83847
+ function extractOuterShadowEffect(spPr) {
83848
+ const outerShdw = findChildByLocalName(findChildByLocalName(spPr?.elements, "effectLst")?.elements, "outerShdw");
83849
+ if (!outerShdw)
83850
+ return null;
83851
+ const colorResult = extractColorFromElement(outerShdw);
83852
+ if (!colorResult)
83853
+ return null;
83854
+ return stripUndefined({
83855
+ type: "outerShadow",
83856
+ blurRadius: finiteNumberOrZero(emuToPixels(outerShdw.attributes?.blurRad)),
83857
+ distance: finiteNumberOrZero(emuToPixels(outerShdw.attributes?.dist)),
83858
+ direction: finiteNumberOrZero(rotToDegrees(outerShdw.attributes?.dir)),
83859
+ color: colorResult.color,
83860
+ opacity: colorResult.alpha ?? 1
83861
+ });
83862
+ }
83863
+ function finiteNumberOrZero(value) {
83864
+ return Number.isFinite(value) ? value : 0;
83865
+ }
83866
+ function stripUndefined(value) {
83867
+ return Object.fromEntries(Object.entries(value).filter(([, fieldValue]) => fieldValue !== undefined));
83868
+ }
83841
83869
  function extractStrokeColor(spPr, style) {
83842
83870
  const ln = findChildByLocalName(spPr?.elements, "ln");
83843
83871
  if (ln) {
@@ -85479,6 +85507,26 @@ function resolveParagraphPropertiesForTextBox(paragraph2, params3) {
85479
85507
  nodes: [pPr]
85480
85508
  }) || {} : {}, false, false, null);
85481
85509
  }
85510
+ function extractTextBoxParagraphSpacing(paragraphProperties, { paragraphIndex, paragraphCount, spcFirstLastPara } = {}) {
85511
+ const spacing = paragraphProperties?.spacing;
85512
+ if (!spacing)
85513
+ return;
85514
+ const honorFirstLast = spcFirstLastPara === "1" || spcFirstLastPara === 1 || spcFirstLastPara === true || spcFirstLastPara === "true" || spcFirstLastPara === "on";
85515
+ const isFirst = paragraphIndex === 0;
85516
+ const isLast = paragraphCount != null && paragraphIndex === paragraphCount - 1;
85517
+ const result = {};
85518
+ if (typeof spacing.before === "number" && !(isFirst && !honorFirstLast)) {
85519
+ const px = twipsToPixels(spacing.before);
85520
+ if (typeof px === "number")
85521
+ result.before = px;
85522
+ }
85523
+ if (typeof spacing.after === "number" && !(isLast && !honorFirstLast)) {
85524
+ const px = twipsToPixels(spacing.after);
85525
+ if (typeof px === "number")
85526
+ result.after = px;
85527
+ }
85528
+ return result.before === undefined && result.after === undefined ? undefined : result;
85529
+ }
85482
85530
  function extractRunFormatting(rPr, paragraphProperties, params3) {
85483
85531
  const resolvedRunProperties = resolveRunProperties(params3, rPr ? translator$133.encode({
85484
85532
  ...params3,
@@ -85542,10 +85590,12 @@ function extractBodyPrProperties(bodyPr) {
85542
85590
  left: lIns * EMU_TO_PX
85543
85591
  };
85544
85592
  const wrap$1 = bodyPrAttrs["wrap"] || "square";
85593
+ const spcFirstLastPara = bodyPrAttrs["spcFirstLastPara"];
85545
85594
  return {
85546
85595
  verticalAlign,
85547
85596
  insets,
85548
- wrap: wrap$1
85597
+ wrap: wrap$1,
85598
+ spcFirstLastPara
85549
85599
  };
85550
85600
  }
85551
85601
  function isValidRelativeHeight(value) {
@@ -85935,14 +85985,13 @@ function handleImageNode$1(node3, params3, isAnchor) {
85935
85985
  left: positionHValue,
85936
85986
  horizontal: positionHValue,
85937
85987
  top: positionVValue
85938
- }, anchorData, wrap$1, isHidden);
85988
+ }, anchorData, wrap$1, extractEffectExtent(node3), isHidden);
85939
85989
  if (uri === "http://schemas.openxmlformats.org/drawingml/2006/chart")
85940
85990
  return handleChartDrawing(params3, node3, graphicData, size2, padding, marginOffset, anchorData, wrap$1, isAnchor);
85941
85991
  const picture = graphicData?.elements.find((el) => el.name === "pic:pic");
85942
85992
  if (!picture || !picture.elements)
85943
85993
  return null;
85944
- const blipFill = picture.elements.find((el) => el.name === "pic:blipFill");
85945
- const blip = findChildByLocalName(blipFill?.elements, "blip");
85994
+ const blip = findChildByLocalName(picture.elements.find((el) => el.name === "pic:blipFill")?.elements, "blip");
85946
85995
  if (!blip)
85947
85996
  return null;
85948
85997
  const hasGrayscale = someChildHasLocalName(blip.elements, "grayscl");
@@ -85954,23 +86003,7 @@ function handleImageNode$1(node3, params3, isAnchor) {
85954
86003
  ...Number.isFinite(rawContrast) ? { contrast: rawContrast } : {}
85955
86004
  } : undefined;
85956
86005
  const alphaModFix = extractAlphaModFix(blip);
85957
- const stretch = findChildByLocalName(blipFill?.elements, "stretch");
85958
- const fillRect = findChildByLocalName(stretch?.elements, "fillRect");
85959
- const srcRect = findChildByLocalName(blipFill?.elements, "srcRect");
85960
- const srcRectAttrs = srcRect?.attributes || {};
85961
- const clipPath = buildClipPathFromSrcRect(srcRectAttrs);
85962
- const srcRectHasNegativeValues = [
85963
- "l",
85964
- "t",
85965
- "r",
85966
- "b"
85967
- ].some((attr) => {
85968
- const val = srcRectAttrs[attr];
85969
- return val != null && parseFloat(val) < 0;
85970
- });
85971
- const shouldStretch = Boolean(stretch && fillRect);
85972
- const shouldCover = shouldStretch && !srcRectHasNegativeValues && !clipPath;
85973
- const shouldFillClippedStretch = shouldStretch && !srcRectHasNegativeValues && Boolean(clipPath);
86006
+ const { clipPath, rawSrcRect, shouldCover, shouldFillClippedStretch, shouldCoverShapeStretch, shapeClipPath } = extractPicturePresentation(picture);
85974
86007
  const spPr = picture.elements.find((el) => el.name === "pic:spPr");
85975
86008
  if (spPr) {
85976
86009
  const xfrm = findChildByLocalName(spPr.elements, "xfrm");
@@ -86090,9 +86123,10 @@ function handleImageNode$1(node3, params3, isAnchor) {
86090
86123
  ...wrap$1.type === "Square" && wrap$1.attrs.wrapText ? { wrapText: wrap$1.attrs.wrapText } : {},
86091
86124
  wrapTopAndBottom: wrap$1.type === "TopAndBottom",
86092
86125
  shouldCover,
86093
- ...shouldFillClippedStretch ? { objectFit: "fill" } : {},
86126
+ ...shouldFillClippedStretch ? { objectFit: "fill" } : shouldCoverShapeStretch ? { objectFit: "cover" } : {},
86094
86127
  ...clipPath ? { clipPath } : {},
86095
- rawSrcRect: srcRect,
86128
+ ...shapeClipPath ? { shapeClipPath } : {},
86129
+ rawSrcRect,
86096
86130
  originalPadding: {
86097
86131
  distT: attributes["distT"],
86098
86132
  distB: attributes["distB"],
@@ -86140,7 +86174,9 @@ function extractTextFromTextBox(textBoxContent, bodyPr, params3 = {}) {
86140
86174
  return null;
86141
86175
  const paragraphs = collectTextBoxParagraphs(preProcessTextBoxContent(textBoxContent, params3)?.elements || []);
86142
86176
  const textParts = [];
86177
+ const paragraphMetadata = [];
86143
86178
  let horizontalAlign = null;
86179
+ const { verticalAlign, insets, wrap: wrap$1, spcFirstLastPara } = extractBodyPrProperties(bodyPr);
86144
86180
  const appendFieldPart = (fieldType, node3, paragraphProperties) => {
86145
86181
  const rPr = node3?.elements?.find((el) => el.name === "w:rPr");
86146
86182
  const formatting = extractRunFormatting(rPr, paragraphProperties, params3);
@@ -86247,6 +86283,11 @@ function extractTextFromTextBox(textBoxContent, bodyPr, params3 = {}) {
86247
86283
  };
86248
86284
  paragraphs.forEach((paragraph2, paragraphIndex) => {
86249
86285
  const paragraphProperties = resolveParagraphPropertiesForTextBox(paragraph2, params3);
86286
+ paragraphMetadata.push({ spacing: extractTextBoxParagraphSpacing(paragraphProperties, {
86287
+ paragraphIndex,
86288
+ paragraphCount: paragraphs.length,
86289
+ spcFirstLastPara
86290
+ }) });
86250
86291
  if (!horizontalAlign)
86251
86292
  horizontalAlign = extractParagraphAlignment(paragraph2);
86252
86293
  let paragraphHasText = false;
@@ -86260,18 +86301,20 @@ function extractTextFromTextBox(textBoxContent, bodyPr, params3 = {}) {
86260
86301
  `,
86261
86302
  formatting: {},
86262
86303
  isLineBreak: true,
86263
- isEmptyParagraph: !paragraphHasText
86304
+ isEmptyParagraph: !paragraphHasText,
86305
+ isParagraphBoundary: true
86264
86306
  });
86265
86307
  });
86266
86308
  if (textParts.length === 0)
86267
86309
  return null;
86268
- const { verticalAlign, insets, wrap: wrap$1 } = extractBodyPrProperties(bodyPr);
86310
+ const hasParagraphSpacing = paragraphMetadata.some((paragraph2) => paragraph2.spacing);
86269
86311
  return {
86270
86312
  parts: textParts,
86271
86313
  horizontalAlign: horizontalAlign || "left",
86272
86314
  verticalAlign,
86273
86315
  insets,
86274
- wrap: wrap$1
86316
+ wrap: wrap$1,
86317
+ ...hasParagraphSpacing ? { paragraphs: paragraphMetadata } : {}
86275
86318
  };
86276
86319
  }
86277
86320
  function extractFieldInlineNodes(node3) {
@@ -86421,6 +86464,7 @@ function getVectorShape({ params: params3, node: node3, graphicData, size: size2
86421
86464
  const strokeColor = extractStrokeColor(spPr, style);
86422
86465
  const strokeWidth = extractStrokeWidth(spPr);
86423
86466
  const lineEnds = extractLineEnds(spPr);
86467
+ const effects = extractShapeEffects(spPr);
86424
86468
  const effectExtent = extractEffectExtent(node3);
86425
86469
  const textBoxContent = wsp.elements?.find((el) => el.name === "wps:txbx")?.elements?.find((el) => el.name === "w:txbxContent");
86426
86470
  const bodyPr = wsp.elements?.find((el) => el.name === "wps:bodyPr");
@@ -86444,6 +86488,7 @@ function getVectorShape({ params: params3, node: node3, graphicData, size: size2
86444
86488
  strokeColor,
86445
86489
  strokeWidth,
86446
86490
  lineEnds,
86491
+ effects,
86447
86492
  effectExtent,
86448
86493
  marginOffset,
86449
86494
  anchorData,
@@ -86477,6 +86522,7 @@ function getVectorShape({ params: params3, node: node3, graphicData, size: size2
86477
86522
  strokeColor,
86478
86523
  strokeWidth,
86479
86524
  lineEnds,
86525
+ effects,
86480
86526
  effectExtent,
86481
86527
  marginOffset,
86482
86528
  anchorData,
@@ -105707,7 +105753,7 @@ function isShapeGroupTransform(value) {
105707
105753
  if (!value || typeof value !== "object")
105708
105754
  return false;
105709
105755
  const maybe = value;
105710
- 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);
105756
+ 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;
105711
105757
  }
105712
105758
  function normalizeShapeSize(value) {
105713
105759
  if (!value || typeof value !== "object")
@@ -105755,13 +105801,73 @@ function normalizeEffectExtent(value) {
105755
105801
  bottom: clamp(bottom)
105756
105802
  };
105757
105803
  }
105804
+ function normalizeShapeEffects(value) {
105805
+ if (!value || typeof value !== "object")
105806
+ return;
105807
+ const outerShadow = normalizeOuterShadowEffect(value.outerShadow);
105808
+ return outerShadow ? { outerShadow } : undefined;
105809
+ }
105810
+ function normalizeOuterShadowEffect(value) {
105811
+ if (!value || typeof value !== "object")
105812
+ return;
105813
+ const maybe = value;
105814
+ if (maybe.type !== "outerShadow")
105815
+ return;
105816
+ const blurRadius = coerceNumber(maybe.blurRadius);
105817
+ const distance2 = coerceNumber(maybe.distance);
105818
+ const direction = coerceNumber(maybe.direction);
105819
+ const opacity = coerceNumber(maybe.opacity);
105820
+ if (blurRadius == null || blurRadius < 0 || distance2 == null || distance2 < 0 || direction == null || opacity == null || typeof maybe.color !== "string")
105821
+ return;
105822
+ const clamp = (val) => Math.max(0, Math.min(1, val));
105823
+ const normalized = {
105824
+ type: "outerShadow",
105825
+ blurRadius,
105826
+ distance: distance2,
105827
+ direction,
105828
+ color: maybe.color,
105829
+ opacity: clamp(opacity)
105830
+ };
105831
+ return Object.fromEntries(Object.entries(normalized).filter(([, fieldValue]) => fieldValue !== undefined));
105832
+ }
105758
105833
  function normalizeShapeGroupChildren(value) {
105759
105834
  if (!Array.isArray(value))
105760
105835
  return [];
105761
- return value.filter((child) => {
105836
+ return value.flatMap((child) => {
105762
105837
  if (!child || typeof child !== "object")
105763
- return false;
105764
- return typeof child.shapeType === "string";
105838
+ return [];
105839
+ if (typeof child.shapeType !== "string")
105840
+ return [];
105841
+ const shapeChild = child;
105842
+ if (shapeChild.shapeType !== "vectorShape")
105843
+ return [shapeChild];
105844
+ const attrs = shapeChild.attrs;
105845
+ if (!attrs || typeof attrs !== "object")
105846
+ return [shapeChild];
105847
+ const rawAttrs = attrs;
105848
+ const normalizedAttrs = { ...rawAttrs };
105849
+ const normalizeAttr = (key, normalize$1) => {
105850
+ if (!(key in rawAttrs))
105851
+ return;
105852
+ const normalized = normalize$1(rawAttrs[key]);
105853
+ if (normalized !== undefined)
105854
+ normalizedAttrs[key] = normalized;
105855
+ else
105856
+ delete normalizedAttrs[key];
105857
+ };
105858
+ normalizeAttr("fillColor", normalizeFillColor);
105859
+ normalizeAttr("strokeColor", normalizeStrokeColor);
105860
+ normalizeAttr("strokeWidth", coerceNumber);
105861
+ normalizeAttr("lineEnds", normalizeLineEnds);
105862
+ normalizeAttr("effects", normalizeShapeEffects);
105863
+ normalizeAttr("textContent", normalizeTextContent);
105864
+ normalizeAttr("textAlign", (value$1) => typeof value$1 === "string" ? value$1 : undefined);
105865
+ normalizeAttr("textVerticalAlign", normalizeTextVerticalAlign);
105866
+ normalizeAttr("textInsets", normalizeTextInsets);
105867
+ return [{
105868
+ ...shapeChild,
105869
+ attrs: normalizedAttrs
105870
+ }];
105765
105871
  });
105766
105872
  }
105767
105873
  function normalizeMediaKey(value) {
@@ -106050,6 +106156,25 @@ function normalizeTextContent(value) {
106050
106156
  "right"
106051
106157
  ].includes(value.horizontalAlign))
106052
106158
  result.horizontalAlign = value.horizontalAlign;
106159
+ if (Array.isArray(value.paragraphs)) {
106160
+ const normalizedParagraphs = value.paragraphs.map((paragraph2) => {
106161
+ if (!isPlainObject3(paragraph2))
106162
+ return {};
106163
+ const spacing = isPlainObject3(paragraph2.spacing) ? paragraph2.spacing : undefined;
106164
+ const before2 = Number.isFinite(spacing?.before) ? spacing.before : undefined;
106165
+ const after2 = Number.isFinite(spacing?.after) ? spacing.after : undefined;
106166
+ if (before2 === undefined && after2 === undefined)
106167
+ return {};
106168
+ const out = { spacing: {} };
106169
+ if (before2 !== undefined)
106170
+ out.spacing.before = before2;
106171
+ if (after2 !== undefined)
106172
+ out.spacing.after = after2;
106173
+ return out;
106174
+ });
106175
+ if (normalizedParagraphs.some((paragraph2) => ("spacing" in paragraph2)))
106176
+ result.paragraphs = normalizedParagraphs;
106177
+ }
106053
106178
  return result;
106054
106179
  }
106055
106180
  function normalizeTextVerticalAlign(value) {
@@ -107722,6 +107847,10 @@ function imageNodeToRun({ node: node3, positions, sdtMetadata }) {
107722
107847
  run$1.title = attrs.title;
107723
107848
  if (typeof attrs.clipPath === "string")
107724
107849
  run$1.clipPath = attrs.clipPath;
107850
+ if (typeof attrs.shapeClipPath === "string")
107851
+ run$1.shapeClipPath = attrs.shapeClipPath;
107852
+ if (isAllowedObjectFit$1(attrs.objectFit))
107853
+ run$1.objectFit = attrs.objectFit;
107725
107854
  const distTop = pickNumber(wrapAttrs.distTop ?? wrapAttrs.distT);
107726
107855
  if (distTop != null)
107727
107856
  run$1.distTop = distTop;
@@ -107996,7 +108125,7 @@ function vectorShapeNodeToDrawingBlock(node3, nextBlockId, positions) {
107996
108125
  const rawAttrs = getAttrs$2(node3);
107997
108126
  if (isHiddenDrawing$1(rawAttrs))
107998
108127
  return null;
107999
- const effectExtent = normalizeEffectExtent(rawAttrs.effectExtent);
108128
+ const effectExtent = mergeEffectExtents(normalizeEffectExtent(rawAttrs.effectExtent), getRequiredVectorShapeEffectExtent(rawAttrs));
108000
108129
  const baseWidth = coercePositiveNumber(rawAttrs.width, 1);
108001
108130
  const baseHeight = coercePositiveNumber(rawAttrs.height, 1);
108002
108131
  const extraWidth = (effectExtent?.left ?? 0) + (effectExtent?.right ?? 0);
@@ -108020,16 +108149,23 @@ function shapeGroupNodeToDrawingBlock(node3, nextBlockId, positions) {
108020
108149
  const size2 = normalizeShapeSize(rawAttrs.size);
108021
108150
  const width = size2?.width ?? groupTransform?.width ?? 1;
108022
108151
  const height = size2?.height ?? groupTransform?.height ?? 1;
108152
+ const childCoordinateWidth = groupTransform?.width ?? width;
108153
+ const childCoordinateHeight = groupTransform?.height ?? height;
108154
+ const shapes = normalizeShapeGroupChildren(rawAttrs.shapes);
108155
+ const effectExtent = mergeEffectExtents(normalizeEffectExtent(rawAttrs.effectExtent), getRequiredGroupEffectExtentFromChildren(shapes, childCoordinateWidth, childCoordinateHeight));
108156
+ const extraWidth = (effectExtent?.left ?? 0) + (effectExtent?.right ?? 0);
108157
+ const extraHeight = (effectExtent?.top ?? 0) + (effectExtent?.bottom ?? 0);
108023
108158
  return buildDrawingBlock(rawAttrs, nextBlockId, positions, node3, {
108024
- width: coercePositiveNumber(width, 1),
108025
- height: coercePositiveNumber(height, 1),
108159
+ width: coercePositiveNumber(width + extraWidth, 1),
108160
+ height: coercePositiveNumber(height + extraHeight, 1),
108026
108161
  rotation: coerceNumber(rawAttrs.rotation) ?? 0,
108027
108162
  flipH: coerceBoolean(rawAttrs.flipH) ?? false,
108028
108163
  flipV: coerceBoolean(rawAttrs.flipV) ?? false
108029
108164
  }, "shapeGroup", {
108030
108165
  groupTransform,
108031
- shapes: normalizeShapeGroupChildren(rawAttrs.shapes),
108032
- size: size2
108166
+ shapes,
108167
+ size: size2,
108168
+ effectExtent
108033
108169
  });
108034
108170
  }
108035
108171
  function shapeContainerNodeToDrawingBlock(node3, nextBlockId, positions) {
@@ -108877,7 +109013,13 @@ function paragraphToFlowBlocks({ para, nextBlockId, positions, storyKey, tracked
108877
109013
  visitNode(child, [], undefined, undefined);
108878
109014
  });
108879
109015
  flushParagraph();
108880
- if (!blocks.some((block) => block.kind === "paragraph") && !suppressedByVanish && !paragraphProps.runProperties?.vanish)
109016
+ if (!blocks.some((block) => block.kind === "paragraph") && !suppressedByVanish && !paragraphProps.runProperties?.vanish) {
109017
+ let syntheticParagraphAttrs = deepClone2(paragraphAttrs);
109018
+ if (isSectPrMarker)
109019
+ if (syntheticParagraphAttrs)
109020
+ syntheticParagraphAttrs.sectPrMarker = true;
109021
+ else
109022
+ syntheticParagraphAttrs = { sectPrMarker: true };
108881
109023
  blocks.push({
108882
109024
  kind: "paragraph",
108883
109025
  id: baseBlockId,
@@ -108886,9 +109028,10 @@ function paragraphToFlowBlocks({ para, nextBlockId, positions, storyKey, tracked
108886
109028
  fontFamily: defaultFont,
108887
109029
  fontSize: defaultSize
108888
109030
  }],
108889
- attrs: deepClone2(paragraphAttrs),
109031
+ attrs: syntheticParagraphAttrs,
108890
109032
  sourceAnchor
108891
109033
  });
109034
+ }
108892
109035
  blocks.forEach((block) => {
108893
109036
  if (block.kind === "paragraph" && block.runs.length > 1)
108894
109037
  block.runs = mergeAdjacentRuns(block.runs);
@@ -118160,7 +118303,24 @@ var isRegExp = (value) => {
118160
118303
  return true;
118161
118304
  }, areAttrsEqual = (attrsA = {}, attrsB = {}) => {
118162
118305
  return objectIncludes(attrsA, attrsB);
118163
- }, 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) => {
118306
+ }, 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) => {
118307
+ const radians = shadow.direction * Math.PI / 180;
118308
+ return {
118309
+ dx: shadow.distance * Math.cos(radians),
118310
+ dy: shadow.distance * Math.sin(radians)
118311
+ };
118312
+ }, getOuterShadowStdDeviation = (shadow) => {
118313
+ return Math.max(0, shadow.blurRadius / 2);
118314
+ }, getOuterShadowPaintExtent = (shadow) => {
118315
+ const { dx, dy } = resolveOuterShadowOffset(shadow);
118316
+ const spread = getOuterShadowStdDeviation(shadow) * 3;
118317
+ return {
118318
+ left: Math.max(0, spread - dx),
118319
+ top: Math.max(0, spread - dy),
118320
+ right: Math.max(0, spread + dx),
118321
+ bottom: Math.max(0, spread + dy)
118322
+ };
118323
+ }, 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) => {
118164
118324
  if (!run$1 || typeof run$1 !== "object")
118165
118325
  return false;
118166
118326
  return typeof run$1.src === "string";
@@ -124678,6 +124838,37 @@ var isRegExp = (value) => {
124678
124838
  const alphaModFix = findChildByLocalName(blip?.elements, "alphaModFix");
124679
124839
  const amt = Number(alphaModFix?.attributes?.amt);
124680
124840
  return Number.isFinite(amt) ? { amt } : undefined;
124841
+ }, buildShapeClipPathFromPreset = (preset) => {
124842
+ if (preset === "ellipse")
124843
+ return "ellipse(50% 50% at 50% 50%)";
124844
+ return null;
124845
+ }, extractPicturePresentation = (picture) => {
124846
+ const blipFill = picture?.elements?.find((el) => el.name === "pic:blipFill");
124847
+ const stretch = findChildByLocalName(blipFill?.elements, "stretch");
124848
+ const fillRect = findChildByLocalName(stretch?.elements, "fillRect");
124849
+ const srcRect = findChildByLocalName(blipFill?.elements, "srcRect");
124850
+ const srcRectAttrs = srcRect?.attributes || {};
124851
+ const clipPath = buildClipPathFromSrcRect(srcRectAttrs);
124852
+ const srcRectHasNegativeValues = [
124853
+ "l",
124854
+ "t",
124855
+ "r",
124856
+ "b"
124857
+ ].some((attr) => {
124858
+ const val = srcRectAttrs[attr];
124859
+ return val != null && parseFloat(val) < 0;
124860
+ });
124861
+ const spPr = picture?.elements?.find((el) => el.name === "pic:spPr");
124862
+ const shapeClipPath = buildShapeClipPathFromPreset(findChildByLocalName(spPr?.elements, "prstGeom")?.attributes?.["prst"]);
124863
+ const shouldStretch = Boolean(stretch && fillRect);
124864
+ return {
124865
+ clipPath,
124866
+ rawSrcRect: srcRect,
124867
+ shouldCover: shouldStretch && !srcRectHasNegativeValues && !clipPath,
124868
+ shouldFillClippedStretch: shouldStretch && !srcRectHasNegativeValues && Boolean(clipPath),
124869
+ shouldCoverShapeStretch: shouldStretch && Boolean(shapeClipPath) && !clipPath,
124870
+ shapeClipPath
124871
+ };
124681
124872
  }, mergeAnchorPaddingIntoWrapDistances = (wrap$1, padding) => {
124682
124873
  if (!wrap$1?.attrs || !padding)
124683
124874
  return;
@@ -124748,7 +124939,289 @@ var isRegExp = (value) => {
124748
124939
  if (placeholder?.attrs && isHidden)
124749
124940
  placeholder.attrs.hidden = true;
124750
124941
  return placeholder;
124751
- }, handleShapeGroup = (params3, node3, graphicData, size2, padding, marginOffset, anchorData, wrap$1, isHidden) => {
124942
+ }, parseEmuNumber = (value, fallback = 0) => {
124943
+ const numeric = Number(value);
124944
+ return Number.isFinite(numeric) ? numeric : fallback;
124945
+ }, getGroupXfrm = (groupNode) => {
124946
+ return findChildByLocalName(findChildByLocalName(groupNode?.elements, "grpSpPr")?.elements, "xfrm");
124947
+ }, buildShapeGroupTransformAttrs = (xfrm) => {
124948
+ const groupTransform = {};
124949
+ if (!xfrm)
124950
+ return groupTransform;
124951
+ if (xfrm.attributes?.["rot"])
124952
+ groupTransform.rotation = rotToDegrees(xfrm.attributes["rot"]);
124953
+ if (xfrm.attributes?.["flipH"] === "1")
124954
+ groupTransform.flipH = true;
124955
+ if (xfrm.attributes?.["flipV"] === "1")
124956
+ groupTransform.flipV = true;
124957
+ const off = findChildByLocalName(xfrm.elements, "off");
124958
+ const ext = findChildByLocalName(xfrm.elements, "ext");
124959
+ const chOff = findChildByLocalName(xfrm.elements, "chOff");
124960
+ const chExt = findChildByLocalName(xfrm.elements, "chExt");
124961
+ if (off) {
124962
+ groupTransform.x = emuToPixels(off.attributes?.["x"] || 0);
124963
+ groupTransform.y = emuToPixels(off.attributes?.["y"] || 0);
124964
+ }
124965
+ if (ext) {
124966
+ groupTransform.width = emuToPixels(ext.attributes?.["cx"] || 0);
124967
+ groupTransform.height = emuToPixels(ext.attributes?.["cy"] || 0);
124968
+ }
124969
+ if (chOff) {
124970
+ groupTransform.childX = emuToPixels(chOff.attributes?.["x"] || 0);
124971
+ groupTransform.childY = emuToPixels(chOff.attributes?.["y"] || 0);
124972
+ groupTransform.childOriginXEmu = parseEmuNumber(chOff.attributes?.["x"]);
124973
+ groupTransform.childOriginYEmu = parseEmuNumber(chOff.attributes?.["y"]);
124974
+ }
124975
+ if (chExt) {
124976
+ groupTransform.childWidth = emuToPixels(chExt.attributes?.["cx"] || 0);
124977
+ groupTransform.childHeight = emuToPixels(chExt.attributes?.["cy"] || 0);
124978
+ }
124979
+ return groupTransform;
124980
+ }, identityMatrix = () => ({
124981
+ a: 1,
124982
+ b: 0,
124983
+ c: 0,
124984
+ d: 1,
124985
+ e: 0,
124986
+ f: 0
124987
+ }), multiplyMatrix = (left, right) => ({
124988
+ a: left.a * right.a + left.c * right.b,
124989
+ b: left.b * right.a + left.d * right.b,
124990
+ c: left.a * right.c + left.c * right.d,
124991
+ d: left.b * right.c + left.d * right.d,
124992
+ e: left.a * right.e + left.c * right.f + left.e,
124993
+ f: left.b * right.e + left.d * right.f + left.f
124994
+ }), transformPoint = (matrix, x, y) => ({
124995
+ x: matrix.a * x + matrix.c * y + matrix.e,
124996
+ y: matrix.b * x + matrix.d * y + matrix.f
124997
+ }), normalizeDegrees = (degrees) => {
124998
+ const normalized = (degrees % 360 + 360) % 360;
124999
+ return Object.is(normalized, -0) ? 0 : normalized;
125000
+ }, decomposeMatrixOrientation = (matrix) => {
125001
+ if (matrix.a * matrix.d - matrix.b * matrix.c < 0)
125002
+ return {
125003
+ rotation: normalizeDegrees(Math.atan2(-matrix.b, -matrix.a) * 180 / Math.PI),
125004
+ flipH: true,
125005
+ flipV: false
125006
+ };
125007
+ return {
125008
+ rotation: normalizeDegrees(Math.atan2(matrix.b, matrix.a) * 180 / Math.PI),
125009
+ flipH: false,
125010
+ flipV: false
125011
+ };
125012
+ }, getVisualOrientationMatrix = ({ rotation = 0, flipH = false, flipV = false } = {}) => {
125013
+ const radians = rotation * Math.PI / 180;
125014
+ const cos = Math.cos(radians);
125015
+ const sin = Math.sin(radians);
125016
+ const flipScaleX = flipH ? -1 : 1;
125017
+ const flipScaleY = flipV ? -1 : 1;
125018
+ return {
125019
+ a: cos * flipScaleX,
125020
+ b: sin * flipScaleX,
125021
+ c: -sin * flipScaleY,
125022
+ d: cos * flipScaleY,
125023
+ e: 0,
125024
+ f: 0
125025
+ };
125026
+ }, getGroupAffineTransform = (xfrm, { includeVisualTransform = false } = {}) => {
125027
+ if (!xfrm)
125028
+ return {
125029
+ matrix: identityMatrix(),
125030
+ rotation: 0,
125031
+ flipH: false,
125032
+ flipV: false
125033
+ };
125034
+ const off = findChildByLocalName(xfrm.elements, "off");
125035
+ const ext = findChildByLocalName(xfrm.elements, "ext");
125036
+ const chOff = findChildByLocalName(xfrm.elements, "chOff");
125037
+ const chExt = findChildByLocalName(xfrm.elements, "chExt");
125038
+ const childWidth = parseEmuNumber(chExt?.attributes?.["cx"]);
125039
+ const childHeight = parseEmuNumber(chExt?.attributes?.["cy"]);
125040
+ const width = parseEmuNumber(ext?.attributes?.["cx"], childWidth || 0);
125041
+ const height = parseEmuNumber(ext?.attributes?.["cy"], childHeight || 0);
125042
+ const childX = parseEmuNumber(chOff?.attributes?.["x"]);
125043
+ const childY = parseEmuNumber(chOff?.attributes?.["y"]);
125044
+ const x = parseEmuNumber(off?.attributes?.["x"]);
125045
+ const y = parseEmuNumber(off?.attributes?.["y"]);
125046
+ const scaleX = childWidth !== 0 ? width / childWidth : 1;
125047
+ const scaleY = childHeight !== 0 ? height / childHeight : 1;
125048
+ const rotation = xfrm.attributes?.["rot"] ? rotToDegrees(xfrm.attributes["rot"]) : 0;
125049
+ const flipH = xfrm.attributes?.["flipH"] === "1";
125050
+ const flipV = xfrm.attributes?.["flipV"] === "1";
125051
+ const baseMatrix = {
125052
+ a: scaleX,
125053
+ b: 0,
125054
+ c: 0,
125055
+ d: scaleY,
125056
+ e: x - childX * scaleX,
125057
+ f: y - childY * scaleY
125058
+ };
125059
+ if (!includeVisualTransform || !rotation && !flipH && !flipV)
125060
+ return {
125061
+ matrix: baseMatrix,
125062
+ rotation: 0,
125063
+ flipH: false,
125064
+ flipV: false
125065
+ };
125066
+ const radians = rotation * Math.PI / 180;
125067
+ const cos = Math.cos(radians);
125068
+ const sin = Math.sin(radians);
125069
+ const flipScaleX = flipH ? -1 : 1;
125070
+ const flipScaleY = flipV ? -1 : 1;
125071
+ const centerX = x + width / 2;
125072
+ const centerY = y + height / 2;
125073
+ return {
125074
+ matrix: multiplyMatrix({
125075
+ a: cos * flipScaleX,
125076
+ b: sin * flipScaleX,
125077
+ c: -sin * flipScaleY,
125078
+ d: cos * flipScaleY,
125079
+ e: centerX - (cos * flipScaleX * centerX + -sin * flipScaleY * centerY),
125080
+ f: centerY - (sin * flipScaleX * centerX + cos * flipScaleY * centerY)
125081
+ }, baseMatrix),
125082
+ rotation,
125083
+ flipH,
125084
+ flipV
125085
+ };
125086
+ }, composeShapeGroupTransform = (parent, child) => {
125087
+ const matrix = multiplyMatrix(parent.matrix, child.matrix);
125088
+ return {
125089
+ matrix,
125090
+ ...decomposeMatrixOrientation(matrix)
125091
+ };
125092
+ }, composeShapeGroupChildOrientation = (rect, xfrm) => {
125093
+ return decomposeMatrixOrientation(multiplyMatrix(getVisualOrientationMatrix({
125094
+ rotation: rect.rotation ?? 0,
125095
+ flipH: Boolean(rect.flipH),
125096
+ flipV: Boolean(rect.flipV)
125097
+ }), getVisualOrientationMatrix({
125098
+ rotation: xfrm?.attributes?.["rot"] ? rotToDegrees(xfrm.attributes["rot"]) : 0,
125099
+ flipH: xfrm?.attributes?.["flipH"] === "1",
125100
+ flipV: xfrm?.attributes?.["flipV"] === "1"
125101
+ })));
125102
+ }, transformShapeGroupChildRect = (transform, rawX, rawY, rawWidth, rawHeight) => {
125103
+ const matrix = transform.matrix ?? identityMatrix();
125104
+ const width = Math.hypot(matrix.a, matrix.b) * rawWidth;
125105
+ const height = Math.hypot(matrix.c, matrix.d) * rawHeight;
125106
+ const center = transformPoint(matrix, rawX + rawWidth / 2, rawY + rawHeight / 2);
125107
+ return {
125108
+ x: emuToPixels(center.x - width / 2),
125109
+ y: emuToPixels(center.y - height / 2),
125110
+ width: emuToPixels(width),
125111
+ height: emuToPixels(height),
125112
+ rotation: transform.rotation ?? 0,
125113
+ flipH: Boolean(transform.flipH),
125114
+ flipV: Boolean(transform.flipV)
125115
+ };
125116
+ }, resolveShapeGroupPicturePath = (pic, params3) => {
125117
+ const blip = findChildByLocalName(findChildByLocalName(pic.elements, "blipFill")?.elements, "blip");
125118
+ if (!blip)
125119
+ return null;
125120
+ const rEmbed = blip.attributes?.["r:embed"];
125121
+ if (!rEmbed)
125122
+ return null;
125123
+ const currentFile = params3.filename || "document.xml";
125124
+ let rels = params3.docx[`word/_rels/${currentFile}.rels`];
125125
+ if (!rels)
125126
+ rels = params3.docx[`word/_rels/document.xml.rels`];
125127
+ const rel = rels?.elements.find((el) => el.name === "Relationships")?.elements?.find((el) => el.attributes["Id"] === rEmbed);
125128
+ if (!rel)
125129
+ return null;
125130
+ return normalizeTargetPath$1(rel.attributes?.["Target"]);
125131
+ }, parseShapeGroupVectorChild = (wsp, transform, params3) => {
125132
+ const spPr = findChildByLocalName(wsp.elements, "spPr");
125133
+ if (!spPr)
125134
+ return null;
125135
+ const shapeKind = findChildByLocalName(spPr.elements, "prstGeom")?.attributes?.["prst"];
125136
+ const customGeom = !shapeKind ? extractCustomGeometry(spPr) : null;
125137
+ const shapeXfrm = findChildByLocalName(spPr.elements, "xfrm");
125138
+ const shapeOff = findChildByLocalName(shapeXfrm?.elements, "off");
125139
+ const shapeExt = findChildByLocalName(shapeXfrm?.elements, "ext");
125140
+ const rect = transformShapeGroupChildRect(transform, parseEmuNumber(shapeOff?.attributes?.["x"]), parseEmuNumber(shapeOff?.attributes?.["y"]), parseEmuNumber(shapeExt?.attributes?.["cx"], 914400), parseEmuNumber(shapeExt?.attributes?.["cy"], 914400));
125141
+ const orientation = composeShapeGroupChildOrientation(rect, shapeXfrm);
125142
+ const style = findChildByLocalName(wsp.elements, "style");
125143
+ const fillColor = extractFillColor(spPr, style);
125144
+ const strokeColor = extractStrokeColor(spPr, style);
125145
+ const strokeWidth = extractStrokeWidth(spPr);
125146
+ const lineEnds = extractLineEnds(spPr);
125147
+ const effects = extractShapeEffects(spPr);
125148
+ const cNvPr = findChildByLocalName(wsp.elements, "cNvPr");
125149
+ const shapeId = cNvPr?.attributes?.["id"];
125150
+ const shapeName = cNvPr?.attributes?.["name"];
125151
+ const textBoxContent = findChildByLocalName(findChildByLocalName(wsp.elements, "txbx")?.elements, "txbxContent");
125152
+ const bodyPr = findChildByLocalName(wsp.elements, "bodyPr");
125153
+ const textContent = textBoxContent ? extractTextFromTextBox(textBoxContent, bodyPr, params3) : null;
125154
+ const textAlign = textContent?.horizontalAlign || "left";
125155
+ return {
125156
+ shapeType: "vectorShape",
125157
+ attrs: {
125158
+ kind: shapeKind,
125159
+ customGeometry: customGeom || undefined,
125160
+ ...rect,
125161
+ ...orientation,
125162
+ fillColor,
125163
+ strokeColor,
125164
+ strokeWidth,
125165
+ lineEnds,
125166
+ effects,
125167
+ shapeId,
125168
+ shapeName,
125169
+ textContent,
125170
+ textAlign,
125171
+ textVerticalAlign: textContent?.verticalAlign,
125172
+ textInsets: textContent?.insets
125173
+ }
125174
+ };
125175
+ }, parseShapeGroupImageChild = (pic, transform, params3) => {
125176
+ const spPr = findChildByLocalName(pic.elements, "spPr");
125177
+ if (!spPr)
125178
+ return null;
125179
+ const xfrm = findChildByLocalName(spPr.elements, "xfrm");
125180
+ const off = findChildByLocalName(xfrm?.elements, "off");
125181
+ const ext = findChildByLocalName(xfrm?.elements, "ext");
125182
+ const rect = transformShapeGroupChildRect(transform, parseEmuNumber(off?.attributes?.["x"]), parseEmuNumber(off?.attributes?.["y"]), parseEmuNumber(ext?.attributes?.["cx"], 914400), parseEmuNumber(ext?.attributes?.["cy"], 914400));
125183
+ const orientation = composeShapeGroupChildOrientation(rect, xfrm);
125184
+ const path2 = resolveShapeGroupPicturePath(pic, params3);
125185
+ if (!path2)
125186
+ return null;
125187
+ const alphaModFix = extractAlphaModFix(findChildByLocalName(findChildByLocalName(pic.elements, "blipFill")?.elements, "blip"));
125188
+ const cNvPr = findChildByLocalName(findChildByLocalName(pic.elements, "nvPicPr")?.elements, "cNvPr");
125189
+ const picId = cNvPr?.attributes?.["id"];
125190
+ const picName = cNvPr?.attributes?.["name"];
125191
+ const { clipPath, shouldCover, shouldFillClippedStretch, shouldCoverShapeStretch, shapeClipPath } = extractPicturePresentation(pic);
125192
+ return {
125193
+ shapeType: "image",
125194
+ attrs: {
125195
+ ...rect,
125196
+ ...orientation,
125197
+ src: path2,
125198
+ imageId: picId,
125199
+ imageName: picName,
125200
+ ...alphaModFix ? { alphaModFix } : {},
125201
+ ...clipPath ? { clipPath } : {},
125202
+ ...shapeClipPath ? { shapeClipPath } : {},
125203
+ ...shouldFillClippedStretch || shouldCoverShapeStretch ? { objectFit: shouldFillClippedStretch ? "fill" : "cover" } : shouldCover ? { objectFit: "cover" } : {}
125204
+ }
125205
+ };
125206
+ }, collectShapeGroupChildren = (groupNode, transform, params3) => {
125207
+ const children = [];
125208
+ for (const child of groupNode?.elements || []) {
125209
+ const localName = getLocalName$1(child?.name);
125210
+ if (localName === "wsp") {
125211
+ const shape = parseShapeGroupVectorChild(child, transform, params3);
125212
+ if (shape)
125213
+ children.push(shape);
125214
+ } else if (localName === "pic") {
125215
+ const picture = parseShapeGroupImageChild(child, transform, params3);
125216
+ if (picture)
125217
+ children.push(picture);
125218
+ } else if (localName === "grpSp") {
125219
+ const nestedTransform = composeShapeGroupTransform(transform, getGroupAffineTransform(getGroupXfrm(child), { includeVisualTransform: true }));
125220
+ children.push(...collectShapeGroupChildren(child, nestedTransform, params3));
125221
+ }
125222
+ }
125223
+ return children;
125224
+ }, handleShapeGroup = (params3, node3, graphicData, size2, padding, marginOffset, anchorData, wrap$1, effectExtent, isHidden) => {
124752
125225
  const wgp = graphicData.elements.find((el) => el.name === "wpg:wgp");
124753
125226
  if (!wgp) {
124754
125227
  const placeholder = buildShapePlaceholder(node3, size2, padding, marginOffset, "group");
@@ -124756,166 +125229,9 @@ var isRegExp = (value) => {
124756
125229
  placeholder.attrs.hidden = true;
124757
125230
  return placeholder;
124758
125231
  }
124759
- const xfrm = findChildByLocalName(wgp.elements.find((el) => el.name === "wpg:grpSpPr")?.elements, "xfrm");
124760
- const groupTransform = {};
124761
- if (xfrm) {
124762
- const off = findChildByLocalName(xfrm.elements, "off");
124763
- const ext = findChildByLocalName(xfrm.elements, "ext");
124764
- const chOff = findChildByLocalName(xfrm.elements, "chOff");
124765
- const chExt = findChildByLocalName(xfrm.elements, "chExt");
124766
- if (off) {
124767
- groupTransform.x = emuToPixels(off.attributes?.["x"] || 0);
124768
- groupTransform.y = emuToPixels(off.attributes?.["y"] || 0);
124769
- }
124770
- if (ext) {
124771
- groupTransform.width = emuToPixels(ext.attributes?.["cx"] || 0);
124772
- groupTransform.height = emuToPixels(ext.attributes?.["cy"] || 0);
124773
- }
124774
- if (chOff) {
124775
- groupTransform.childX = emuToPixels(chOff.attributes?.["x"] || 0);
124776
- groupTransform.childY = emuToPixels(chOff.attributes?.["y"] || 0);
124777
- groupTransform.childOriginXEmu = parseFloat(chOff.attributes?.["x"] || 0);
124778
- groupTransform.childOriginYEmu = parseFloat(chOff.attributes?.["y"] || 0);
124779
- }
124780
- if (chExt) {
124781
- groupTransform.childWidth = emuToPixels(chExt.attributes?.["cx"] || 0);
124782
- groupTransform.childHeight = emuToPixels(chExt.attributes?.["cy"] || 0);
124783
- }
124784
- }
124785
- const childShapes = wgp.elements.filter((el) => el.name === "wps:wsp");
124786
- const childPictures = wgp.elements.filter((el) => el.name === "pic:pic");
124787
- const shapes = childShapes.map((wsp) => {
124788
- const spPr = wsp.elements?.find((el) => el.name === "wps:spPr");
124789
- if (!spPr)
124790
- return null;
124791
- const shapeKind = findChildByLocalName(spPr.elements, "prstGeom")?.attributes?.["prst"];
124792
- const customGeom = !shapeKind ? extractCustomGeometry(spPr) : null;
124793
- const shapeXfrm = findChildByLocalName(spPr.elements, "xfrm");
124794
- const shapeOff = findChildByLocalName(shapeXfrm?.elements, "off");
124795
- const shapeExt = findChildByLocalName(shapeXfrm?.elements, "ext");
124796
- const rawX = shapeOff?.attributes?.["x"] ? parseFloat(shapeOff.attributes["x"]) : 0;
124797
- const rawY = shapeOff?.attributes?.["y"] ? parseFloat(shapeOff.attributes["y"]) : 0;
124798
- const rawWidth = shapeExt?.attributes?.["cx"] ? parseFloat(shapeExt.attributes["cx"]) : 914400;
124799
- const rawHeight = shapeExt?.attributes?.["cy"] ? parseFloat(shapeExt.attributes["cy"]) : 914400;
124800
- let x, y, width, height;
124801
- if (groupTransform.childWidth && groupTransform.childHeight) {
124802
- const scaleX = groupTransform.width / groupTransform.childWidth;
124803
- const scaleY = groupTransform.height / groupTransform.childHeight;
124804
- const childOriginX = groupTransform.childOriginXEmu || 0;
124805
- const childOriginY = groupTransform.childOriginYEmu || 0;
124806
- x = groupTransform.x + emuToPixels((rawX - childOriginX) * scaleX);
124807
- y = groupTransform.y + emuToPixels((rawY - childOriginY) * scaleY);
124808
- width = emuToPixels(rawWidth * scaleX);
124809
- height = emuToPixels(rawHeight * scaleY);
124810
- } else {
124811
- x = emuToPixels(rawX);
124812
- y = emuToPixels(rawY);
124813
- width = emuToPixels(rawWidth);
124814
- height = emuToPixels(rawHeight);
124815
- }
124816
- const rotation = shapeXfrm?.attributes?.["rot"] ? rotToDegrees(shapeXfrm.attributes["rot"]) : 0;
124817
- const flipH = shapeXfrm?.attributes?.["flipH"] === "1";
124818
- const flipV = shapeXfrm?.attributes?.["flipV"] === "1";
124819
- const style = wsp.elements?.find((el) => el.name === "wps:style");
124820
- const fillColor = extractFillColor(spPr, style);
124821
- const strokeColor = extractStrokeColor(spPr, style);
124822
- const strokeWidth = extractStrokeWidth(spPr);
124823
- const lineEnds = extractLineEnds(spPr);
124824
- const cNvPr = wsp.elements?.find((el) => el.name === "wps:cNvPr");
124825
- const shapeId = cNvPr?.attributes?.["id"];
124826
- const shapeName = cNvPr?.attributes?.["name"];
124827
- const textBoxContent = wsp.elements?.find((el) => el.name === "wps:txbx")?.elements?.find((el) => el.name === "w:txbxContent");
124828
- const bodyPr = wsp.elements?.find((el) => el.name === "wps:bodyPr");
124829
- let textContent = null;
124830
- if (textBoxContent)
124831
- textContent = extractTextFromTextBox(textBoxContent, bodyPr, params3);
124832
- const textAlign = textContent?.horizontalAlign || "left";
124833
- return {
124834
- shapeType: "vectorShape",
124835
- attrs: {
124836
- kind: shapeKind,
124837
- customGeometry: customGeom || undefined,
124838
- x,
124839
- y,
124840
- width,
124841
- height,
124842
- rotation,
124843
- flipH,
124844
- flipV,
124845
- fillColor,
124846
- strokeColor,
124847
- strokeWidth,
124848
- lineEnds,
124849
- shapeId,
124850
- shapeName,
124851
- textContent,
124852
- textAlign,
124853
- textVerticalAlign: textContent?.verticalAlign,
124854
- textInsets: textContent?.insets
124855
- }
124856
- };
124857
- }).filter(Boolean);
124858
- const allShapes = [...childPictures.map((pic) => {
124859
- const spPr = pic.elements?.find((el) => el.name === "pic:spPr");
124860
- if (!spPr)
124861
- return null;
124862
- const xfrm$1 = findChildByLocalName(spPr.elements, "xfrm");
124863
- const off = findChildByLocalName(xfrm$1?.elements, "off");
124864
- const ext = findChildByLocalName(xfrm$1?.elements, "ext");
124865
- const rawX = off?.attributes?.["x"] ? parseFloat(off.attributes["x"]) : 0;
124866
- const rawY = off?.attributes?.["y"] ? parseFloat(off.attributes["y"]) : 0;
124867
- const rawWidth = ext?.attributes?.["cx"] ? parseFloat(ext.attributes["cx"]) : 914400;
124868
- const rawHeight = ext?.attributes?.["cy"] ? parseFloat(ext.attributes["cy"]) : 914400;
124869
- let x, y, width, height;
124870
- if (groupTransform.childWidth && groupTransform.childHeight) {
124871
- const scaleX = groupTransform.width / groupTransform.childWidth;
124872
- const scaleY = groupTransform.height / groupTransform.childHeight;
124873
- const childOriginX = groupTransform.childOriginXEmu || 0;
124874
- const childOriginY = groupTransform.childOriginYEmu || 0;
124875
- x = groupTransform.x + emuToPixels((rawX - childOriginX) * scaleX);
124876
- y = groupTransform.y + emuToPixels((rawY - childOriginY) * scaleY);
124877
- width = emuToPixels(rawWidth * scaleX);
124878
- height = emuToPixels(rawHeight * scaleY);
124879
- } else {
124880
- x = emuToPixels(rawX);
124881
- y = emuToPixels(rawY);
124882
- width = emuToPixels(rawWidth);
124883
- height = emuToPixels(rawHeight);
124884
- }
124885
- const blipFill = pic.elements?.find((el) => el.name === "pic:blipFill");
124886
- const blip = findChildByLocalName(blipFill?.elements, "blip");
124887
- if (!blip)
124888
- return null;
124889
- const alphaModFix = extractAlphaModFix(blip);
124890
- const rEmbed = blip.attributes?.["r:embed"];
124891
- if (!rEmbed)
124892
- return null;
124893
- const currentFile = params3.filename || "document.xml";
124894
- let rels = params3.docx[`word/_rels/${currentFile}.rels`];
124895
- if (!rels)
124896
- rels = params3.docx[`word/_rels/document.xml.rels`];
124897
- const { elements } = rels?.elements.find((el) => el.name === "Relationships") || [];
124898
- const rel = elements?.find((el) => el.attributes["Id"] === rEmbed);
124899
- if (!rel)
124900
- return null;
124901
- const path2 = normalizeTargetPath$1(rel.attributes?.["Target"]);
124902
- const cNvPr = pic.elements?.find((el) => el.name === "pic:nvPicPr")?.elements?.find((el) => el.name === "pic:cNvPr");
124903
- const picId = cNvPr?.attributes?.["id"];
124904
- const picName = cNvPr?.attributes?.["name"];
124905
- return {
124906
- shapeType: "image",
124907
- attrs: {
124908
- x,
124909
- y,
124910
- width,
124911
- height,
124912
- src: path2,
124913
- imageId: picId,
124914
- imageName: picName,
124915
- ...alphaModFix ? { alphaModFix } : {}
124916
- }
124917
- };
124918
- }).filter(Boolean), ...shapes];
125232
+ const groupXfrm = getGroupXfrm(wgp);
125233
+ const groupTransform = buildShapeGroupTransformAttrs(groupXfrm);
125234
+ const allShapes = collectShapeGroupChildren(wgp, getGroupAffineTransform(groupXfrm), params3);
124919
125235
  const schemaAttrs = {};
124920
125236
  const drawingNode = params3.nodes?.[0];
124921
125237
  if (drawingNode?.name === DRAWING_XML_TAG)
@@ -124930,6 +125246,7 @@ var isRegExp = (value) => {
124930
125246
  size: size2,
124931
125247
  padding,
124932
125248
  marginOffset,
125249
+ effectExtent,
124933
125250
  anchorData,
124934
125251
  wrap: wrap$1,
124935
125252
  originalAttributes: node3?.attributes
@@ -135685,7 +136002,7 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
135685
136002
  return children;
135686
136003
  }
135687
136004
  return [];
135688
- }, NON_RENDERED_STRUCTURAL_INLINE_TYPES, PARAGRAPH_CONTAINER_TYPES, NON_BREAKING_HYPHEN = "‑", DEFAULT_IMAGE_DIMENSION_PX = 100, isNodeHidden = (node3) => {
136005
+ }, 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 = (node3) => {
135689
136006
  const attrs = node3.attrs ?? {};
135690
136007
  if (attrs.hidden === true)
135691
136008
  return true;
@@ -136007,6 +136324,7 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
136007
136324
  fillColor: normalizeFillColor(rawAttrs.fillColor),
136008
136325
  strokeColor: normalizeStrokeColor(rawAttrs.strokeColor),
136009
136326
  strokeWidth: coerceNumber(rawAttrs.strokeWidth),
136327
+ effects: normalizeShapeEffects(rawAttrs.effects),
136010
136328
  textContent: normalizeTextContent(rawAttrs.textContent),
136011
136329
  textAlign: typeof rawAttrs.textAlign === "string" ? rawAttrs.textAlign : undefined,
136012
136330
  textVerticalAlign: normalizeTextVerticalAlign(rawAttrs.textVerticalAlign),
@@ -136014,6 +136332,77 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
136014
136332
  sourceAnchor,
136015
136333
  ...extraProps
136016
136334
  };
136335
+ }, mergeEffectExtents = (base$1, supplement) => {
136336
+ if (!base$1)
136337
+ return supplement;
136338
+ if (!supplement)
136339
+ return base$1;
136340
+ return {
136341
+ left: Math.max(base$1.left, supplement.left),
136342
+ top: Math.max(base$1.top, supplement.top),
136343
+ right: Math.max(base$1.right, supplement.right),
136344
+ bottom: Math.max(base$1.bottom, supplement.bottom)
136345
+ };
136346
+ }, hasEffectExtent = (extent) => {
136347
+ return !!extent && (extent.left > 0 || extent.top > 0 || extent.right > 0 || extent.bottom > 0);
136348
+ }, getCenteredStrokeHalfExtent = (attrs) => {
136349
+ if (!("fillColor" in attrs))
136350
+ return 0;
136351
+ if ("lineEnds" in attrs && attrs.lineEnds)
136352
+ return 0;
136353
+ if (attrs.strokeColor === null)
136354
+ return 0;
136355
+ const strokeWidth = pickNumber(attrs.strokeWidth) ?? 1;
136356
+ return strokeWidth > 0 ? strokeWidth / 2 : 0;
136357
+ }, getShapeGroupChildStrokeExtent = (child) => {
136358
+ if (child.shapeType !== "vectorShape" || !isPlainObject3(child.attrs))
136359
+ return 0;
136360
+ return getCenteredStrokeHalfExtent(child.attrs);
136361
+ }, getOuterShadowPaintExtent$1 = (attrs) => {
136362
+ if ("lineEnds" in attrs && attrs.lineEnds)
136363
+ return;
136364
+ const shadow = normalizeShapeEffects(attrs.effects)?.outerShadow;
136365
+ if (!shadow)
136366
+ return;
136367
+ const extent = getOuterShadowPaintExtent(shadow);
136368
+ return hasEffectExtent(extent) ? extent : undefined;
136369
+ }, getRequiredVectorShapeEffectExtent = (attrs) => {
136370
+ const strokeExtent = getCenteredStrokeHalfExtent(attrs);
136371
+ return mergeEffectExtents(strokeExtent > 0 ? {
136372
+ left: strokeExtent,
136373
+ top: strokeExtent,
136374
+ right: strokeExtent,
136375
+ bottom: strokeExtent
136376
+ } : undefined, getOuterShadowPaintExtent$1(attrs));
136377
+ }, getRequiredGroupEffectExtentFromChildren = (children, width, height) => {
136378
+ const required = {
136379
+ left: 0,
136380
+ top: 0,
136381
+ right: 0,
136382
+ bottom: 0
136383
+ };
136384
+ for (const child of children) {
136385
+ if (child.shapeType !== "vectorShape" || !isPlainObject3(child.attrs))
136386
+ continue;
136387
+ const strokeExtent = getShapeGroupChildStrokeExtent(child);
136388
+ const paintExtent = mergeEffectExtents(strokeExtent > 0 ? {
136389
+ left: strokeExtent,
136390
+ top: strokeExtent,
136391
+ right: strokeExtent,
136392
+ bottom: strokeExtent
136393
+ } : undefined, getOuterShadowPaintExtent$1(child.attrs));
136394
+ if (!paintExtent)
136395
+ continue;
136396
+ const childX = pickNumber(child.attrs.x) ?? 0;
136397
+ const childY = pickNumber(child.attrs.y) ?? 0;
136398
+ const childWidth = pickNumber(child.attrs.width) ?? 0;
136399
+ const childHeight = pickNumber(child.attrs.height) ?? 0;
136400
+ required.left = Math.max(required.left, Math.max(0, paintExtent.left - childX));
136401
+ required.top = Math.max(required.top, Math.max(0, paintExtent.top - childY));
136402
+ required.right = Math.max(required.right, Math.max(0, childX + childWidth + paintExtent.right - width));
136403
+ required.bottom = Math.max(required.bottom, Math.max(0, childY + childHeight + paintExtent.bottom - height));
136404
+ }
136405
+ return hasEffectExtent(required) ? required : undefined;
136017
136406
  }, getAttrs$1 = (node3) => {
136018
136407
  return isPlainObject3(node3.attrs) ? { ...node3.attrs } : {};
136019
136408
  }, parseFullWidth = (value) => {
@@ -137282,7 +137671,7 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
137282
137671
  "data-track-change-date": change.date || ""
137283
137672
  }));
137284
137673
  }
137285
- }, 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_MODES2, 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 }) => {
137674
+ }, 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_MODES2, 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 }) => {
137286
137675
  if (!runProps?.elements?.length || !state)
137287
137676
  return;
137288
137677
  const fontsNode = runProps.elements.find((el) => el.name === "w:rFonts");
@@ -137316,7 +137705,7 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
137316
137705
  state.kern = kernNode.attributes["w:val"];
137317
137706
  }
137318
137707
  }, SuperConverter;
137319
- var init_SuperConverter_DQ2wMaLK_es = __esm(() => {
137708
+ var init_SuperConverter_DJEK5GYX_es = __esm(() => {
137320
137709
  init_rolldown_runtime_Bg48TavK_es();
137321
137710
  init_jszip_C49i9kUs_es();
137322
137711
  init_xml_js_CqGKpaft_es();
@@ -164760,6 +165149,12 @@ var init_SuperConverter_DQ2wMaLK_es = __esm(() => {
164760
165149
  "index",
164761
165150
  "tableOfAuthorities"
164762
165151
  ]);
165152
+ ALLOWED_OBJECT_FIT = new Set([
165153
+ "contain",
165154
+ "cover",
165155
+ "fill",
165156
+ "scale-down"
165157
+ ]);
164763
165158
  VERTICAL_ELEMENTS = {
164764
165159
  "m:f": 0.6,
164765
165160
  "m:bar": 0.25,
@@ -166325,7 +166720,7 @@ var init_SuperConverter_DQ2wMaLK_es = __esm(() => {
166325
166720
  };
166326
166721
  });
166327
166722
 
166328
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-BhSfQYaO.es.js
166723
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-BYe9VWHO.es.js
166329
166724
  function parseSizeUnit(val = "0") {
166330
166725
  const length3 = val.toString() || "0";
166331
166726
  const value = Number.parseFloat(length3);
@@ -177068,9 +177463,9 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, MARK_KEYS, STEP_OP_CATALOG_UNFROZEN2, P
177068
177463
  }
177069
177464
  };
177070
177465
  };
177071
- var init_create_headless_toolbar_BhSfQYaO_es = __esm(() => {
177466
+ var init_create_headless_toolbar_BYe9VWHO_es = __esm(() => {
177072
177467
  init_rolldown_runtime_Bg48TavK_es();
177073
- init_SuperConverter_DQ2wMaLK_es();
177468
+ init_SuperConverter_DJEK5GYX_es();
177074
177469
  init_jszip_C49i9kUs_es();
177075
177470
  init_uuid_B2wVPhPi_es();
177076
177471
  init_constants_D9qj59G2_es();
@@ -227164,7 +227559,7 @@ var init_remark_gfm_DCND_V_3_es = __esm(() => {
227164
227559
  init_remark_gfm_BUJjZJLy_es();
227165
227560
  });
227166
227561
 
227167
- // ../../packages/superdoc/dist/chunks/src-CkxGCnVm.es.js
227562
+ // ../../packages/superdoc/dist/chunks/src-q2d5WRO-.es.js
227168
227563
  function deleteProps(obj, propOrProps) {
227169
227564
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
227170
227565
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -227311,7 +227706,7 @@ function prosemirrorToYXmlFragment(doc$12, xmlFragment) {
227311
227706
  }
227312
227707
  function getSuperdocVersion() {
227313
227708
  try {
227314
- return "1.41.0";
227709
+ return "1.43.0";
227315
227710
  } catch {
227316
227711
  return "unknown";
227317
227712
  }
@@ -233430,11 +233825,25 @@ function x0(t, n, o) {
233430
233825
  paths: l.paths
233431
233826
  } : null;
233432
233827
  }
233828
+ function W0(t, n, o) {
233829
+ 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);
233830
+ return {
233831
+ preset: "roundRect",
233832
+ viewBox: `0 0 ${L} ${e}`,
233833
+ paths: l0([{
233834
+ 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`,
233835
+ fill: "#000000",
233836
+ stroke: "#000000"
233837
+ }], o)
233838
+ };
233839
+ }
233433
233840
  function i0(t) {
233434
233841
  let { preset: n, styleOverrides: o, width: L, height: e } = t;
233435
233842
  if (!n)
233436
233843
  throw new Error("createPresetShape requires a preset name.");
233437
- if (F.has(n) && L != null && e != null && L !== e) {
233844
+ if (n === "roundRect" && L != null && e != null)
233845
+ return W0(L, e, o);
233846
+ if (F.has(n) && L != null && e != null && (L !== e || n === "leftUpArrow")) {
233438
233847
  let i3 = x0(n, L, e);
233439
233848
  if (i3)
233440
233849
  return {
@@ -271477,6 +271886,19 @@ function calculateFirstLineIndent(block, measure) {
271477
271886
  const gutterWidthRaw = measure.marker.gutterWidth ?? 0;
271478
271887
  return markerWidth + (Number.isFinite(gutterWidthRaw) && gutterWidthRaw >= 0 ? gutterWidthRaw : 0);
271479
271888
  }
271889
+ function getSuppressedMarkerImageGroupAnchorOffset(entry, suppressVisibleSectPrMarkerParagraph, hasPageRelativeAnchorForParagraph, markerSpacingBefore) {
271890
+ if (!suppressVisibleSectPrMarkerParagraph || !hasPageRelativeAnchorForParagraph)
271891
+ return 0;
271892
+ if (entry.block.kind !== "drawing" || entry.block.drawingKind !== "shapeGroup")
271893
+ return 0;
271894
+ if (!entry.block.shapes?.some((child) => child.shapeType === "image"))
271895
+ return 0;
271896
+ if ((entry.block.anchor?.vRelativeFrom ?? "paragraph") !== "paragraph")
271897
+ return 0;
271898
+ if (entry.block.anchor?.alignV && entry.block.anchor.alignV !== "top")
271899
+ return 0;
271900
+ return Math.max(0, markerSpacingBefore / 2);
271901
+ }
271480
271902
  function layoutParagraphBlock(ctx$1, anchors) {
271481
271903
  const { block, measure, columnWidth, ensurePage, advanceColumn, columnX, floatManager } = ctx$1;
271482
271904
  const remeasureParagraph$1 = ctx$1.remeasureParagraph;
@@ -271513,6 +271935,13 @@ function layoutParagraphBlock(ctx$1, anchors) {
271513
271935
  if (!spacingExplicit.after)
271514
271936
  spacingAfter = 0;
271515
271937
  }
271938
+ const markerSpacingBefore = spacingBefore;
271939
+ const hasAnchoredObjects = Boolean(anchors?.anchoredDrawings?.length || anchors?.anchoredTables?.length);
271940
+ const suppressVisibleSectPrMarkerParagraph = attrs?.sectPrMarker === true && emptyTextParagraph && hasAnchoredObjects;
271941
+ if (suppressVisibleSectPrMarkerParagraph) {
271942
+ spacingBefore = 0;
271943
+ spacingAfter = 0;
271944
+ }
271516
271945
  const baseSpacingBefore = spacingBefore;
271517
271946
  let appliedSpacingBefore = spacingBefore === 0;
271518
271947
  let lastState = null;
@@ -271531,7 +271960,11 @@ function layoutParagraphBlock(ctx$1, anchors) {
271531
271960
  suppressSpacingBefore: shouldSuppressOwnSpacing(styleId$1, contextualSpacing, previewState.lastParagraphStyleId),
271532
271961
  rewindTrailingFromPrevious: shouldSuppressOwnSpacing(previewState.lastParagraphStyleId, previewState.lastParagraphContextualSpacing, styleId$1)
271533
271962
  }) + borderExpansion.top - (inBorderGroup ? rawBorderExpansion.bottom : 0);
271963
+ const sectionBaseTopMargin = anchors?.sectionBaseTopMargin;
271964
+ const sectionHeaderDistance = typeof anchors?.sectionHeaderDistance === "number" ? Math.max(0, anchors.sectionHeaderDistance) : 0;
271965
+ 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;
271534
271966
  let paragraphContentEndY = paragraphAnchorBaseY;
271967
+ const anchorFirstLineHeight = suppressVisibleSectPrMarkerParagraph ? 0 : measure.lines?.[0]?.lineHeight ?? 0;
271535
271968
  const registerAnchoredDrawingsAt = (paragraphContentStartY) => {
271536
271969
  if (!anchors?.anchoredDrawings?.length)
271537
271970
  return;
@@ -271541,14 +271974,15 @@ function layoutParagraphBlock(ctx$1, anchors) {
271541
271974
  const state = ensurePage();
271542
271975
  const contentTop = state.topMargin;
271543
271976
  const contentBottom = state.contentBottom;
271977
+ const anchorParagraphY = paragraphContentStartY + getSuppressedMarkerImageGroupAnchorOffset(entry, suppressVisibleSectPrMarkerParagraph, anchors.hasPageRelativeAnchorForParagraph === true, markerSpacingBefore);
271544
271978
  const anchorY = resolveAnchoredGraphicY({
271545
271979
  anchor: entry.block.anchor,
271546
271980
  objectHeight: entry.measure.height,
271547
271981
  contentTop,
271548
271982
  contentBottom,
271549
271983
  pageBottomMargin: anchors.pageMargins.bottom ?? 0,
271550
- anchorParagraphY: paragraphContentStartY,
271551
- firstLineHeight: measure.lines?.[0]?.lineHeight ?? 0
271984
+ anchorParagraphY,
271985
+ firstLineHeight: anchorFirstLineHeight
271552
271986
  });
271553
271987
  floatManager.registerDrawing(entry.block, entry.measure, anchorY, state.columnIndex, state.page.number);
271554
271988
  const anchorX = entry.block.anchor ? resolveAnchoredGraphicX(entry.block.anchor, state.columnIndex, anchors.columns, entry.measure.width, {
@@ -271627,7 +272061,7 @@ function layoutParagraphBlock(ctx$1, anchors) {
271627
272061
  anchors.placedAnchoredIds.add(entry.block.id);
271628
272062
  }
271629
272063
  };
271630
- registerAnchoredDrawingsAt(paragraphAnchorBaseY);
272064
+ registerAnchoredDrawingsAt(effectiveParagraphAnchorBaseY);
271631
272065
  const registerAnchoredTablesAt = (paragraphContentStartY, entries2) => {
271632
272066
  if (!entries2.length)
271633
272067
  return;
@@ -271643,7 +272077,7 @@ function layoutParagraphBlock(ctx$1, anchors) {
271643
272077
  const contentTop = state.topMargin;
271644
272078
  const contentBottom = state.contentBottom;
271645
272079
  const layoutOffsetV = entry.layoutOffsetV;
271646
- const firstLineHeight = measure.lines?.[0]?.lineHeight ?? 0;
272080
+ const firstLineHeight = anchorFirstLineHeight;
271647
272081
  const wrapType = entry.block.wrap?.type ?? "None";
271648
272082
  const anchorY = resolveAnchoredGraphicY({
271649
272083
  anchor: graphicAnchorY(anchorForLineScopedFormField(layoutOffsetV != null && entry.block.anchor ? {
@@ -271655,7 +272089,7 @@ function layoutParagraphBlock(ctx$1, anchors) {
271655
272089
  contentBottom,
271656
272090
  pageBottomMargin: anchors.pageMargins.bottom ?? 0,
271657
272091
  anchorParagraphY: nextStackY,
271658
- firstLineHeight: measure.lines?.[0]?.lineHeight ?? 0
272092
+ firstLineHeight: anchorFirstLineHeight
271659
272093
  });
271660
272094
  floatManager.registerTable(entry.block, entry.measure, anchorY, state.columnIndex, state.page.number);
271661
272095
  const anchorX = entry.block.anchor ? resolveAnchoredGraphicX(graphicAnchorH(entry.block.anchor), state.columnIndex, anchors.columns, totalWidth, {
@@ -271676,11 +272110,15 @@ function layoutParagraphBlock(ctx$1, anchors) {
271676
272110
  const remainingHeightOnStartPage = previewState.contentBottom - paragraphAnchorBaseY;
271677
272111
  const paragraphWillSpanPages = lines.length > 1 && totalLineHeight > remainingHeightOnStartPage;
271678
272112
  const shouldPreLayoutSquareTable = (entry) => entry.lineScopedOnAnchor === true && !paragraphWillSpanPages;
271679
- registerAnchoredTablesAt(paragraphAnchorBaseY, anchoredTablesForPara.filter((entry) => {
272113
+ registerAnchoredTablesAt(effectiveParagraphAnchorBaseY, anchoredTablesForPara.filter((entry) => {
271680
272114
  if ((entry.block.wrap?.type ?? "None") === "None")
271681
272115
  return true;
271682
272116
  return shouldPreLayoutSquareTable(entry);
271683
272117
  }));
272118
+ if (suppressVisibleSectPrMarkerParagraph) {
272119
+ registerAnchoredTablesAt(effectiveParagraphAnchorBaseY, anchors?.anchoredTables ?? []);
272120
+ return;
272121
+ }
271684
272122
  if (frame?.wrap === "none") {
271685
272123
  let state = ensurePage();
271686
272124
  if (state.cursorY >= state.contentBottom)
@@ -272141,6 +272579,34 @@ function collectPreRegisteredAnchors(blocks2, measures) {
272141
272579
  }
272142
272580
  return result;
272143
272581
  }
272582
+ function collectPageRelativeAnchorsByParagraph(blocks2, measures) {
272583
+ const map$12 = /* @__PURE__ */ new Map;
272584
+ const len2 = Math.min(blocks2.length, measures.length);
272585
+ const paragraphIndexById = buildParagraphIndexById(blocks2, len2);
272586
+ for (let i3 = 0;i3 < len2; i3 += 1) {
272587
+ const block = blocks2[i3];
272588
+ const measure = measures[i3];
272589
+ const isImage = block.kind === "image" && measure?.kind === "image";
272590
+ const isDrawing = block.kind === "drawing" && measure?.kind === "drawing";
272591
+ if (!isImage && !isDrawing)
272592
+ continue;
272593
+ const drawingBlock = block;
272594
+ const drawingMeasure = measure;
272595
+ if (!drawingBlock.anchor?.isAnchored || !isPageRelativeAnchor(drawingBlock))
272596
+ continue;
272597
+ const anchorParagraphId = typeof drawingBlock.attrs === "object" && drawingBlock.attrs ? drawingBlock.attrs.anchorParagraphId : undefined;
272598
+ const anchorParaIndex = resolveAnchorParagraphIndex(blocks2, len2, paragraphIndexById, i3, anchorParagraphId);
272599
+ if (anchorParaIndex == null)
272600
+ continue;
272601
+ const list5 = map$12.get(anchorParaIndex) ?? [];
272602
+ list5.push({
272603
+ block: drawingBlock,
272604
+ measure: drawingMeasure
272605
+ });
272606
+ map$12.set(anchorParaIndex, list5);
272607
+ }
272608
+ return map$12;
272609
+ }
272144
272610
  function collectAnchoredDrawings(blocks2, measures) {
272145
272611
  const byParagraph = /* @__PURE__ */ new Map;
272146
272612
  const withoutParagraph = [];
@@ -274083,7 +274549,58 @@ function layoutDocument(blocks2, measures, options = {}) {
274083
274549
  const paragraphlessAnchoredTables = anchoredTables.withoutParagraph;
274084
274550
  const placedAnchoredIds = /* @__PURE__ */ new Set;
274085
274551
  const preRegisteredAnchors = collectPreRegisteredAnchors(blocks2, measures);
274086
- const preRegisteredPositions = /* @__PURE__ */ new Map;
274552
+ const pageRelativeAnchorsByParagraph = collectPageRelativeAnchorsByParagraph(blocks2, measures);
274553
+ const preRegisteredAnchorIds = /* @__PURE__ */ new Set;
274554
+ const blockIndexById = new Map(blocks2.map((candidateBlock, candidateIndex) => [candidateBlock.id, candidateIndex]));
274555
+ const hasHardBreakBetween = (startIndex, endIndex) => {
274556
+ const first$1 = Math.min(startIndex, endIndex) + 1;
274557
+ const last2 = Math.max(startIndex, endIndex);
274558
+ for (let candidateIndex = first$1;candidateIndex < last2; candidateIndex += 1) {
274559
+ const candidateBlock = blocks2[candidateIndex];
274560
+ if (candidateBlock.kind === "pageBreak" || candidateBlock.kind === "sectionBreak" || candidateBlock.kind === "columnBreak")
274561
+ return true;
274562
+ }
274563
+ return false;
274564
+ };
274565
+ const shouldWrapParagraphWithPageRelativeAnchor = (anchorBlock, paragraphIndex, paragraphId) => {
274566
+ const anchorParagraphId = anchorBlock.attrs != null && typeof anchorBlock.attrs === "object" ? anchorBlock.attrs.anchorParagraphId : undefined;
274567
+ if (typeof anchorParagraphId === "string")
274568
+ return anchorParagraphId === paragraphId;
274569
+ const anchorIndex = blockIndexById.get(anchorBlock.id);
274570
+ if (anchorIndex == null || anchorIndex === paragraphIndex)
274571
+ return false;
274572
+ return !hasHardBreakBetween(paragraphIndex, anchorIndex);
274573
+ };
274574
+ const isWrappingDrawingAnchor = (anchorBlock) => {
274575
+ const wrapType = anchorBlock.wrap?.type ?? "None";
274576
+ return wrapType !== "None" && wrapType !== "Inline";
274577
+ };
274578
+ const collectLaterPageRelativeAnchorsForParagraph = (paragraphIndex, paragraphId) => {
274579
+ const anchors = [];
274580
+ for (const entry of preRegisteredAnchors) {
274581
+ const anchorIndex = blockIndexById.get(entry.block.id);
274582
+ if (anchorIndex == null || anchorIndex <= paragraphIndex)
274583
+ continue;
274584
+ if (!isWrappingDrawingAnchor(entry.block))
274585
+ continue;
274586
+ if (!shouldWrapParagraphWithPageRelativeAnchor(entry.block, paragraphIndex, paragraphId))
274587
+ continue;
274588
+ anchors.push(entry);
274589
+ }
274590
+ return anchors.length > 0 ? anchors : undefined;
274591
+ };
274592
+ const mergeAnchoredDrawings = (...groups) => {
274593
+ const merged = [];
274594
+ const seen = /* @__PURE__ */ new Set;
274595
+ for (const group of groups)
274596
+ for (const entry of group ?? []) {
274597
+ if (seen.has(entry.block.id))
274598
+ continue;
274599
+ seen.add(entry.block.id);
274600
+ merged.push(entry);
274601
+ }
274602
+ return merged.length > 0 ? merged : undefined;
274603
+ };
274087
274604
  const resolveParagraphlessAnchoredTableY = (block, measure, state) => {
274088
274605
  const contentTop = state.topMargin;
274089
274606
  const contentBottom = state.contentBottom;
@@ -274097,40 +274614,36 @@ function layoutDocument(blocks2, measures, options = {}) {
274097
274614
  preRegisteredFallbackToContentTop: true
274098
274615
  });
274099
274616
  };
274100
- const resolveParagraphlessAnchoredDrawingY = (block, measure, state) => resolveAnchoredGraphicY({
274101
- anchor: block.anchor,
274102
- objectHeight: measure.height ?? 0,
274103
- contentTop: state.topMargin,
274104
- contentBottom: state.contentBottom,
274105
- pageBottomMargin: state.page.margins?.bottom ?? activeBottomMargin,
274106
- preRegisteredFallbackToContentTop: true
274107
- });
274108
- const resolveParagraphlessAnchoredDrawingX = (block, measure, state) => block.anchor ? computeAnchorX(block.anchor, state.columnIndex, normalizeColumns(activeColumns, activePageSize.w - (activeLeftMargin + activeRightMargin)), measure.width, {
274109
- left: activeLeftMargin,
274110
- right: activeRightMargin
274111
- }, activePageSize.w) : columnX(state);
274112
- for (const entry of preRegisteredAnchors) {
274113
- const state = paginator.ensurePage();
274617
+ const resolveAnchoredDrawingPosition = (block, measure, state) => {
274114
274618
  const contentTop = state.topMargin;
274115
274619
  const contentBottom = state.contentBottom;
274116
274620
  const anchorY = resolveAnchoredGraphicY({
274117
- anchor: entry.block.anchor,
274118
- objectHeight: entry.measure.height ?? 0,
274621
+ anchor: block.anchor,
274622
+ objectHeight: measure.height ?? 0,
274119
274623
  contentTop,
274120
274624
  contentBottom,
274121
274625
  pageBottomMargin: state.page.margins?.bottom ?? activeBottomMargin,
274122
274626
  preRegisteredFallbackToContentTop: true
274123
274627
  });
274124
- const anchorX = entry.block.anchor ? computeAnchorX(entry.block.anchor, state.columnIndex, normalizeColumns(activeColumns, activePageSize.w - (activeLeftMargin + activeRightMargin)), entry.measure.width, {
274125
- left: activeLeftMargin,
274126
- right: activeRightMargin
274127
- }, activePageSize.w) : activeLeftMargin;
274128
- floatManager.registerDrawing(entry.block, entry.measure, anchorY, state.columnIndex, state.page.number);
274129
- preRegisteredPositions.set(entry.block.id, {
274130
- anchorX,
274628
+ const columns = getActiveColumnsForState(state);
274629
+ const pageMargins = {
274630
+ top: state.page.margins?.top ?? activeTopMargin,
274631
+ bottom: state.page.margins?.bottom ?? activeBottomMargin,
274632
+ left: state.page.margins?.left ?? activeLeftMargin,
274633
+ right: state.page.margins?.right ?? activeRightMargin
274634
+ };
274635
+ const pageWidth = state.page.size?.w ?? activePageSize.w;
274636
+ const contentWidth = pageWidth - ((pageMargins.left ?? 0) + (pageMargins.right ?? 0));
274637
+ return {
274638
+ anchorX: block.anchor ? computeAnchorX(block.anchor, state.columnIndex, normalizeColumns(columns, contentWidth), measure.width, {
274639
+ left: pageMargins.left,
274640
+ right: pageMargins.right
274641
+ }, pageWidth) : pageMargins.left ?? activeLeftMargin,
274131
274642
  anchorY
274132
- });
274133
- }
274643
+ };
274644
+ };
274645
+ for (const entry of preRegisteredAnchors)
274646
+ preRegisteredAnchorIds.add(entry.block.id);
274134
274647
  const keepNextChains = computeKeepNextChains(blocks2);
274135
274648
  const midChainIndices = /* @__PURE__ */ new Set;
274136
274649
  for (const chain of keepNextChains.values())
@@ -274342,20 +274855,25 @@ function layoutDocument(blocks2, measures, options = {}) {
274342
274855
  if (measure.kind !== "paragraph")
274343
274856
  throw new Error(`layoutDocument: expected paragraph measure for block ${block.id}`);
274344
274857
  const paraBlock = block;
274345
- 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 === "")) {
274858
+ 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 === "");
274859
+ const drawingAnchorsForPara = anchoredByParagraph.get(index2);
274860
+ const wrappingPageRelativeAnchorsForPara = pageRelativeAnchorsByParagraph.get(index2)?.filter(({ block: anchorBlock }) => shouldWrapParagraphWithPageRelativeAnchor(anchorBlock, index2, paraBlock.id));
274861
+ const laterPageRelativeAnchorsForPara = collectLaterPageRelativeAnchorsForParagraph(index2, paraBlock.id);
274862
+ const anchorsForPara = mergeAnchoredDrawings(drawingAnchorsForPara, wrappingPageRelativeAnchorsForPara, laterPageRelativeAnchorsForPara);
274863
+ const tablesForPara = anchoredTablesByParagraph.get(index2);
274864
+ if (isEmpty3) {
274346
274865
  const isSectPrMarker = paraBlock.attrs?.sectPrMarker === true;
274347
274866
  const prevBlock = index2 > 0 ? blocks2[index2 - 1] : null;
274348
274867
  const nextBlock = index2 < blocks2.length - 1 ? blocks2[index2 + 1] : null;
274349
274868
  const nextSectionBreak = nextBlock?.kind === "sectionBreak" ? nextBlock : null;
274350
274869
  const nextBreakType = nextSectionBreak?.type ?? (nextSectionBreak?.attrs?.source === "sectPr" ? "nextPage" : undefined);
274351
274870
  const nextBreakForcesPage = nextSectionBreak && (nextBreakType === "nextPage" || nextBreakType === "evenPage" || nextBreakType === "oddPage" || nextSectionBreak.attrs?.requirePageBoundary === true);
274352
- if (isSectPrMarker && nextBreakForcesPage)
274871
+ const hasAnchoredObjectsForMarker = Boolean(anchorsForPara?.length || tablesForPara?.length);
274872
+ if (isSectPrMarker && nextBreakForcesPage && !hasAnchoredObjectsForMarker)
274353
274873
  continue;
274354
- if (prevBlock?.kind === "pageBreak" && nextBlock?.kind === "sectionBreak")
274874
+ if (prevBlock?.kind === "pageBreak" && nextBlock?.kind === "sectionBreak" && !hasAnchoredObjectsForMarker)
274355
274875
  continue;
274356
274876
  }
274357
- const anchorsForPara = anchoredByParagraph.get(index2);
274358
- const tablesForPara = anchoredTablesByParagraph.get(index2);
274359
274877
  const chain = keepNextChains.get(index2);
274360
274878
  if (midChainIndices.has(index2)) {} else if (chain) {
274361
274879
  let state = paginator.ensurePage();
@@ -274426,6 +274944,10 @@ function layoutDocument(blocks2, measures, options = {}) {
274426
274944
  overrideSpacingAfter = 0;
274427
274945
  }
274428
274946
  }
274947
+ const hasPageRelativeAnchorForPara = Boolean(pageRelativeAnchorsByParagraph.get(index2)?.length || laterPageRelativeAnchorsForPara?.length || tablesForPara?.some(({ block: tableBlock }) => {
274948
+ const vRelativeFrom = tableBlock.anchor?.vRelativeFrom;
274949
+ return vRelativeFrom === "page" || vRelativeFrom === "margin";
274950
+ }));
274429
274951
  layoutParagraphBlock({
274430
274952
  block,
274431
274953
  measure,
@@ -274451,6 +274973,9 @@ function layoutDocument(blocks2, measures, options = {}) {
274451
274973
  left: activeLeftMargin,
274452
274974
  right: activeRightMargin
274453
274975
  },
274976
+ sectionBaseTopMargin: activeSectionBaseTopMargin,
274977
+ sectionHeaderDistance: activeHeaderDistance,
274978
+ hasPageRelativeAnchorForParagraph: hasPageRelativeAnchorForPara,
274454
274979
  columns: getCurrentColumns(),
274455
274980
  placedAnchoredIds
274456
274981
  } : undefined);
@@ -274478,11 +275003,14 @@ function layoutDocument(blocks2, measures, options = {}) {
274478
275003
  if (block.kind === "image") {
274479
275004
  if (measure.kind !== "image")
274480
275005
  throw new Error(`layoutDocument: expected image measure for block ${block.id}`);
274481
- const preRegPos = preRegisteredPositions.get(block.id);
274482
- if (preRegPos && Number.isFinite(preRegPos.anchorX) && Number.isFinite(preRegPos.anchorY)) {
275006
+ if (placedAnchoredIds.has(block.id))
275007
+ continue;
275008
+ if (preRegisteredAnchorIds.has(block.id)) {
274483
275009
  const state = paginator.ensurePage();
274484
275010
  const imgBlock = block;
274485
275011
  const imgMeasure = measure;
275012
+ const { anchorX, anchorY } = resolveAnchoredDrawingPosition(imgBlock, imgMeasure, state);
275013
+ floatManager.registerDrawing(imgBlock, imgMeasure, anchorY, state.columnIndex, state.page.number);
274486
275014
  const pageContentHeight = Math.max(0, state.contentBottom - state.topMargin);
274487
275015
  const relativeFrom = imgBlock.anchor?.hRelativeFrom ?? "column";
274488
275016
  const cols = getCurrentColumns();
@@ -274508,8 +275036,8 @@ function layoutDocument(blocks2, measures, options = {}) {
274508
275036
  const fragment2 = {
274509
275037
  kind: "image",
274510
275038
  blockId: imgBlock.id,
274511
- x: preRegPos.anchorX,
274512
- y: preRegPos.anchorY,
275039
+ x: anchorX,
275040
+ y: anchorY,
274513
275041
  width: imgMeasure.width,
274514
275042
  height: imgMeasure.height,
274515
275043
  isAnchored: true,
@@ -274540,18 +275068,21 @@ function layoutDocument(blocks2, measures, options = {}) {
274540
275068
  if (block.kind === "drawing") {
274541
275069
  if (measure.kind !== "drawing")
274542
275070
  throw new Error(`layoutDocument: expected drawing measure for block ${block.id}`);
274543
- const preRegPos = preRegisteredPositions.get(block.id);
274544
- if (preRegPos && Number.isFinite(preRegPos.anchorX) && Number.isFinite(preRegPos.anchorY)) {
275071
+ if (placedAnchoredIds.has(block.id))
275072
+ continue;
275073
+ if (preRegisteredAnchorIds.has(block.id)) {
274545
275074
  const state = paginator.ensurePage();
274546
275075
  const drawBlock = block;
274547
275076
  const drawMeasure = measure;
275077
+ const { anchorX, anchorY } = resolveAnchoredDrawingPosition(drawBlock, drawMeasure, state);
275078
+ floatManager.registerDrawing(drawBlock, drawMeasure, anchorY, state.columnIndex, state.page.number);
274548
275079
  const contentMeasures = drawBlock.drawingKind === "textboxShape" && typeof options.remeasureParagraph === "function" ? layoutTextboxContent(drawBlock, options.remeasureParagraph) : undefined;
274549
275080
  const fragment2 = {
274550
275081
  kind: "drawing",
274551
275082
  blockId: drawBlock.id,
274552
275083
  drawingKind: drawBlock.drawingKind,
274553
- x: preRegPos.anchorX,
274554
- y: preRegPos.anchorY,
275084
+ x: anchorX,
275085
+ y: anchorY,
274555
275086
  width: drawMeasure.width,
274556
275087
  height: drawMeasure.height,
274557
275088
  geometry: drawMeasure.geometry,
@@ -274633,8 +275164,7 @@ function layoutDocument(blocks2, measures, options = {}) {
274633
275164
  for (const { block, measure } of paragraphlessAnchoredDrawings) {
274634
275165
  if (placedAnchoredIds.has(block.id))
274635
275166
  continue;
274636
- const anchorX = resolveParagraphlessAnchoredDrawingX(block, measure, state);
274637
- const anchorY = resolveParagraphlessAnchoredDrawingY(block, measure, state);
275167
+ const { anchorX, anchorY } = resolveAnchoredDrawingPosition(block, measure, state);
274638
275168
  if (block.kind === "image" && measure.kind === "image") {
274639
275169
  const pageContentHeight = Math.max(0, state.contentBottom - state.topMargin);
274640
275170
  const aspectRatio = measure.width > 0 && measure.height > 0 ? measure.width / measure.height : 1;
@@ -274902,6 +275432,15 @@ function getPageRelativeMeasurementBand(kind, constraints) {
274902
275432
  end: bandSize
274903
275433
  };
274904
275434
  }
275435
+ function isHeaderFooterAbsoluteOverlay(block, kind, fragment2, fragmentBottom, canvasHeight) {
275436
+ if (!kind)
275437
+ return false;
275438
+ if (block.anchor?.isAnchored !== true)
275439
+ return false;
275440
+ if (block.wrap?.type !== "None")
275441
+ return false;
275442
+ return fragment2.y < 0 || fragmentBottom > canvasHeight;
275443
+ }
274905
275444
  function shouldExcludeFromMeasurement(fragment2, block, fragmentBottom, canvasHeight, kind, constraints) {
274906
275445
  if (!((fragment2.kind === "image" || fragment2.kind === "drawing") && fragment2.isAnchored === true))
274907
275446
  return false;
@@ -274910,6 +275449,8 @@ function shouldExcludeFromMeasurement(fragment2, block, fragmentBottom, canvasHe
274910
275449
  const anchoredBlock = block;
274911
275450
  if (anchoredBlock.anchor?.behindDoc)
274912
275451
  return true;
275452
+ if (isHeaderFooterAbsoluteOverlay(anchoredBlock, kind, fragment2, fragmentBottom, canvasHeight))
275453
+ return true;
274913
275454
  if (isPageRelativeAnchor(anchoredBlock)) {
274914
275455
  const fragmentTop = fragment2.y;
274915
275456
  if (fragmentBottom <= 0 || fragmentTop >= canvasHeight)
@@ -274920,13 +275461,6 @@ function shouldExcludeFromMeasurement(fragment2, block, fragmentBottom, canvasHe
274920
275461
  if (measurementBand && !rangesIntersect(fragment2.y, fragmentBottom, measurementBand.start, measurementBand.end))
274921
275462
  return true;
274922
275463
  }
274923
- const fragmentHeight = typeof fragment2.height === "number" ? fragment2.height : fragmentBottom - fragment2.y;
274924
- const fragmentWidth = typeof fragment2.width === "number" ? fragment2.width : 0;
274925
- const heightCoversCanvas = Number.isFinite(fragmentHeight) && fragmentHeight >= canvasHeight;
274926
- const widthCoversCanvas = Number.isFinite(constraints.width) && constraints.width > 0 && fragmentWidth >= constraints.width;
274927
- const isOverlayWrap = anchoredBlock.wrap?.type === "None";
274928
- if (kind && heightCoversCanvas && widthCoversCanvas && isOverlayWrap)
274929
- return true;
274930
275464
  return false;
274931
275465
  }
274932
275466
  function layoutHeaderFooter(blocks2, measures, constraints, kind, remeasureParagraph$1) {
@@ -286967,13 +287501,17 @@ async function buildMeasuredAutoFitContentMetrics(block, workingInput, fixedLayo
286967
287501
  cellMetricKeys: contentMetrics.cellMetricKeys
286968
287502
  };
286969
287503
  }
287504
+ function isBehindDocOverlay(block) {
287505
+ return block.anchor?.behindDoc === true || block.wrap?.type === "None" && block.wrap?.behindDoc === true;
287506
+ }
287507
+ function hasNegativeVerticalPosition(block) {
287508
+ return block.anchor?.isAnchored === true && (typeof block.anchor?.offsetV === "number" && block.anchor.offsetV < 0 || typeof block.margin?.top === "number" && block.margin.top < 0);
287509
+ }
286970
287510
  async function measureImageBlock(block, constraints) {
286971
287511
  const intrinsic = getIntrinsicImageSize(block, constraints.maxWidth);
286972
- const isBlockBehindDoc = block.anchor?.behindDoc;
286973
- const isBlockWrapBehindDoc = block.wrap?.type === "None" && block.wrap?.behindDoc;
286974
287512
  const isPageRelativeAnchor$1 = block.anchor?.isAnchored && (block.anchor?.hRelativeFrom === "page" || block.anchor?.hRelativeFrom === "margin");
286975
- const maxWidth = isBlockBehindDoc || isBlockWrapBehindDoc || isPageRelativeAnchor$1 || constraints.maxWidth <= 0 ? intrinsic.width : constraints.maxWidth;
286976
- 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;
287513
+ const maxWidth = isBehindDocOverlay(block) || isPageRelativeAnchor$1 || constraints.maxWidth <= 0 ? intrinsic.width : constraints.maxWidth;
287514
+ const maxHeight = isBehindDocOverlay(block) || hasNegativeVerticalPosition(block) || block.objectFit === "cover" || !constraints.maxHeight || constraints.maxHeight <= 0 ? Infinity : constraints.maxHeight;
286977
287515
  const widthScale = maxWidth / intrinsic.width;
286978
287516
  const heightScale = maxHeight / intrinsic.height;
286979
287517
  const scale = Math.min(1, widthScale, heightScale);
@@ -286986,8 +287524,9 @@ async function measureImageBlock(block, constraints) {
286986
287524
  async function measureDrawingBlock(block, constraints) {
286987
287525
  if (block.drawingKind === "image") {
286988
287526
  const intrinsic = getIntrinsicSizeFromDims(block.width, block.height, constraints.maxWidth);
286989
- const maxWidth$1 = constraints.maxWidth > 0 ? constraints.maxWidth : intrinsic.width;
286990
- const maxHeight$1 = constraints.maxHeight && constraints.maxHeight > 0 ? constraints.maxHeight : Infinity;
287527
+ const isPageRelativeAnchor$1 = block.anchor?.isAnchored === true && (block.anchor.hRelativeFrom === "page" || block.anchor.hRelativeFrom === "margin");
287528
+ const maxWidth$1 = isBehindDocOverlay(block) || isPageRelativeAnchor$1 || constraints.maxWidth <= 0 ? intrinsic.width : constraints.maxWidth;
287529
+ const maxHeight$1 = isBehindDocOverlay(block) || hasNegativeVerticalPosition(block) || !constraints.maxHeight || constraints.maxHeight <= 0 ? Infinity : constraints.maxHeight;
286991
287530
  const widthScale$1 = maxWidth$1 / intrinsic.width;
286992
287531
  const heightScale$1 = maxHeight$1 / intrinsic.height;
286993
287532
  const scale$1 = Math.min(1, widthScale$1, heightScale$1);
@@ -287009,6 +287548,21 @@ async function measureDrawingBlock(block, constraints) {
287009
287548
  };
287010
287549
  }
287011
287550
  const geometry = ensureDrawingGeometry(block.geometry);
287551
+ if (block.drawingKind === "shapeGroup" && block.groupTransform) {
287552
+ const effectExtent = block.effectExtent ?? {
287553
+ left: 0,
287554
+ top: 0,
287555
+ right: 0,
287556
+ bottom: 0
287557
+ };
287558
+ const groupWidth = block.groupTransform.width ?? geometry.width;
287559
+ const groupHeight = block.groupTransform.height ?? geometry.height;
287560
+ geometry.width = Math.max(1, geometry.width, groupWidth + effectExtent.left + effectExtent.right);
287561
+ geometry.height = Math.max(1, geometry.height, groupHeight + effectExtent.top + effectExtent.bottom);
287562
+ geometry.rotation = normalizeRotation(block.groupTransform.rotation ?? geometry.rotation ?? 0);
287563
+ geometry.flipH = Boolean(block.groupTransform.flipH ?? geometry.flipH);
287564
+ geometry.flipV = Boolean(block.groupTransform.flipV ?? geometry.flipV);
287565
+ }
287012
287566
  const attrs = block.attrs;
287013
287567
  const indentLeft = typeof attrs?.hrIndentLeft === "number" ? attrs.hrIndentLeft : 0;
287014
287568
  const indentRight = typeof attrs?.hrIndentRight === "number" ? attrs.hrIndentRight : 0;
@@ -287020,7 +287574,7 @@ async function measureDrawingBlock(block, constraints) {
287020
287574
  const naturalHeight = Math.max(1, rotatedBounds.height);
287021
287575
  const isFloating = block.wrap?.type === "None" || block.anchor?.isAnchored === true;
287022
287576
  const maxWidth = fullWidthMax ?? (constraints.maxWidth > 0 && !isFloating ? constraints.maxWidth : naturalWidth);
287023
- 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;
287577
+ const maxHeight = isBehindDocOverlay(block) || hasNegativeVerticalPosition(block) || !constraints.maxHeight || constraints.maxHeight <= 0 ? Infinity : constraints.maxHeight;
287024
287578
  const widthScale = maxWidth / naturalWidth;
287025
287579
  const heightScale = maxHeight / naturalHeight;
287026
287580
  const normalizedScale = Math.min(1, widthScale, heightScale);
@@ -287608,15 +288162,17 @@ function shiftResolvedPaintItemY(item, yOffset) {
287608
288162
  y: item.y + yOffset
287609
288163
  };
287610
288164
  }
287611
- function isExplicitBehindDocMediaFragment(fragment2) {
287612
- return (fragment2.kind === "image" || fragment2.kind === "drawing") && fragment2.behindDoc === true;
288165
+ function isExcludedFromDecorationNormalization(fragment2) {
288166
+ if (fragment2.kind !== "image" && fragment2.kind !== "drawing")
288167
+ return false;
288168
+ return fragment2.behindDoc === true || fragment2.isAnchored === true || fragment2.sourceAnchor != null;
287613
288169
  }
287614
288170
  function getDecorationNormalizationMinY(fragments, layoutMinY) {
287615
288171
  if (!Number.isFinite(layoutMinY) || layoutMinY >= 0)
287616
288172
  return 0;
287617
288173
  let minY = Infinity;
287618
288174
  for (const fragment2 of fragments) {
287619
- if (isExplicitBehindDocMediaFragment(fragment2))
288175
+ if (isExcludedFromDecorationNormalization(fragment2))
287620
288176
  continue;
287621
288177
  if (Number.isFinite(fragment2.y))
287622
288178
  minY = Math.min(minY, fragment2.y);
@@ -305328,7 +305884,7 @@ var Node$13 = class Node$14 {
305328
305884
  domAvailabilityCache = false;
305329
305885
  return false;
305330
305886
  }
305331
- }, summaryVersion = "1.41.0", nodeKeys, markKeys, transformListsInCopiedContent = (html3) => {
305887
+ }, summaryVersion = "1.43.0", nodeKeys, markKeys, transformListsInCopiedContent = (html3) => {
305332
305888
  const container = document.createElement("div");
305333
305889
  container.innerHTML = html3;
305334
305890
  const result = [];
@@ -306514,7 +307070,7 @@ var Node$13 = class Node$14 {
306514
307070
  return () => {};
306515
307071
  const handle3 = setInterval(callback, intervalMs);
306516
307072
  return () => clearInterval(handle3);
306517
- }, 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) => {
307073
+ }, 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) => {
306518
307074
  if (!isTrackedReviewMark(mark2))
306519
307075
  return null;
306520
307076
  const id2 = typeof mark2.attrs?.id === "string" ? mark2.attrs.id : "";
@@ -306673,6 +307229,8 @@ var Node$13 = class Node$14 {
306673
307229
  return false;
306674
307230
  if (step3.from === step3.to && step3.slice.content.size > 0 && collapsedInsertionExtendsTrackedInsertion(doc$12, step3.from, step3.slice))
306675
307231
  return false;
307232
+ if (step3.from === step3.to && step3.slice.content.size > 0 && collapsedPositionIsInsideTrackedReviewMark(doc$12, step3.from))
307233
+ return false;
306676
307234
  if (rangeHasTrackedReviewMark(doc$12, step3.from, step3.to))
306677
307235
  return true;
306678
307236
  if (step3.from === step3.to && step3.slice.content.size > 0)
@@ -306689,6 +307247,35 @@ var Node$13 = class Node$14 {
306689
307247
  return false;
306690
307248
  const docs = tr.docs ?? [];
306691
307249
  return tr.steps.some((step3, index2) => stepTouchesTrackedReviewState(step3, docs[index2] ?? state.doc));
307250
+ }, enclosingTrackedReviewMarksAtCollapsedPosition = (doc$12, pos) => {
307251
+ const boundedPos = Math.max(0, Math.min(doc$12.content.size, pos));
307252
+ const $pos = doc$12.resolve(boundedPos);
307253
+ const afterKeys = trackedReviewMarkKeysForNode($pos.nodeAfter);
307254
+ if (!afterKeys.size)
307255
+ return [];
307256
+ const enclosing = [];
307257
+ for (const mark2 of $pos.nodeBefore?.marks ?? []) {
307258
+ const key2 = trackedReviewMarkKey(mark2);
307259
+ if (key2 && afterKeys.has(key2))
307260
+ enclosing.push(mark2);
307261
+ }
307262
+ return enclosing;
307263
+ }, collapsedInsertInsideTrackedReviewMarkRange = (state, tr) => {
307264
+ if (!tr.docChanged || tr.steps.length !== 1)
307265
+ return null;
307266
+ const [step3] = tr.steps;
307267
+ if (!(step3 instanceof ReplaceStep))
307268
+ return null;
307269
+ if (step3.from !== step3.to || step3.slice.content.size === 0)
307270
+ return null;
307271
+ const marks = enclosingTrackedReviewMarksAtCollapsedPosition((tr.docs ?? [])[0] ?? state.doc, step3.from);
307272
+ if (!marks.length)
307273
+ return null;
307274
+ return {
307275
+ from: step3.from,
307276
+ to: step3.from + step3.slice.size,
307277
+ marks
307278
+ };
306692
307279
  }, CONTENT_CONTROL_POINTER_WINDOW_MS = 800, cloneExtensionInstance = (extension3) => {
306693
307280
  const extensionLike = extension3;
306694
307281
  const config2 = extensionLike?.config;
@@ -309179,6 +309766,12 @@ menclose::after {
309179
309766
  if (!SUPPORTED_IMAGE_CLIP_PATH_PREFIXES.some((prefix2) => lower.startsWith(prefix2)))
309180
309767
  return "";
309181
309768
  return normalized;
309769
+ }, applyImageObjectFit = (img2, objectFit) => {
309770
+ img2.style.objectFit = objectFit;
309771
+ if (objectFit === "cover")
309772
+ img2.style.objectPosition = "left top";
309773
+ else
309774
+ img2.style.removeProperty("object-position");
309182
309775
  }, applyRunDataAttributes = (element3, dataAttrs) => {
309183
309776
  if (!dataAttrs)
309184
309777
  return;
@@ -309466,7 +310059,10 @@ menclose::after {
309466
310059
  }, renderImageRun = (run2, context) => {
309467
310060
  if (!run2.src)
309468
310061
  return null;
309469
- const hasClipPath = typeof run2.clipPath === "string" && run2.clipPath.trim().length > 0;
310062
+ const runClipPath = readImageClipPathValue(run2.clipPath);
310063
+ const shapeClipPath = readImageClipPathValue(run2.shapeClipPath);
310064
+ const hasClipPath = runClipPath.length > 0;
310065
+ const hasShapeClipPath = shapeClipPath.length > 0;
309470
310066
  const img2 = context.doc.createElement("img");
309471
310067
  img2.classList.add(DOM_CLASS_NAMES.INLINE_IMAGE);
309472
310068
  if (typeof run2.src === "string" && run2.src.startsWith("data:")) {
@@ -309480,7 +310076,7 @@ menclose::after {
309480
310076
  else
309481
310077
  return null;
309482
310078
  }
309483
- if (!hasClipPath) {
310079
+ if (!hasClipPath && !hasShapeClipPath) {
309484
310080
  img2.width = run2.width;
309485
310081
  img2.height = run2.height;
309486
310082
  } else
@@ -309493,7 +310089,9 @@ menclose::after {
309493
310089
  minWidth: "0",
309494
310090
  minHeight: "0"
309495
310091
  });
309496
- applyImageClipPath(img2, run2.clipPath);
310092
+ applyImageClipPath(img2, runClipPath);
310093
+ if (run2.objectFit)
310094
+ applyImageObjectFit(img2, run2.objectFit);
309497
310095
  if (run2.width > 0 && run2.height > 0) {
309498
310096
  const aspectRatio = run2.width / run2.height;
309499
310097
  const inlineImageMetadata = {
@@ -309511,7 +310109,7 @@ menclose::after {
309511
310109
  if (run2.title)
309512
310110
  img2.title = run2.title;
309513
310111
  img2.style.display = "inline-block";
309514
- const useWrapper = hasClipPath && run2.width > 0 && run2.height > 0;
310112
+ const useWrapper = (hasClipPath || hasShapeClipPath) && run2.width > 0 && run2.height > 0;
309515
310113
  if (!useWrapper) {
309516
310114
  img2.style.verticalAlign = run2.verticalAlign ?? "top";
309517
310115
  if (run2.distTop)
@@ -309572,6 +310170,8 @@ menclose::after {
309572
310170
  wrapper.style.marginRight = `${run2.distRight}px`;
309573
310171
  wrapper.style.position = "relative";
309574
310172
  wrapper.style.zIndex = "1";
310173
+ if (shapeClipPath)
310174
+ wrapper.style.clipPath = shapeClipPath;
309575
310175
  if (run2.pmStart != null)
309576
310176
  wrapper.dataset.pmStart = String(run2.pmStart);
309577
310177
  if (run2.pmEnd != null)
@@ -309591,7 +310191,6 @@ menclose::after {
309591
310191
  context.applySdtDataset(img2, run2.sdt);
309592
310192
  if (run2.dataAttrs)
309593
310193
  applyRunDataAttributes(img2, run2.dataAttrs);
309594
- const runClipPath = readImageClipPathValue(run2.clipPath);
309595
310194
  if (runClipPath) {
309596
310195
  img2.style.clipPath = runClipPath;
309597
310196
  img2.style.display = "block";
@@ -309637,6 +310236,12 @@ menclose::after {
309637
310236
  return "";
309638
310237
  const record = block;
309639
310238
  return readImageClipPathValue(record.clipPath) || resolveClipPathFromAttrs$1(record.attrs);
310239
+ }, resolveBlockImageShapeClipPath = (block) => {
310240
+ if (!block || typeof block !== "object")
310241
+ return "";
310242
+ const record = block;
310243
+ const attrs = record.attrs && typeof record.attrs === "object" ? record.attrs : undefined;
310244
+ return readImageClipPathValue(record.shapeClipPath) || readImageClipPathValue(attrs?.shapeClipPath);
309640
310245
  }, createBlockImageContent = ({ doc: doc$12, block, className, clipContainer, imageDisplay, hyperlinkDisplay = "block", buildImageHyperlinkAnchor: buildImageHyperlinkAnchor$1 }) => {
309641
310246
  const img2 = doc$12.createElement("img");
309642
310247
  if (className)
@@ -309646,10 +310251,19 @@ menclose::after {
309646
310251
  img2.alt = block.alt ?? "";
309647
310252
  img2.style.width = "100%";
309648
310253
  img2.style.height = "100%";
309649
- img2.style.objectFit = block.objectFit ?? "contain";
309650
- if (block.objectFit === "cover")
309651
- img2.style.objectPosition = "left top";
309652
- applyImageClipPath(img2, resolveBlockImageClipPath(block), clipContainer ? { clipContainer } : undefined);
310254
+ applyImageObjectFit(img2, block.objectFit ?? "contain");
310255
+ const shapeClipPath = resolveBlockImageShapeClipPath(block);
310256
+ const ownShapeClipContainer = shapeClipPath && !clipContainer ? doc$12.createElement("div") : undefined;
310257
+ if (ownShapeClipContainer) {
310258
+ ownShapeClipContainer.style.width = "100%";
310259
+ ownShapeClipContainer.style.height = "100%";
310260
+ }
310261
+ const shapeClipContainer = clipContainer ?? ownShapeClipContainer;
310262
+ if (shapeClipPath && shapeClipContainer) {
310263
+ shapeClipContainer.style.clipPath = shapeClipPath;
310264
+ shapeClipContainer.style.overflow = "hidden";
310265
+ }
310266
+ applyImageClipPath(img2, resolveBlockImageClipPath(block), shapeClipContainer ? { clipContainer: shapeClipContainer } : undefined);
309653
310267
  img2.style.display = imageDisplay ?? (block.display === "inline" ? "inline-block" : "block");
309654
310268
  const filters = buildImageFilters(block);
309655
310269
  if (filters.length > 0)
@@ -309657,7 +310271,12 @@ menclose::after {
309657
310271
  const opacity = resolveImageOpacity(block);
309658
310272
  if (opacity != null)
309659
310273
  img2.style.opacity = opacity;
309660
- return buildImageHyperlinkAnchor$1?.(img2, block.hyperlink, hyperlinkDisplay) ?? img2;
310274
+ const content3 = buildImageHyperlinkAnchor$1?.(img2, block.hyperlink, hyperlinkDisplay) ?? img2;
310275
+ if (ownShapeClipContainer) {
310276
+ ownShapeClipContainer.appendChild(content3);
310277
+ return ownShapeClipContainer;
310278
+ }
310279
+ return content3;
309661
310280
  }, buildImageHyperlinkAnchor = (doc$12, imageEl, hyperlink, display) => {
309662
310281
  if (!hyperlink?.url)
309663
310282
  return imageEl;
@@ -313793,13 +314412,24 @@ menclose::after {
313793
314412
  const img2 = doc$12.createElement("img");
313794
314413
  img2.src = attrs.src;
313795
314414
  img2.alt = attrs.alt ?? "";
313796
- img2.style.objectFit = "contain";
314415
+ applyImageObjectFit(img2, attrs.objectFit ?? "contain");
313797
314416
  img2.style.display = "block";
313798
- applyImageClipPath(img2, attrs.clipPath);
313799
314417
  const opacity = resolveImageOpacity(attrs);
313800
314418
  if (opacity != null)
313801
314419
  img2.style.opacity = opacity;
313802
- return img2;
314420
+ img2.style.width = "100%";
314421
+ img2.style.height = "100%";
314422
+ if (!attrs.clipPath && !attrs.shapeClipPath)
314423
+ return img2;
314424
+ const clipContainer = doc$12.createElement("div");
314425
+ clipContainer.style.width = "100%";
314426
+ clipContainer.style.height = "100%";
314427
+ clipContainer.style.overflow = "hidden";
314428
+ if (attrs.shapeClipPath)
314429
+ clipContainer.style.clipPath = attrs.shapeClipPath;
314430
+ applyImageClipPath(img2, attrs.clipPath, { clipContainer });
314431
+ clipContainer.appendChild(img2);
314432
+ return clipContainer;
313803
314433
  }, createShapeTextImageElement = (doc$12, part) => {
313804
314434
  const img2 = doc$12.createElement("img");
313805
314435
  img2.src = part.src;
@@ -313890,7 +314520,7 @@ menclose::after {
313890
314520
  });
313891
314521
  return createErrorPlaceholder(fragment2.blockId, error3);
313892
314522
  }
313893
- }, ACTIVE_HEADER_FOOTER_WATERMARK_PREVIEW_OPACITY = "1", INACTIVE_HEADER_FOOTER_WATERMARK_PREVIEW_OPACITY = "0.5", resolveOrBuildFragmentIdentity = (fragment2, story, existing) => buildLayoutSourceIdentityForFragment(existing ? {
314523
+ }, ACTIVE_HEADER_FOOTER_WATERMARK_PREVIEW_OPACITY = "1", INACTIVE_HEADER_FOOTER_WATERMARK_PREVIEW_OPACITY = "0.5", normalizeRotationDegrees = (rotation) => (rotation % 360 + 360) % 360, resolveOrBuildFragmentIdentity = (fragment2, story, existing) => buildLayoutSourceIdentityForFragment(existing ? {
313894
314524
  ...fragment2,
313895
314525
  layoutSourceIdentity: existing,
313896
314526
  sourceAnchor: fragment2.sourceAnchor ?? existing.sourceAnchor
@@ -313904,7 +314534,7 @@ menclose::after {
313904
314534
  kind,
313905
314535
  id: id2
313906
314536
  } : { kind };
313907
- }, 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 {
314537
+ }, 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 {
313908
314538
  constructor(options = {}) {
313909
314539
  this.mount = null;
313910
314540
  this.doc = null;
@@ -314735,6 +315365,63 @@ menclose::after {
314735
315365
  return false;
314736
315366
  return block.anchor?.vRelativeFrom === "page";
314737
315367
  }
315368
+ isHorizontallyPageRelativeAnchoredFragment(fragment2, resolvedItem) {
315369
+ if (fragment2.kind !== "image" && fragment2.kind !== "drawing")
315370
+ return false;
315371
+ const block = resolvedItem && "block" in resolvedItem ? resolvedItem.block : undefined;
315372
+ if (!block || block.kind !== "image" && block.kind !== "drawing")
315373
+ return false;
315374
+ return block.anchor?.hRelativeFrom === "page";
315375
+ }
315376
+ isHeaderFooterAbsoluteOverlayFragment(fragment2, kind, resolvedItem) {
315377
+ if (kind !== "header" && kind !== "footer")
315378
+ return false;
315379
+ if (fragment2.kind !== "image" && fragment2.kind !== "drawing")
315380
+ return false;
315381
+ if (fragment2.isAnchored !== true)
315382
+ return false;
315383
+ const block = resolvedItem && "block" in resolvedItem ? resolvedItem.block : undefined;
315384
+ if (!block || block.kind !== "image" && block.kind !== "drawing")
315385
+ return false;
315386
+ if (block.anchor?.isAnchored !== true)
315387
+ return false;
315388
+ if (block.wrap?.type !== "None")
315389
+ return false;
315390
+ if (fragment2.behindDoc === true || block.anchor?.behindDoc === true)
315391
+ return false;
315392
+ return true;
315393
+ }
315394
+ getPageBackgroundDecorationZOrder(fragment2, resolvedItem) {
315395
+ const block = resolvedItem && "block" in resolvedItem ? resolvedItem.block : undefined;
315396
+ const isDrawingBlock = block?.kind === "image" || block?.kind === "drawing";
315397
+ const normalizedZIndex = normalizeZIndex(isDrawingBlock ? block.attrs?.originalAttributes : undefined);
315398
+ const isBehindDoc = (fragment2.kind === "image" || fragment2.kind === "drawing") && fragment2.behindDoc === true || isDrawingBlock && block.anchor?.behindDoc === true;
315399
+ if (isBehindDoc && normalizedZIndex != null)
315400
+ return normalizedZIndex;
315401
+ if ((fragment2.kind === "image" || fragment2.kind === "drawing") && typeof fragment2.zIndex === "number")
315402
+ return isBehindDoc ? fragment2.zIndex : PAGE_BACKGROUND_OVERLAY_Z_ORDER_OFFSET + Math.max(1, fragment2.zIndex);
315403
+ if (normalizedZIndex != null)
315404
+ return PAGE_BACKGROUND_OVERLAY_Z_ORDER_OFFSET + Math.max(1, normalizedZIndex);
315405
+ return 0;
315406
+ }
315407
+ insertPageBackgroundDecoration(pageEl, fragEl, zOrder) {
315408
+ fragEl.dataset.pageBackgroundZIndex = String(zOrder);
315409
+ let lastBackgroundDecoration = null;
315410
+ let insertBefore = null;
315411
+ for (const child of Array.from(pageEl.children)) {
315412
+ const el = child;
315413
+ if (el.dataset.behindDocSection != null || el.dataset.headerFooterOverlaySection != null) {
315414
+ if (Number(el.dataset.pageBackgroundZIndex ?? 0) > zOrder) {
315415
+ insertBefore = el;
315416
+ break;
315417
+ }
315418
+ lastBackgroundDecoration = el;
315419
+ continue;
315420
+ }
315421
+ break;
315422
+ }
315423
+ pageEl.insertBefore(fragEl, insertBefore ?? lastBackgroundDecoration?.nextSibling ?? pageEl.firstChild);
315424
+ }
314738
315425
  getDecorationAnchorPageOriginY(page, kind, effectiveOffset) {
314739
315426
  if (kind === "header")
314740
315427
  return effectiveOffset;
@@ -314759,8 +315446,12 @@ menclose::after {
314759
315446
  const className = kind === "header" ? CLASS_NAMES$1.pageHeader : CLASS_NAMES$1.pageFooter;
314760
315447
  const existing = pageEl.querySelector(`.${className}`);
314761
315448
  const data = provider ? provider(page.number, page.margins, page) : null;
315449
+ const behindDocSelector = `[data-behind-doc-section="${kind}"]`;
315450
+ const overlaySelector = `[data-header-footer-overlay-section="${kind}"]`;
314762
315451
  if (!data || data.fragments.length === 0) {
314763
315452
  existing?.remove();
315453
+ pageEl.querySelectorAll(behindDocSelector).forEach((el) => el.remove());
315454
+ pageEl.querySelectorAll(overlaySelector).forEach((el) => el.remove());
314764
315455
  return;
314765
315456
  }
314766
315457
  const container = existing ?? this.doc.createElement("div");
@@ -314822,27 +315513,34 @@ menclose::after {
314822
315513
  const decorationItems = data.items ?? [];
314823
315514
  const betweenBorderFlags = computeBetweenBorderFlags(decorationItems);
314824
315515
  const behindDocFragments = [];
315516
+ const absoluteOverlayFragments = [];
314825
315517
  const normalFragments = [];
314826
315518
  for (let fi = 0;fi < data.fragments.length; fi += 1) {
314827
315519
  const fragment2 = data.fragments[fi];
315520
+ const resolvedItem = decorationItems[fi];
314828
315521
  let isBehindDoc = false;
314829
315522
  if (fragment2.kind === "image" || fragment2.kind === "drawing") {
314830
- const resolvedItem = decorationItems[fi];
314831
- isBehindDoc = fragment2.behindDoc === true || fragment2.behindDoc == null && "zIndex" in fragment2 && fragment2.zIndex === 0 || this.shouldRenderBehindPageContent(fragment2, kind, resolvedItem);
315523
+ const resolvedMediaItem = resolvedItem;
315524
+ isBehindDoc = fragment2.behindDoc === true || fragment2.behindDoc == null && "zIndex" in fragment2 && fragment2.zIndex === 0 || this.shouldRenderBehindPageContent(fragment2, kind, resolvedMediaItem);
314832
315525
  }
314833
315526
  if (isBehindDoc)
314834
315527
  behindDocFragments.push({
314835
315528
  fragment: fragment2,
314836
315529
  originalIndex: fi
314837
315530
  });
315531
+ else if (this.isHeaderFooterAbsoluteOverlayFragment(fragment2, kind, resolvedItem))
315532
+ absoluteOverlayFragments.push({
315533
+ fragment: fragment2,
315534
+ originalIndex: fi
315535
+ });
314838
315536
  else
314839
315537
  normalFragments.push({
314840
315538
  fragment: fragment2,
314841
315539
  originalIndex: fi
314842
315540
  });
314843
315541
  }
314844
- const behindDocSelector = `[data-behind-doc-section="${kind}"]`;
314845
315542
  pageEl.querySelectorAll(behindDocSelector).forEach((el) => el.remove());
315543
+ pageEl.querySelectorAll(overlaySelector).forEach((el) => el.remove());
314846
315544
  behindDocFragments.forEach(({ fragment: fragment2, originalIndex }) => {
314847
315545
  const resolvedItem = data.items?.[originalIndex];
314848
315546
  const fragEl = this.renderFragment(fragment2, context, undefined, betweenBorderFlags.get(originalIndex), resolvedItem);
@@ -314855,11 +315553,12 @@ menclose::after {
314855
315553
  pageY = fragment2.y;
314856
315554
  else
314857
315555
  pageY = effectiveOffset + fragment2.y + (kind === "footer" ? footerYOffset : 0);
315556
+ const isHorizontallyPageRelative = this.isHorizontallyPageRelativeAnchoredFragment(fragment2, resolvedItem);
314858
315557
  fragEl.style.top = `${pageY}px`;
314859
- fragEl.style.left = `${isPageRelative ? fragment2.x : marginLeft + fragment2.x}px`;
315558
+ fragEl.style.left = `${isHorizontallyPageRelative ? fragment2.x : marginLeft + fragment2.x}px`;
314860
315559
  fragEl.style.zIndex = "0";
314861
315560
  fragEl.dataset.behindDocSection = kind;
314862
- pageEl.insertBefore(fragEl, pageEl.firstChild);
315561
+ this.insertPageBackgroundDecoration(pageEl, fragEl, this.getPageBackgroundDecorationZOrder(fragment2, resolvedItem));
314863
315562
  });
314864
315563
  normalFragments.forEach(({ fragment: fragment2, originalIndex }) => {
314865
315564
  const resolvedItem = data.items?.[originalIndex];
@@ -314878,6 +315577,27 @@ menclose::after {
314878
315577
  });
314879
315578
  if (!existing)
314880
315579
  pageEl.appendChild(container);
315580
+ absoluteOverlayFragments.forEach(({ fragment: fragment2, originalIndex }) => {
315581
+ const resolvedItem = data.items?.[originalIndex];
315582
+ const fragEl = this.renderFragment(fragment2, context, undefined, betweenBorderFlags.get(originalIndex), resolvedItem);
315583
+ const isPageRelative = this.isPageRelativeAnchoredFragment(fragment2, resolvedItem);
315584
+ this.applyHeaderFooterTextWatermarkPreviewOpacity(fragEl, data.isActiveHeaderFooter === true);
315585
+ let pageY;
315586
+ if (isPageRelative && kind === "footer")
315587
+ pageY = footerAnchorPageOriginY + fragment2.y;
315588
+ else if (isPageRelative)
315589
+ pageY = fragment2.y;
315590
+ else
315591
+ pageY = effectiveOffset + fragment2.y + (kind === "footer" ? footerYOffset : 0);
315592
+ const isHorizontallyPageRelative = this.isHorizontallyPageRelativeAnchoredFragment(fragment2, resolvedItem);
315593
+ fragEl.style.top = `${pageY}px`;
315594
+ fragEl.style.left = `${isHorizontallyPageRelative ? fragment2.x : marginLeft + fragment2.x}px`;
315595
+ fragEl.style.zIndex = "0";
315596
+ if (data.isActiveHeaderFooter !== true)
315597
+ fragEl.style.pointerEvents = "none";
315598
+ fragEl.dataset.headerFooterOverlaySection = kind;
315599
+ this.insertPageBackgroundDecoration(pageEl, fragEl, this.getPageBackgroundDecorationZOrder(fragment2, resolvedItem));
315600
+ });
314881
315601
  }
314882
315602
  resetState() {
314883
315603
  if (this.mount) {
@@ -315302,6 +316022,19 @@ menclose::after {
315302
316022
  innerWrapper.style.width = `${fragment2.geometry.width}px`;
315303
316023
  innerWrapper.style.height = `${fragment2.geometry.height}px`;
315304
316024
  innerWrapper.style.transformOrigin = "center";
316025
+ if (block.drawingKind === "shapeGroup" && block.groupTransform) {
316026
+ const effectExtent = block.effectExtent ?? {
316027
+ left: 0,
316028
+ top: 0,
316029
+ right: 0,
316030
+ bottom: 0
316031
+ };
316032
+ const groupWidth = block.groupTransform.width ?? Math.max(0, block.geometry.width - effectExtent.left - effectExtent.right);
316033
+ const groupHeight = block.groupTransform.height ?? Math.max(0, block.geometry.height - effectExtent.top - effectExtent.bottom);
316034
+ const originX = effectExtent.left + groupWidth / 2;
316035
+ const originY = effectExtent.top + groupHeight / 2;
316036
+ innerWrapper.style.transformOrigin = `${originX}px ${originY}px`;
316037
+ }
315305
316038
  const scale = fragment2.scale ?? 1;
315306
316039
  const transforms = ["translate(-50%, -50%)"];
315307
316040
  transforms.push(`rotate(${fragment2.geometry.rotation ?? 0}deg)`);
@@ -315328,7 +316061,7 @@ menclose::after {
315328
316061
  if (block.drawingKind === "vectorShape" || block.drawingKind === "textboxShape")
315329
316062
  return this.createVectorShapeElement(block, fragment2.geometry, false, 1, 1, context, fragment2);
315330
316063
  if (block.drawingKind === "shapeGroup")
315331
- return this.createShapeGroupElement(block, context);
316064
+ return this.createShapeGroupElement(block, context, fragment2.geometry);
315332
316065
  if (block.drawingKind === "chart")
315333
316066
  return this.createChartElement(block);
315334
316067
  return this.createDrawingPlaceholder();
@@ -315360,12 +316093,14 @@ menclose::after {
315360
316093
  svgElement.setAttribute("width", "100%");
315361
316094
  svgElement.setAttribute("height", "100%");
315362
316095
  svgElement.style.display = "block";
316096
+ svgElement.style.overflow = "visible";
315363
316097
  if (block.fillColor && typeof block.fillColor === "object") {
315364
316098
  if ("type" in block.fillColor && block.fillColor.type === "gradient")
315365
316099
  applyGradientToSVG(svgElement, block.fillColor);
315366
316100
  else if ("type" in block.fillColor && block.fillColor.type === "solidWithAlpha")
315367
316101
  applyAlphaToSVG(svgElement, block.fillColor);
315368
316102
  }
316103
+ this.applyShapeEffects(svgElement, block);
315369
316104
  this.applyLineEnds(svgElement, block);
315370
316105
  contentContainer.appendChild(svgElement);
315371
316106
  if (block.drawingKind === "textboxShape" || this.hasShapeTextContent(block.textContent)) {
@@ -315616,19 +316351,40 @@ menclose::after {
315616
316351
  textDiv.style.textAlign = "right";
315617
316352
  else
315618
316353
  textDiv.style.textAlign = "left";
315619
- let currentParagraph = this.doc.createElement("div");
315620
- currentParagraph.style.width = "100%";
315621
- currentParagraph.style.minWidth = "0";
315622
- currentParagraph.style.whiteSpace = "normal";
316354
+ const paragraphSpacing = textContent$1.paragraphs;
316355
+ const spacingBefore = (index2) => paragraphSpacing?.[index2]?.spacing?.before;
316356
+ const spacingAfter = (index2) => paragraphSpacing?.[index2]?.spacing?.after;
316357
+ const createParagraphElement = () => {
316358
+ const paragraph2 = this.doc.createElement("div");
316359
+ paragraph2.style.width = "100%";
316360
+ paragraph2.style.minWidth = "0";
316361
+ paragraph2.style.whiteSpace = "normal";
316362
+ paragraph2.style.marginLeft = "0";
316363
+ paragraph2.style.marginRight = "0";
316364
+ return paragraph2;
316365
+ };
316366
+ let logicalParagraphIndex = 0;
316367
+ let currentParagraph = createParagraphElement();
316368
+ const firstParagraphBefore = spacingBefore(logicalParagraphIndex);
316369
+ if (typeof firstParagraphBefore === "number")
316370
+ currentParagraph.style.marginTop = `${firstParagraphBefore}px`;
315623
316371
  textContent$1.parts.forEach((part) => {
315624
316372
  if (part.isLineBreak) {
316373
+ if (part.isParagraphBoundary) {
316374
+ const currentParagraphAfter = spacingAfter(logicalParagraphIndex);
316375
+ if (typeof currentParagraphAfter === "number")
316376
+ currentParagraph.style.marginBottom = `${currentParagraphAfter}px`;
316377
+ }
315625
316378
  textDiv.appendChild(currentParagraph);
315626
- currentParagraph = this.doc.createElement("div");
315627
- currentParagraph.style.width = "100%";
315628
- currentParagraph.style.minWidth = "0";
315629
- currentParagraph.style.whiteSpace = "normal";
316379
+ currentParagraph = createParagraphElement();
315630
316380
  if (part.isEmptyParagraph)
315631
316381
  currentParagraph.style.minHeight = "1em";
316382
+ if (part.isParagraphBoundary) {
316383
+ logicalParagraphIndex += 1;
316384
+ const nextParagraphBefore = spacingBefore(logicalParagraphIndex);
316385
+ if (typeof nextParagraphBefore === "number")
316386
+ currentParagraph.style.marginTop = `${nextParagraphBefore}px`;
316387
+ }
315632
316388
  } else if (part.kind === "image" && part.src)
315633
316389
  currentParagraph.appendChild(createShapeTextImageElement(this.doc, part));
315634
316390
  else {
@@ -315654,6 +316410,9 @@ menclose::after {
315654
316410
  currentParagraph.appendChild(span);
315655
316411
  }
315656
316412
  });
316413
+ const finalParagraphAfter = spacingAfter(logicalParagraphIndex);
316414
+ if (typeof finalParagraphAfter === "number")
316415
+ currentParagraph.style.marginBottom = `${finalParagraphAfter}px`;
315657
316416
  textDiv.appendChild(currentParagraph);
315658
316417
  return textDiv;
315659
316418
  }
@@ -315705,6 +316464,7 @@ menclose::after {
315705
316464
  const viewH = firstPath.h || height;
315706
316465
  if (viewW === 0 || viewH === 0)
315707
316466
  return null;
316467
+ const explicitStrokeEffect = viewW / width > 10 || viewH / height > 10 ? ' vector-effect="non-scaling-stroke"' : "";
315708
316468
  const edgeStroke = fillColor !== "none" && strokeColor === "none" ? ` stroke="${fillColor}" stroke-width="0.5" vector-effect="non-scaling-stroke"` : "";
315709
316469
  return `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${viewW} ${viewH}" preserveAspectRatio="none">
315710
316470
  ${custGeom.paths.map((p$12) => {
@@ -315714,7 +316474,7 @@ menclose::after {
315714
316474
  const scaleX = viewW / pathW;
315715
316475
  const scaleY = viewH / pathH;
315716
316476
  const transform = needsTransform ? ` transform="scale(${scaleX}, ${scaleY})"` : "";
315717
- const strokeAttr = strokeColor !== "none" ? ` stroke="${strokeColor}" stroke-width="${strokeWidth}"` : edgeStroke;
316477
+ const strokeAttr = strokeColor !== "none" ? ` stroke="${strokeColor}" stroke-width="${strokeWidth}"${explicitStrokeEffect}` : edgeStroke;
315718
316478
  return `<path d="${p$12.d}" fill="${fillColor}" fill-rule="evenodd"${strokeAttr}${transform} />`;
315719
316479
  }).join(`
315720
316480
  `)}
@@ -315788,6 +316548,112 @@ menclose::after {
315788
316548
  target.setAttribute("marker-end", `url(#${id2})`);
315789
316549
  }
315790
316550
  }
316551
+ applyShapeEffects(svgElement, block) {
316552
+ const outerShadow = block.effects?.outerShadow;
316553
+ if (!outerShadow)
316554
+ return;
316555
+ this.applyOuterShadowEffect(svgElement, block.id, outerShadow);
316556
+ }
316557
+ applyOuterShadowEffect(svgElement, blockId, shadow) {
316558
+ const targets = this.findShapeEffectTargets(svgElement);
316559
+ if (!targets.length)
316560
+ return;
316561
+ const defs = this.ensureSvgDefs(svgElement);
316562
+ const filterId = this.sanitizeSvgId(`sd-shadow-${blockId}`);
316563
+ const outlineFilterId = this.sanitizeSvgId(`sd-shadow-outline-${blockId}`);
316564
+ if (!defs.querySelector(`#${filterId}`)) {
316565
+ const filter = this.doc.createElementNS("http://www.w3.org/2000/svg", "filter");
316566
+ filter.setAttribute("id", filterId);
316567
+ filter.setAttribute("x", "-50%");
316568
+ filter.setAttribute("y", "-50%");
316569
+ filter.setAttribute("width", "200%");
316570
+ filter.setAttribute("height", "200%");
316571
+ const { dx, dy } = resolveOuterShadowOffset(shadow);
316572
+ const dropShadow = this.doc.createElementNS("http://www.w3.org/2000/svg", "feDropShadow");
316573
+ dropShadow.setAttribute("dx", this.formatSvgNumber(dx));
316574
+ dropShadow.setAttribute("dy", this.formatSvgNumber(dy));
316575
+ dropShadow.setAttribute("stdDeviation", this.formatSvgNumber(getOuterShadowStdDeviation(shadow)));
316576
+ dropShadow.setAttribute("flood-color", shadow.color);
316577
+ dropShadow.setAttribute("flood-opacity", this.formatSvgNumber(shadow.opacity));
316578
+ filter.appendChild(dropShadow);
316579
+ defs.appendChild(filter);
316580
+ }
316581
+ targets.forEach((target) => {
316582
+ if (this.shouldRenderFilledShadowClone(target)) {
316583
+ this.appendFilledShadowClone(svgElement, defs, target, outlineFilterId, shadow);
316584
+ return;
316585
+ }
316586
+ target.setAttribute("filter", `url(#${filterId})`);
316587
+ });
316588
+ }
316589
+ findShapeEffectTargets(svgElement) {
316590
+ return Array.from(svgElement.querySelectorAll("path, line, polyline, polygon, rect, ellipse, circle")).filter((target) => !target.closest("defs") && !target.hasAttribute("data-sd-shadow-clone"));
316591
+ }
316592
+ shouldRenderFilledShadowClone(target) {
316593
+ if (target.getAttribute("fill") !== "none")
316594
+ return false;
316595
+ if (target.tagName.toLowerCase() === "path")
316596
+ return /z\s*$/i.test(target.getAttribute("d") ?? "");
316597
+ return [
316598
+ "polygon",
316599
+ "rect",
316600
+ "ellipse",
316601
+ "circle"
316602
+ ].includes(target.tagName.toLowerCase());
316603
+ }
316604
+ appendFilledShadowClone(svgElement, defs, target, filterId, shadow) {
316605
+ this.ensureOuterShadowOnlyFilter(defs, filterId, shadow);
316606
+ const clone$1 = target.cloneNode(false);
316607
+ clone$1.setAttribute("data-sd-shadow-clone", filterId);
316608
+ clone$1.setAttribute("aria-hidden", "true");
316609
+ clone$1.setAttribute("fill", "#000000");
316610
+ clone$1.setAttribute("stroke", "none");
316611
+ clone$1.setAttribute("filter", `url(#${filterId})`);
316612
+ target.parentNode?.insertBefore(clone$1, target);
316613
+ }
316614
+ ensureOuterShadowOnlyFilter(defs, filterId, shadow) {
316615
+ if (defs.querySelector(`#${filterId}`))
316616
+ return;
316617
+ const filter = this.doc.createElementNS("http://www.w3.org/2000/svg", "filter");
316618
+ filter.setAttribute("id", filterId);
316619
+ filter.setAttribute("x", "-50%");
316620
+ filter.setAttribute("y", "-50%");
316621
+ filter.setAttribute("width", "200%");
316622
+ filter.setAttribute("height", "200%");
316623
+ const blur = this.doc.createElementNS("http://www.w3.org/2000/svg", "feGaussianBlur");
316624
+ blur.setAttribute("in", "SourceAlpha");
316625
+ blur.setAttribute("stdDeviation", this.formatSvgNumber(getOuterShadowStdDeviation(shadow)));
316626
+ blur.setAttribute("result", "blur");
316627
+ const { dx, dy } = resolveOuterShadowOffset(shadow);
316628
+ const offset$1 = this.doc.createElementNS("http://www.w3.org/2000/svg", "feOffset");
316629
+ offset$1.setAttribute("in", "blur");
316630
+ offset$1.setAttribute("dx", this.formatSvgNumber(dx));
316631
+ offset$1.setAttribute("dy", this.formatSvgNumber(dy));
316632
+ offset$1.setAttribute("result", "offsetBlur");
316633
+ const flood = this.doc.createElementNS("http://www.w3.org/2000/svg", "feFlood");
316634
+ flood.setAttribute("flood-color", shadow.color);
316635
+ flood.setAttribute("flood-opacity", this.formatSvgNumber(shadow.opacity));
316636
+ flood.setAttribute("result", "shadowColor");
316637
+ const composite = this.doc.createElementNS("http://www.w3.org/2000/svg", "feComposite");
316638
+ composite.setAttribute("in", "shadowColor");
316639
+ composite.setAttribute("in2", "offsetBlur");
316640
+ composite.setAttribute("operator", "in");
316641
+ composite.setAttribute("result", "shadow");
316642
+ const outsideOnly = this.doc.createElementNS("http://www.w3.org/2000/svg", "feComposite");
316643
+ outsideOnly.setAttribute("in", "shadow");
316644
+ outsideOnly.setAttribute("in2", "SourceAlpha");
316645
+ outsideOnly.setAttribute("operator", "out");
316646
+ outsideOnly.setAttribute("result", "outerShadow");
316647
+ filter.appendChild(blur);
316648
+ filter.appendChild(offset$1);
316649
+ filter.appendChild(flood);
316650
+ filter.appendChild(composite);
316651
+ filter.appendChild(outsideOnly);
316652
+ defs.appendChild(filter);
316653
+ }
316654
+ formatSvgNumber(value) {
316655
+ return Number.isFinite(value) ? Number(value.toFixed(4)).toString() : "0";
316656
+ }
315791
316657
  findLineEndTarget(svgElement) {
315792
316658
  const line = svgElement.querySelector("line");
315793
316659
  if (line)
@@ -315876,7 +316742,7 @@ menclose::after {
315876
316742
  target.style.removeProperty("transform-origin");
315877
316743
  }
315878
316744
  }
315879
- createShapeGroupElement(block, context) {
316745
+ createShapeGroupElement(block, context, fragmentGeometry) {
315880
316746
  const groupEl = this.doc.createElement("div");
315881
316747
  groupEl.classList.add("superdoc-shape-group");
315882
316748
  groupEl.style.position = "relative";
@@ -315884,32 +316750,56 @@ menclose::after {
315884
316750
  groupEl.style.height = "100%";
315885
316751
  const groupTransform = block.groupTransform;
315886
316752
  let contentContainer = groupEl;
315887
- const visibleWidth = groupTransform?.width ?? block.geometry.width ?? 0;
315888
- const visibleHeight = groupTransform?.height ?? block.geometry.height ?? 0;
315889
- if (groupTransform) {
316753
+ const groupEffectExtent = block.effectExtent ?? {
316754
+ left: 0,
316755
+ top: 0,
316756
+ right: 0,
316757
+ bottom: 0
316758
+ };
316759
+ const hasGroupEffectExtent = groupEffectExtent.left > 0 || groupEffectExtent.top > 0 || groupEffectExtent.right > 0 || groupEffectExtent.bottom > 0;
316760
+ const visibleWidth = groupTransform?.width ?? Math.max(0, (block.geometry.width ?? 0) - groupEffectExtent.left - groupEffectExtent.right);
316761
+ const visibleHeight = groupTransform?.height ?? Math.max(0, (block.geometry.height ?? 0) - groupEffectExtent.top - groupEffectExtent.bottom);
316762
+ if (groupTransform || hasGroupEffectExtent) {
315890
316763
  const inner = this.doc.createElement("div");
315891
316764
  inner.style.position = "absolute";
315892
- inner.style.left = "0";
315893
- inner.style.top = "0";
316765
+ inner.style.left = `${groupEffectExtent.left}px`;
316766
+ inner.style.top = `${groupEffectExtent.top}px`;
315894
316767
  inner.style.width = `${Math.max(1, visibleWidth)}px`;
315895
316768
  inner.style.height = `${Math.max(1, visibleHeight)}px`;
316769
+ const groupTransforms = [];
316770
+ const normalizedGroupRotation = typeof groupTransform?.rotation === "number" ? normalizeRotationDegrees(groupTransform.rotation) : 0;
316771
+ const normalizedFragmentRotation = typeof fragmentGeometry?.rotation === "number" ? normalizeRotationDegrees(fragmentGeometry.rotation) : 0;
316772
+ const groupRotation = normalizedGroupRotation && normalizedGroupRotation !== normalizedFragmentRotation ? groupTransform?.rotation ?? 0 : 0;
316773
+ const groupFlipH = groupTransform?.flipH && groupTransform.flipH !== fragmentGeometry?.flipH;
316774
+ const groupFlipV = groupTransform?.flipV && groupTransform.flipV !== fragmentGeometry?.flipV;
316775
+ if (groupRotation)
316776
+ groupTransforms.push(`rotate(${groupRotation}deg)`);
316777
+ if (groupFlipH)
316778
+ groupTransforms.push("scaleX(-1)");
316779
+ if (groupFlipV)
316780
+ groupTransforms.push("scaleY(-1)");
316781
+ if (groupTransforms.length > 0) {
316782
+ inner.style.transformOrigin = "center";
316783
+ inner.style.transform = groupTransforms.join(" ");
316784
+ }
315896
316785
  groupEl.appendChild(inner);
315897
316786
  contentContainer = inner;
315898
316787
  }
315899
- block.shapes.forEach((child) => {
315900
- const childContent = this.createGroupChildContent(child, 1, 1, context);
316788
+ block.shapes.forEach((child, childIndex) => {
316789
+ const attrs = child.attrs ?? {};
316790
+ const paintExtent = this.getShapeGroupChildPaintExtent(child);
316791
+ const childContent = this.createGroupChildContent(child, 1, 1, context, paintExtent, block.id, childIndex);
315901
316792
  if (!childContent)
315902
316793
  return;
315903
- const attrs = child.attrs ?? {};
315904
316794
  const wrapper = this.doc.createElement("div");
315905
316795
  wrapper.classList.add("superdoc-shape-group__child");
315906
316796
  wrapper.style.position = "absolute";
315907
- wrapper.style.left = `${Number(attrs.x ?? 0)}px`;
315908
- wrapper.style.top = `${Number(attrs.y ?? 0)}px`;
316797
+ wrapper.style.left = `${Number(attrs.x ?? 0) - paintExtent.left}px`;
316798
+ wrapper.style.top = `${Number(attrs.y ?? 0) - paintExtent.top}px`;
315909
316799
  const childW = typeof attrs.width === "number" ? attrs.width : block.geometry.width;
315910
316800
  const childH = typeof attrs.height === "number" ? attrs.height : block.geometry.height;
315911
- wrapper.style.width = `${Math.max(1, childW)}px`;
315912
- wrapper.style.height = `${Math.max(1, childH)}px`;
316801
+ wrapper.style.width = `${Math.max(1, childW + paintExtent.left + paintExtent.right)}px`;
316802
+ wrapper.style.height = `${Math.max(1, childH + paintExtent.top + paintExtent.bottom)}px`;
315913
316803
  wrapper.style.transformOrigin = "center";
315914
316804
  const transforms = [];
315915
316805
  if (attrs.rotation)
@@ -315927,20 +316817,63 @@ menclose::after {
315927
316817
  });
315928
316818
  return groupEl;
315929
316819
  }
315930
- createGroupChildContent(child, groupScaleX = 1, groupScaleY = 1, context) {
316820
+ getShapeGroupChildPaintExtent(child) {
316821
+ if (child.shapeType !== "vectorShape" || !("fillColor" in child.attrs))
316822
+ return {
316823
+ left: 0,
316824
+ top: 0,
316825
+ right: 0,
316826
+ bottom: 0
316827
+ };
316828
+ const attrs = child.attrs;
316829
+ const shadowExtent = attrs.effects?.outerShadow ? getOuterShadowPaintExtent(attrs.effects.outerShadow) : {
316830
+ left: 0,
316831
+ top: 0,
316832
+ right: 0,
316833
+ bottom: 0
316834
+ };
316835
+ if (attrs.lineEnds)
316836
+ return {
316837
+ left: 0,
316838
+ top: 0,
316839
+ right: 0,
316840
+ bottom: 0
316841
+ };
316842
+ if (attrs.strokeColor === null)
316843
+ return shadowExtent;
316844
+ const rawStrokeWidth = child.attrs.strokeWidth;
316845
+ const parsedStrokeWidth = typeof rawStrokeWidth === "number" ? rawStrokeWidth : typeof rawStrokeWidth === "string" && rawStrokeWidth.trim() !== "" ? Number(rawStrokeWidth) : undefined;
316846
+ const strokeWidth = parsedStrokeWidth != null && Number.isFinite(parsedStrokeWidth) ? parsedStrokeWidth : 1;
316847
+ if (strokeWidth <= 0)
316848
+ return shadowExtent;
316849
+ const extent = strokeWidth / 2;
316850
+ return {
316851
+ left: Math.max(extent, shadowExtent.left),
316852
+ top: Math.max(extent, shadowExtent.top),
316853
+ right: Math.max(extent, shadowExtent.right),
316854
+ bottom: Math.max(extent, shadowExtent.bottom)
316855
+ };
316856
+ }
316857
+ createGroupChildContent(child, groupScaleX = 1, groupScaleY = 1, context, paintExtent = {
316858
+ left: 0,
316859
+ top: 0,
316860
+ right: 0,
316861
+ bottom: 0
316862
+ }, groupId, childIndex) {
315931
316863
  if (child.shapeType === "vectorShape" && "fillColor" in child.attrs) {
315932
316864
  const attrs = child.attrs;
315933
316865
  const childGeometry = {
315934
- width: attrs.width ?? 0,
315935
- height: attrs.height ?? 0,
316866
+ width: (attrs.width ?? 0) + paintExtent.left + paintExtent.right,
316867
+ height: (attrs.height ?? 0) + paintExtent.top + paintExtent.bottom,
315936
316868
  rotation: attrs.rotation ?? 0,
315937
316869
  flipH: attrs.flipH ?? false,
315938
316870
  flipV: attrs.flipV ?? false
315939
316871
  };
316872
+ const hasPaintExtent = paintExtent.left > 0 || paintExtent.top > 0 || paintExtent.right > 0 || paintExtent.bottom > 0;
315940
316873
  const vectorChild = {
315941
316874
  drawingKind: "vectorShape",
315942
316875
  kind: "drawing",
315943
- id: `${attrs.shapeId ?? child.shapeType}`,
316876
+ id: groupId != null ? `${groupId}-${childIndex ?? 0}-${attrs.shapeId ?? child.shapeType}` : `${attrs.shapeId ?? child.shapeType}`,
315944
316877
  geometry: childGeometry,
315945
316878
  padding: undefined,
315946
316879
  margin: undefined,
@@ -315955,10 +316888,12 @@ menclose::after {
315955
316888
  strokeColor: attrs.strokeColor,
315956
316889
  strokeWidth: attrs.strokeWidth,
315957
316890
  lineEnds: attrs.lineEnds,
316891
+ effects: attrs.effects,
315958
316892
  textContent: attrs.textContent,
315959
316893
  textAlign: attrs.textAlign,
315960
316894
  textVerticalAlign: attrs.textVerticalAlign,
315961
- textInsets: attrs.textInsets
316895
+ textInsets: attrs.textInsets,
316896
+ effectExtent: hasPaintExtent ? paintExtent : undefined
315962
316897
  };
315963
316898
  return this.createVectorShapeElement(vectorChild, childGeometry, false, groupScaleX, groupScaleY, context);
315964
316899
  }
@@ -316590,11 +317525,20 @@ menclose::after {
316590
317525
  if (!attrs || typeof attrs !== "object")
316591
317526
  return "";
316592
317527
  return readClipPathValue(attrs.clipPath);
317528
+ }, resolveShapeClipPathFromAttrs = (attrs) => {
317529
+ if (!attrs || typeof attrs !== "object")
317530
+ return "";
317531
+ return readClipPathValue(attrs.shapeClipPath);
316593
317532
  }, resolveBlockClipPath = (block) => {
316594
317533
  if (!block || typeof block !== "object")
316595
317534
  return "";
316596
317535
  const record = block;
316597
317536
  return readClipPathValue(record.clipPath) || resolveClipPathFromAttrs(record.attrs);
317537
+ }, resolveBlockShapeClipPath = (block) => {
317538
+ if (!block || typeof block !== "object")
317539
+ return "";
317540
+ const record = block;
317541
+ return readClipPathValue(record.shapeClipPath) || resolveShapeClipPathFromAttrs(record.attrs);
316598
317542
  }, imageHyperlinkVersion = (hyperlink) => {
316599
317543
  if (!hyperlink)
316600
317544
  return "";
@@ -316633,7 +317577,8 @@ menclose::after {
316633
317577
  image2.flipH ? 1 : 0,
316634
317578
  image2.flipV ? 1 : 0,
316635
317579
  imageHyperlinkVersion(image2.hyperlink),
316636
- resolveBlockClipPath(image2)
317580
+ resolveBlockClipPath(image2),
317581
+ resolveBlockShapeClipPath(image2)
316637
317582
  ].join("|"), renderedInlineImageRunVersion = (image2) => [
316638
317583
  "img",
316639
317584
  image2.src ?? "",
@@ -316642,6 +317587,8 @@ menclose::after {
316642
317587
  image2.alt ?? "",
316643
317588
  image2.title ?? "",
316644
317589
  typeof image2.clipPath === "string" ? image2.clipPath.trim() : "",
317590
+ typeof image2.shapeClipPath === "string" ? image2.shapeClipPath.trim() : "",
317591
+ image2.objectFit ?? "",
316645
317592
  image2.distTop ?? "",
316646
317593
  image2.distBottom ?? "",
316647
317594
  image2.distLeft ?? "",
@@ -316840,7 +317787,9 @@ menclose::after {
316840
317787
  vector.geometry.flipV ? 1 : 0,
316841
317788
  drawingTextVersion(vector),
316842
317789
  block.anchor?.offsetH ?? "",
316843
- block.anchor?.offsetV ?? ""
317790
+ block.anchor?.offsetV ?? "",
317791
+ vector.effects ? JSON.stringify(vector.effects) : "",
317792
+ vector.effectExtent ? JSON.stringify(vector.effectExtent) : ""
316844
317793
  ].join("|");
316845
317794
  }
316846
317795
  if (block.drawingKind === "shapeGroup") {
@@ -316850,6 +317799,7 @@ menclose::after {
316850
317799
  "drawing:group",
316851
317800
  group.geometry.width,
316852
317801
  group.geometry.height,
317802
+ group.effectExtent ? JSON.stringify(group.effectExtent) : "",
316853
317803
  group.groupTransform ? JSON.stringify(group.groupTransform) : "",
316854
317804
  childSignature
316855
317805
  ].join("|");
@@ -317545,6 +318495,7 @@ menclose::after {
317545
318495
  JSON.stringify(block.customGeometry ?? null),
317546
318496
  JSON.stringify(block.lineEnds ?? null),
317547
318497
  JSON.stringify(block.effectExtent ?? null),
318498
+ JSON.stringify(block.effects ?? null),
317548
318499
  JSON.stringify(block.textContent ?? null),
317549
318500
  block.textAlign ?? "",
317550
318501
  block.textVerticalAlign ?? "",
@@ -317708,7 +318659,7 @@ menclose::after {
317708
318659
  return `${block.id}:table:${contentHash}${tableAttrsKey}`;
317709
318660
  }
317710
318661
  if (block.kind !== "paragraph")
317711
- return block.id;
318662
+ return hashNonParagraphCellBlock(block);
317712
318663
  const trackedMode = block.attrs && "trackedChangesMode" in block.attrs && block.attrs.trackedChangesMode || "review";
317713
318664
  const trackedEnabled = resolveTrackedChangesEnabled(block.attrs, true);
317714
318665
  const runsHash = block.runs.map((run2) => {
@@ -318577,7 +319528,7 @@ menclose::after {
318577
319528
  }
318578
319529
  return true;
318579
319530
  }, imageRunsEqual = (a2, b$1) => {
318580
- 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);
319531
+ 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);
318581
319532
  }, imageBlocksEqual = (a2, b$1) => {
318582
319533
  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);
318583
319534
  }, drawingBlocksEqual = (a2, b$1) => {
@@ -318603,10 +319554,10 @@ menclose::after {
318603
319554
  return imageBlocksEqual(a2, b$1);
318604
319555
  if ((a2.drawingKind === "vectorShape" || a2.drawingKind === "textboxShape") && (b$1.drawingKind === "vectorShape" || b$1.drawingKind === "textboxShape")) {
318605
319556
  const textboxContentEqual = a2.drawingKind !== "textboxShape" || b$1.drawingKind !== "textboxShape" || jsonEqual(a2.contentBlocks, b$1.contentBlocks);
318606
- 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;
319557
+ 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;
318607
319558
  }
318608
319559
  if (a2.drawingKind === "shapeGroup" && b$1.drawingKind === "shapeGroup")
318609
- 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);
319560
+ 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);
318610
319561
  if (a2.drawingKind === "chart" && b$1.drawingKind === "chart")
318611
319562
  return drawingGeometryEqual(a2.geometry, b$1.geometry) && a2.chartRelId === b$1.chartRelId && jsonEqual(a2.chartData, b$1.chartData);
318612
319563
  return true;
@@ -318658,7 +319609,7 @@ menclose::after {
318658
319609
  return true;
318659
319610
  if (!a2 || !b$1)
318660
319611
  return !a2 && !b$1;
318661
- 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;
319612
+ 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);
318662
319613
  }, shapeGroupSizeEqual = (a2, b$1) => {
318663
319614
  if (a2 === b$1)
318664
319615
  return true;
@@ -322043,9 +322994,10 @@ menclose::after {
322043
322994
  const visiblePointerSurface = resolveVisibleSurfaceAtPointer(event.target, event.clientX, event.clientY);
322044
322995
  const clickedInsideVisibleActiveSurface = visiblePointerSurface?.kind === "headerFooter" && visiblePointerSurface.surface.closest(activeSurfaceSelector) != null;
322045
322996
  if (visiblePointerSurface?.kind === "bodyContent") {
322046
- const behindDocSection = (event.target instanceof Element ? event.target.closest("[data-behind-doc-section]") : null)?.dataset.behindDocSection;
322997
+ const targetElement = event.target instanceof Element ? event.target : null;
322998
+ const pageLevelSection = targetElement?.closest("[data-behind-doc-section]")?.dataset.behindDocSection ?? targetElement?.closest("[data-header-footer-overlay-section]")?.dataset.headerFooterOverlaySection;
322047
322999
  const sessionMode = session?.session?.mode;
322048
- if (behindDocSection && behindDocSection === sessionMode)
323000
+ if (pageLevelSection && pageLevelSection === sessionMode)
322049
323001
  return false;
322050
323002
  this.#callbacks.exitHeaderFooterMode?.();
322051
323003
  return false;
@@ -326336,13 +327288,13 @@ menclose::after {
326336
327288
  return;
326337
327289
  console.log(...args$1);
326338
327290
  }, 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;
326339
- var init_src_CkxGCnVm_es = __esm(() => {
327291
+ var init_src_q2d5WRO_es = __esm(() => {
326340
327292
  init_rolldown_runtime_Bg48TavK_es();
326341
- init_SuperConverter_DQ2wMaLK_es();
327293
+ init_SuperConverter_DJEK5GYX_es();
326342
327294
  init_jszip_C49i9kUs_es();
326343
327295
  init_xml_js_CqGKpaft_es();
326344
327296
  init_uuid_B2wVPhPi_es();
326345
- init_create_headless_toolbar_BhSfQYaO_es();
327297
+ init_create_headless_toolbar_BYe9VWHO_es();
326346
327298
  init_constants_D9qj59G2_es();
326347
327299
  init_unified_BDuVPlMu_es();
326348
327300
  init_remark_gfm_BUJjZJLy_es();
@@ -338763,6 +339715,14 @@ ${err.toString()}`);
338763
339715
  return { style: style2 };
338764
339716
  }
338765
339717
  },
339718
+ shapeClipPath: {
339719
+ default: null,
339720
+ rendered: false
339721
+ },
339722
+ objectFit: {
339723
+ default: null,
339724
+ rendered: false
339725
+ },
338766
339726
  size: {
338767
339727
  default: {},
338768
339728
  renderDOM: ({ size: size$1, shouldCover }) => {
@@ -339816,6 +340776,10 @@ ${err.toString()}`);
339816
340776
  default: null,
339817
340777
  rendered: false
339818
340778
  },
340779
+ effects: {
340780
+ default: null,
340781
+ rendered: false
340782
+ },
339819
340783
  lineEnds: {
339820
340784
  default: null,
339821
340785
  rendered: false
@@ -342507,32 +343471,419 @@ ${err.toString()}`);
342507
343471
  }]
342508
343472
  }
342509
343473
  };
342510
- F = new Set(["leftRightArrow", "upDownArrow"]);
343474
+ F = new Set([
343475
+ "bentArrow",
343476
+ "bentUpArrow",
343477
+ "downArrow",
343478
+ "leftArrow",
343479
+ "leftRightArrow",
343480
+ "leftRightUpArrow",
343481
+ "leftUpArrow",
343482
+ "quadArrow",
343483
+ "rightArrow",
343484
+ "upArrow",
343485
+ "upDownArrow",
343486
+ "uturnArrow"
343487
+ ]);
342511
343488
  X = {
343489
+ bentArrow: `<bentArrow>
343490
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
343491
+ <path w="588010" h="648335">
343492
+ <moveTo>
343493
+ <pt x="0" y="648335"/>
343494
+ </moveTo>
343495
+ <lnTo>
343496
+ <pt x="0" y="330756"/>
343497
+ </lnTo>
343498
+ <cubicBezTo>
343499
+ <pt x="0" y="188679"/>
343500
+ <pt x="115177" y="73502"/>
343501
+ <pt x="257254" y="73502"/>
343502
+ </cubicBezTo>
343503
+ <lnTo>
343504
+ <pt x="441008" y="73501"/>
343505
+ </lnTo>
343506
+ <lnTo>
343507
+ <pt x="441008" y="0"/>
343508
+ </lnTo>
343509
+ <lnTo>
343510
+ <pt x="588010" y="147003"/>
343511
+ </lnTo>
343512
+ <lnTo>
343513
+ <pt x="441008" y="294005"/>
343514
+ </lnTo>
343515
+ <lnTo>
343516
+ <pt x="441008" y="220504"/>
343517
+ </lnTo>
343518
+ <lnTo>
343519
+ <pt x="257254" y="220504"/>
343520
+ </lnTo>
343521
+ <cubicBezTo>
343522
+ <pt x="196364" y="220504"/>
343523
+ <pt x="147002" y="269866"/>
343524
+ <pt x="147002" y="330756"/>
343525
+ </cubicBezTo>
343526
+ <cubicBezTo>
343527
+ <pt x="147002" y="436616"/>
343528
+ <pt x="147003" y="542475"/>
343529
+ <pt x="147003" y="648335"/>
343530
+ </cubicBezTo>
343531
+ <lnTo>
343532
+ <pt x="0" y="648335"/>
343533
+ </lnTo>
343534
+ <close/>
343535
+ </path>
343536
+ </pathLst>
343537
+ </bentArrow>`,
343538
+ bentUpArrow: `<bentUpArrow>
343539
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
343540
+ <path w="850265" h="731520">
343541
+ <moveTo>
343542
+ <pt x="0" y="548640"/>
343543
+ </moveTo>
343544
+ <lnTo>
343545
+ <pt x="575945" y="548640"/>
343546
+ </lnTo>
343547
+ <lnTo>
343548
+ <pt x="575945" y="182880"/>
343549
+ </lnTo>
343550
+ <lnTo>
343551
+ <pt x="484505" y="182880"/>
343552
+ </lnTo>
343553
+ <lnTo>
343554
+ <pt x="667385" y="0"/>
343555
+ </lnTo>
343556
+ <lnTo>
343557
+ <pt x="850265" y="182880"/>
343558
+ </lnTo>
343559
+ <lnTo>
343560
+ <pt x="758825" y="182880"/>
343561
+ </lnTo>
343562
+ <lnTo>
343563
+ <pt x="758825" y="731520"/>
343564
+ </lnTo>
343565
+ <lnTo>
343566
+ <pt x="0" y="731520"/>
343567
+ </lnTo>
343568
+ <lnTo>
343569
+ <pt x="0" y="548640"/>
343570
+ </lnTo>
343571
+ <close/>
343572
+ </path>
343573
+ </pathLst>
343574
+ </bentUpArrow>`,
343575
+ downArrow: `<downArrow>
343576
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
343577
+ <path w="394970" h="576580">
343578
+ <moveTo>
343579
+ <pt x="0" y="379095"/>
343580
+ </moveTo>
343581
+ <lnTo>
343582
+ <pt x="98743" y="379095"/>
343583
+ </lnTo>
343584
+ <lnTo>
343585
+ <pt x="98743" y="0"/>
343586
+ </lnTo>
343587
+ <lnTo>
343588
+ <pt x="296228" y="0"/>
343589
+ </lnTo>
343590
+ <lnTo>
343591
+ <pt x="296228" y="379095"/>
343592
+ </lnTo>
343593
+ <lnTo>
343594
+ <pt x="394970" y="379095"/>
343595
+ </lnTo>
343596
+ <lnTo>
343597
+ <pt x="197485" y="576580"/>
343598
+ </lnTo>
343599
+ <lnTo>
343600
+ <pt x="0" y="379095"/>
343601
+ </lnTo>
343602
+ <close/>
343603
+ </path>
343604
+ </pathLst>
343605
+ </downArrow>`,
343606
+ leftArrow: `<leftArrow>
343607
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
343608
+ <path w="662549" h="367128">
343609
+ <moveTo>
343610
+ <pt x="0" y="183564"/>
343611
+ </moveTo>
343612
+ <lnTo>
343613
+ <pt x="183564" y="0"/>
343614
+ </lnTo>
343615
+ <lnTo>
343616
+ <pt x="183564" y="91782"/>
343617
+ </lnTo>
343618
+ <lnTo>
343619
+ <pt x="662549" y="91782"/>
343620
+ </lnTo>
343621
+ <lnTo>
343622
+ <pt x="662549" y="275346"/>
343623
+ </lnTo>
343624
+ <lnTo>
343625
+ <pt x="183564" y="275346"/>
343626
+ </lnTo>
343627
+ <lnTo>
343628
+ <pt x="183564" y="367128"/>
343629
+ </lnTo>
343630
+ <lnTo>
343631
+ <pt x="0" y="183564"/>
343632
+ </lnTo>
343633
+ <close/>
343634
+ </path>
343635
+ </pathLst>
343636
+ </leftArrow>`,
342512
343637
  leftRightArrow: `<leftRightArrow>
343638
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
343639
+ <path w="985520" h="379730">
343640
+ <moveTo>
343641
+ <pt x="0" y="189865"/>
343642
+ </moveTo>
343643
+ <lnTo>
343644
+ <pt x="189865" y="0"/>
343645
+ </lnTo>
343646
+ <lnTo>
343647
+ <pt x="189865" y="94933"/>
343648
+ </lnTo>
343649
+ <lnTo>
343650
+ <pt x="795655" y="94933"/>
343651
+ </lnTo>
343652
+ <lnTo>
343653
+ <pt x="795655" y="0"/>
343654
+ </lnTo>
343655
+ <lnTo>
343656
+ <pt x="985520" y="189865"/>
343657
+ </lnTo>
343658
+ <lnTo>
343659
+ <pt x="795655" y="379730"/>
343660
+ </lnTo>
343661
+ <lnTo>
343662
+ <pt x="795655" y="284798"/>
343663
+ </lnTo>
343664
+ <lnTo>
343665
+ <pt x="189865" y="284798"/>
343666
+ </lnTo>
343667
+ <lnTo>
343668
+ <pt x="189865" y="379730"/>
343669
+ </lnTo>
343670
+ <lnTo>
343671
+ <pt x="0" y="189865"/>
343672
+ </lnTo>
343673
+ <close/>
343674
+ </path>
343675
+ </pathLst>
343676
+ </leftRightArrow>`,
343677
+ leftRightUpArrow: `<leftRightUpArrow>
343678
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
343679
+ <path w="928370" h="634365">
343680
+ <moveTo>
343681
+ <pt x="0" y="475774"/>
343682
+ </moveTo>
343683
+ <lnTo>
343684
+ <pt x="158591" y="317183"/>
343685
+ </lnTo>
343686
+ <lnTo>
343687
+ <pt x="158591" y="396478"/>
343688
+ </lnTo>
343689
+ <lnTo>
343690
+ <pt x="384889" y="396478"/>
343691
+ </lnTo>
343692
+ <lnTo>
343693
+ <pt x="384889" y="158591"/>
343694
+ </lnTo>
343695
+ <lnTo>
343696
+ <pt x="305594" y="158591"/>
343697
+ </lnTo>
343698
+ <lnTo>
343699
+ <pt x="464185" y="0"/>
343700
+ </lnTo>
343701
+ <lnTo>
343702
+ <pt x="622776" y="158591"/>
343703
+ </lnTo>
343704
+ <lnTo>
343705
+ <pt x="543481" y="158591"/>
343706
+ </lnTo>
343707
+ <lnTo>
343708
+ <pt x="543481" y="396478"/>
343709
+ </lnTo>
343710
+ <lnTo>
343711
+ <pt x="769779" y="396478"/>
343712
+ </lnTo>
343713
+ <lnTo>
343714
+ <pt x="769779" y="317183"/>
343715
+ </lnTo>
343716
+ <lnTo>
343717
+ <pt x="928370" y="475774"/>
343718
+ </lnTo>
343719
+ <lnTo>
343720
+ <pt x="769779" y="634365"/>
343721
+ </lnTo>
343722
+ <lnTo>
343723
+ <pt x="769779" y="555069"/>
343724
+ </lnTo>
343725
+ <lnTo>
343726
+ <pt x="158591" y="555069"/>
343727
+ </lnTo>
343728
+ <lnTo>
343729
+ <pt x="158591" y="634365"/>
343730
+ </lnTo>
343731
+ <lnTo>
343732
+ <pt x="0" y="475774"/>
343733
+ </lnTo>
343734
+ <close/>
343735
+ </path>
343736
+ </pathLst>
343737
+ </leftRightUpArrow>`,
343738
+ leftUpArrow: `<leftUpArrow>
343739
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
343740
+ <path w="850265" h="850265">
343741
+ <moveTo>
343742
+ <pt x="0" y="637699"/>
343743
+ </moveTo>
343744
+ <lnTo>
343745
+ <pt x="212566" y="425133"/>
343746
+ </lnTo>
343747
+ <lnTo>
343748
+ <pt x="212566" y="531416"/>
343749
+ </lnTo>
343750
+ <lnTo>
343751
+ <pt x="531416" y="531416"/>
343752
+ </lnTo>
343753
+ <lnTo>
343754
+ <pt x="531416" y="212566"/>
343755
+ </lnTo>
343756
+ <lnTo>
343757
+ <pt x="425133" y="212566"/>
343758
+ </lnTo>
343759
+ <lnTo>
343760
+ <pt x="637699" y="0"/>
343761
+ </lnTo>
343762
+ <lnTo>
343763
+ <pt x="850265" y="212566"/>
343764
+ </lnTo>
343765
+ <lnTo>
343766
+ <pt x="743982" y="212566"/>
343767
+ </lnTo>
343768
+ <lnTo>
343769
+ <pt x="743982" y="743982"/>
343770
+ </lnTo>
343771
+ <lnTo>
343772
+ <pt x="212566" y="743982"/>
343773
+ </lnTo>
343774
+ <lnTo>
343775
+ <pt x="212566" y="850265"/>
343776
+ </lnTo>
343777
+ <lnTo>
343778
+ <pt x="0" y="637699"/>
343779
+ </lnTo>
343780
+ <close/>
343781
+ </path>
343782
+ </pathLst>
343783
+ </leftUpArrow>`,
343784
+ quadArrow: `<quadArrow>
343785
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
343786
+ <path w="788670" h="831215">
343787
+ <moveTo>
343788
+ <pt x="0" y="415608"/>
343789
+ </moveTo>
343790
+ <lnTo>
343791
+ <pt x="177451" y="238157"/>
343792
+ </lnTo>
343793
+ <lnTo>
343794
+ <pt x="177451" y="326882"/>
343795
+ </lnTo>
343796
+ <lnTo>
343797
+ <pt x="305610" y="326882"/>
343798
+ </lnTo>
343799
+ <lnTo>
343800
+ <pt x="305610" y="177451"/>
343801
+ </lnTo>
343802
+ <lnTo>
343803
+ <pt x="216884" y="177451"/>
343804
+ </lnTo>
343805
+ <lnTo>
343806
+ <pt x="394335" y="0"/>
343807
+ </lnTo>
343808
+ <lnTo>
343809
+ <pt x="571786" y="177451"/>
343810
+ </lnTo>
343811
+ <lnTo>
343812
+ <pt x="483060" y="177451"/>
343813
+ </lnTo>
343814
+ <lnTo>
343815
+ <pt x="483060" y="326882"/>
343816
+ </lnTo>
343817
+ <lnTo>
343818
+ <pt x="611219" y="326882"/>
343819
+ </lnTo>
343820
+ <lnTo>
343821
+ <pt x="611219" y="238157"/>
343822
+ </lnTo>
343823
+ <lnTo>
343824
+ <pt x="788670" y="415608"/>
343825
+ </lnTo>
343826
+ <lnTo>
343827
+ <pt x="611219" y="593058"/>
343828
+ </lnTo>
343829
+ <lnTo>
343830
+ <pt x="611219" y="504333"/>
343831
+ </lnTo>
343832
+ <lnTo>
343833
+ <pt x="483060" y="504333"/>
343834
+ </lnTo>
343835
+ <lnTo>
343836
+ <pt x="483060" y="653764"/>
343837
+ </lnTo>
343838
+ <lnTo>
343839
+ <pt x="571786" y="653764"/>
343840
+ </lnTo>
343841
+ <lnTo>
343842
+ <pt x="394335" y="831215"/>
343843
+ </lnTo>
343844
+ <lnTo>
343845
+ <pt x="216884" y="653764"/>
343846
+ </lnTo>
343847
+ <lnTo>
343848
+ <pt x="305610" y="653764"/>
343849
+ </lnTo>
343850
+ <lnTo>
343851
+ <pt x="305610" y="504333"/>
343852
+ </lnTo>
343853
+ <lnTo>
343854
+ <pt x="177451" y="504333"/>
343855
+ </lnTo>
343856
+ <lnTo>
343857
+ <pt x="177451" y="593058"/>
343858
+ </lnTo>
343859
+ <lnTo>
343860
+ <pt x="0" y="415608"/>
343861
+ </lnTo>
343862
+ <close/>
343863
+ </path>
343864
+ </pathLst>
343865
+ </quadArrow>`,
343866
+ rightArrow: `<rightArrow>
342513
343867
  <avLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
342514
343868
  <gd name="adj1" fmla="val 50000"/>
342515
343869
  <gd name="adj2" fmla="val 50000"/>
342516
343870
  </avLst>
342517
343871
  <gdLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
342518
- <gd name="maxAdj2" fmla="*/ 50000 w ss"/>
343872
+ <gd name="maxAdj2" fmla="*/ 100000 w ss"/>
342519
343873
  <gd name="a1" fmla="pin 0 adj1 100000"/>
342520
343874
  <gd name="a2" fmla="pin 0 adj2 maxAdj2"/>
342521
- <gd name="x2" fmla="*/ ss a2 100000"/>
342522
- <gd name="x3" fmla="+- r 0 x2"/>
342523
- <gd name="dy" fmla="*/ h a1 200000"/>
342524
- <gd name="y1" fmla="+- vc 0 dy"/>
342525
- <gd name="y2" fmla="+- vc dy 0"/>
342526
- <gd name="dx1" fmla="*/ y1 x2 hd2"/>
342527
- <gd name="x1" fmla="+- x2 0 dx1"/>
342528
- <gd name="x4" fmla="+- x3 dx1 0"/>
343875
+ <gd name="dx1" fmla="*/ ss a2 100000"/>
343876
+ <gd name="x1" fmla="+- r 0 dx1"/>
343877
+ <gd name="dy1" fmla="*/ h a1 200000"/>
343878
+ <gd name="y1" fmla="+- vc 0 dy1"/>
343879
+ <gd name="y2" fmla="+- vc dy1 0"/>
342529
343880
  </gdLst>
342530
343881
  <ahLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
342531
343882
  <ahXY gdRefY="adj1" minY="0" maxY="100000">
342532
- <pos x="x3" y="y1"/>
343883
+ <pos x="x1" y="y1"/>
342533
343884
  </ahXY>
342534
343885
  <ahXY gdRefX="adj2" minX="0" maxX="maxAdj2">
342535
- <pos x="x2" y="t"/>
343886
+ <pos x="x1" y="t"/>
342536
343887
  </ahXY>
342537
343888
  </ahLst>
342538
343889
  <cxnLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
@@ -342540,147 +343891,177 @@ ${err.toString()}`);
342540
343891
  <pos x="r" y="vc"/>
342541
343892
  </cxn>
342542
343893
  <cxn ang="cd4">
342543
- <pos x="x3" y="b"/>
342544
- </cxn>
342545
- <cxn ang="cd4">
342546
- <pos x="x2" y="b"/>
343894
+ <pos x="x1" y="b"/>
342547
343895
  </cxn>
342548
343896
  <cxn ang="cd2">
342549
343897
  <pos x="l" y="vc"/>
342550
343898
  </cxn>
342551
343899
  <cxn ang="3cd4">
342552
- <pos x="x2" y="t"/>
342553
- </cxn>
342554
- <cxn ang="3cd4">
342555
- <pos x="x3" y="t"/>
343900
+ <pos x="x1" y="t"/>
342556
343901
  </cxn>
342557
343902
  </cxnLst>
342558
- <rect l="x1" t="y1" r="x4" b="y2" xmlns="http://schemas.openxmlformats.org/drawingml/2006/main"/>
343903
+ <rect l="l" t="y1" r="x1" b="y2" xmlns="http://schemas.openxmlformats.org/drawingml/2006/main"/>
342559
343904
  <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
342560
343905
  <path>
342561
343906
  <moveTo>
342562
- <pt x="l" y="vc"/>
343907
+ <pt x="l" y="y1"/>
342563
343908
  </moveTo>
342564
343909
  <lnTo>
342565
- <pt x="x2" y="t"/>
343910
+ <pt x="x1" y="y1"/>
342566
343911
  </lnTo>
342567
343912
  <lnTo>
342568
- <pt x="x2" y="y1"/>
343913
+ <pt x="x1" y="t"/>
342569
343914
  </lnTo>
342570
343915
  <lnTo>
342571
- <pt x="x3" y="y1"/>
343916
+ <pt x="r" y="vc"/>
342572
343917
  </lnTo>
342573
343918
  <lnTo>
342574
- <pt x="x3" y="t"/>
343919
+ <pt x="x1" y="b"/>
342575
343920
  </lnTo>
342576
343921
  <lnTo>
342577
- <pt x="r" y="vc"/>
343922
+ <pt x="x1" y="y2"/>
343923
+ </lnTo>
343924
+ <lnTo>
343925
+ <pt x="l" y="y2"/>
343926
+ </lnTo>
343927
+ <close/>
343928
+ </path>
343929
+ </pathLst>
343930
+ </rightArrow>`,
343931
+ upArrow: `<upArrow>
343932
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
343933
+ <path w="367127" h="550008">
343934
+ <moveTo>
343935
+ <pt x="0" y="183564"/>
343936
+ </moveTo>
343937
+ <lnTo>
343938
+ <pt x="183564" y="0"/>
343939
+ </lnTo>
343940
+ <lnTo>
343941
+ <pt x="367127" y="183564"/>
343942
+ </lnTo>
343943
+ <lnTo>
343944
+ <pt x="275345" y="183564"/>
342578
343945
  </lnTo>
342579
343946
  <lnTo>
342580
- <pt x="x3" y="b"/>
343947
+ <pt x="275345" y="550008"/>
342581
343948
  </lnTo>
342582
343949
  <lnTo>
342583
- <pt x="x3" y="y2"/>
343950
+ <pt x="91782" y="550008"/>
342584
343951
  </lnTo>
342585
343952
  <lnTo>
342586
- <pt x="x2" y="y2"/>
343953
+ <pt x="91782" y="183564"/>
342587
343954
  </lnTo>
342588
343955
  <lnTo>
342589
- <pt x="x2" y="b"/>
343956
+ <pt x="0" y="183564"/>
342590
343957
  </lnTo>
342591
343958
  <close/>
342592
343959
  </path>
342593
343960
  </pathLst>
342594
- </leftRightArrow>`,
343961
+ </upArrow>`,
342595
343962
  upDownArrow: `<upDownArrow>
342596
- <avLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
342597
- <gd name="adj1" fmla="val 50000"/>
342598
- <gd name="adj2" fmla="val 50000"/>
342599
- </avLst>
342600
- <gdLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
342601
- <gd name="maxAdj2" fmla="*/ 50000 h ss"/>
342602
- <gd name="a1" fmla="pin 0 adj1 100000"/>
342603
- <gd name="a2" fmla="pin 0 adj2 maxAdj2"/>
342604
- <gd name="y2" fmla="*/ ss a2 100000"/>
342605
- <gd name="y3" fmla="+- b 0 y2"/>
342606
- <gd name="dx1" fmla="*/ w a1 200000"/>
342607
- <gd name="x1" fmla="+- hc 0 dx1"/>
342608
- <gd name="x2" fmla="+- hc dx1 0"/>
342609
- <gd name="dy1" fmla="*/ x1 y2 wd2"/>
342610
- <gd name="y1" fmla="+- y2 0 dy1"/>
342611
- <gd name="y4" fmla="+- y3 dy1 0"/>
342612
- </gdLst>
342613
- <ahLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
342614
- <ahXY gdRefX="adj1" minX="0" maxX="100000">
342615
- <pos x="x1" y="y3"/>
342616
- </ahXY>
342617
- <ahXY gdRefY="adj2" minY="0" maxY="maxAdj2">
342618
- <pos x="l" y="y2"/>
342619
- </ahXY>
342620
- </ahLst>
342621
- <cxnLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
342622
- <cxn ang="3cd4">
342623
- <pos x="hc" y="t"/>
342624
- </cxn>
342625
- <cxn ang="cd2">
342626
- <pos x="l" y="y2"/>
342627
- </cxn>
342628
- <cxn ang="cd2">
342629
- <pos x="x1" y="vc"/>
342630
- </cxn>
342631
- <cxn ang="cd2">
342632
- <pos x="l" y="y3"/>
342633
- </cxn>
342634
- <cxn ang="cd4">
342635
- <pos x="hc" y="b"/>
342636
- </cxn>
342637
- <cxn ang="0">
342638
- <pos x="r" y="y3"/>
342639
- </cxn>
342640
- <cxn ang="0">
342641
- <pos x="x2" y="vc"/>
342642
- </cxn>
342643
- <cxn ang="0">
342644
- <pos x="r" y="y2"/>
342645
- </cxn>
342646
- </cxnLst>
342647
- <rect l="x1" t="y1" r="x2" b="y4" xmlns="http://schemas.openxmlformats.org/drawingml/2006/main"/>
342648
343963
  <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
342649
- <path>
343964
+ <path w="296545" h="746760">
342650
343965
  <moveTo>
342651
- <pt x="l" y="y2"/>
343966
+ <pt x="0" y="148273"/>
342652
343967
  </moveTo>
342653
343968
  <lnTo>
342654
- <pt x="hc" y="t"/>
343969
+ <pt x="148273" y="0"/>
342655
343970
  </lnTo>
342656
343971
  <lnTo>
342657
- <pt x="r" y="y2"/>
343972
+ <pt x="296545" y="148273"/>
342658
343973
  </lnTo>
342659
343974
  <lnTo>
342660
- <pt x="x2" y="y2"/>
343975
+ <pt x="222409" y="148273"/>
342661
343976
  </lnTo>
342662
343977
  <lnTo>
342663
- <pt x="x2" y="y3"/>
343978
+ <pt x="222409" y="598488"/>
342664
343979
  </lnTo>
342665
343980
  <lnTo>
342666
- <pt x="r" y="y3"/>
343981
+ <pt x="296545" y="598488"/>
342667
343982
  </lnTo>
342668
343983
  <lnTo>
342669
- <pt x="hc" y="b"/>
343984
+ <pt x="148273" y="746760"/>
342670
343985
  </lnTo>
342671
343986
  <lnTo>
342672
- <pt x="l" y="y3"/>
343987
+ <pt x="0" y="598488"/>
342673
343988
  </lnTo>
342674
343989
  <lnTo>
342675
- <pt x="x1" y="y3"/>
343990
+ <pt x="74136" y="598488"/>
342676
343991
  </lnTo>
342677
343992
  <lnTo>
342678
- <pt x="x1" y="y2"/>
343993
+ <pt x="74136" y="148273"/>
343994
+ </lnTo>
343995
+ <lnTo>
343996
+ <pt x="0" y="148273"/>
342679
343997
  </lnTo>
342680
343998
  <close/>
342681
343999
  </path>
342682
344000
  </pathLst>
342683
- </upDownArrow>`
344001
+ </upDownArrow>`,
344002
+ uturnArrow: `<uturnArrow>
344003
+ <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
344004
+ <path w="886460" h="661035">
344005
+ <moveTo>
344006
+ <pt x="0" y="661035"/>
344007
+ </moveTo>
344008
+ <lnTo>
344009
+ <pt x="0" y="289203"/>
344010
+ </lnTo>
344011
+ <cubicBezTo>
344012
+ <pt x="0" y="129481"/>
344013
+ <pt x="129481" y="0"/>
344014
+ <pt x="289203" y="0"/>
344015
+ </cubicBezTo>
344016
+ <lnTo>
344017
+ <pt x="514628" y="0"/>
344018
+ </lnTo>
344019
+ <cubicBezTo>
344020
+ <pt x="674350" y="0"/>
344021
+ <pt x="803831" y="129481"/>
344022
+ <pt x="803831" y="289203"/>
344023
+ </cubicBezTo>
344024
+ <lnTo>
344025
+ <pt x="803831" y="330518"/>
344026
+ </lnTo>
344027
+ <lnTo>
344028
+ <pt x="886460" y="330518"/>
344029
+ </lnTo>
344030
+ <lnTo>
344031
+ <pt x="721201" y="495776"/>
344032
+ </lnTo>
344033
+ <lnTo>
344034
+ <pt x="555943" y="330518"/>
344035
+ </lnTo>
344036
+ <lnTo>
344037
+ <pt x="638572" y="330518"/>
344038
+ </lnTo>
344039
+ <lnTo>
344040
+ <pt x="638572" y="289203"/>
344041
+ </lnTo>
344042
+ <cubicBezTo>
344043
+ <pt x="638572" y="220751"/>
344044
+ <pt x="583080" y="165259"/>
344045
+ <pt x="514628" y="165259"/>
344046
+ </cubicBezTo>
344047
+ <lnTo>
344048
+ <pt x="289203" y="165259"/>
344049
+ </lnTo>
344050
+ <cubicBezTo>
344051
+ <pt x="220751" y="165259"/>
344052
+ <pt x="165259" y="220751"/>
344053
+ <pt x="165259" y="289203"/>
344054
+ </cubicBezTo>
344055
+ <lnTo>
344056
+ <pt x="165259" y="661035"/>
344057
+ </lnTo>
344058
+ <lnTo>
344059
+ <pt x="0" y="661035"/>
344060
+ </lnTo>
344061
+ <close/>
344062
+ </path>
344063
+ </pathLst>
344064
+ </uturnArrow>`
342684
344065
  };
342685
344066
  G = {
342686
344067
  darken: "color-mix(in srgb, currentColor 60%, black)",
@@ -342784,6 +344165,10 @@ ${err.toString()}`);
342784
344165
  default: null,
342785
344166
  rendered: false
342786
344167
  },
344168
+ effects: {
344169
+ default: null,
344170
+ rendered: false
344171
+ },
342787
344172
  rotation: {
342788
344173
  default: 0,
342789
344174
  renderDOM: (attrs) => {
@@ -342918,6 +344303,10 @@ ${err.toString()}`);
342918
344303
  return offsetData;
342919
344304
  }
342920
344305
  },
344306
+ effectExtent: {
344307
+ default: null,
344308
+ rendered: false
344309
+ },
342921
344310
  hidden: {
342922
344311
  default: false,
342923
344312
  rendered: false
@@ -359444,8 +360833,23 @@ function print() { __p += __j.call(arguments, '') }
359444
360833
  transactionToApply.setMeta("protectTrackedReviewState", true);
359445
360834
  const shouldTrackForComposition = (isTrackChangesActive$1 || forceTrackChanges) && !skipTrackChanges;
359446
360835
  const shouldTrack = shouldTrackForComposition || protectsExistingTrackedReviewState;
359447
- if (!shouldTrack && directInsertionMutationCommentMeta && !transactionToApply.getMeta(TrackChangesBasePluginKey))
360836
+ const plainInsertRange = !shouldTrack ? collapsedInsertInsideTrackedReviewMarkRange(prevState, transactionToApply) : null;
360837
+ if (!shouldTrack && !plainInsertRange && directInsertionMutationCommentMeta && !transactionToApply.getMeta(TrackChangesBasePluginKey))
359448
360838
  transactionToApply.setMeta(TrackChangesBasePluginKey, directInsertionMutationCommentMeta);
360839
+ if (plainInsertRange) {
360840
+ for (const mark2 of plainInsertRange.marks)
360841
+ transactionToApply.removeMark(plainInsertRange.from, plainInsertRange.to, mark2);
360842
+ const schemaMarks = prevState.schema.marks;
360843
+ for (const markName of [
360844
+ TrackInsertMarkName,
360845
+ TrackDeleteMarkName,
360846
+ TrackFormatMarkName
360847
+ ]) {
360848
+ const markType = schemaMarks[markName];
360849
+ if (markType)
360850
+ transactionToApply.removeStoredMark(markType);
360851
+ }
360852
+ }
359449
360853
  if (shouldTrack && forceTrackChanges && !this.options.user)
359450
360854
  throw new Error("forceTrackChanges requires a user to be configured on the editor instance.");
359451
360855
  const deferTrackingForComposition = shouldTrackForComposition && (isCompositionTransaction(transactionToApply) || this.view?.composing === true && this.#replacesWithinDeferredRange(transactionToApply)) && this.#canDeferCompositionTracking(transactionToApply, prevState);
@@ -369199,11 +370603,11 @@ function print() { __p += __j.call(arguments, '') }
369199
370603
  ]);
369200
370604
  });
369201
370605
 
369202
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-BjToI9WN.es.js
370606
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-3od8qYhB.es.js
369203
370607
  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;
369204
- var init_create_super_doc_ui_BjToI9WN_es = __esm(() => {
369205
- init_SuperConverter_DQ2wMaLK_es();
369206
- init_create_headless_toolbar_BhSfQYaO_es();
370608
+ var init_create_super_doc_ui_3od8qYhB_es = __esm(() => {
370609
+ init_SuperConverter_DJEK5GYX_es();
370610
+ init_create_headless_toolbar_BYe9VWHO_es();
369207
370611
  DEFAULT_TEXT_ALIGN_OPTIONS = [
369208
370612
  {
369209
370613
  label: "Left",
@@ -369494,15 +370898,15 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
369494
370898
 
369495
370899
  // ../../packages/superdoc/dist/super-editor.es.js
369496
370900
  var init_super_editor_es = __esm(() => {
369497
- init_src_CkxGCnVm_es();
369498
- init_SuperConverter_DQ2wMaLK_es();
370901
+ init_src_q2d5WRO_es();
370902
+ init_SuperConverter_DJEK5GYX_es();
369499
370903
  init_jszip_C49i9kUs_es();
369500
370904
  init_xml_js_CqGKpaft_es();
369501
- init_create_headless_toolbar_BhSfQYaO_es();
370905
+ init_create_headless_toolbar_BYe9VWHO_es();
369502
370906
  init_constants_D9qj59G2_es();
369503
370907
  init_unified_BDuVPlMu_es();
369504
370908
  init_DocxZipper_BzS208BW_es();
369505
- init_create_super_doc_ui_BjToI9WN_es();
370909
+ init_create_super_doc_ui_3od8qYhB_es();
369506
370910
  init_ui_CGB3qmy3_es();
369507
370911
  init_eventemitter3_UwU_CLPU_es();
369508
370912
  init_errors_C_DoKMoN_es();