oasis-editor 0.0.159 → 0.0.161

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.
@@ -11,5 +11,14 @@ declare module "./nodes.js" {
11
11
  /** Enclosing cell-level `w:sdt` content controls, outermost first. */
12
12
  sdtWrappers?: EditorSdtBlockWrapper[];
13
13
  }
14
+ interface EditorSdtPr {
15
+ /** Word 2013 `w15:repeatingSection` settings. */
16
+ repeatingSectionProperties?: {
17
+ /** `w15:sectionTitle/@w15:val`. */
18
+ sectionTitle?: string;
19
+ /** Presence/value of `w15:doNotAllowInsertDeleteSection`. */
20
+ doNotAllowInsertDeleteSection?: boolean;
21
+ };
22
+ }
14
23
  }
15
24
  export {};
@@ -1,10 +1,3 @@
1
1
  import { EditorSdtPr } from '../../../core/model.js';
2
2
 
3
- /**
4
- * `<w:sdtPr>` requires its subtype element to be the final named child per schema
5
- * order, with `appearance`, `showingPlcHdr`, `color` trailing as extension-like
6
- * properties. The exact ordering used by Word is: rPr, alias, tag, id, lock,
7
- * placeholder, dataBinding, temporary, subtype, appearance, showingPlcHdr,
8
- * color, extension. We mirror that so we round-trip as schema-valid.
9
- */
10
3
  export declare function serializeSdtPrXml(sdtPr: EditorSdtPr): string;
@@ -1,9 +1,4 @@
1
1
  import { Element as XmlElement } from '@xmldom/xmldom';
2
2
  import { EditorSdtPr } from '../../core/model.js';
3
3
 
4
- /**
5
- * Parse a `<w:sdtPr>` element into the typed model. Returns `{}` (empty) when
6
- * `sdtPr` is null or has no recognized children; the caller still attaches an
7
- * empty wrapper so the round-trip emits an empty `<w:sdtPr/>`.
8
- */
9
4
  export declare function parseSdtPr(sdtPr: XmlElement | null): EditorSdtPr;
@@ -4,23 +4,16 @@ export declare const WORD_NS = "http://schemas.openxmlformats.org/wordprocessing
4
4
  export declare const DRAWINGML_NS = "http://schemas.openxmlformats.org/drawingml/2006/main";
5
5
  export declare const OFFICE_REL_NS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
6
6
  export declare const WORD14_NS = "http://schemas.microsoft.com/office/word/2010/wordml";
7
+ export declare const WORD15_NS = "http://schemas.microsoft.com/office/word/2012/wordml";
7
8
  export declare function getChildrenByTagNameNS(element: XmlElement | null | undefined, namespace: string, localName: string): XmlElement[];
8
9
  export type DocxTextDirection = "lrTb" | "tbRl" | "btLr" | "lrTbV" | "tbRlV";
9
- /** Validate a raw `w:textDirection/@w:val` token, or return undefined. */
10
10
  export declare function parseTextDirection(value: string | null | undefined): DocxTextDirection | undefined;
11
11
  export declare function getFirstChildByTagNameNS(element: XmlElement | null | undefined, namespace: string, localName: string): XmlElement | null;
12
- /**
13
- * Finds a direct `w14:localName` child using a Markup Compatibility capability
14
- * profile that explicitly understands the w14 namespace. The generic child
15
- * helpers remain conservative and continue to consume mc:Fallback instead.
16
- */
17
12
  export declare function getFirstW14Child(element: XmlElement | null | undefined, localName: string): XmlElement | null;
13
+ /** Finds a direct Word 2013 (`w15`) child while honoring MC choice semantics. */
14
+ export declare function getFirstW15Child(element: XmlElement | null | undefined, localName: string): XmlElement | null;
18
15
  export declare function getAttributeValue(element: XmlElement | null, localName: string): string | null;
19
16
  export declare function findElementDeep(element: XmlElement, localName: string): XmlElement | null;
20
- /**
21
- * Collects non-WORD_NS extension attributes (e.g. `w14:paraId`, `w15:*`) from
22
- * a table/row/cell element for round-trip preservation.
23
- */
24
17
  export declare function collectExtAttributes(element: XmlElement): Record<string, string> | undefined;
25
18
  export declare function isWordTrue(value: string | null | undefined): boolean;
26
19
  export declare function parseOnOffProperty(parent: XmlElement, localName: string): boolean | undefined;
