oasis-editor 0.0.158 → 0.0.159

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.
@@ -3,5 +3,13 @@ declare module "./nodes.js" {
3
3
  /** Enclosing inline `w:sdt` content controls, outermost first. */
4
4
  sdtWrappers?: EditorSdtBlockWrapper[];
5
5
  }
6
+ interface EditorTableRowNode {
7
+ /** Enclosing row-level `w:sdt` content controls, outermost first. */
8
+ sdtWrappers?: EditorSdtBlockWrapper[];
9
+ }
10
+ interface EditorTableCellNode {
11
+ /** Enclosing cell-level `w:sdt` content controls, outermost first. */
12
+ sdtWrappers?: EditorSdtBlockWrapper[];
13
+ }
6
14
  }
7
15
  export {};
@@ -1,10 +1,4 @@
1
1
  import { EditorTableNode } from '../../core/model.js';
2
2
  import { SerializeTableParagraphXml } from './tableXml.js';
3
3
 
4
- /**
5
- * Serializes a table canonically and then overlays source-backed table, row and
6
- * cell property containers. Text/content stays authoritative from the editor;
7
- * source attributes, extension children and unknown property children survive
8
- * while relationship-bearing fragments continue to use the conservative path.
9
- */
10
4
  export declare function serializeTableXmlPreservingSource(table: EditorTableNode, serializeParagraphXml: SerializeTableParagraphXml): string;