@@ -2863,7 +2863,7 @@ function OasisEditorAppLazy(props = {}) {
2863
2863
  onCleanup(() => {
2864
2864
  cancelled = true;
2865
2865
  });
2866
- import("./OasisEditorApp-DU_hHfTo.js").then((m) => {
2866
+ import("./OasisEditorApp-CZ4smGNO.js").then((m) => {
2867
2867
  cancelled = true;
2868
2868
  setProgress(1);
2869
2869
  setTimeout(() => setApp(() => m.OasisEditorApp), 180);
@@ -35962,10 +35962,15 @@ const WORD_NS$3 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main"
35962
35962
  const DRAWINGML_NS = "http://schemas.openxmlformats.org/drawingml/2006/main";
35963
35963
  const OFFICE_REL_NS$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
35964
35964
  const WORD14_NS$1 = "http://schemas.microsoft.com/office/word/2010/wordml";
35965
+ const WORD15_NS$3 = "http://schemas.microsoft.com/office/word/2012/wordml";
35965
35966
  const WORD14_MARKUP_COMPATIBILITY_CAPABILITIES = extendMarkupCompatibilityCapabilities(
35966
35967
  DEFAULT_MARKUP_COMPATIBILITY_CAPABILITIES,
35967
35968
  WORD14_NS$1
35968
35969
  );
35970
+ const WORD15_MARKUP_COMPATIBILITY_CAPABILITIES = extendMarkupCompatibilityCapabilities(
35971
+ DEFAULT_MARKUP_COMPATIBILITY_CAPABILITIES,
35972
+ WORD15_NS$3
35973
+ );
35969
35974
  function getChildrenByTagNameNS(element, namespace, localName) {
35970
35975
  if (!element) {
35971
35976
  return [];
@@ -35998,11 +36003,22 @@ function getFirstW14Child(element, localName) {
35998
36003
  (child2) => child2.namespaceURI === WORD14_NS$1 && child2.localName === localName
35999
36004
  ) ?? null;
36000
36005
  }
36006
+ function getFirstW15Child(element, localName) {
36007
+ if (!element) {
36008
+ return null;
36009
+ }
36010
+ return getMarkupCompatibleChildren(
36011
+ element,
36012
+ WORD15_MARKUP_COMPATIBILITY_CAPABILITIES
36013
+ ).find(
36014
+ (child2) => child2.namespaceURI === WORD15_NS$3 && child2.localName === localName
36015
+ ) ?? null;
36016
+ }
36001
36017
  function getAttributeValue(element, localName) {
36002
36018
  if (!element) {
36003
36019
  return null;
36004
36020
  }
36005
- return element.getAttributeNS(WORD_NS$3, localName) ?? element.getAttributeNS(WORD14_NS$1, localName) ?? element.getAttribute(`w:${localName}`) ?? element.getAttribute(`w14:${localName}`) ?? element.getAttribute(localName);
36021
+ return element.getAttributeNS(WORD_NS$3, localName) ?? element.getAttributeNS(WORD14_NS$1, localName) ?? element.getAttributeNS(WORD15_NS$3, localName) ?? element.getAttribute(`w:${localName}`) ?? element.getAttribute(`w14:${localName}`) ?? element.getAttribute(`w15:${localName}`) ?? element.getAttribute(localName);
36006
36022
  }
36007
36023
  function findElementDeep(element, localName) {
36008
36024
  for (let index = 0; index < element.childNodes.length; index += 1) {
@@ -38883,7 +38899,7 @@ function parseMathExpression(element) {
38883
38899
  sourceXml: serializer.serializeToString(element)
38884
38900
  };
38885
38901
  }
38886
- const RECOGNIZED_SDT_PR_CHILDREN = /* @__PURE__ */ new Set([
38902
+ const RECOGNIZED_WORD_SDT_PR_CHILDREN = /* @__PURE__ */ new Set([
38887
38903
  "alias",
38888
38904
  "tag",
38889
38905
  "id",
@@ -38900,6 +38916,8 @@ const RECOGNIZED_SDT_PR_CHILDREN = /* @__PURE__ */ new Set([
38900
38916
  "comboBox",
38901
38917
  "dropDownList",
38902
38918
  "date",
38919
+ // Keep accepting the old namespace form for compatibility with Oasis files
38920
+ // produced before the w15 correction.
38903
38921
  "repeatingSection",
38904
38922
  "repeatingSectionItem",
38905
38923
  "group",
@@ -38907,6 +38925,10 @@ const RECOGNIZED_SDT_PR_CHILDREN = /* @__PURE__ */ new Set([
38907
38925
  "citation",
38908
38926
  "bibliography"
38909
38927
  ]);
38928
+ const RECOGNIZED_WORD15_SDT_PR_CHILDREN = /* @__PURE__ */ new Set([
38929
+ "repeatingSection",
38930
+ "repeatingSectionItem"
38931
+ ]);
38910
38932
  function parseSdtPr(sdtPr) {
38911
38933
  if (!sdtPr) {
38912
38934
  return {};
@@ -38915,37 +38937,27 @@ function parseSdtPr(sdtPr) {
38915
38937
  const aliasEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "alias");
38916
38938
  if (aliasEl) {
38917
38939
  const alias = getAttributeValue(aliasEl, "val");
38918
- if (alias !== null) {
38919
- result.alias = alias;
38920
- }
38940
+ if (alias !== null) result.alias = alias;
38921
38941
  }
38922
38942
  const tagEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "tag");
38923
38943
  if (tagEl) {
38924
38944
  const tag = getAttributeValue(tagEl, "val");
38925
- if (tag !== null) {
38926
- result.tag = tag;
38927
- }
38945
+ if (tag !== null) result.tag = tag;
38928
38946
  }
38929
38947
  const idEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "id");
38930
38948
  if (idEl) {
38931
38949
  const id = getAttributeValue(idEl, "val");
38932
- if (id !== null) {
38933
- result.id = id;
38934
- }
38950
+ if (id !== null) result.id = id;
38935
38951
  }
38936
38952
  const lockEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "lock");
38937
38953
  if (lockEl) {
38938
38954
  const lock = getAttributeValue(lockEl, "val");
38939
- if (lock !== null) {
38940
- result.lock = lock;
38941
- }
38955
+ if (lock !== null) result.lock = lock;
38942
38956
  }
38943
38957
  const appearanceEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "appearance");
38944
38958
  if (appearanceEl) {
38945
38959
  const appearance = getAttributeValue(appearanceEl, "val");
38946
- if (appearance !== null) {
38947
- result.appearance = appearance;
38948
- }
38960
+ if (appearance !== null) result.appearance = appearance;
38949
38961
  }
38950
38962
  const showingPlcHdrEl = getFirstChildByTagNameNS(
38951
38963
  sdtPr,
@@ -38964,74 +38976,77 @@ function parseSdtPr(sdtPr) {
38964
38976
  const colorEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "color");
38965
38977
  if (colorEl) {
38966
38978
  const color = getAttributeValue(colorEl, "val");
38967
- if (color !== null) {
38968
- result.color = color;
38969
- }
38979
+ if (color !== null) result.color = color;
38970
38980
  }
38971
38981
  const placeholderEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "placeholder");
38972
38982
  if (placeholderEl) {
38973
38983
  const docPart = getFirstChildByTagNameNS(placeholderEl, WORD_NS$3, "docPart");
38974
38984
  if (docPart) {
38975
38985
  const docPartVal = getAttributeValue(docPart, "val");
38976
- if (docPartVal !== null) {
38977
- result.placeholderDocPart = docPartVal;
38978
- }
38986
+ if (docPartVal !== null) result.placeholderDocPart = docPartVal;
38979
38987
  }
38980
38988
  }
38981
38989
  const dataBindingEl = getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "dataBinding");
38982
38990
  if (dataBindingEl) {
38983
38991
  const dataBinding = parseSdtDataBinding(dataBindingEl);
38984
- if (dataBinding) {
38985
- result.dataBinding = dataBinding;
38986
- }
38992
+ if (dataBinding) result.dataBinding = dataBinding;
38987
38993
  }
38988
38994
  const subtype = parseSdtSubtype(sdtPr);
38989
38995
  if (subtype) {
38990
38996
  result.subtype = subtype;
38997
+ if (subtype.kind === "repeatingSection") {
38998
+ const repeating = getFirstW15Child(sdtPr, "repeatingSection") ?? getFirstChildByTagNameNS(sdtPr, WORD_NS$3, "repeatingSection");
38999
+ if (repeating) {
39000
+ const sectionTitle = getFirstW15Child(repeating, "sectionTitle");
39001
+ const noInsertDelete = getFirstW15Child(
39002
+ repeating,
39003
+ "doNotAllowInsertDeleteSection"
39004
+ );
39005
+ const properties = {};
39006
+ const title = getAttributeValue(sectionTitle, "val");
39007
+ if (title !== null) properties.sectionTitle = title;
39008
+ if (noInsertDelete) {
39009
+ const raw = getAttributeValue(noInsertDelete, "val");
39010
+ properties.doNotAllowInsertDeleteSection = raw === null ? true : isWordTrue(raw);
39011
+ }
39012
+ if (Object.keys(properties).length > 0) {
39013
+ result.repeatingSectionProperties = properties;
39014
+ }
39015
+ }
39016
+ }
38991
39017
  }
38992
39018
  const unknownXml = serializeUnknownSdtPrChildren(sdtPr);
38993
- if (unknownXml.length > 0) {
38994
- result.unknownXml = unknownXml;
38995
- }
39019
+ if (unknownXml.length > 0) result.unknownXml = unknownXml;
38996
39020
  return result;
38997
39021
  }
38998
39022
  function parseSdtDataBinding(el) {
38999
- const prefixMappingsEl = getFirstChildByTagNameNS(
39000
- el,
39001
- WORD_NS$3,
39002
- "prefixMappings"
39003
- );
39004
- const xpathEl = getFirstChildByTagNameNS(el, WORD_NS$3, "xpath");
39005
- const storeItemIDEl = getFirstChildByTagNameNS(el, WORD_NS$3, "storeItemID");
39006
39023
  const dataBinding = {};
39007
- if (prefixMappingsEl) {
39008
- const val = getAttributeValue(prefixMappingsEl, "val");
39009
- if (val !== null) {
39010
- dataBinding.prefixMappings = val;
39011
- }
39012
- }
39013
- if (xpathEl) {
39014
- const val = getAttributeValue(xpathEl, "val");
39015
- if (val !== null) {
39016
- dataBinding.xpath = val;
39017
- }
39018
- }
39019
- if (storeItemIDEl) {
39020
- const val = getAttributeValue(storeItemIDEl, "val");
39021
- if (val !== null) {
39022
- dataBinding.storeItemID = val;
39023
- }
39024
- }
39025
- if (dataBinding.prefixMappings === void 0 && dataBinding.xpath === void 0 && dataBinding.storeItemID === void 0) {
39026
- return null;
39027
- }
39028
- return dataBinding;
39024
+ const prefixMappings = getAttributeValue(el, "prefixMappings");
39025
+ const xpath = getAttributeValue(el, "xpath");
39026
+ const storeItemID = getAttributeValue(el, "storeItemID");
39027
+ if (prefixMappings !== null) dataBinding.prefixMappings = prefixMappings;
39028
+ if (xpath !== null) dataBinding.xpath = xpath;
39029
+ if (storeItemID !== null) dataBinding.storeItemID = storeItemID;
39030
+ if (dataBinding.prefixMappings === void 0) {
39031
+ const legacy = getFirstChildByTagNameNS(el, WORD_NS$3, "prefixMappings");
39032
+ const value2 = getAttributeValue(legacy, "val");
39033
+ if (value2 !== null) dataBinding.prefixMappings = value2;
39034
+ }
39035
+ if (dataBinding.xpath === void 0) {
39036
+ const legacy = getFirstChildByTagNameNS(el, WORD_NS$3, "xpath");
39037
+ const value2 = getAttributeValue(legacy, "val");
39038
+ if (value2 !== null) dataBinding.xpath = value2;
39039
+ }
39040
+ if (dataBinding.storeItemID === void 0) {
39041
+ const legacy = getFirstChildByTagNameNS(el, WORD_NS$3, "storeItemID");
39042
+ const value2 = getAttributeValue(legacy, "val");
39043
+ if (value2 !== null) dataBinding.storeItemID = value2;
39044
+ }
39045
+ return dataBinding.prefixMappings === void 0 && dataBinding.xpath === void 0 && dataBinding.storeItemID === void 0 ? null : dataBinding;
39029
39046
  }
39030
39047
  function parseSdtListItems(parent) {
39031
39048
  const items = getChildrenByTagNameNS(parent, WORD_NS$3, "listItem");
39032
- if (items.length === 0) {
39033
- return void 0;
39034
- }
39049
+ if (items.length === 0) return void 0;
39035
39050
  return items.map(
39036
39051
  (item) => ({
39037
39052
  displayText: getAttributeValue(item, "displayText") ?? void 0,
@@ -39095,22 +39110,22 @@ function parseSdtSubtype(parent) {
39095
39110
  };
39096
39111
  }
39097
39112
  const textEl = getFirstChildByTagNameNS(parent, WORD_NS$3, "text");
39098
- if (textEl) {
39099
- return { kind: "text" };
39100
- }
39113
+ if (textEl) return { kind: "text" };
39101
39114
  for (const kind of [
39102
39115
  "richText",
39103
39116
  "picture",
39104
39117
  "group",
39105
39118
  "equation",
39106
39119
  "citation",
39107
- "bibliography",
39108
- "repeatingSection",
39109
- "repeatingSectionItem"
39120
+ "bibliography"
39110
39121
  ]) {
39111
- if (getFirstChildByTagNameNS(parent, WORD_NS$3, kind)) {
39112
- return { kind };
39113
- }
39122
+ if (getFirstChildByTagNameNS(parent, WORD_NS$3, kind)) return { kind };
39123
+ }
39124
+ if (getFirstW15Child(parent, "repeatingSection") || getFirstChildByTagNameNS(parent, WORD_NS$3, "repeatingSection")) {
39125
+ return { kind: "repeatingSection" };
39126
+ }
39127
+ if (getFirstW15Child(parent, "repeatingSectionItem") || getFirstChildByTagNameNS(parent, WORD_NS$3, "repeatingSectionItem")) {
39128
+ return { kind: "repeatingSectionItem" };
39114
39129
  }
39115
39130
  const w14CheckboxEl = getFirstW14Child(parent, "checkbox");
39116
39131
  if (w14CheckboxEl) {
@@ -39149,13 +39164,11 @@ function serializeUnknownSdtPrChildren(sdtPr) {
39149
39164
  let out = "";
39150
39165
  for (let i = 0; i < sdtPr.childNodes.length; i += 1) {
39151
39166
  const node = sdtPr.childNodes[i];
39152
- if ((node == null ? void 0 : node.nodeType) !== node.ELEMENT_NODE) {
39153
- continue;
39154
- }
39167
+ if ((node == null ? void 0 : node.nodeType) !== node.ELEMENT_NODE) continue;
39155
39168
  const el = node;
39156
- if (el.localName && el.namespaceURI === WORD_NS$3 && RECOGNIZED_SDT_PR_CHILDREN.has(el.localName)) {
39157
- continue;
39158
- }
39169
+ const recognizedWord = el.localName && el.namespaceURI === WORD_NS$3 && RECOGNIZED_WORD_SDT_PR_CHILDREN.has(el.localName);
39170
+ const recognizedWord15 = el.localName && el.namespaceURI === WORD15_NS$3 && RECOGNIZED_WORD15_SDT_PR_CHILDREN.has(el.localName);
39171
+ if (recognizedWord || recognizedWord15) continue;
39159
39172
  out += new XMLSerializer().serializeToString(el);
39160
39173
  }
39161
39174
  return out;
@@ -41462,7 +41475,7 @@ function extractCommentRangesFromSections(sections) {
41462
41475
  }
41463
41476
  return ranges;
41464
41477
  }
41465
- const WORD15_NS$1 = "http://schemas.microsoft.com/office/word/2012/wordml";
41478
+ const WORD15_NS$2 = "http://schemas.microsoft.com/office/word/2012/wordml";
41466
41479
  const WORD16DU_NS$1 = "http://schemas.microsoft.com/office/word/2023/wordml/word16du";
41467
41480
  function flattenCommentText(element) {
41468
41481
  let out = "";
@@ -41507,12 +41520,12 @@ function parseCommentsExtended(xml) {
41507
41520
  if (!root) {
41508
41521
  return done;
41509
41522
  }
41510
- for (const ex of getChildrenByTagNameNS(root, WORD15_NS$1, "commentEx")) {
41511
- const paraId = ex.getAttributeNS(WORD15_NS$1, "paraId");
41523
+ for (const ex of getChildrenByTagNameNS(root, WORD15_NS$2, "commentEx")) {
41524
+ const paraId = ex.getAttributeNS(WORD15_NS$2, "paraId");
41512
41525
  if (!paraId) {
41513
41526
  continue;
41514
41527
  }
41515
- const isDone = ex.getAttributeNS(WORD15_NS$1, "done");
41528
+ const isDone = ex.getAttributeNS(WORD15_NS$2, "done");
41516
41529
  done.set(paraId, isDone === "1" || isDone === "true");
41517
41530
  }
41518
41531
  return done;
@@ -42372,7 +42385,7 @@ function serializeBookmarkEvent(event) {
42372
42385
  event.name ?? ""
42373
42386
  )}"${col}/>`;
42374
42387
  }
42375
- const WORD15_NS = "http://schemas.microsoft.com/office/word/2012/wordml";
42388
+ const WORD15_NS$1 = "http://schemas.microsoft.com/office/word/2012/wordml";
42376
42389
  const WORD16DU_NS = "http://schemas.microsoft.com/office/word/2023/wordml/word16du";
42377
42390
  function buildCommentExportPlan(document2) {
42378
42391
  const registry2 = document2.comments;
@@ -42449,7 +42462,7 @@ function serializeCommentRangeEvent(event) {
42449
42462
  return `<w:r><w:commentReference w:id="${event.wId}"/></w:r>`;
42450
42463
  }
42451
42464
  }
42452
- const COMMENTS_XMLNS = `xmlns:w="${WORD_NS$1}" xmlns:w14="${WORD14_NS}" xmlns:w15="${WORD15_NS}" xmlns:w16du="${WORD16DU_NS}"`;
42465
+ const COMMENTS_XMLNS = `xmlns:w="${WORD_NS$1}" xmlns:w14="${WORD14_NS}" xmlns:w15="${WORD15_NS$1}" xmlns:w16du="${WORD16DU_NS}"`;
42453
42466
  function serializeCommentBody(text2) {
42454
42467
  const lines = text2.split("\n");
42455
42468
  const runs = lines.map((line, i) => {
@@ -43000,11 +43013,11 @@ function serializeTableXml(table, serializeBlockXml) {
43000
43013
  ).join("")}</w:tblGrid></w:tblGridChange>` : ""}</w:tblGrid>` : "";
43001
43014
  return `<w:tbl>${serializeTableProperties(table)}${gridXml}${rowsXml}</w:tbl>`;
43002
43015
  }
43016
+ const WORD15_NS = "http://schemas.microsoft.com/office/word/2012/wordml";
43017
+ const WORD15_XMLNS = `xmlns:w15="${WORD15_NS}"`;
43003
43018
  function serializeSdtPrXml(sdtPr) {
43004
- const hasAnyField = sdtPr.alias !== void 0 || sdtPr.tag !== void 0 || sdtPr.id !== void 0 || sdtPr.lock !== void 0 || sdtPr.appearance !== void 0 || sdtPr.showingPlcHdr !== void 0 || sdtPr.temporary !== void 0 || sdtPr.color !== void 0 || sdtPr.placeholderDocPart !== void 0 || sdtPr.dataBinding !== void 0 || sdtPr.subtype !== void 0 || (sdtPr.unknownXml ?? "").length > 0;
43005
- if (!hasAnyField) {
43006
- return "<w:sdtPr/>";
43007
- }
43019
+ const hasAnyField = sdtPr.alias !== void 0 || sdtPr.tag !== void 0 || sdtPr.id !== void 0 || sdtPr.lock !== void 0 || sdtPr.appearance !== void 0 || sdtPr.showingPlcHdr !== void 0 || sdtPr.temporary !== void 0 || sdtPr.color !== void 0 || sdtPr.placeholderDocPart !== void 0 || sdtPr.dataBinding !== void 0 || sdtPr.subtype !== void 0 || sdtPr.repeatingSectionProperties !== void 0 || (sdtPr.unknownXml ?? "").length > 0;
43020
+ if (!hasAnyField) return "<w:sdtPr/>";
43008
43021
  let inner = "";
43009
43022
  if (sdtPr.alias !== void 0) {
43010
43023
  inner += `<w:alias w:val="${escapeXml(sdtPr.alias)}"/>`;
@@ -43030,7 +43043,10 @@ function serializeSdtPrXml(sdtPr) {
43030
43043
  inner += `<w:temporary w:val="${sdtPr.temporary ? "true" : "false"}"/>`;
43031
43044
  }
43032
43045
  if (sdtPr.subtype !== void 0) {
43033
- inner += serializeSdtSubtypeXml(sdtPr.subtype);
43046
+ inner += serializeSdtSubtypeXml(
43047
+ sdtPr.subtype,
43048
+ sdtPr.repeatingSectionProperties
43049
+ );
43034
43050
  }
43035
43051
  if (sdtPr.appearance !== void 0) {
43036
43052
  inner += `<w:appearance w:val="${escapeXml(sdtPr.appearance)}"/>`;
@@ -43041,32 +43057,38 @@ function serializeSdtPrXml(sdtPr) {
43041
43057
  if (sdtPr.color !== void 0) {
43042
43058
  inner += `<w:color w:val="${escapeXml(sdtPr.color)}"/>`;
43043
43059
  }
43044
- if (sdtPr.unknownXml) {
43045
- inner += sdtPr.unknownXml;
43046
- }
43060
+ if (sdtPr.unknownXml) inner += sdtPr.unknownXml;
43047
43061
  return `<w:sdtPr>${inner}</w:sdtPr>`;
43048
43062
  }
43049
43063
  function serializeSdtDataBindingXml(dataBinding) {
43050
- let inner = "";
43064
+ const attrs = [];
43051
43065
  if (dataBinding.prefixMappings !== void 0) {
43052
- inner += `<w:prefixMappings w:val="${escapeXml(
43053
- dataBinding.prefixMappings
43054
- )}"/>`;
43066
+ attrs.push(`w:prefixMappings="${escapeXml(dataBinding.prefixMappings)}"`);
43055
43067
  }
43056
43068
  if (dataBinding.xpath !== void 0) {
43057
- inner += `<w:xpath w:val="${escapeXml(dataBinding.xpath)}"/>`;
43069
+ attrs.push(`w:xpath="${escapeXml(dataBinding.xpath)}"`);
43058
43070
  }
43059
43071
  if (dataBinding.storeItemID !== void 0) {
43060
- inner += `<w:storeItemID w:val="${escapeXml(dataBinding.storeItemID)}"/>`;
43072
+ attrs.push(`w:storeItemID="${escapeXml(dataBinding.storeItemID)}"`);
43061
43073
  }
43062
- return inner ? `<w:dataBinding>${inner}</w:dataBinding>` : "";
43074
+ return attrs.length > 0 ? `<w:dataBinding ${attrs.join(" ")}/>` : "";
43063
43075
  }
43064
43076
  function serializeSdtListItemXml(item) {
43065
43077
  const displayTextAttr = item.displayText !== void 0 ? ` w:displayText="${escapeXml(item.displayText)}"` : "";
43066
43078
  const valueAttr = item.value !== void 0 ? ` w:value="${escapeXml(item.value)}"` : "";
43067
43079
  return `<w:listItem${displayTextAttr}${valueAttr}/>`;
43068
43080
  }
43069
- function serializeSdtSubtypeXml(subtype) {
43081
+ function serializeRepeatingSectionXml(properties) {
43082
+ let children2 = "";
43083
+ if ((properties == null ? void 0 : properties.sectionTitle) !== void 0) {
43084
+ children2 += `<w15:sectionTitle w15:val="${escapeXml(properties.sectionTitle)}"/>`;
43085
+ }
43086
+ if ((properties == null ? void 0 : properties.doNotAllowInsertDeleteSection) !== void 0) {
43087
+ children2 += `<w15:doNotAllowInsertDeleteSection w15:val="${properties.doNotAllowInsertDeleteSection ? "1" : "0"}"/>`;
43088
+ }
43089
+ return children2 ? `<w15:repeatingSection ${WORD15_XMLNS}>${children2}</w15:repeatingSection>` : `<w15:repeatingSection ${WORD15_XMLNS}/>`;
43090
+ }
43091
+ function serializeSdtSubtypeXml(subtype, repeatingSectionProperties) {
43070
43092
  switch (subtype.kind) {
43071
43093
  case "text":
43072
43094
  return "<w:text/>";
@@ -43083,9 +43105,9 @@ function serializeSdtSubtypeXml(subtype) {
43083
43105
  case "bibliography":
43084
43106
  return "<w:bibliography/>";
43085
43107
  case "repeatingSection":
43086
- return "<w:repeatingSection/>";
43108
+ return serializeRepeatingSectionXml(repeatingSectionProperties);
43087
43109
  case "repeatingSectionItem":
43088
- return "<w:repeatingSectionItem/>";
43110
+ return `<w15:repeatingSectionItem ${WORD15_XMLNS}/>`;
43089
43111
  case "comboBox":
43090
43112
  case "dropDownList": {
43091
43113
  const items = (subtype.listItems ?? []).map(serializeSdtListItemXml).join("");
@@ -45523,29 +45545,26 @@ function overlayEditorParagraphOnOoxmlSource(paragraph, generatedParagraphProper
45523
45545
  function isSplittableTextRun(run) {
45524
45546
  return run.kind === "text" || run.kind === "sym";
45525
45547
  }
45526
- function serializeRunsWithBoundaries(runs, tokens, context2, paragraphStyleId, styles) {
45548
+ function serializeRunsWithInlineSdtsAndBoundaries(runs, tokens, context2, paragraphStyleId, styles) {
45527
45549
  const sorted = [...tokens].sort(
45528
45550
  (a, b) => a.offset - b.offset || a.seq - b.seq
45529
45551
  );
45530
- let ei = 0;
45531
- let pos = 0;
45532
- let out = "";
45533
- const flushUpTo = (limit) => {
45534
- while (ei < sorted.length && sorted[ei].offset <= limit) {
45535
- out += sorted[ei].xml;
45536
- ei += 1;
45537
- }
45538
- };
45539
- for (const run of runs) {
45540
- const runStart = pos;
45552
+ let eventIndex = 0;
45553
+ let position2 = 0;
45554
+ const serializeLeafRun = (run) => {
45555
+ let out2 = "";
45556
+ const runStart = position2;
45541
45557
  const runEnd = runStart + run.text.length;
45542
- flushUpTo(runStart);
45558
+ while (eventIndex < sorted.length && sorted[eventIndex].offset <= runStart) {
45559
+ out2 += sorted[eventIndex].xml;
45560
+ eventIndex += 1;
45561
+ }
45543
45562
  if (isSplittableTextRun(run) && run.text.length > 0) {
45544
45563
  let cursor = runStart;
45545
- while (ei < sorted.length && sorted[ei].offset < runEnd) {
45546
- const token = sorted[ei];
45564
+ while (eventIndex < sorted.length && sorted[eventIndex].offset < runEnd) {
45565
+ const token = sorted[eventIndex];
45547
45566
  if (token.offset > cursor) {
45548
- out += serializeRunWithRelationships(
45567
+ out2 += serializeRunWithRelationships(
45549
45568
  {
45550
45569
  ...run,
45551
45570
  text: run.text.slice(cursor - runStart, token.offset - runStart)
@@ -45556,12 +45575,12 @@ function serializeRunsWithBoundaries(runs, tokens, context2, paragraphStyleId, s
45556
45575
  serializeBlocksXml
45557
45576
  );
45558
45577
  }
45559
- out += token.xml;
45560
- ei += 1;
45578
+ out2 += token.xml;
45579
+ eventIndex += 1;
45561
45580
  cursor = token.offset;
45562
45581
  }
45563
45582
  if (cursor < runEnd) {
45564
- out += serializeRunWithRelationships(
45583
+ out2 += serializeRunWithRelationships(
45565
45584
  { ...run, text: run.text.slice(cursor - runStart) },
45566
45585
  context2,
45567
45586
  paragraphStyleId,
@@ -45570,7 +45589,7 @@ function serializeRunsWithBoundaries(runs, tokens, context2, paragraphStyleId, s
45570
45589
  );
45571
45590
  }
45572
45591
  } else {
45573
- out += serializeRunWithRelationships(
45592
+ out2 += serializeRunWithRelationships(
45574
45593
  run,
45575
45594
  context2,
45576
45595
  paragraphStyleId,
@@ -45578,9 +45597,14 @@ function serializeRunsWithBoundaries(runs, tokens, context2, paragraphStyleId, s
45578
45597
  serializeBlocksXml
45579
45598
  );
45580
45599
  }
45581
- pos = runEnd;
45600
+ position2 = runEnd;
45601
+ return out2;
45602
+ };
45603
+ let out = serializeRunsWithInlineSdts(runs, serializeLeafRun);
45604
+ while (eventIndex < sorted.length) {
45605
+ out += sorted[eventIndex].xml;
45606
+ eventIndex += 1;
45582
45607
  }
45583
- flushUpTo(Number.POSITIVE_INFINITY);
45584
45608
  return out;
45585
45609
  }
45586
45610
  function blockHasGeneratedBoundaryTokens(block, context2) {
@@ -45696,9 +45720,7 @@ function serializeParagraphXml(paragraph, context2, styles, overrides) {
45696
45720
  hasOverrides: Boolean(overrides),
45697
45721
  hasBoundaryTokens: boundaryTokens.length > 0
45698
45722
  });
45699
- if (reusableParagraphXml) {
45700
- return reusableParagraphXml;
45701
- }
45723
+ if (reusableParagraphXml) return reusableParagraphXml;
45702
45724
  const serializeCanonicalRun = (run) => {
45703
45725
  var _a3;
45704
45726
  return serializeRunWithRelationships(
@@ -45713,7 +45735,7 @@ function serializeParagraphXml(paragraph, context2, styles, overrides) {
45713
45735
  const runsXml = boundaryTokens.length === 0 ? serializeRunsWithInlineSdts(
45714
45736
  runs,
45715
45737
  serializeCanonicalRun
45716
- ) : serializeRunsWithBoundaries(
45738
+ ) : serializeRunsWithInlineSdtsAndBoundaries(
45717
45739
  runs,
45718
45740
  boundaryTokens,
45719
45741
  context2,
@@ -45743,9 +45765,7 @@ function serializeParagraphXml(paragraph, context2, styles, overrides) {
45743
45765
  hasBoundaryTokens: false
45744
45766
  }
45745
45767
  );
45746
- if (overlaidParagraphXml) {
45747
- return overlaidParagraphXml;
45748
- }
45768
+ if (overlaidParagraphXml) return overlaidParagraphXml;
45749
45769
  }
45750
45770
  return `${dropCapFrame}<w:p${paragraphAttributes}>${paragraphProperties}${runsXml}</w:p>`;
45751
45771
  }
@@ -47548,7 +47568,7 @@ async function importDocxInWorker(buffer, options = {}) {
47548
47568
  const worker = new Worker(
47549
47569
  new URL(
47550
47570
  /* @vite-ignore */
47551
- "" + new URL("assets/importDocxWorker-BHz7MeiI.js", import.meta.url).href,
47571
+ "" + new URL("assets/importDocxWorker-CyAWuOO6.js", import.meta.url).href,
47552
47572
  import.meta.url
47553
47573
  ),
47554
47574
  {
@@ -1,4 +1,4 @@
1
- import { dK, ah, aw, aM, aG, dL, dM, dN, aA, dO, ai, dP, dt, aN, dQ, dR, aL, aD, dS, dT, dU, ag, dV, dr, aP, dW, dX, dY, dZ, d_, dF, d$, e0, e1, aU, aT, e2, aE, e3, e4, e5, e6, e7, e8, aI, aF, e9, b3, aO, b2, aV, az, aK, dE, ea, dL as dL2, dS as dS2, dV as dV2, e2 as e22, e3 as e32, e8 as e82, eb, ec, dv, dq, ed, ee, ef, eg, eh, ei, ej, ds, ek, el, em, du, en } from "./index-BWxZXNb4.js";
1
+ import { dK, ah, aw, aM, aG, dL, dM, dN, aA, dO, ai, dP, dt, aN, dQ, dR, aL, aD, dS, dT, dU, ag, dV, dr, aP, dW, dX, dY, dZ, d_, dF, d$, e0, e1, aU, aT, e2, aE, e3, e4, e5, e6, e7, e8, aI, aF, e9, b3, aO, b2, aV, az, aK, dE, ea, dL as dL2, dS as dS2, dV as dV2, e2 as e22, e3 as e32, e8 as e82, eb, ec, dv, dq, ed, ee, ef, eg, eh, ei, ej, ds, ek, el, em, du, en } from "./index-BXPaFnv7.js";
2
2
  export {
3
3
  dK as ActionRow,
4
4
  ah as BalloonShell,