@@ -0,0 +1,9 @@
1
+ import { Element as XmlElement } from '@xmldom/xmldom';
2
+ import { EditorTableNode } from '../../core/model.js';
3
+
4
+ /**
5
+ * Rebuilds row-level and cell-level `w:sdt` envelopes after canonical table
6
+ * serialization and source-property overlay have completed. Structural wrappers
7
+ * therefore do not interfere with the existing row/cell property pipeline.
8
+ */
9
+ export declare function wrapTableStructuralSdts(table: EditorTableNode, tableElement: XmlElement): void;
@@ -0,0 +1,13 @@
1
+ import { Element as XmlElement } from '@xmldom/xmldom';
2
+ import { EditorSdtBlockWrapper } from '../../core/model.js';
3
+
4
+ export interface SdtWrappedWordChild {
5
+ element: XmlElement;
6
+ sdtWrappers?: EditorSdtBlockWrapper[];
7
+ }
8
+ /**
9
+ * Collects direct Word children while transparently unwrapping any intervening
10
+ * `w:sdt/w:sdtContent` containers. Wrapper metadata is returned outermost-first
11
+ * so the canonical exporter can rebuild nested structural content controls.
12
+ */
13
+ export declare function collectSdtWrappedWordChildren(container: XmlElement, localName: string): SdtWrappedWordChild[];
@@ -2863,7 +2863,7 @@ function OasisEditorAppLazy(props = {}) {
2863
2863
  onCleanup(() => {
2864
2864
  cancelled = true;
2865
2865
  });
2866
- import("./OasisEditorApp-D8XC2a93.js").then((m) => {
2866
+ import("./OasisEditorApp-DU_hHfTo.js").then((m) => {
2867
2867
  cancelled = true;
2868
2868
  setProgress(1);
2869
2869
  setTimeout(() => setApp(() => m.OasisEditorApp), 180);
@@ -40224,7 +40224,7 @@ function stableSemanticString(value2) {
40224
40224
  function hasRelationshipReference$4(xml) {
40225
40225
  return /\br:(?:id|embed|link)\s*=/.test(xml);
40226
40226
  }
40227
- function directWordChildren$1(element, localName) {
40227
+ function directWordChildren$2(element, localName) {
40228
40228
  const children2 = [];
40229
40229
  for (let index = 0; index < element.childNodes.length; index += 1) {
40230
40230
  const child2 = element.childNodes[index];
@@ -40235,7 +40235,7 @@ function directWordChildren$1(element, localName) {
40235
40235
  return children2;
40236
40236
  }
40237
40237
  function firstDirectWordChild$1(element, localName) {
40238
- return directWordChildren$1(element, localName)[0];
40238
+ return directWordChildren$2(element, localName)[0];
40239
40239
  }
40240
40240
  function serializeElement$1(element) {
40241
40241
  return element ? new XMLSerializer().serializeToString(element) : void 0;
@@ -40385,7 +40385,7 @@ function captureGranularTableSources(table, tableElement) {
40385
40385
  const tableGridXml = serializeElement$1(
40386
40386
  firstDirectWordChild$1(tableElement, "tblGrid")
40387
40387
  );
40388
- const rowElements = directWordChildren$1(tableElement, "tr");
40388
+ const rowElements = directWordChildren$2(tableElement, "tr");
40389
40389
  if (rowElements.length === table.rows.length) {
40390
40390
  rowElements.forEach((rowElement, rowIndex) => {
40391
40391
  const row = table.rows[rowIndex];
@@ -40397,7 +40397,7 @@ function captureGranularTableSources(table, tableElement) {
40397
40397
  firstDirectWordChild$1(rowElement, "tblPrEx")
40398
40398
  )
40399
40399
  });
40400
- const cellElements = directWordChildren$1(rowElement, "tc");
40400
+ const cellElements = directWordChildren$2(rowElement, "tc");
40401
40401
  if (cellElements.length !== row.cells.length) {
40402
40402
  return;
40403
40403
  }
@@ -40748,6 +40748,45 @@ function parseTableLook(tblPr) {
40748
40748
  noVBand: attr2("noVBand") ?? bit(1024) ?? false
40749
40749
  };
40750
40750
  }
40751
+ function collectSdtWrappedWordChildrenImpl(container, localName, inheritedWrappers, result) {
40752
+ for (const child2 of getMarkupCompatibleChildren(container)) {
40753
+ if (child2.namespaceURI !== WORD_NS$3) {
40754
+ continue;
40755
+ }
40756
+ if (child2.localName === localName) {
40757
+ result.push({
40758
+ element: child2,
40759
+ ...inheritedWrappers.length > 0 ? { sdtWrappers: inheritedWrappers } : {}
40760
+ });
40761
+ continue;
40762
+ }
40763
+ if (child2.localName !== "sdt") {
40764
+ continue;
40765
+ }
40766
+ const content2 = getFirstChildByTagNameNS(child2, WORD_NS$3, "sdtContent");
40767
+ if (!content2) {
40768
+ continue;
40769
+ }
40770
+ const properties = getFirstChildByTagNameNS(child2, WORD_NS$3, "sdtPr");
40771
+ const endProperties = getFirstChildByTagNameNS(child2, WORD_NS$3, "sdtEndPr");
40772
+ const wrapper = {
40773
+ groupId: createEditorNodeId("sdt"),
40774
+ sdtPr: parseSdtPr(properties),
40775
+ ...endProperties ? { sdtEndPrXml: new XMLSerializer().serializeToString(endProperties) } : {}
40776
+ };
40777
+ collectSdtWrappedWordChildrenImpl(
40778
+ content2,
40779
+ localName,
40780
+ [...inheritedWrappers, wrapper],
40781
+ result
40782
+ );
40783
+ }
40784
+ }
40785
+ function collectSdtWrappedWordChildren(container, localName) {
40786
+ const result = [];
40787
+ collectSdtWrappedWordChildrenImpl(container, localName, [], result);
40788
+ return result;
40789
+ }
40751
40790
  function collapseCellAutospacing(paragraphs, flags) {
40752
40791
  var _a2, _b2;
40753
40792
  const styleOf = (paragraph) => paragraph.style ?? (paragraph.style = {});
@@ -40793,6 +40832,7 @@ function applyCellParagraphAutospacing(cellNode, blocks) {
40793
40832
  );
40794
40833
  }
40795
40834
  async function parseTableNode(tableNode, numberingMaps, zip, relsMap, assets, theme, parseNestedBlocks, _styles) {
40835
+ var _a2, _b2;
40796
40836
  const gridCols = [];
40797
40837
  const tblGrid = getFirstChildByTagNameNS(tableNode, WORD_NS$3, "tblGrid");
40798
40838
  if (tblGrid) {
@@ -40816,16 +40856,18 @@ async function parseTableNode(tableNode, numberingMaps, zip, relsMap, assets, th
40816
40856
  );
40817
40857
  const directTableStyle = parseTableStyle(tblPr, tableStyleId ?? void 0);
40818
40858
  const look = parseTableLook(tblPr);
40819
- const rowNodes = getChildrenByTagNameNS(tableNode, WORD_NS$3, "tr");
40859
+ const rowEntries = collectSdtWrappedWordChildren(tableNode, "tr");
40820
40860
  const rows = [];
40821
- for (let rowIndex = 0; rowIndex < rowNodes.length; rowIndex += 1) {
40822
- const rowNode = rowNodes[rowIndex];
40861
+ for (let rowIndex = 0; rowIndex < rowEntries.length; rowIndex += 1) {
40862
+ const rowEntry = rowEntries[rowIndex];
40863
+ const rowNode = rowEntry.element;
40823
40864
  const rowProperties = getFirstChildByTagNameNS(rowNode, WORD_NS$3, "trPr");
40824
40865
  const rowConditionalStyle = parseTableConditionalFlags(rowProperties);
40825
- const cellNodes = getChildrenByTagNameNS(rowNode, WORD_NS$3, "tc");
40866
+ const cellEntries = collectSdtWrappedWordChildren(rowNode, "tc");
40826
40867
  const cells = [];
40827
- for (let colIndex = 0; colIndex < cellNodes.length; colIndex += 1) {
40828
- const cellNode = cellNodes[colIndex];
40868
+ for (let colIndex = 0; colIndex < cellEntries.length; colIndex += 1) {
40869
+ const cellEntry = cellEntries[colIndex];
40870
+ const cellNode = cellEntry.element;
40829
40871
  const cellProperties = getFirstChildByTagNameNS(
40830
40872
  cellNode,
40831
40873
  WORD_NS$3,
@@ -40853,6 +40895,9 @@ async function parseTableNode(tableNode, numberingMaps, zip, relsMap, assets, th
40853
40895
  );
40854
40896
  if (cellStyle) cell.style = cellStyle;
40855
40897
  cell.conditionalStyle = parseTableConditionalFlags(cellProperties);
40898
+ if ((_a2 = cellEntry.sdtWrappers) == null ? void 0 : _a2.length) {
40899
+ cell.sdtWrappers = [...cellEntry.sdtWrappers];
40900
+ }
40856
40901
  const cellExtAttrs = collectExtAttributes(cellNode);
40857
40902
  if (cellExtAttrs) cell.extAttributes = cellExtAttrs;
40858
40903
  if (vMerge === "continue") {
@@ -40869,6 +40914,9 @@ async function parseTableNode(tableNode, numberingMaps, zip, relsMap, assets, th
40869
40914
  row.style = rowStyle;
40870
40915
  }
40871
40916
  row.conditionalStyle = rowConditionalStyle;
40917
+ if ((_b2 = rowEntry.sdtWrappers) == null ? void 0 : _b2.length) {
40918
+ row.sdtWrappers = [...rowEntry.sdtWrappers];
40919
+ }
40872
40920
  const rowExtAttrs = collectExtAttributes(rowNode);
40873
40921
  if (rowExtAttrs) row.extAttributes = rowExtAttrs;
40874
40922
  const tblPrEx = getFirstChildByTagNameNS(rowNode, WORD_NS$3, "tblPrEx");
@@ -42952,6 +43000,240 @@ function serializeTableXml(table, serializeBlockXml) {
42952
43000
  ).join("")}</w:tblGrid></w:tblGridChange>` : ""}</w:tblGrid>` : "";
42953
43001
  return `<w:tbl>${serializeTableProperties(table)}${gridXml}${rowsXml}</w:tbl>`;
42954
43002
  }
43003
+ 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
+ }
43008
+ let inner = "";
43009
+ if (sdtPr.alias !== void 0) {
43010
+ inner += `<w:alias w:val="${escapeXml(sdtPr.alias)}"/>`;
43011
+ }
43012
+ if (sdtPr.tag !== void 0) {
43013
+ inner += `<w:tag w:val="${escapeXml(sdtPr.tag)}"/>`;
43014
+ }
43015
+ if (sdtPr.id !== void 0) {
43016
+ inner += `<w:id w:val="${escapeXml(sdtPr.id)}"/>`;
43017
+ }
43018
+ if (sdtPr.lock !== void 0) {
43019
+ inner += `<w:lock w:val="${escapeXml(sdtPr.lock)}"/>`;
43020
+ }
43021
+ if (sdtPr.placeholderDocPart !== void 0) {
43022
+ inner += `<w:placeholder><w:docPart w:val="${escapeXml(
43023
+ sdtPr.placeholderDocPart
43024
+ )}"/></w:placeholder>`;
43025
+ }
43026
+ if (sdtPr.dataBinding !== void 0) {
43027
+ inner += serializeSdtDataBindingXml(sdtPr.dataBinding);
43028
+ }
43029
+ if (sdtPr.temporary !== void 0) {
43030
+ inner += `<w:temporary w:val="${sdtPr.temporary ? "true" : "false"}"/>`;
43031
+ }
43032
+ if (sdtPr.subtype !== void 0) {
43033
+ inner += serializeSdtSubtypeXml(sdtPr.subtype);
43034
+ }
43035
+ if (sdtPr.appearance !== void 0) {
43036
+ inner += `<w:appearance w:val="${escapeXml(sdtPr.appearance)}"/>`;
43037
+ }
43038
+ if (sdtPr.showingPlcHdr !== void 0) {
43039
+ inner += `<w:showingPlcHdr w:val="${sdtPr.showingPlcHdr ? "true" : "false"}"/>`;
43040
+ }
43041
+ if (sdtPr.color !== void 0) {
43042
+ inner += `<w:color w:val="${escapeXml(sdtPr.color)}"/>`;
43043
+ }
43044
+ if (sdtPr.unknownXml) {
43045
+ inner += sdtPr.unknownXml;
43046
+ }
43047
+ return `<w:sdtPr>${inner}</w:sdtPr>`;
43048
+ }
43049
+ function serializeSdtDataBindingXml(dataBinding) {
43050
+ let inner = "";
43051
+ if (dataBinding.prefixMappings !== void 0) {
43052
+ inner += `<w:prefixMappings w:val="${escapeXml(
43053
+ dataBinding.prefixMappings
43054
+ )}"/>`;
43055
+ }
43056
+ if (dataBinding.xpath !== void 0) {
43057
+ inner += `<w:xpath w:val="${escapeXml(dataBinding.xpath)}"/>`;
43058
+ }
43059
+ if (dataBinding.storeItemID !== void 0) {
43060
+ inner += `<w:storeItemID w:val="${escapeXml(dataBinding.storeItemID)}"/>`;
43061
+ }
43062
+ return inner ? `<w:dataBinding>${inner}</w:dataBinding>` : "";
43063
+ }
43064
+ function serializeSdtListItemXml(item) {
43065
+ const displayTextAttr = item.displayText !== void 0 ? ` w:displayText="${escapeXml(item.displayText)}"` : "";
43066
+ const valueAttr = item.value !== void 0 ? ` w:value="${escapeXml(item.value)}"` : "";
43067
+ return `<w:listItem${displayTextAttr}${valueAttr}/>`;
43068
+ }
43069
+ function serializeSdtSubtypeXml(subtype) {
43070
+ switch (subtype.kind) {
43071
+ case "text":
43072
+ return "<w:text/>";
43073
+ case "richText":
43074
+ return "<w:richText/>";
43075
+ case "picture":
43076
+ return "<w:picture/>";
43077
+ case "group":
43078
+ return "<w:group/>";
43079
+ case "equation":
43080
+ return "<w:equation/>";
43081
+ case "citation":
43082
+ return "<w:citation/>";
43083
+ case "bibliography":
43084
+ return "<w:bibliography/>";
43085
+ case "repeatingSection":
43086
+ return "<w:repeatingSection/>";
43087
+ case "repeatingSectionItem":
43088
+ return "<w:repeatingSectionItem/>";
43089
+ case "comboBox":
43090
+ case "dropDownList": {
43091
+ const items = (subtype.listItems ?? []).map(serializeSdtListItemXml).join("");
43092
+ const lastSelected = subtype.lastSelectedValue !== void 0 ? `<w:lastSelectedValue w:val="${escapeXml(
43093
+ subtype.lastSelectedValue
43094
+ )}"/>` : "";
43095
+ return `<w:${subtype.kind}>${items}${lastSelected}</w:${subtype.kind}>`;
43096
+ }
43097
+ case "date": {
43098
+ const fullDateAttr = subtype.fullDate !== void 0 ? ` w:fullDate="${escapeXml(subtype.fullDate)}"` : "";
43099
+ let children2 = "";
43100
+ if (subtype.dateFormat !== void 0) {
43101
+ children2 += `<w:dateFormat w:val="${escapeXml(subtype.dateFormat)}"/>`;
43102
+ }
43103
+ if (subtype.lid !== void 0) {
43104
+ children2 += `<w:lid w:val="${escapeXml(subtype.lid)}"/>`;
43105
+ }
43106
+ if (subtype.calendar !== void 0) {
43107
+ children2 += `<w:calendar w:val="${escapeXml(subtype.calendar)}"/>`;
43108
+ }
43109
+ if (subtype.storeMappedDataAs !== void 0) {
43110
+ children2 += `<w:storeMappedDataAs w:val="${escapeXml(
43111
+ subtype.storeMappedDataAs
43112
+ )}"/>`;
43113
+ }
43114
+ return `<w:date${fullDateAttr}>${children2}</w:date>`;
43115
+ }
43116
+ case "checkbox": {
43117
+ let children2 = "";
43118
+ if (subtype.checked !== void 0) {
43119
+ children2 += `<w14:checked w14:val="${subtype.checked ? "1" : "0"}"/>`;
43120
+ }
43121
+ if (subtype.checkedStateFont !== void 0 || subtype.checkedStateChar !== void 0) {
43122
+ const fontAttr = subtype.checkedStateFont !== void 0 ? ` w14:font="${escapeXml(subtype.checkedStateFont)}"` : "";
43123
+ const charAttr = subtype.checkedStateChar !== void 0 ? ` w14:char="${escapeXml(subtype.checkedStateChar)}"` : "";
43124
+ children2 += `<w14:checkedState${fontAttr}${charAttr}/>`;
43125
+ }
43126
+ if (subtype.uncheckedStateFont !== void 0 || subtype.uncheckedStateChar !== void 0) {
43127
+ const fontAttr = subtype.uncheckedStateFont !== void 0 ? ` w14:font="${escapeXml(subtype.uncheckedStateFont)}"` : "";
43128
+ const charAttr = subtype.uncheckedStateChar !== void 0 ? ` w14:char="${escapeXml(subtype.uncheckedStateChar)}"` : "";
43129
+ children2 += `<w14:uncheckedState${fontAttr}${charAttr}/>`;
43130
+ }
43131
+ return `<w14:checkbox>${children2}</w14:checkbox>`;
43132
+ }
43133
+ default: {
43134
+ const _exhaustive = subtype;
43135
+ return _exhaustive;
43136
+ }
43137
+ }
43138
+ }
43139
+ function directWordChildren$1(parent, localName) {
43140
+ const result = [];
43141
+ for (let index = 0; index < parent.childNodes.length; index += 1) {
43142
+ const node = parent.childNodes[index];
43143
+ if ((node == null ? void 0 : node.nodeType) === node.ELEMENT_NODE && node.namespaceURI === WORD_NS$1 && node.localName === localName) {
43144
+ result.push(node);
43145
+ }
43146
+ }
43147
+ return result;
43148
+ }
43149
+ function parseWordFragment$1(xml, expectedLocalName) {
43150
+ const wrapper = new DOMParser$1().parseFromString(
43151
+ `<oasis:root xmlns:oasis="urn:oasis:docx" xmlns:w="${WORD_NS$1}" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml">${xml}</oasis:root>`,
43152
+ "application/xml"
43153
+ ).documentElement;
43154
+ if (!wrapper) return void 0;
43155
+ for (let index = 0; index < wrapper.childNodes.length; index += 1) {
43156
+ const node = wrapper.childNodes[index];
43157
+ if ((node == null ? void 0 : node.nodeType) === node.ELEMENT_NODE && node.namespaceURI === WORD_NS$1 && node.localName === expectedLocalName) {
43158
+ return node;
43159
+ }
43160
+ }
43161
+ return void 0;
43162
+ }
43163
+ function createSdtEnvelope(parent, wrapper) {
43164
+ const document2 = parent.ownerDocument;
43165
+ if (!document2) return null;
43166
+ const sdt = document2.createElementNS(WORD_NS$1, "w:sdt");
43167
+ const properties = parseWordFragment$1(serializeSdtPrXml(wrapper.sdtPr), "sdtPr");
43168
+ if (properties) {
43169
+ sdt.appendChild(properties.cloneNode(true));
43170
+ }
43171
+ if (wrapper.sdtEndPrXml) {
43172
+ const endProperties = parseWordFragment$1(wrapper.sdtEndPrXml, "sdtEndPr");
43173
+ if (endProperties) {
43174
+ sdt.appendChild(endProperties.cloneNode(true));
43175
+ }
43176
+ }
43177
+ const content2 = document2.createElementNS(WORD_NS$1, "w:sdtContent");
43178
+ sdt.appendChild(content2);
43179
+ return { sdt, content: content2 };
43180
+ }
43181
+ function wrapSequence(parent, entries2) {
43182
+ var _a2;
43183
+ let index = 0;
43184
+ while (index < entries2.length) {
43185
+ const wrapper = entries2[index].wrappers[0];
43186
+ if (!wrapper) {
43187
+ index += 1;
43188
+ continue;
43189
+ }
43190
+ let end = index + 1;
43191
+ while (end < entries2.length && ((_a2 = entries2[end].wrappers[0]) == null ? void 0 : _a2.groupId) === wrapper.groupId) {
43192
+ end += 1;
43193
+ }
43194
+ const envelope = createSdtEnvelope(parent, wrapper);
43195
+ if (!envelope) {
43196
+ index = end;
43197
+ continue;
43198
+ }
43199
+ parent.insertBefore(envelope.sdt, entries2[index].element);
43200
+ const nestedEntries = [];
43201
+ for (let cursor = index; cursor < end; cursor += 1) {
43202
+ const entry = entries2[cursor];
43203
+ envelope.content.appendChild(entry.element);
43204
+ nestedEntries.push({
43205
+ element: entry.element,
43206
+ wrappers: entry.wrappers.slice(1)
43207
+ });
43208
+ }
43209
+ wrapSequence(envelope.content, nestedEntries);
43210
+ index = end;
43211
+ }
43212
+ }
43213
+ function wrapTableStructuralSdts(table, tableElement) {
43214
+ const rowElements = directWordChildren$1(tableElement, "tr");
43215
+ if (rowElements.length !== table.rows.length) return;
43216
+ for (let rowIndex = 0; rowIndex < rowElements.length; rowIndex += 1) {
43217
+ const rowElement = rowElements[rowIndex];
43218
+ const row = table.rows[rowIndex];
43219
+ const cellElements = directWordChildren$1(rowElement, "tc");
43220
+ if (cellElements.length !== row.cells.length) continue;
43221
+ wrapSequence(
43222
+ rowElement,
43223
+ cellElements.map((element, cellIndex) => ({
43224
+ element,
43225
+ wrappers: row.cells[cellIndex].sdtWrappers ?? []
43226
+ }))
43227
+ );
43228
+ }
43229
+ wrapSequence(
43230
+ tableElement,
43231
+ rowElements.map((element, rowIndex) => ({
43232
+ element,
43233
+ wrappers: table.rows[rowIndex].sdtWrappers ?? []
43234
+ }))
43235
+ );
43236
+ }
42955
43237
  function elementChildren(node) {
42956
43238
  const children2 = [];
42957
43239
  for (let index = 0; index < node.childNodes.length; index += 1) {
@@ -43321,6 +43603,9 @@ function parseWordFragment(xml, expectedLocalName) {
43321
43603
  `<oasis:root xmlns:oasis="urn:oasis:docx" xmlns:w="${WORD_NS$1}">${xml}</oasis:root>`,
43322
43604
  "application/xml"
43323
43605
  ).documentElement;
43606
+ if (!wrapper) {
43607
+ return void 0;
43608
+ }
43324
43609
  const element = wrapper ? directElementChildren$3(wrapper).find(
43325
43610
  (child2) => child2.namespaceURI === WORD_NS$1 && child2.localName === expectedLocalName
43326
43611
  ) : void 0;
@@ -43534,6 +43819,7 @@ function serializeTableXmlPreservingSource(table, serializeParagraphXml2) {
43534
43819
  overlayTableProperties(table, tableElement);
43535
43820
  overlayRowAndCellProperties(table, tableElement);
43536
43821
  ensureTerminalCellParagraphs(tableElement);
43822
+ wrapTableStructuralSdts(table, tableElement);
43537
43823
  const serialized = new XMLSerializer().serializeToString(tableElement);
43538
43824
  return serialized.replace(`<w:tbl xmlns:w="${WORD_NS$1}"`, "<w:tbl");
43539
43825
  }
@@ -44897,142 +45183,6 @@ function serializeRunWithRelationships(run, context2, paragraphStyleId, styles,
44897
45183
  }
44898
45184
  return wrapRunWithHyperlink(runXml, href, context2);
44899
45185
  }
44900
- function serializeSdtPrXml(sdtPr) {
44901
- 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;
44902
- if (!hasAnyField) {
44903
- return "<w:sdtPr/>";
44904
- }
44905
- let inner = "";
44906
- if (sdtPr.alias !== void 0) {
44907
- inner += `<w:alias w:val="${escapeXml(sdtPr.alias)}"/>`;
44908
- }
44909
- if (sdtPr.tag !== void 0) {
44910
- inner += `<w:tag w:val="${escapeXml(sdtPr.tag)}"/>`;
44911
- }
44912
- if (sdtPr.id !== void 0) {
44913
- inner += `<w:id w:val="${escapeXml(sdtPr.id)}"/>`;
44914
- }
44915
- if (sdtPr.lock !== void 0) {
44916
- inner += `<w:lock w:val="${escapeXml(sdtPr.lock)}"/>`;
44917
- }
44918
- if (sdtPr.placeholderDocPart !== void 0) {
44919
- inner += `<w:placeholder><w:docPart w:val="${escapeXml(
44920
- sdtPr.placeholderDocPart
44921
- )}"/></w:placeholder>`;
44922
- }
44923
- if (sdtPr.dataBinding !== void 0) {
44924
- inner += serializeSdtDataBindingXml(sdtPr.dataBinding);
44925
- }
44926
- if (sdtPr.temporary !== void 0) {
44927
- inner += `<w:temporary w:val="${sdtPr.temporary ? "true" : "false"}"/>`;
44928
- }
44929
- if (sdtPr.subtype !== void 0) {
44930
- inner += serializeSdtSubtypeXml(sdtPr.subtype);
44931
- }
44932
- if (sdtPr.appearance !== void 0) {
44933
- inner += `<w:appearance w:val="${escapeXml(sdtPr.appearance)}"/>`;
44934
- }
44935
- if (sdtPr.showingPlcHdr !== void 0) {
44936
- inner += `<w:showingPlcHdr w:val="${sdtPr.showingPlcHdr ? "true" : "false"}"/>`;
44937
- }
44938
- if (sdtPr.color !== void 0) {
44939
- inner += `<w:color w:val="${escapeXml(sdtPr.color)}"/>`;
44940
- }
44941
- if (sdtPr.unknownXml) {
44942
- inner += sdtPr.unknownXml;
44943
- }
44944
- return `<w:sdtPr>${inner}</w:sdtPr>`;
44945
- }
44946
- function serializeSdtDataBindingXml(dataBinding) {
44947
- let inner = "";
44948
- if (dataBinding.prefixMappings !== void 0) {
44949
- inner += `<w:prefixMappings w:val="${escapeXml(
44950
- dataBinding.prefixMappings
44951
- )}"/>`;
44952
- }
44953
- if (dataBinding.xpath !== void 0) {
44954
- inner += `<w:xpath w:val="${escapeXml(dataBinding.xpath)}"/>`;
44955
- }
44956
- if (dataBinding.storeItemID !== void 0) {
44957
- inner += `<w:storeItemID w:val="${escapeXml(dataBinding.storeItemID)}"/>`;
44958
- }
44959
- return inner ? `<w:dataBinding>${inner}</w:dataBinding>` : "";
44960
- }
44961
- function serializeSdtListItemXml(item) {
44962
- const displayTextAttr = item.displayText !== void 0 ? ` w:displayText="${escapeXml(item.displayText)}"` : "";
44963
- const valueAttr = item.value !== void 0 ? ` w:value="${escapeXml(item.value)}"` : "";
44964
- return `<w:listItem${displayTextAttr}${valueAttr}/>`;
44965
- }
44966
- function serializeSdtSubtypeXml(subtype) {
44967
- switch (subtype.kind) {
44968
- case "text":
44969
- return "<w:text/>";
44970
- case "richText":
44971
- return "<w:richText/>";
44972
- case "picture":
44973
- return "<w:picture/>";
44974
- case "group":
44975
- return "<w:group/>";
44976
- case "equation":
44977
- return "<w:equation/>";
44978
- case "citation":
44979
- return "<w:citation/>";
44980
- case "bibliography":
44981
- return "<w:bibliography/>";
44982
- case "repeatingSection":
44983
- return "<w:repeatingSection/>";
44984
- case "repeatingSectionItem":
44985
- return "<w:repeatingSectionItem/>";
44986
- case "comboBox":
44987
- case "dropDownList": {
44988
- const items = (subtype.listItems ?? []).map(serializeSdtListItemXml).join("");
44989
- const lastSelected = subtype.lastSelectedValue !== void 0 ? `<w:lastSelectedValue w:val="${escapeXml(
44990
- subtype.lastSelectedValue
44991
- )}"/>` : "";
44992
- return `<w:${subtype.kind}>${items}${lastSelected}</w:${subtype.kind}>`;
44993
- }
44994
- case "date": {
44995
- const fullDateAttr = subtype.fullDate !== void 0 ? ` w:fullDate="${escapeXml(subtype.fullDate)}"` : "";
44996
- let children2 = "";
44997
- if (subtype.dateFormat !== void 0) {
44998
- children2 += `<w:dateFormat w:val="${escapeXml(subtype.dateFormat)}"/>`;
44999
- }
45000
- if (subtype.lid !== void 0) {
45001
- children2 += `<w:lid w:val="${escapeXml(subtype.lid)}"/>`;
45002
- }
45003
- if (subtype.calendar !== void 0) {
45004
- children2 += `<w:calendar w:val="${escapeXml(subtype.calendar)}"/>`;
45005
- }
45006
- if (subtype.storeMappedDataAs !== void 0) {
45007
- children2 += `<w:storeMappedDataAs w:val="${escapeXml(
45008
- subtype.storeMappedDataAs
45009
- )}"/>`;
45010
- }
45011
- return `<w:date${fullDateAttr}>${children2}</w:date>`;
45012
- }
45013
- case "checkbox": {
45014
- let children2 = "";
45015
- if (subtype.checked !== void 0) {
45016
- children2 += `<w14:checked w14:val="${subtype.checked ? "1" : "0"}"/>`;
45017
- }
45018
- if (subtype.checkedStateFont !== void 0 || subtype.checkedStateChar !== void 0) {
45019
- const fontAttr = subtype.checkedStateFont !== void 0 ? ` w14:font="${escapeXml(subtype.checkedStateFont)}"` : "";
45020
- const charAttr = subtype.checkedStateChar !== void 0 ? ` w14:char="${escapeXml(subtype.checkedStateChar)}"` : "";
45021
- children2 += `<w14:checkedState${fontAttr}${charAttr}/>`;
45022
- }
45023
- if (subtype.uncheckedStateFont !== void 0 || subtype.uncheckedStateChar !== void 0) {
45024
- const fontAttr = subtype.uncheckedStateFont !== void 0 ? ` w14:font="${escapeXml(subtype.uncheckedStateFont)}"` : "";
45025
- const charAttr = subtype.uncheckedStateChar !== void 0 ? ` w14:char="${escapeXml(subtype.uncheckedStateChar)}"` : "";
45026
- children2 += `<w14:uncheckedState${fontAttr}${charAttr}/>`;
45027
- }
45028
- return `<w14:checkbox>${children2}</w14:checkbox>`;
45029
- }
45030
- default: {
45031
- const _exhaustive = subtype;
45032
- return _exhaustive;
45033
- }
45034
- }
45035
- }
45036
45186
  function serializeRunsWithInlineSdts(runs, serializeRun2) {
45037
45187
  var _a2, _b2, _c;
45038
45188
  let out = "";
@@ -47398,7 +47548,7 @@ async function importDocxInWorker(buffer, options = {}) {
47398
47548
  const worker = new Worker(
47399
47549
  new URL(
47400
47550
  /* @vite-ignore */
47401
- "" + new URL("assets/importDocxWorker-CEVODY5C.js", import.meta.url).href,
47551
+ "" + new URL("assets/importDocxWorker-BHz7MeiI.js", import.meta.url).href,
47402
47552
  import.meta.url
47403
47553
  ),
47404
47554
  {
@@ -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-0LIU1rxH.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-BWxZXNb4.js";
2
2
  export {
3
3
  dK as ActionRow,
4
4
  ah as BalloonShell,