@harbour-enterprises/superdoc 0.12.35 → 0.12.36-next.10

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 (40) hide show
  1. package/dist/chunks/{super-editor.es-B4SPMXXo.cjs → super-editor.es-C5-RTRXN.cjs} +1754 -221
  2. package/dist/chunks/{super-editor.es-D8BL6ojY.es.js → super-editor.es-Zxne04bX.es.js} +1754 -221
  3. package/dist/style.css +36 -7
  4. package/dist/super-editor/ai-writer.es.js +2 -2
  5. package/dist/super-editor/chunks/{converter-DQPyKWs_.js → converter-Dhv5kzsP.js} +108 -9
  6. package/dist/super-editor/chunks/{docx-zipper-cJ42om_0.js → docx-zipper-Co1uS6tK.js} +1 -1
  7. package/dist/super-editor/chunks/{editor-B5TyAe8v.js → editor-D2aY4DLZ.js} +1688 -254
  8. package/dist/super-editor/chunks/{toolbar-CDeO5r_T.js → toolbar-CVZmXsRq.js} +2 -2
  9. package/dist/super-editor/components/pagination-helpers.d.ts.map +1 -1
  10. package/dist/super-editor/converter.es.js +1 -1
  11. package/dist/super-editor/core/Attribute.d.ts +2 -2
  12. package/dist/super-editor/core/Editor.d.ts.map +1 -1
  13. package/dist/super-editor/core/Schema.d.ts +2 -2
  14. package/dist/super-editor/core/helpers/annotator.d.ts +2 -0
  15. package/dist/super-editor/core/helpers/annotator.d.ts.map +1 -1
  16. package/dist/super-editor/core/helpers/findWordBounds.d.ts +5 -0
  17. package/dist/super-editor/core/helpers/findWordBounds.d.ts.map +1 -0
  18. package/dist/super-editor/core/super-converter/exporter.d.ts.map +1 -1
  19. package/dist/super-editor/core/super-converter/helpers.d.ts.map +1 -1
  20. package/dist/super-editor/core/super-converter/v2/importer/autoPageNumberImporter.d.ts.map +1 -1
  21. package/dist/super-editor/docx-zipper.es.js +2 -2
  22. package/dist/super-editor/editor.es.js +3 -3
  23. package/dist/super-editor/extensions/line-height/line-height.d.ts.map +1 -1
  24. package/dist/super-editor/extensions/page-number/page-number.d.ts +10 -0
  25. package/dist/super-editor/extensions/page-number/page-number.d.ts.map +1 -1
  26. package/dist/super-editor/extensions/pagination/pagination-helpers.d.ts +2 -1
  27. package/dist/super-editor/extensions/pagination/pagination-helpers.d.ts.map +1 -1
  28. package/dist/super-editor/extensions/pagination/pagination.d.ts.map +1 -1
  29. package/dist/super-editor/extensions/paragraph/paragraph.d.ts.map +1 -1
  30. package/dist/super-editor/file-zipper.es.js +1 -1
  31. package/dist/super-editor/style.css +36 -7
  32. package/dist/super-editor/super-editor.es.js +7 -7
  33. package/dist/super-editor/toolbar.es.js +2 -2
  34. package/dist/super-editor.cjs +1 -1
  35. package/dist/super-editor.es.js +1 -1
  36. package/dist/superdoc.cjs +2 -2
  37. package/dist/superdoc.es.js +3 -3
  38. package/dist/superdoc.umd.js +1770 -237
  39. package/dist/superdoc.umd.js.map +1 -1
  40. package/package.json +1 -1
@@ -9933,29 +9933,29 @@
9933
9933
  abs$1 = Math.abs;
9934
9934
  return abs$1;
9935
9935
  }
9936
- var floor$1;
9936
+ var floor$2;
9937
9937
  var hasRequiredFloor;
9938
9938
  function requireFloor() {
9939
- if (hasRequiredFloor) return floor$1;
9939
+ if (hasRequiredFloor) return floor$2;
9940
9940
  hasRequiredFloor = 1;
9941
- floor$1 = Math.floor;
9942
- return floor$1;
9941
+ floor$2 = Math.floor;
9942
+ return floor$2;
9943
9943
  }
9944
- var max$2;
9944
+ var max$3;
9945
9945
  var hasRequiredMax;
9946
9946
  function requireMax() {
9947
- if (hasRequiredMax) return max$2;
9947
+ if (hasRequiredMax) return max$3;
9948
9948
  hasRequiredMax = 1;
9949
- max$2 = Math.max;
9950
- return max$2;
9949
+ max$3 = Math.max;
9950
+ return max$3;
9951
9951
  }
9952
- var min$2;
9952
+ var min$3;
9953
9953
  var hasRequiredMin;
9954
9954
  function requireMin() {
9955
- if (hasRequiredMin) return min$2;
9955
+ if (hasRequiredMin) return min$3;
9956
9956
  hasRequiredMin = 1;
9957
- min$2 = Math.min;
9958
- return min$2;
9957
+ min$3 = Math.min;
9958
+ return min$3;
9959
9959
  }
9960
9960
  var pow;
9961
9961
  var hasRequiredPow;
@@ -9965,13 +9965,13 @@
9965
9965
  pow = Math.pow;
9966
9966
  return pow;
9967
9967
  }
9968
- var round$1;
9968
+ var round$2;
9969
9969
  var hasRequiredRound;
9970
9970
  function requireRound() {
9971
- if (hasRequiredRound) return round$1;
9971
+ if (hasRequiredRound) return round$2;
9972
9972
  hasRequiredRound = 1;
9973
- round$1 = Math.round;
9974
- return round$1;
9973
+ round$2 = Math.round;
9974
+ return round$2;
9975
9975
  }
9976
9976
  var _isNaN;
9977
9977
  var hasRequired_isNaN;
@@ -23434,7 +23434,6 @@
23434
23434
  if (Number.isNaN(value) || value === 0) return {};
23435
23435
  if (lineRule === "atLeast" && value < 1) return {};
23436
23436
  unit = unit ? unit : defaultUnit;
23437
- value += unit ? 4 : 0.2;
23438
23437
  return isObject2 ? { ["line-height"]: `${value}${unit}` } : `line-height: ${value}${unit}`;
23439
23438
  };
23440
23439
  const deobfuscateFont = (arrayBuffer, guidHex) => {
@@ -26223,7 +26222,9 @@
26223
26222
  shapeContainer: translateShapeContainer,
26224
26223
  shapeTextbox: translateShapeTextbox,
26225
26224
  contentBlock: translateContentBlock,
26226
- structuredContent: translateStructuredContent
26225
+ structuredContent: translateStructuredContent,
26226
+ "page-number": translatePageNumberNode,
26227
+ "total-page-number": translateTotalPageNumberNode
26227
26228
  };
26228
26229
  if (!router[type2]) {
26229
26230
  console.error("No translation function found for node type:", type2);
@@ -26661,7 +26662,10 @@
26661
26662
  if (Array.isArray(outputNode)) {
26662
26663
  const mapped = [];
26663
26664
  outputNode.forEach((el, index22) => {
26664
- mapped.push(...el.elements);
26665
+ el.elements.forEach((element) => {
26666
+ if (element.name === "w:pPr") return;
26667
+ mapped.push(element);
26668
+ });
26665
26669
  if (index22 < outputNode.length - 1) mapped.push({ name: "w:br", type: "element" });
26666
26670
  });
26667
26671
  mapped.unshift(carbonCopy(pPr));
@@ -27917,6 +27921,81 @@
27917
27921
  elements: nodeElements
27918
27922
  };
27919
27923
  }
27924
+ const translatePageNumberNode = (params2) => {
27925
+ const outputMarks = processOutputMarks(params2.node.attrs?.marksAsAttrs || []);
27926
+ return getAutoPageJson("PAGE", outputMarks);
27927
+ };
27928
+ const translateTotalPageNumberNode = (params2) => {
27929
+ const outputMarks = processOutputMarks(params2.node.attrs?.marksAsAttrs || []);
27930
+ return getAutoPageJson("NUMPAGES", outputMarks);
27931
+ };
27932
+ const getAutoPageJson = (type2, outputMarks = []) => {
27933
+ return [
27934
+ {
27935
+ "name": "w:r",
27936
+ "elements": [
27937
+ {
27938
+ "name": "w:rPr",
27939
+ "elements": outputMarks
27940
+ },
27941
+ {
27942
+ "name": "w:fldChar",
27943
+ "attributes": {
27944
+ "w:fldCharType": "begin"
27945
+ }
27946
+ }
27947
+ ]
27948
+ },
27949
+ {
27950
+ "name": "w:r",
27951
+ "elements": [
27952
+ {
27953
+ "name": "w:rPr",
27954
+ "elements": outputMarks
27955
+ },
27956
+ {
27957
+ "name": "w:instrText",
27958
+ "elements": [
27959
+ {
27960
+ "type": "text",
27961
+ "text": ` ${type2}`
27962
+ }
27963
+ ]
27964
+ }
27965
+ ]
27966
+ },
27967
+ {
27968
+ "name": "w:r",
27969
+ "elements": [
27970
+ {
27971
+ "name": "w:rPr",
27972
+ "elements": outputMarks
27973
+ },
27974
+ {
27975
+ "name": "w:fldChar",
27976
+ "attributes": {
27977
+ "w:fldCharType": "separate"
27978
+ }
27979
+ }
27980
+ ]
27981
+ },
27982
+ {
27983
+ "name": "w:r",
27984
+ "elements": [
27985
+ {
27986
+ "name": "w:rPr",
27987
+ "elements": outputMarks
27988
+ },
27989
+ {
27990
+ "name": "w:fldChar",
27991
+ "attributes": {
27992
+ "w:fldCharType": "end"
27993
+ }
27994
+ }
27995
+ ]
27996
+ }
27997
+ ];
27998
+ };
27920
27999
  const defaultInitialXml = `<w:document xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:cx1="http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" xmlns:cx2="http://schemas.microsoft.com/office/drawing/2015/10/21/chartex" xmlns:cx3="http://schemas.microsoft.com/office/drawing/2016/5/9/chartex" xmlns:cx4="http://schemas.microsoft.com/office/drawing/2016/5/10/chartex" xmlns:cx5="http://schemas.microsoft.com/office/drawing/2016/5/11/chartex" xmlns:cx6="http://schemas.microsoft.com/office/drawing/2016/5/12/chartex" xmlns:cx7="http://schemas.microsoft.com/office/drawing/2016/5/13/chartex" xmlns:cx8="http://schemas.microsoft.com/office/drawing/2016/5/14/chartex" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:aink="http://schemas.microsoft.com/office/drawing/2016/ink" xmlns:am3d="http://schemas.microsoft.com/office/drawing/2017/model3d" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:oel="http://schemas.microsoft.com/office/2019/extlst" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:w16cex="http://schemas.microsoft.com/office/word/2018/wordml/cex" xmlns:w16cid="http://schemas.microsoft.com/office/word/2016/wordml/cid" xmlns:w16="http://schemas.microsoft.com/office/word/2018/wordml" xmlns:w16sdtdh="http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" xmlns:w16se="http://schemas.microsoft.com/office/word/2015/wordml/symex" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" mc:Ignorable="w14 w15 w16se w16cid w16 w16cex w16sdtdh wp14"><w:body></w:body></w:document>`;
27921
28000
  const parseXmlToJson = (xml) => {
27922
28001
  return JSON.parse(xmljs.xml2json(xml, null, 2));
@@ -29625,15 +29704,25 @@
29625
29704
  if (!isNumPages) isNumPages = instrText?.trim().startsWith("NUMPAGES");
29626
29705
  const urlMatch = instrText?.match(/HYPERLINK\s+"([^"]+)"/);
29627
29706
  if (hasPageMarker) {
29628
- processedNodes.push({
29707
+ const pageNumNode = {
29629
29708
  name: "sd:autoPageNumber",
29630
29709
  type: "element"
29710
+ };
29711
+ nodesToCombine.forEach((n) => {
29712
+ const rPrNode = n.elements.find((el) => el.name === "w:rPr");
29713
+ if (rPrNode) pageNumNode.elements = [rPrNode];
29631
29714
  });
29715
+ processedNodes.push(pageNumNode);
29632
29716
  } else if (isNumPages) {
29633
- processedNodes.push({
29717
+ const totalPageNumNode = {
29634
29718
  name: "sd:totalPageNumber",
29635
29719
  type: "element"
29720
+ };
29721
+ nodesToCombine.forEach((n) => {
29722
+ const rPrNode = n.elements.find((el) => el.name === "w:rPr");
29723
+ if (rPrNode) totalPageNumNode.elements = [rPrNode];
29636
29724
  });
29725
+ processedNodes.push(totalPageNumNode);
29637
29726
  } else if (urlMatch && urlMatch?.length >= 2) {
29638
29727
  const url = urlMatch[1];
29639
29728
  const textMarks = [];
@@ -29969,8 +30058,13 @@
29969
30058
  if (nodes.length === 0 || nodes[0].name !== "sd:autoPageNumber") {
29970
30059
  return { nodes: [], consumed: 0 };
29971
30060
  }
30061
+ const rPr = nodes[0].elements?.find((el) => el.name === "w:rPr");
30062
+ const marks = parseMarks(rPr || { elements: [] });
29972
30063
  const processedNode = {
29973
- type: "page-number"
30064
+ type: "page-number",
30065
+ attrs: {
30066
+ marksAsAttrs: marks
30067
+ }
29974
30068
  };
29975
30069
  return { nodes: [processedNode], consumed: 1 };
29976
30070
  };
@@ -29983,8 +30077,13 @@
29983
30077
  if (nodes.length === 0 || nodes[0].name !== "sd:totalPageNumber") {
29984
30078
  return { nodes: [], consumed: 0 };
29985
30079
  }
30080
+ const rPr = nodes[0].elements?.find((el) => el.name === "w:rPr");
30081
+ const marks = parseMarks(rPr || { elements: [] });
29986
30082
  const processedNode = {
29987
- type: "total-page-number"
30083
+ type: "total-page-number",
30084
+ attrs: {
30085
+ marksAsAttrs: marks
30086
+ }
29988
30087
  };
29989
30088
  return { nodes: [processedNode], consumed: 1 };
29990
30089
  };
@@ -30669,7 +30768,7 @@
30669
30768
  return;
30670
30769
  }
30671
30770
  }
30672
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.12.35") {
30771
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.12.36-next.10") {
30673
30772
  const customLocation = "docProps/custom.xml";
30674
30773
  if (!docx[customLocation]) {
30675
30774
  docx[customLocation] = generateCustomXml();
@@ -31136,7 +31235,7 @@
31136
31235
  function generateCustomXml() {
31137
31236
  return DEFAULT_CUSTOM_XML;
31138
31237
  }
31139
- function generateSuperdocVersion(pid = 2, version2 = "0.12.35") {
31238
+ function generateSuperdocVersion(pid = 2, version2 = "0.12.36-next.10") {
31140
31239
  return {
31141
31240
  type: "element",
31142
31241
  name: "property",
@@ -33669,7 +33768,7 @@
33669
33768
  var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
33670
33769
  var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
33671
33770
  var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
33672
- var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _commandService, _css, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, createSchema_fn, generatePmData_fn, createDocFromHTML_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, _FieldAnnotationView_instances, createAnnotation_fn;
33771
+ var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _commandService, _css, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, createSchema_fn, generatePmData_fn, createDocFromHTML_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn;
33673
33772
  function getMarksFromSelection(state2) {
33674
33773
  const { from: from2, to, empty: empty2 } = state2.selection;
33675
33774
  const marks = [];
@@ -38078,7 +38177,7 @@
38078
38177
  bottom: doc2.documentElement.clientHeight
38079
38178
  };
38080
38179
  }
38081
- function getSide(value, side) {
38180
+ function getSide$1(value, side) {
38082
38181
  return typeof value == "number" ? value : value[side];
38083
38182
  }
38084
38183
  function clientRect(node2) {
@@ -38106,14 +38205,14 @@
38106
38205
  let atTop = elt == doc2.body;
38107
38206
  let bounding = atTop ? windowRect(doc2) : clientRect(elt);
38108
38207
  let moveX = 0, moveY = 0;
38109
- if (rect.top < bounding.top + getSide(scrollThreshold, "top"))
38110
- moveY = -(bounding.top - rect.top + getSide(scrollMargin, "top"));
38111
- else if (rect.bottom > bounding.bottom - getSide(scrollThreshold, "bottom"))
38112
- moveY = rect.bottom - rect.top > bounding.bottom - bounding.top ? rect.top + getSide(scrollMargin, "top") - bounding.top : rect.bottom - bounding.bottom + getSide(scrollMargin, "bottom");
38113
- if (rect.left < bounding.left + getSide(scrollThreshold, "left"))
38114
- moveX = -(bounding.left - rect.left + getSide(scrollMargin, "left"));
38115
- else if (rect.right > bounding.right - getSide(scrollThreshold, "right"))
38116
- moveX = rect.right - bounding.right + getSide(scrollMargin, "right");
38208
+ if (rect.top < bounding.top + getSide$1(scrollThreshold, "top"))
38209
+ moveY = -(bounding.top - rect.top + getSide$1(scrollMargin, "top"));
38210
+ else if (rect.bottom > bounding.bottom - getSide$1(scrollThreshold, "bottom"))
38211
+ moveY = rect.bottom - rect.top > bounding.bottom - bounding.top ? rect.top + getSide$1(scrollMargin, "top") - bounding.top : rect.bottom - bounding.bottom + getSide$1(scrollMargin, "bottom");
38212
+ if (rect.left < bounding.left + getSide$1(scrollThreshold, "left"))
38213
+ moveX = -(bounding.left - rect.left + getSide$1(scrollMargin, "left"));
38214
+ else if (rect.right > bounding.right - getSide$1(scrollThreshold, "right"))
38215
+ moveX = rect.right - bounding.right + getSide$1(scrollMargin, "right");
38117
38216
  if (moveX || moveY) {
38118
38217
  if (atTop) {
38119
38218
  doc2.defaultView.scrollBy(moveX, moveY);
@@ -43052,10 +43151,10 @@
43052
43151
  if (plugin2.spec.state || plugin2.spec.filterTransaction || plugin2.spec.appendTransaction)
43053
43152
  throw new RangeError("Plugins passed directly to the view must not have a state component");
43054
43153
  }
43055
- const floor = Math.floor;
43154
+ const floor$1 = Math.floor;
43056
43155
  const abs = Math.abs;
43057
- const min$1 = (a, b) => a < b ? a : b;
43058
- const max$1 = (a, b) => a > b ? a : b;
43156
+ const min$2 = (a, b) => a < b ? a : b;
43157
+ const max$2 = (a, b) => a > b ? a : b;
43059
43158
  const isNegativeZero = (n) => n !== 0 ? n < 0 : 1 / n < 0;
43060
43159
  const BIT7 = 64;
43061
43160
  const BIT8 = 128;
@@ -43063,7 +43162,7 @@
43063
43162
  const BITS6 = 63;
43064
43163
  const BITS7 = 127;
43065
43164
  const BITS31 = 2147483647;
43066
- const isInteger = Number.isInteger || ((num) => typeof num === "number" && isFinite(num) && floor(num) === num);
43165
+ const isInteger = Number.isInteger || ((num) => typeof num === "number" && isFinite(num) && floor$1(num) === num);
43067
43166
  const create$2 = () => /* @__PURE__ */ new Set();
43068
43167
  const isArray$2 = Array.isArray;
43069
43168
  const fromCharCode = String.fromCharCode;
@@ -43127,7 +43226,7 @@
43127
43226
  const bufferLen = encoder.cbuf.length;
43128
43227
  if (bufferLen - encoder.cpos < len2) {
43129
43228
  encoder.bufs.push(new Uint8Array(encoder.cbuf.buffer, 0, encoder.cpos));
43130
- encoder.cbuf = new Uint8Array(max$1(bufferLen, len2) * 2);
43229
+ encoder.cbuf = new Uint8Array(max$2(bufferLen, len2) * 2);
43131
43230
  encoder.cpos = 0;
43132
43231
  }
43133
43232
  };
@@ -43143,7 +43242,7 @@
43143
43242
  const writeVarUint = (encoder, num) => {
43144
43243
  while (num > BITS7) {
43145
43244
  write$1(encoder, BIT8 | BITS7 & num);
43146
- num = floor(num / 128);
43245
+ num = floor$1(num / 128);
43147
43246
  }
43148
43247
  write$1(encoder, BITS7 & num);
43149
43248
  };
@@ -43153,10 +43252,10 @@
43153
43252
  num = -num;
43154
43253
  }
43155
43254
  write$1(encoder, (num > BITS6 ? BIT8 : 0) | (isNegative ? BIT7 : 0) | BITS6 & num);
43156
- num = floor(num / 64);
43255
+ num = floor$1(num / 64);
43157
43256
  while (num > 0) {
43158
43257
  write$1(encoder, (num > BITS7 ? BIT8 : 0) | BITS7 & num);
43159
- num = floor(num / 128);
43258
+ num = floor$1(num / 128);
43160
43259
  }
43161
43260
  };
43162
43261
  const _strBuffer = new Uint8Array(3e4);
@@ -43189,13 +43288,13 @@
43189
43288
  const writeUint8Array = (encoder, uint8Array) => {
43190
43289
  const bufferLen = encoder.cbuf.length;
43191
43290
  const cpos = encoder.cpos;
43192
- const leftCopyLen = min$1(bufferLen - cpos, uint8Array.length);
43291
+ const leftCopyLen = min$2(bufferLen - cpos, uint8Array.length);
43193
43292
  const rightCopyLen = uint8Array.length - leftCopyLen;
43194
43293
  encoder.cbuf.set(uint8Array.subarray(0, leftCopyLen), cpos);
43195
43294
  encoder.cpos += leftCopyLen;
43196
43295
  if (rightCopyLen > 0) {
43197
43296
  encoder.bufs.push(encoder.cbuf);
43198
- encoder.cbuf = new Uint8Array(max$1(bufferLen * 2, rightCopyLen));
43297
+ encoder.cbuf = new Uint8Array(max$2(bufferLen * 2, rightCopyLen));
43199
43298
  encoder.cbuf.set(uint8Array.subarray(leftCopyLen));
43200
43299
  encoder.cpos = rightCopyLen;
43201
43300
  }
@@ -43337,7 +43436,7 @@
43337
43436
  const yUndoPluginKey = new PluginKey("y-undo");
43338
43437
  const yCursorPluginKey = new PluginKey("yjs-cursor");
43339
43438
  const rand = Math.random;
43340
- const oneOf = (arr) => arr[floor(rand() * arr.length)];
43439
+ const oneOf = (arr) => arr[floor$1(rand() * arr.length)];
43341
43440
  const undefinedToNull = (v) => v === void 0 ? null : v;
43342
43441
  class VarStoragePolyfill {
43343
43442
  constructor() {
@@ -43367,12 +43466,12 @@
43367
43466
  } catch (e) {
43368
43467
  }
43369
43468
  const varStorage = _localStorage;
43370
- const isNode = typeof process$1$1 !== "undefined" && process$1$1.release && /node|io\.js/.test(process$1$1.release.name) && Object.prototype.toString.call(typeof process$1$1 !== "undefined" ? process$1$1 : 0) === "[object process]";
43371
- const isBrowser$1$2 = typeof window !== "undefined" && typeof document !== "undefined" && !isNode;
43469
+ const isNode$1 = typeof process$1$1 !== "undefined" && process$1$1.release && /node|io\.js/.test(process$1$1.release.name) && Object.prototype.toString.call(typeof process$1$1 !== "undefined" ? process$1$1 : 0) === "[object process]";
43470
+ const isBrowser$1$2 = typeof window !== "undefined" && typeof document !== "undefined" && !isNode$1;
43372
43471
  let params;
43373
43472
  const computeParams = () => {
43374
43473
  if (params === void 0) {
43375
- if (isNode) {
43474
+ if (isNode$1) {
43376
43475
  params = create();
43377
43476
  const pargs = process$1$1.argv;
43378
43477
  let currParamName = null;
@@ -43409,12 +43508,12 @@
43409
43508
  return params;
43410
43509
  };
43411
43510
  const hasParam = (name) => computeParams().has(name);
43412
- const getVariable = (name) => isNode ? undefinedToNull(process$1$1.env[name.toUpperCase().replaceAll("-", "_")]) : undefinedToNull(varStorage.getItem(name));
43511
+ const getVariable = (name) => isNode$1 ? undefinedToNull(process$1$1.env[name.toUpperCase().replaceAll("-", "_")]) : undefinedToNull(varStorage.getItem(name));
43413
43512
  const hasConf = (name) => hasParam("--" + name) || getVariable(name) !== null;
43414
43513
  hasConf("production");
43415
- const forceColor = isNode && isOneOf(process$1$1.env.FORCE_COLOR, ["true", "1", "2"]);
43514
+ const forceColor = isNode$1 && isOneOf(process$1$1.env.FORCE_COLOR, ["true", "1", "2"]);
43416
43515
  forceColor || !hasParam("--no-colors") && // @todo deprecate --no-colors
43417
- !hasConf("no-color") && (!isNode || process$1$1.stdout.isTTY) && (!isNode || hasParam("--color") || getVariable("COLORTERM") !== null || (getVariable("TERM") || "").includes("color"));
43516
+ !hasConf("no-color") && (!isNode$1 || process$1$1.stdout.isTTY) && (!isNode$1 || hasParam("--color") || getVariable("COLORTERM") !== null || (getVariable("TERM") || "").includes("color"));
43418
43517
  const doc = (
43419
43518
  /** @type {Document} */
43420
43519
  typeof document !== "undefined" ? document : {}
@@ -43923,8 +44022,8 @@
43923
44022
  new Slice(Fragment.from(fragmentContent), 0, 0)
43924
44023
  );
43925
44024
  if (sel) {
43926
- const clampedAnchor = min$1(max$1(sel.anchor, 0), tr.doc.content.size);
43927
- const clampedHead = min$1(max$1(sel.head, 0), tr.doc.content.size);
44025
+ const clampedAnchor = min$2(max$2(sel.anchor, 0), tr.doc.content.size);
44026
+ const clampedHead = min$2(max$2(sel.head, 0), tr.doc.content.size);
43928
44027
  tr.setSelection(TextSelection.create(tr.doc, clampedAnchor, clampedHead));
43929
44028
  }
43930
44029
  this.prosemirrorView.dispatch(
@@ -44321,7 +44420,7 @@
44321
44420
  const pChildren = normalizePNodeContent(pnode);
44322
44421
  const pChildCnt = pChildren.length;
44323
44422
  const yChildCnt = yChildren.length;
44324
- const minCnt = min$1(yChildCnt, pChildCnt);
44423
+ const minCnt = min$2(yChildCnt, pChildCnt);
44325
44424
  let left2 = 0;
44326
44425
  let right2 = 0;
44327
44426
  let foundMappedChild = false;
@@ -44433,7 +44532,7 @@
44433
44532
  const pChildCnt = pChildren.length;
44434
44533
  const yChildren = yDomFragment.toArray();
44435
44534
  const yChildCnt = yChildren.length;
44436
- const minCnt = min$1(pChildCnt, yChildCnt);
44535
+ const minCnt = min$2(pChildCnt, yChildCnt);
44437
44536
  let left2 = 0;
44438
44537
  let right2 = 0;
44439
44538
  for (; left2 < minCnt; left2++) {
@@ -44806,17 +44905,17 @@
44806
44905
  ystate.binding.mapping
44807
44906
  );
44808
44907
  if (anchor !== null && head !== null) {
44809
- const maxsize = max$1(state2.doc.content.size - 1, 0);
44810
- anchor = min$1(anchor, maxsize);
44811
- head = min$1(head, maxsize);
44908
+ const maxsize = max$2(state2.doc.content.size - 1, 0);
44909
+ anchor = min$2(anchor, maxsize);
44910
+ head = min$2(head, maxsize);
44812
44911
  decorations.push(
44813
44912
  Decoration.widget(head, () => createCursor(user, clientId), {
44814
44913
  key: clientId + "",
44815
44914
  side: 10
44816
44915
  })
44817
44916
  );
44818
- const from2 = min$1(anchor, head);
44819
- const to = max$1(anchor, head);
44917
+ const from2 = min$2(anchor, head);
44918
+ const to = max$2(anchor, head);
44820
44919
  decorations.push(
44821
44920
  Decoration.inline(from2, to, createSelection(user, clientId), {
44822
44921
  inclusiveEnd: true,
@@ -46438,7 +46537,8 @@
46438
46537
  appendToBody = true,
46439
46538
  sectionId,
46440
46539
  type: type2,
46441
- availableHeight
46540
+ availableHeight,
46541
+ currentPageNumber
46442
46542
  }) => {
46443
46543
  const parentStyles = editor.converter.getDocumentDefaultStyles();
46444
46544
  const { fontSizePt, typeface } = parentStyles;
@@ -46474,11 +46574,13 @@
46474
46574
  content: data,
46475
46575
  extensions: getStarterExtensions(),
46476
46576
  documentId: sectionId || "sectionId",
46477
- media: editor.options.media,
46478
- mediaFiles: editor.options.mediaFiles,
46577
+ media: editor.storage.image.media,
46578
+ mediaFiles: editor.storage.image.media,
46479
46579
  fonts: editor.options.fonts,
46480
46580
  isHeaderOrFooter: true,
46481
46581
  annotations: true,
46582
+ currentPageNumber,
46583
+ parentEditor: editor,
46482
46584
  onCreate: (evt) => setEditorToolbar(evt, editor),
46483
46585
  onBlur: (evt) => onHeaderFooterDataUpdate(evt, editor, sectionId, type2)
46484
46586
  });
@@ -47596,6 +47698,68 @@
47596
47698
  );
47597
47699
  });
47598
47700
  };
47701
+ const cleanUpListsWithAnnotations = (fieldsToDelete = [], editor) => {
47702
+ if (!Array.isArray(fieldsToDelete)) fieldsToDelete = [fieldsToDelete];
47703
+ const { doc: doc2 } = editor.state;
47704
+ const docxAnnotations = getAllFieldAnnotations(editor.state) || [];
47705
+ const nodesToDelete = [];
47706
+ fieldsToDelete.forEach((fieldId) => {
47707
+ const matched = docxAnnotations.find((a) => a.node.attrs.fieldId === fieldId);
47708
+ if (!matched) return;
47709
+ const listItem = findParentNodeClosestToPos(
47710
+ doc2.resolve(matched.pos),
47711
+ (node22) => node22.type.name === "listItem"
47712
+ );
47713
+ if (!listItem) return;
47714
+ let remainingNodes = 0;
47715
+ listItem.node.descendants((node22) => {
47716
+ if (node22.type.name === "fieldAnnotation") {
47717
+ remainingNodes += 1;
47718
+ }
47719
+ });
47720
+ let matchingNodesFound = 0;
47721
+ let hasOtherNodes = false;
47722
+ listItem.node.children.forEach((child, index2) => {
47723
+ const { type: type2 } = child;
47724
+ if (type2.name !== "paragraph" && type2.name !== "fieldAnnotation") return;
47725
+ child.children.forEach((inline) => {
47726
+ const isFieldToDelete = fieldsToDelete.includes(inline.attrs.fieldId);
47727
+ const isFieldType = inline.type.name === "fieldAnnotation";
47728
+ const isMatchingField = isFieldType && isFieldToDelete;
47729
+ if (!isFieldType && !isMatchingField) hasOtherNodes = true;
47730
+ if (isMatchingField) matchingNodesFound += 1;
47731
+ });
47732
+ });
47733
+ if (!hasOtherNodes && matchingNodesFound > 0) {
47734
+ remainingNodes -= matchingNodesFound;
47735
+ }
47736
+ if (remainingNodes > 0) {
47737
+ return;
47738
+ }
47739
+ let { pos, node: node2, depth } = listItem;
47740
+ let $pos = doc2.resolve(pos);
47741
+ while (depth > 0) {
47742
+ const parent = $pos.node(depth - 1);
47743
+ if (parent.childCount === 1) {
47744
+ depth -= 1;
47745
+ pos = $pos.before(depth);
47746
+ node2 = parent;
47747
+ $pos = doc2.resolve(pos);
47748
+ } else {
47749
+ break;
47750
+ }
47751
+ }
47752
+ if (!nodesToDelete.some((n) => n.pos === pos)) {
47753
+ nodesToDelete.push({ pos, node: node2 });
47754
+ }
47755
+ });
47756
+ if (!nodesToDelete.length) return;
47757
+ const tr = editor.state.tr;
47758
+ nodesToDelete.sort((a, b) => b.pos - a.pos).forEach(({ pos, node: node2 }) => {
47759
+ tr.delete(pos, pos + node2.nodeSize);
47760
+ });
47761
+ editor.view.dispatch(tr);
47762
+ };
47599
47763
  const AnnotatorHelpers = {
47600
47764
  getFieldAttrs,
47601
47765
  processTables,
@@ -47603,7 +47767,8 @@
47603
47767
  annotateHeadersAndFooters,
47604
47768
  getAllHeaderFooterEditors,
47605
47769
  updateHeaderFooterFieldAnnotations,
47606
- deleteHeaderFooterFieldAnnotations
47770
+ deleteHeaderFooterFieldAnnotations,
47771
+ cleanUpListsWithAnnotations
47607
47772
  };
47608
47773
  const CollaborationPluginKey = new PluginKey("collaboration");
47609
47774
  const Collaboration = Extension.create({
@@ -47763,6 +47928,19 @@
47763
47928
  setHighContrastMode
47764
47929
  };
47765
47930
  }
47931
+ const findWordBounds = (doc2, pos) => {
47932
+ const $pos = doc2.resolve(pos);
47933
+ const parent = $pos.parent;
47934
+ const offset2 = $pos.parentOffset;
47935
+ const text = parent.textContent;
47936
+ if (!text) return { from: pos, to: pos };
47937
+ let start2 = offset2, end2 = offset2;
47938
+ while (start2 > 0 && /\w/.test(text[start2 - 1])) start2--;
47939
+ while (end2 < text.length && /\w/.test(text[end2])) end2++;
47940
+ const from2 = $pos.start() + start2;
47941
+ const to = $pos.start() + end2;
47942
+ return { from: from2, to };
47943
+ };
47766
47944
  const _Editor = class _Editor2 extends EventEmitter$2 {
47767
47945
  /**
47768
47946
  * Create a new Editor instance
@@ -48006,6 +48184,7 @@
48006
48184
  __privateMethod$1(this, _Editor_instances, initMedia_fn).call(this);
48007
48185
  const doc2 = __privateMethod$1(this, _Editor_instances, generatePmData_fn).call(this);
48008
48186
  const tr = this.state.tr.replaceWith(0, this.state.doc.content.size, doc2);
48187
+ tr.setMeta("replaceContent", true);
48009
48188
  this.view.dispatch(tr);
48010
48189
  }
48011
48190
  /**
@@ -48413,7 +48592,7 @@
48413
48592
  * @returns {Object | void} Migration results
48414
48593
  */
48415
48594
  processCollaborationMigrations() {
48416
- console.debug("[checkVersionMigrations] Current editor version", "0.12.35");
48595
+ console.debug("[checkVersionMigrations] Current editor version", "0.12.36-next.10");
48417
48596
  if (!this.options.ydoc) return;
48418
48597
  const metaMap = this.options.ydoc.getMap("meta");
48419
48598
  let docVersion = metaMap.get("version");
@@ -48778,6 +48957,10 @@
48778
48957
  pm.classList.remove("header-footer-edit");
48779
48958
  pm.setAttribute("aria-readonly", false);
48780
48959
  }
48960
+ const { state: state22, dispatch } = view;
48961
+ const word = findWordBounds(state22.doc, pos);
48962
+ const tr = state22.tr.setSelection(TextSelection.create(state22.doc, word.from, word.to));
48963
+ dispatch(tr);
48781
48964
  }
48782
48965
  });
48783
48966
  const newState = this.state.reconfigure({
@@ -49178,7 +49361,14 @@
49178
49361
  parseDOM: (el) => el.style.lineHeight,
49179
49362
  renderDOM: (attrs) => {
49180
49363
  if (!attrs.lineHeight) return {};
49181
- return { style: getLineHeightValueString(attrs.lineHeight, this.options.defaults.unit, attrs.spacing?.lineRule) };
49364
+ const lineHeightStyle = getLineHeightValueString(
49365
+ attrs.lineHeight,
49366
+ this.options.defaults.unit,
49367
+ attrs.spacing?.lineRule
49368
+ );
49369
+ return {
49370
+ style: `${lineHeightStyle}`
49371
+ };
49182
49372
  }
49183
49373
  }
49184
49374
  }
@@ -51103,7 +51293,9 @@
51103
51293
  renderDOM: (attrs) => {
51104
51294
  const { spacing } = attrs;
51105
51295
  if (!spacing) return {};
51106
- const style2 = getSpacingStyleString(spacing);
51296
+ const spacingCopy = { ...spacing };
51297
+ if (attrs.lineHeight) delete spacingCopy.line;
51298
+ const style2 = getSpacingStyleString(spacingCopy);
51107
51299
  if (style2) return { style: style2 };
51108
51300
  return {};
51109
51301
  }
@@ -54280,8 +54472,8 @@
54280
54472
  cellMargins: {
54281
54473
  renderDOM({ cellMargins }) {
54282
54474
  if (!cellMargins) return {};
54283
- const sides = ["top", "right", "bottom", "left"];
54284
- const style2 = sides.map((side) => {
54475
+ const sides2 = ["top", "right", "bottom", "left"];
54476
+ const style2 = sides2.map((side) => {
54285
54477
  const margin = cellMargins?.[side];
54286
54478
  if (margin) return `padding-${side}: ${margin}px;`;
54287
54479
  return "";
@@ -54293,8 +54485,8 @@
54293
54485
  default: () => createCellBorders(),
54294
54486
  renderDOM({ borders }) {
54295
54487
  if (!borders) return {};
54296
- const sides = ["top", "right", "bottom", "left"];
54297
- const style2 = sides.map((side) => {
54488
+ const sides2 = ["top", "right", "bottom", "left"];
54489
+ const style2 = sides2.map((side) => {
54298
54490
  const border = borders?.[side];
54299
54491
  if (border && border.val === "none") return `border-${side}: ${border.val};`;
54300
54492
  if (border) return `border-${side}: ${border.size}px solid ${border.color || "black"};`;
@@ -56052,32 +56244,89 @@
56052
56244
  name: "page-number",
56053
56245
  group: "inline",
56054
56246
  inline: true,
56055
- content: "text*",
56247
+ atom: true,
56248
+ selectable: false,
56249
+ draggable: false,
56250
+ selectable: false,
56251
+ defining: true,
56252
+ content: "",
56056
56253
  addOptions() {
56057
56254
  return {
56058
56255
  htmlAttributes: {
56256
+ contenteditable: false,
56059
56257
  "data-id": "auto-page-number",
56060
56258
  "aria-label": "Page number node"
56061
56259
  }
56062
56260
  };
56063
56261
  },
56262
+ addAttributes() {
56263
+ return {
56264
+ marksAsAttrs: {
56265
+ default: null,
56266
+ rendered: false
56267
+ }
56268
+ };
56269
+ },
56270
+ addNodeView() {
56271
+ return ({ node: node2, editor, getPos, decorations }) => {
56272
+ const htmlAttributes = this.options.htmlAttributes;
56273
+ return new AutoPageNumberNodeView(node2, getPos, decorations, editor, htmlAttributes);
56274
+ };
56275
+ },
56064
56276
  parseDOM() {
56065
56277
  return [{ tag: 'span[data-id="auto-page-number"' }];
56066
56278
  },
56067
56279
  renderDOM({ htmlAttributes }) {
56068
- return ["span", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
56280
+ return ["span", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes)];
56281
+ },
56282
+ addCommands() {
56283
+ return {
56284
+ addAutoPageNumber: () => ({ tr, dispatch, state: state2, editor }) => {
56285
+ const { options: options2 } = editor;
56286
+ if (!options2.isHeaderOrFooter) return false;
56287
+ const { schema } = state2;
56288
+ const pageNumberType = schema?.nodes?.["page-number"];
56289
+ if (!pageNumberType) return false;
56290
+ const pageNumberNodeJSON = { type: "page-number" };
56291
+ const pageNumberNode = schema.nodeFromJSON(pageNumberNodeJSON);
56292
+ if (dispatch) {
56293
+ tr.replaceSelectionWith(pageNumberNode, false);
56294
+ tr.setMeta("forceUpdatePagination", true);
56295
+ }
56296
+ return true;
56297
+ }
56298
+ };
56299
+ },
56300
+ addShortcuts() {
56301
+ return {
56302
+ "Mod-Shift-alt-p": () => this.editor.commands.addAutoPageNumber()
56303
+ };
56069
56304
  }
56070
56305
  });
56071
56306
  const TotalPageCount = Node$1.create({
56072
56307
  name: "total-page-number",
56073
56308
  group: "inline",
56074
56309
  inline: true,
56310
+ atom: true,
56311
+ selectable: false,
56312
+ draggable: false,
56313
+ selectable: false,
56075
56314
  content: "text*",
56076
56315
  addOptions() {
56077
56316
  return {
56078
56317
  htmlAttributes: {
56318
+ contenteditable: false,
56079
56319
  "data-id": "auto-total-pages",
56080
- "aria-label": "Total page count node"
56320
+ "aria-label": "Total page count node",
56321
+ "class": "sd-editor-auto-total-pages"
56322
+ }
56323
+ };
56324
+ },
56325
+ addAttributes() {
56326
+ return {
56327
+ marksAsAttrs: {
56328
+ default: null,
56329
+ rendered: false
56081
56330
  }
56082
56331
  };
56083
56332
  },
@@ -56086,8 +56335,139 @@
56086
56335
  },
56087
56336
  renderDOM({ htmlAttributes }) {
56088
56337
  return ["span", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
56338
+ },
56339
+ addCommands() {
56340
+ return {
56341
+ addTotalPageCount: () => ({ tr, dispatch, state: state2, editor }) => {
56342
+ const { options: options2 } = editor;
56343
+ if (!options2.isHeaderOrFooter) return false;
56344
+ const { schema } = state2;
56345
+ const pageNumberType = schema.nodes?.["total-page-number"];
56346
+ if (!pageNumberType) return false;
56347
+ const currentPages = editor?.options?.parentEditor?.currentTotalPages || 1;
56348
+ const pageNumberNode = {
56349
+ type: "total-page-number",
56350
+ content: [{ type: "text", text: String(currentPages) }]
56351
+ };
56352
+ const pageNode = schema.nodeFromJSON(pageNumberNode);
56353
+ if (dispatch) {
56354
+ tr.replaceSelectionWith(pageNode, false);
56355
+ }
56356
+ return true;
56357
+ }
56358
+ };
56359
+ },
56360
+ addShortcuts() {
56361
+ return {
56362
+ "Mod-Shift-alt-c": () => this.editor.commands.addTotalPageCount()
56363
+ };
56089
56364
  }
56090
56365
  });
56366
+ class AutoPageNumberNodeView {
56367
+ constructor(node2, getPos, decorations, editor, htmlAttributes = {}) {
56368
+ __privateAdd$1(this, _AutoPageNumberNodeView_instances);
56369
+ this.node = node2;
56370
+ this.editor = editor;
56371
+ this.view = editor.view;
56372
+ this.getPos = getPos;
56373
+ this.editor = editor;
56374
+ this.dom = __privateMethod$1(this, _AutoPageNumberNodeView_instances, renderDom_fn).call(this, node2, htmlAttributes);
56375
+ }
56376
+ update(node2) {
56377
+ if (node2.type !== this.node.type) return false;
56378
+ this.node = node2;
56379
+ return true;
56380
+ }
56381
+ }
56382
+ _AutoPageNumberNodeView_instances = /* @__PURE__ */ new WeakSet();
56383
+ renderDom_fn = function(node2, htmlAttributes) {
56384
+ const pageText = this.editor.options.currentPageNumber || "1";
56385
+ const content = document.createTextNode(String(pageText));
56386
+ const nodeContent = document.createElement("span");
56387
+ nodeContent.className = "sd-editor-auto-page-number";
56388
+ nodeContent.setAttribute("data-id", "auto-page-number");
56389
+ nodeContent.setAttribute("aria-label", "Page number node");
56390
+ const currentPos = this.getPos();
56391
+ const { styles, marks } = getMarksFromNeighbors(currentPos, this.view);
56392
+ __privateMethod$1(this, _AutoPageNumberNodeView_instances, scheduleUpdateNodeStyle_fn).call(this, currentPos, marks);
56393
+ Object.assign(nodeContent.style, styles);
56394
+ nodeContent.appendChild(content);
56395
+ Object.entries(htmlAttributes).forEach(([key, value]) => {
56396
+ if (value) nodeContent.setAttribute(key, value);
56397
+ });
56398
+ return nodeContent;
56399
+ };
56400
+ scheduleUpdateNodeStyle_fn = function(pos, marks) {
56401
+ setTimeout(() => {
56402
+ const { state: state2 } = this.editor;
56403
+ const { dispatch } = this.view;
56404
+ const node2 = state2.doc.nodeAt(pos);
56405
+ if (!node2) return;
56406
+ const currentMarks = node2.attrs.marksAsAttrs || [];
56407
+ const newMarks = marks.map((m) => ({ type: m.type.name, attrs: m.attrs }));
56408
+ const isEqual = JSON.stringify(currentMarks) === JSON.stringify(newMarks);
56409
+ if (isEqual) return;
56410
+ const newAttrs = {
56411
+ ...node2.attrs,
56412
+ marksAsAttrs: newMarks
56413
+ };
56414
+ const tr = state2.tr.setNodeMarkup(pos, void 0, newAttrs);
56415
+ dispatch(tr);
56416
+ }, 0);
56417
+ };
56418
+ const getMarksFromNeighbors = (currentPos, view) => {
56419
+ const $pos = view.state.doc.resolve(currentPos);
56420
+ const styles = {};
56421
+ const marks = [];
56422
+ const before = $pos.nodeBefore;
56423
+ if (before) {
56424
+ Object.assign(styles, processMarks(before.marks));
56425
+ marks.push(...before.marks);
56426
+ }
56427
+ const after = $pos.nodeAfter;
56428
+ if (after) {
56429
+ Object.assign(styles, { ...styles, ...processMarks(after.marks) });
56430
+ marks.push(...after.marks);
56431
+ }
56432
+ return {
56433
+ styles,
56434
+ marks
56435
+ };
56436
+ };
56437
+ const processMarks = (marks) => {
56438
+ const styles = {};
56439
+ marks.forEach((mark) => {
56440
+ const { type: type2, attrs } = mark;
56441
+ switch (type2.name) {
56442
+ case "textStyle":
56443
+ if (attrs.fontFamily) styles["font-family"] = attrs.fontFamily;
56444
+ if (attrs.fontSize) styles["font-size"] = attrs.fontSize;
56445
+ if (attrs.color) styles["color"] = attrs.color;
56446
+ if (attrs.backgroundColor) styles["background-color"] = attrs.backgroundColor;
56447
+ break;
56448
+ case "bold":
56449
+ styles["font-weight"] = "bold";
56450
+ break;
56451
+ case "italic":
56452
+ styles["font-style"] = "italic";
56453
+ break;
56454
+ case "underline":
56455
+ styles["text-decoration"] = (styles["text-decoration"] || "") + " underline";
56456
+ break;
56457
+ case "strike":
56458
+ styles["text-decoration"] = (styles["text-decoration"] || "") + " line-through";
56459
+ break;
56460
+ default:
56461
+ if (attrs?.style) {
56462
+ Object.entries(attrs.style).forEach(([key, value]) => {
56463
+ styles[key] = value;
56464
+ });
56465
+ }
56466
+ break;
56467
+ }
56468
+ });
56469
+ return styles;
56470
+ };
56091
56471
  const ShapeContainer = Node$1.create({
56092
56472
  name: "shapeContainer",
56093
56473
  group: "block",
@@ -57100,10 +57480,10 @@
57100
57480
  var write = "write";
57101
57481
  var afterWrite = "afterWrite";
57102
57482
  var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
57103
- function getNodeName(element) {
57483
+ function getNodeName$1(element) {
57104
57484
  return element ? (element.nodeName || "").toLowerCase() : null;
57105
57485
  }
57106
- function getWindow(node2) {
57486
+ function getWindow$1(node2) {
57107
57487
  if (node2 == null) {
57108
57488
  return window;
57109
57489
  }
@@ -57113,19 +57493,19 @@
57113
57493
  }
57114
57494
  return node2;
57115
57495
  }
57116
- function isElement$1$1(node2) {
57117
- var OwnElement = getWindow(node2).Element;
57496
+ function isElement$2(node2) {
57497
+ var OwnElement = getWindow$1(node2).Element;
57118
57498
  return node2 instanceof OwnElement || node2 instanceof Element;
57119
57499
  }
57120
- function isHTMLElement$2(node2) {
57121
- var OwnElement = getWindow(node2).HTMLElement;
57500
+ function isHTMLElement$1$1(node2) {
57501
+ var OwnElement = getWindow$1(node2).HTMLElement;
57122
57502
  return node2 instanceof OwnElement || node2 instanceof HTMLElement;
57123
57503
  }
57124
- function isShadowRoot(node2) {
57504
+ function isShadowRoot$1(node2) {
57125
57505
  if (typeof ShadowRoot === "undefined") {
57126
57506
  return false;
57127
57507
  }
57128
- var OwnElement = getWindow(node2).ShadowRoot;
57508
+ var OwnElement = getWindow$1(node2).ShadowRoot;
57129
57509
  return node2 instanceof OwnElement || node2 instanceof ShadowRoot;
57130
57510
  }
57131
57511
  function applyStyles(_ref) {
@@ -57134,7 +57514,7 @@
57134
57514
  var style2 = state2.styles[name] || {};
57135
57515
  var attributes = state2.attributes[name] || {};
57136
57516
  var element = state2.elements[name];
57137
- if (!isHTMLElement$2(element) || !getNodeName(element)) {
57517
+ if (!isHTMLElement$1$1(element) || !getNodeName$1(element)) {
57138
57518
  return;
57139
57519
  }
57140
57520
  Object.assign(element.style, style2);
@@ -57176,7 +57556,7 @@
57176
57556
  style22[property2] = "";
57177
57557
  return style22;
57178
57558
  }, {});
57179
- if (!isHTMLElement$2(element) || !getNodeName(element)) {
57559
+ if (!isHTMLElement$1$1(element) || !getNodeName$1(element)) {
57180
57560
  return;
57181
57561
  }
57182
57562
  Object.assign(element.style, style2);
@@ -57197,9 +57577,9 @@
57197
57577
  function getBasePlacement$1(placement) {
57198
57578
  return placement.split("-")[0];
57199
57579
  }
57200
- var max = Math.max;
57201
- var min = Math.min;
57202
- var round = Math.round;
57580
+ var max$1 = Math.max;
57581
+ var min$1 = Math.min;
57582
+ var round$1 = Math.round;
57203
57583
  function getUAString() {
57204
57584
  var uaData = navigator.userAgentData;
57205
57585
  if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
@@ -57212,7 +57592,7 @@
57212
57592
  function isLayoutViewport() {
57213
57593
  return !/^((?!chrome|android).)*safari/i.test(getUAString());
57214
57594
  }
57215
- function getBoundingClientRect(element, includeScale, isFixedStrategy) {
57595
+ function getBoundingClientRect$1(element, includeScale, isFixedStrategy) {
57216
57596
  if (includeScale === void 0) {
57217
57597
  includeScale = false;
57218
57598
  }
@@ -57222,11 +57602,11 @@
57222
57602
  var clientRect2 = element.getBoundingClientRect();
57223
57603
  var scaleX = 1;
57224
57604
  var scaleY = 1;
57225
- if (includeScale && isHTMLElement$2(element)) {
57226
- scaleX = element.offsetWidth > 0 ? round(clientRect2.width) / element.offsetWidth || 1 : 1;
57227
- scaleY = element.offsetHeight > 0 ? round(clientRect2.height) / element.offsetHeight || 1 : 1;
57605
+ if (includeScale && isHTMLElement$1$1(element)) {
57606
+ scaleX = element.offsetWidth > 0 ? round$1(clientRect2.width) / element.offsetWidth || 1 : 1;
57607
+ scaleY = element.offsetHeight > 0 ? round$1(clientRect2.height) / element.offsetHeight || 1 : 1;
57228
57608
  }
57229
- var _ref = isElement$1$1(element) ? getWindow(element) : window, visualViewport = _ref.visualViewport;
57609
+ var _ref = isElement$2(element) ? getWindow$1(element) : window, visualViewport = _ref.visualViewport;
57230
57610
  var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
57231
57611
  var x = (clientRect2.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
57232
57612
  var y = (clientRect2.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
@@ -57244,7 +57624,7 @@
57244
57624
  };
57245
57625
  }
57246
57626
  function getLayoutRect(element) {
57247
- var clientRect2 = getBoundingClientRect(element);
57627
+ var clientRect2 = getBoundingClientRect$1(element);
57248
57628
  var width = element.offsetWidth;
57249
57629
  var height = element.offsetHeight;
57250
57630
  if (Math.abs(clientRect2.width - width) <= 1) {
@@ -57264,7 +57644,7 @@
57264
57644
  var rootNode = child.getRootNode && child.getRootNode();
57265
57645
  if (parent.contains(child)) {
57266
57646
  return true;
57267
- } else if (rootNode && isShadowRoot(rootNode)) {
57647
+ } else if (rootNode && isShadowRoot$1(rootNode)) {
57268
57648
  var next = child;
57269
57649
  do {
57270
57650
  if (next && parent.isSameNode(next)) {
@@ -57275,20 +57655,20 @@
57275
57655
  }
57276
57656
  return false;
57277
57657
  }
57278
- function getComputedStyle$1(element) {
57279
- return getWindow(element).getComputedStyle(element);
57658
+ function getComputedStyle$2(element) {
57659
+ return getWindow$1(element).getComputedStyle(element);
57280
57660
  }
57281
- function isTableElement(element) {
57282
- return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0;
57661
+ function isTableElement$1(element) {
57662
+ return ["table", "td", "th"].indexOf(getNodeName$1(element)) >= 0;
57283
57663
  }
57284
- function getDocumentElement(element) {
57285
- return ((isElement$1$1(element) ? element.ownerDocument : (
57664
+ function getDocumentElement$1(element) {
57665
+ return ((isElement$2(element) ? element.ownerDocument : (
57286
57666
  // $FlowFixMe[prop-missing]
57287
57667
  element.document
57288
57668
  )) || window.document).documentElement;
57289
57669
  }
57290
- function getParentNode$2(element) {
57291
- if (getNodeName(element) === "html") {
57670
+ function getParentNode$1$1(element) {
57671
+ if (getNodeName$1(element) === "html") {
57292
57672
  return element;
57293
57673
  }
57294
57674
  return (
@@ -57297,33 +57677,33 @@
57297
57677
  // $FlowFixMe[prop-missing]
57298
57678
  element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
57299
57679
  element.parentNode || // DOM Element detected
57300
- (isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
57680
+ (isShadowRoot$1(element) ? element.host : null) || // ShadowRoot detected
57301
57681
  // $FlowFixMe[incompatible-call]: HTMLElement is a Node
57302
- getDocumentElement(element)
57682
+ getDocumentElement$1(element)
57303
57683
  );
57304
57684
  }
57305
- function getTrueOffsetParent(element) {
57306
- if (!isHTMLElement$2(element) || // https://github.com/popperjs/popper-core/issues/837
57307
- getComputedStyle$1(element).position === "fixed") {
57685
+ function getTrueOffsetParent$1(element) {
57686
+ if (!isHTMLElement$1$1(element) || // https://github.com/popperjs/popper-core/issues/837
57687
+ getComputedStyle$2(element).position === "fixed") {
57308
57688
  return null;
57309
57689
  }
57310
57690
  return element.offsetParent;
57311
57691
  }
57312
- function getContainingBlock(element) {
57692
+ function getContainingBlock$1(element) {
57313
57693
  var isFirefox = /firefox/i.test(getUAString());
57314
57694
  var isIE = /Trident/i.test(getUAString());
57315
- if (isIE && isHTMLElement$2(element)) {
57316
- var elementCss = getComputedStyle$1(element);
57695
+ if (isIE && isHTMLElement$1$1(element)) {
57696
+ var elementCss = getComputedStyle$2(element);
57317
57697
  if (elementCss.position === "fixed") {
57318
57698
  return null;
57319
57699
  }
57320
57700
  }
57321
- var currentNode = getParentNode$2(element);
57322
- if (isShadowRoot(currentNode)) {
57701
+ var currentNode = getParentNode$1$1(element);
57702
+ if (isShadowRoot$1(currentNode)) {
57323
57703
  currentNode = currentNode.host;
57324
57704
  }
57325
- while (isHTMLElement$2(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
57326
- var css = getComputedStyle$1(currentNode);
57705
+ while (isHTMLElement$1$1(currentNode) && ["html", "body"].indexOf(getNodeName$1(currentNode)) < 0) {
57706
+ var css = getComputedStyle$2(currentNode);
57327
57707
  if (css.transform !== "none" || css.perspective !== "none" || css.contain === "paint" || ["transform", "perspective"].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === "filter" || isFirefox && css.filter && css.filter !== "none") {
57328
57708
  return currentNode;
57329
57709
  } else {
@@ -57332,22 +57712,22 @@
57332
57712
  }
57333
57713
  return null;
57334
57714
  }
57335
- function getOffsetParent(element) {
57336
- var window2 = getWindow(element);
57337
- var offsetParent = getTrueOffsetParent(element);
57338
- while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === "static") {
57339
- offsetParent = getTrueOffsetParent(offsetParent);
57715
+ function getOffsetParent$1(element) {
57716
+ var window2 = getWindow$1(element);
57717
+ var offsetParent = getTrueOffsetParent$1(element);
57718
+ while (offsetParent && isTableElement$1(offsetParent) && getComputedStyle$2(offsetParent).position === "static") {
57719
+ offsetParent = getTrueOffsetParent$1(offsetParent);
57340
57720
  }
57341
- if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle$1(offsetParent).position === "static")) {
57721
+ if (offsetParent && (getNodeName$1(offsetParent) === "html" || getNodeName$1(offsetParent) === "body" && getComputedStyle$2(offsetParent).position === "static")) {
57342
57722
  return window2;
57343
57723
  }
57344
- return offsetParent || getContainingBlock(element) || window2;
57724
+ return offsetParent || getContainingBlock$1(element) || window2;
57345
57725
  }
57346
57726
  function getMainAxisFromPlacement(placement) {
57347
57727
  return ["top", "bottom"].indexOf(placement) >= 0 ? "x" : "y";
57348
57728
  }
57349
- function within(min$12, value, max$12) {
57350
- return max(min$12, min(value, max$12));
57729
+ function within(min2, value, max2) {
57730
+ return max$1(min2, min$1(value, max2));
57351
57731
  }
57352
57732
  function withinMaxClamp(min2, value, max2) {
57353
57733
  var v = within(min2, value, max2);
@@ -57394,7 +57774,7 @@
57394
57774
  var maxProp = axis === "y" ? bottom : right;
57395
57775
  var endDiff = state2.rects.reference[len2] + state2.rects.reference[axis] - popperOffsets2[axis] - state2.rects.popper[len2];
57396
57776
  var startDiff = popperOffsets2[axis] - state2.rects.reference[axis];
57397
- var arrowOffsetParent = getOffsetParent(arrowElement);
57777
+ var arrowOffsetParent = getOffsetParent$1(arrowElement);
57398
57778
  var clientSize = arrowOffsetParent ? axis === "y" ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
57399
57779
  var centerToReference = endDiff / 2 - startDiff / 2;
57400
57780
  var min2 = paddingObject[minProp];
@@ -57443,8 +57823,8 @@
57443
57823
  var x = _ref.x, y = _ref.y;
57444
57824
  var dpr = win.devicePixelRatio || 1;
57445
57825
  return {
57446
- x: round(x * dpr) / dpr || 0,
57447
- y: round(y * dpr) / dpr || 0
57826
+ x: round$1(x * dpr) / dpr || 0,
57827
+ y: round$1(y * dpr) / dpr || 0
57448
57828
  };
57449
57829
  }
57450
57830
  function mapToStyles(_ref2) {
@@ -57466,12 +57846,12 @@
57466
57846
  var sideY = top;
57467
57847
  var win = window;
57468
57848
  if (adaptive) {
57469
- var offsetParent = getOffsetParent(popper2);
57849
+ var offsetParent = getOffsetParent$1(popper2);
57470
57850
  var heightProp = "clientHeight";
57471
57851
  var widthProp = "clientWidth";
57472
- if (offsetParent === getWindow(popper2)) {
57473
- offsetParent = getDocumentElement(popper2);
57474
- if (getComputedStyle$1(offsetParent).position !== "static" && position === "absolute") {
57852
+ if (offsetParent === getWindow$1(popper2)) {
57853
+ offsetParent = getDocumentElement$1(popper2);
57854
+ if (getComputedStyle$2(offsetParent).position !== "static" && position === "absolute") {
57475
57855
  heightProp = "scrollHeight";
57476
57856
  widthProp = "scrollWidth";
57477
57857
  }
@@ -57502,7 +57882,7 @@
57502
57882
  var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
57503
57883
  x,
57504
57884
  y
57505
- }, getWindow(popper2)) : {
57885
+ }, getWindow$1(popper2)) : {
57506
57886
  x,
57507
57887
  y
57508
57888
  };
@@ -57558,7 +57938,7 @@
57558
57938
  function effect(_ref) {
57559
57939
  var state2 = _ref.state, instance = _ref.instance, options2 = _ref.options;
57560
57940
  var _options$scroll = options2.scroll, scroll = _options$scroll === void 0 ? true : _options$scroll, _options$resize = options2.resize, resize = _options$resize === void 0 ? true : _options$resize;
57561
- var window2 = getWindow(state2.elements.popper);
57941
+ var window2 = getWindow$1(state2.elements.popper);
57562
57942
  var scrollParents = [].concat(state2.scrollParents.reference, state2.scrollParents.popper);
57563
57943
  if (scroll) {
57564
57944
  scrollParents.forEach(function(scrollParent) {
@@ -57609,7 +57989,7 @@
57609
57989
  });
57610
57990
  }
57611
57991
  function getWindowScroll(node2) {
57612
- var win = getWindow(node2);
57992
+ var win = getWindow$1(node2);
57613
57993
  var scrollLeft = win.pageXOffset;
57614
57994
  var scrollTop = win.pageYOffset;
57615
57995
  return {
@@ -57617,12 +57997,12 @@
57617
57997
  scrollTop
57618
57998
  };
57619
57999
  }
57620
- function getWindowScrollBarX(element) {
57621
- return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
58000
+ function getWindowScrollBarX$1(element) {
58001
+ return getBoundingClientRect$1(getDocumentElement$1(element)).left + getWindowScroll(element).scrollLeft;
57622
58002
  }
57623
- function getViewportRect(element, strategy) {
57624
- var win = getWindow(element);
57625
- var html = getDocumentElement(element);
58003
+ function getViewportRect$1(element, strategy) {
58004
+ var win = getWindow$1(element);
58005
+ var html = getDocumentElement$1(element);
57626
58006
  var visualViewport = win.visualViewport;
57627
58007
  var width = html.clientWidth;
57628
58008
  var height = html.clientHeight;
@@ -57640,21 +58020,21 @@
57640
58020
  return {
57641
58021
  width,
57642
58022
  height,
57643
- x: x + getWindowScrollBarX(element),
58023
+ x: x + getWindowScrollBarX$1(element),
57644
58024
  y
57645
58025
  };
57646
58026
  }
57647
- function getDocumentRect(element) {
58027
+ function getDocumentRect$1(element) {
57648
58028
  var _element$ownerDocumen;
57649
- var html = getDocumentElement(element);
58029
+ var html = getDocumentElement$1(element);
57650
58030
  var winScroll = getWindowScroll(element);
57651
58031
  var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
57652
- var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
57653
- var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
57654
- var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
58032
+ var width = max$1(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
58033
+ var height = max$1(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
58034
+ var x = -winScroll.scrollLeft + getWindowScrollBarX$1(element);
57655
58035
  var y = -winScroll.scrollTop;
57656
- if (getComputedStyle$1(body || html).direction === "rtl") {
57657
- x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
58036
+ if (getComputedStyle$2(body || html).direction === "rtl") {
58037
+ x += max$1(html.clientWidth, body ? body.clientWidth : 0) - width;
57658
58038
  }
57659
58039
  return {
57660
58040
  width,
@@ -57664,17 +58044,17 @@
57664
58044
  };
57665
58045
  }
57666
58046
  function isScrollParent(element) {
57667
- var _getComputedStyle = getComputedStyle$1(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
58047
+ var _getComputedStyle = getComputedStyle$2(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
57668
58048
  return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
57669
58049
  }
57670
58050
  function getScrollParent$2(node2) {
57671
- if (["html", "body", "#document"].indexOf(getNodeName(node2)) >= 0) {
58051
+ if (["html", "body", "#document"].indexOf(getNodeName$1(node2)) >= 0) {
57672
58052
  return node2.ownerDocument.body;
57673
58053
  }
57674
- if (isHTMLElement$2(node2) && isScrollParent(node2)) {
58054
+ if (isHTMLElement$1$1(node2) && isScrollParent(node2)) {
57675
58055
  return node2;
57676
58056
  }
57677
- return getScrollParent$2(getParentNode$2(node2));
58057
+ return getScrollParent$2(getParentNode$1$1(node2));
57678
58058
  }
57679
58059
  function listScrollParents(element, list) {
57680
58060
  var _element$ownerDocumen;
@@ -57683,15 +58063,15 @@
57683
58063
  }
57684
58064
  var scrollParent = getScrollParent$2(element);
57685
58065
  var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
57686
- var win = getWindow(scrollParent);
58066
+ var win = getWindow$1(scrollParent);
57687
58067
  var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
57688
58068
  var updatedList = list.concat(target);
57689
58069
  return isBody ? updatedList : (
57690
58070
  // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
57691
- updatedList.concat(listScrollParents(getParentNode$2(target)))
58071
+ updatedList.concat(listScrollParents(getParentNode$1$1(target)))
57692
58072
  );
57693
58073
  }
57694
- function rectToClientRect(rect) {
58074
+ function rectToClientRect$1(rect) {
57695
58075
  return Object.assign({}, rect, {
57696
58076
  left: rect.x,
57697
58077
  top: rect.y,
@@ -57699,8 +58079,8 @@
57699
58079
  bottom: rect.y + rect.height
57700
58080
  });
57701
58081
  }
57702
- function getInnerBoundingClientRect(element, strategy) {
57703
- var rect = getBoundingClientRect(element, false, strategy === "fixed");
58082
+ function getInnerBoundingClientRect$1(element, strategy) {
58083
+ var rect = getBoundingClientRect$1(element, false, strategy === "fixed");
57704
58084
  rect.top = rect.top + element.clientTop;
57705
58085
  rect.left = rect.left + element.clientLeft;
57706
58086
  rect.bottom = rect.top + element.clientHeight;
@@ -57712,29 +58092,29 @@
57712
58092
  return rect;
57713
58093
  }
57714
58094
  function getClientRectFromMixedType(element, clippingParent, strategy) {
57715
- return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement$1$1(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
58095
+ return clippingParent === viewport ? rectToClientRect$1(getViewportRect$1(element, strategy)) : isElement$2(clippingParent) ? getInnerBoundingClientRect$1(clippingParent, strategy) : rectToClientRect$1(getDocumentRect$1(getDocumentElement$1(element)));
57716
58096
  }
57717
58097
  function getClippingParents(element) {
57718
- var clippingParents2 = listScrollParents(getParentNode$2(element));
57719
- var canEscapeClipping = ["absolute", "fixed"].indexOf(getComputedStyle$1(element).position) >= 0;
57720
- var clipperElement = canEscapeClipping && isHTMLElement$2(element) ? getOffsetParent(element) : element;
57721
- if (!isElement$1$1(clipperElement)) {
58098
+ var clippingParents2 = listScrollParents(getParentNode$1$1(element));
58099
+ var canEscapeClipping = ["absolute", "fixed"].indexOf(getComputedStyle$2(element).position) >= 0;
58100
+ var clipperElement = canEscapeClipping && isHTMLElement$1$1(element) ? getOffsetParent$1(element) : element;
58101
+ if (!isElement$2(clipperElement)) {
57722
58102
  return [];
57723
58103
  }
57724
58104
  return clippingParents2.filter(function(clippingParent) {
57725
- return isElement$1$1(clippingParent) && contains$2(clippingParent, clipperElement) && getNodeName(clippingParent) !== "body";
58105
+ return isElement$2(clippingParent) && contains$2(clippingParent, clipperElement) && getNodeName$1(clippingParent) !== "body";
57726
58106
  });
57727
58107
  }
57728
- function getClippingRect(element, boundary, rootBoundary, strategy) {
58108
+ function getClippingRect$1(element, boundary, rootBoundary, strategy) {
57729
58109
  var mainClippingParents = boundary === "clippingParents" ? getClippingParents(element) : [].concat(boundary);
57730
58110
  var clippingParents2 = [].concat(mainClippingParents, [rootBoundary]);
57731
58111
  var firstClippingParent = clippingParents2[0];
57732
58112
  var clippingRect = clippingParents2.reduce(function(accRect, clippingParent) {
57733
58113
  var rect = getClientRectFromMixedType(element, clippingParent, strategy);
57734
- accRect.top = max(rect.top, accRect.top);
57735
- accRect.right = min(rect.right, accRect.right);
57736
- accRect.bottom = min(rect.bottom, accRect.bottom);
57737
- accRect.left = max(rect.left, accRect.left);
58114
+ accRect.top = max$1(rect.top, accRect.top);
58115
+ accRect.right = min$1(rect.right, accRect.right);
58116
+ accRect.bottom = min$1(rect.bottom, accRect.bottom);
58117
+ accRect.left = max$1(rect.left, accRect.left);
57738
58118
  return accRect;
57739
58119
  }, getClientRectFromMixedType(element, firstClippingParent, strategy));
57740
58120
  clippingRect.width = clippingRect.right - clippingRect.left;
@@ -57795,7 +58175,7 @@
57795
58175
  }
57796
58176
  return offsets;
57797
58177
  }
57798
- function detectOverflow(state2, options2) {
58178
+ function detectOverflow$1(state2, options2) {
57799
58179
  if (options2 === void 0) {
57800
58180
  options2 = {};
57801
58181
  }
@@ -57804,14 +58184,14 @@
57804
58184
  var altContext = elementContext === popper ? reference : popper;
57805
58185
  var popperRect = state2.rects.popper;
57806
58186
  var element = state2.elements[altBoundary ? altContext : elementContext];
57807
- var clippingClientRect = getClippingRect(isElement$1$1(element) ? element : element.contextElement || getDocumentElement(state2.elements.popper), boundary, rootBoundary, strategy);
57808
- var referenceClientRect = getBoundingClientRect(state2.elements.reference);
58187
+ var clippingClientRect = getClippingRect$1(isElement$2(element) ? element : element.contextElement || getDocumentElement$1(state2.elements.popper), boundary, rootBoundary, strategy);
58188
+ var referenceClientRect = getBoundingClientRect$1(state2.elements.reference);
57809
58189
  var popperOffsets2 = computeOffsets({
57810
58190
  reference: referenceClientRect,
57811
58191
  element: popperRect,
57812
58192
  placement
57813
58193
  });
57814
- var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets2));
58194
+ var popperClientRect = rectToClientRect$1(Object.assign({}, popperRect, popperOffsets2));
57815
58195
  var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect;
57816
58196
  var overflowOffsets = {
57817
58197
  top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
@@ -57846,7 +58226,7 @@
57846
58226
  allowedPlacements = placements$1;
57847
58227
  }
57848
58228
  var overflows = allowedPlacements.reduce(function(acc, placement2) {
57849
- acc[placement2] = detectOverflow(state2, {
58229
+ acc[placement2] = detectOverflow$1(state2, {
57850
58230
  placement: placement2,
57851
58231
  boundary,
57852
58232
  rootBoundary,
@@ -57896,7 +58276,7 @@
57896
58276
  var isStartVariation = getVariation(placement) === start;
57897
58277
  var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
57898
58278
  var len2 = isVertical ? "width" : "height";
57899
- var overflow = detectOverflow(state2, {
58279
+ var overflow = detectOverflow$1(state2, {
57900
58280
  placement,
57901
58281
  boundary,
57902
58282
  rootBoundary,
@@ -57961,7 +58341,7 @@
57961
58341
  _skip: false
57962
58342
  }
57963
58343
  };
57964
- function getSideOffsets(overflow, rect, preventedOffsets) {
58344
+ function getSideOffsets$1(overflow, rect, preventedOffsets) {
57965
58345
  if (preventedOffsets === void 0) {
57966
58346
  preventedOffsets = {
57967
58347
  x: 0,
@@ -57975,26 +58355,26 @@
57975
58355
  left: overflow.left - rect.width - preventedOffsets.x
57976
58356
  };
57977
58357
  }
57978
- function isAnySideFullyClipped(overflow) {
58358
+ function isAnySideFullyClipped$1(overflow) {
57979
58359
  return [top, right, bottom, left].some(function(side) {
57980
58360
  return overflow[side] >= 0;
57981
58361
  });
57982
58362
  }
57983
- function hide(_ref) {
58363
+ function hide$2(_ref) {
57984
58364
  var state2 = _ref.state, name = _ref.name;
57985
58365
  var referenceRect = state2.rects.reference;
57986
58366
  var popperRect = state2.rects.popper;
57987
58367
  var preventedOffsets = state2.modifiersData.preventOverflow;
57988
- var referenceOverflow = detectOverflow(state2, {
58368
+ var referenceOverflow = detectOverflow$1(state2, {
57989
58369
  elementContext: "reference"
57990
58370
  });
57991
- var popperAltOverflow = detectOverflow(state2, {
58371
+ var popperAltOverflow = detectOverflow$1(state2, {
57992
58372
  altBoundary: true
57993
58373
  });
57994
- var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
57995
- var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
57996
- var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
57997
- var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
58374
+ var referenceClippingOffsets = getSideOffsets$1(referenceOverflow, referenceRect);
58375
+ var popperEscapeOffsets = getSideOffsets$1(popperAltOverflow, popperRect, preventedOffsets);
58376
+ var isReferenceHidden = isAnySideFullyClipped$1(referenceClippingOffsets);
58377
+ var hasPopperEscaped = isAnySideFullyClipped$1(popperEscapeOffsets);
57998
58378
  state2.modifiersData[name] = {
57999
58379
  referenceClippingOffsets,
58000
58380
  popperEscapeOffsets,
@@ -58006,12 +58386,12 @@
58006
58386
  "data-popper-escaped": hasPopperEscaped
58007
58387
  });
58008
58388
  }
58009
- const hide$1 = {
58389
+ const hide$3 = {
58010
58390
  name: "hide",
58011
58391
  enabled: true,
58012
58392
  phase: "main",
58013
58393
  requiresIfExists: ["preventOverflow"],
58014
- fn: hide
58394
+ fn: hide$2
58015
58395
  };
58016
58396
  function distanceAndSkiddingToXY(placement, rects, offset2) {
58017
58397
  var basePlacement = getBasePlacement$1(placement);
@@ -58071,7 +58451,7 @@
58071
58451
  function preventOverflow(_ref) {
58072
58452
  var state2 = _ref.state, options2 = _ref.options, name = _ref.name;
58073
58453
  var _options$mainAxis = options2.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options2.altAxis, checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis, boundary = options2.boundary, rootBoundary = options2.rootBoundary, altBoundary = options2.altBoundary, padding = options2.padding, _options$tether = options2.tether, tether = _options$tether === void 0 ? true : _options$tether, _options$tetherOffset = options2.tetherOffset, tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
58074
- var overflow = detectOverflow(state2, {
58454
+ var overflow = detectOverflow$1(state2, {
58075
58455
  boundary,
58076
58456
  rootBoundary,
58077
58457
  padding,
@@ -58109,8 +58489,8 @@
58109
58489
  var altSide = mainAxis === "y" ? bottom : right;
58110
58490
  var len2 = mainAxis === "y" ? "height" : "width";
58111
58491
  var offset2 = popperOffsets2[mainAxis];
58112
- var min$12 = offset2 + overflow[mainSide];
58113
- var max$12 = offset2 - overflow[altSide];
58492
+ var min2 = offset2 + overflow[mainSide];
58493
+ var max2 = offset2 - overflow[altSide];
58114
58494
  var additive = tether ? -popperRect[len2] / 2 : 0;
58115
58495
  var minLen = variation === start ? referenceRect[len2] : popperRect[len2];
58116
58496
  var maxLen = variation === start ? -popperRect[len2] : -referenceRect[len2];
@@ -58125,12 +58505,12 @@
58125
58505
  var arrowLen = within(0, referenceRect[len2], arrowRect[len2]);
58126
58506
  var minOffset = isBasePlacement ? referenceRect[len2] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
58127
58507
  var maxOffset = isBasePlacement ? -referenceRect[len2] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
58128
- var arrowOffsetParent = state2.elements.arrow && getOffsetParent(state2.elements.arrow);
58508
+ var arrowOffsetParent = state2.elements.arrow && getOffsetParent$1(state2.elements.arrow);
58129
58509
  var clientOffset = arrowOffsetParent ? mainAxis === "y" ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
58130
58510
  var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
58131
58511
  var tetherMin = offset2 + minOffset - offsetModifierValue - clientOffset;
58132
58512
  var tetherMax = offset2 + maxOffset - offsetModifierValue;
58133
- var preventedOffset = within(tether ? min(min$12, tetherMin) : min$12, offset2, tether ? max(max$12, tetherMax) : max$12);
58513
+ var preventedOffset = within(tether ? min$1(min2, tetherMin) : min2, offset2, tether ? max$1(max2, tetherMax) : max2);
58134
58514
  popperOffsets2[mainAxis] = preventedOffset;
58135
58515
  data[mainAxis] = preventedOffset - offset2;
58136
58516
  }
@@ -58165,8 +58545,8 @@
58165
58545
  scrollTop: element.scrollTop
58166
58546
  };
58167
58547
  }
58168
- function getNodeScroll(node2) {
58169
- if (node2 === getWindow(node2) || !isHTMLElement$2(node2)) {
58548
+ function getNodeScroll$1(node2) {
58549
+ if (node2 === getWindow$1(node2) || !isHTMLElement$1$1(node2)) {
58170
58550
  return getWindowScroll(node2);
58171
58551
  } else {
58172
58552
  return getHTMLElementScroll(node2);
@@ -58174,18 +58554,18 @@
58174
58554
  }
58175
58555
  function isElementScaled(element) {
58176
58556
  var rect = element.getBoundingClientRect();
58177
- var scaleX = round(rect.width) / element.offsetWidth || 1;
58178
- var scaleY = round(rect.height) / element.offsetHeight || 1;
58557
+ var scaleX = round$1(rect.width) / element.offsetWidth || 1;
58558
+ var scaleY = round$1(rect.height) / element.offsetHeight || 1;
58179
58559
  return scaleX !== 1 || scaleY !== 1;
58180
58560
  }
58181
58561
  function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
58182
58562
  if (isFixed === void 0) {
58183
58563
  isFixed = false;
58184
58564
  }
58185
- var isOffsetParentAnElement = isHTMLElement$2(offsetParent);
58186
- var offsetParentIsScaled = isHTMLElement$2(offsetParent) && isElementScaled(offsetParent);
58187
- var documentElement = getDocumentElement(offsetParent);
58188
- var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
58565
+ var isOffsetParentAnElement = isHTMLElement$1$1(offsetParent);
58566
+ var offsetParentIsScaled = isHTMLElement$1$1(offsetParent) && isElementScaled(offsetParent);
58567
+ var documentElement = getDocumentElement$1(offsetParent);
58568
+ var rect = getBoundingClientRect$1(elementOrVirtualElement, offsetParentIsScaled, isFixed);
58189
58569
  var scroll = {
58190
58570
  scrollLeft: 0,
58191
58571
  scrollTop: 0
@@ -58195,16 +58575,16 @@
58195
58575
  y: 0
58196
58576
  };
58197
58577
  if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
58198
- if (getNodeName(offsetParent) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
58578
+ if (getNodeName$1(offsetParent) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
58199
58579
  isScrollParent(documentElement)) {
58200
- scroll = getNodeScroll(offsetParent);
58580
+ scroll = getNodeScroll$1(offsetParent);
58201
58581
  }
58202
- if (isHTMLElement$2(offsetParent)) {
58203
- offsets = getBoundingClientRect(offsetParent, true);
58582
+ if (isHTMLElement$1$1(offsetParent)) {
58583
+ offsets = getBoundingClientRect$1(offsetParent, true);
58204
58584
  offsets.x += offsetParent.clientLeft;
58205
58585
  offsets.y += offsetParent.clientTop;
58206
58586
  } else if (documentElement) {
58207
- offsets.x = getWindowScrollBarX(documentElement);
58587
+ offsets.x = getWindowScrollBarX$1(documentElement);
58208
58588
  }
58209
58589
  }
58210
58590
  return {
@@ -58319,7 +58699,7 @@
58319
58699
  cleanupModifierEffects();
58320
58700
  state2.options = Object.assign({}, defaultOptions, state2.options, options22);
58321
58701
  state2.scrollParents = {
58322
- reference: isElement$1$1(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
58702
+ reference: isElement$2(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
58323
58703
  popper: listScrollParents(popper2)
58324
58704
  };
58325
58705
  var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state2.options.modifiers)));
@@ -58343,7 +58723,7 @@
58343
58723
  return;
58344
58724
  }
58345
58725
  state2.rects = {
58346
- reference: getCompositeRect(reference3, getOffsetParent(popper3), state2.options.strategy === "fixed"),
58726
+ reference: getCompositeRect(reference3, getOffsetParent$1(popper3), state2.options.strategy === "fixed"),
58347
58727
  popper: getLayoutRect(popper3)
58348
58728
  };
58349
58729
  state2.reset = false;
@@ -58414,7 +58794,7 @@
58414
58794
  return instance;
58415
58795
  };
58416
58796
  }
58417
- var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
58797
+ var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$3];
58418
58798
  var createPopper = /* @__PURE__ */ popperGenerator({
58419
58799
  defaultModifiers
58420
58800
  });
@@ -58499,7 +58879,7 @@
58499
58879
  function div() {
58500
58880
  return document.createElement("div");
58501
58881
  }
58502
- function isElement$2(value) {
58882
+ function isElement$1$1(value) {
58503
58883
  return ["Element", "Fragment"].some(function(type2) {
58504
58884
  return isType(value, type2);
58505
58885
  });
@@ -58514,7 +58894,7 @@
58514
58894
  return !!(value && value._tippy && value._tippy.reference === value);
58515
58895
  }
58516
58896
  function getArrayOfElements(value) {
58517
- if (isElement$2(value)) {
58897
+ if (isElement$1$1(value)) {
58518
58898
  return [value];
58519
58899
  }
58520
58900
  if (isNodeList(value)) {
@@ -58823,7 +59203,7 @@
58823
59203
  arrow2.className = ARROW_CLASS;
58824
59204
  } else {
58825
59205
  arrow2.className = SVG_ARROW_CLASS;
58826
- if (isElement$2(value)) {
59206
+ if (isElement$1$1(value)) {
58827
59207
  arrow2.appendChild(value);
58828
59208
  } else {
58829
59209
  dangerouslySetInnerHTML(arrow2, value);
@@ -58832,7 +59212,7 @@
58832
59212
  return arrow2;
58833
59213
  }
58834
59214
  function setContent(content, props) {
58835
- if (isElement$2(props.content)) {
59215
+ if (isElement$1$1(props.content)) {
58836
59216
  dangerouslySetInnerHTML(content, "");
58837
59217
  content.appendChild(props.content);
58838
59218
  } else if (typeof props.content !== "function") {
@@ -59655,7 +60035,7 @@
59655
60035
  });
59656
60036
  var elements = getArrayOfElements(targets);
59657
60037
  if (process$1$1.env.NODE_ENV !== "production") {
59658
- var isSingleContentElement = isElement$2(passedProps.content);
60038
+ var isSingleContentElement = isElement$1$1(passedProps.content);
59659
60039
  var isMoreThanOneReferenceElement = elements.length > 1;
59660
60040
  warnWhen(isSingleContentElement && isMoreThanOneReferenceElement, ["tippy() was passed an Element as the `content` prop, but more than", "one tippy instance was created by this invocation. This means the", "content element will only be appended to the last tippy instance.", "\n\n", "Instead, pass the .innerHTML of the element, or use a function that", "returns a cloned version of the element instead.", "\n\n", "1) content: element.innerHTML\n", "2) content: () => element.cloneNode(true)"].join(" "));
59661
60041
  }
@@ -59666,7 +60046,7 @@
59666
60046
  }
59667
60047
  return acc;
59668
60048
  }, []);
59669
- return isElement$2(targets) ? instances[0] : instances;
60049
+ return isElement$1$1(targets) ? instances[0] : instances;
59670
60050
  }
59671
60051
  tippy.defaultProps = defaultProps;
59672
60052
  tippy.setDefaultProps = setDefaultProps;
@@ -59935,7 +60315,1067 @@
59935
60315
  this.popover.remove();
59936
60316
  }
59937
60317
  }
60318
+ const sides = ["top", "right", "bottom", "left"];
60319
+ const min = Math.min;
60320
+ const max = Math.max;
60321
+ const round = Math.round;
60322
+ const floor = Math.floor;
60323
+ const createCoords = (v) => ({
60324
+ x: v,
60325
+ y: v
60326
+ });
60327
+ function evaluate(value, param) {
60328
+ return typeof value === "function" ? value(param) : value;
60329
+ }
60330
+ function getSide(placement) {
60331
+ return placement.split("-")[0];
60332
+ }
60333
+ function getAlignment(placement) {
60334
+ return placement.split("-")[1];
60335
+ }
60336
+ function getOppositeAxis(axis) {
60337
+ return axis === "x" ? "y" : "x";
60338
+ }
60339
+ function getAxisLength(axis) {
60340
+ return axis === "y" ? "height" : "width";
60341
+ }
60342
+ function getSideAxis(placement) {
60343
+ return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x";
60344
+ }
60345
+ function getAlignmentAxis(placement) {
60346
+ return getOppositeAxis(getSideAxis(placement));
60347
+ }
60348
+ function expandPaddingObject(padding) {
60349
+ return {
60350
+ top: 0,
60351
+ right: 0,
60352
+ bottom: 0,
60353
+ left: 0,
60354
+ ...padding
60355
+ };
60356
+ }
60357
+ function getPaddingObject(padding) {
60358
+ return typeof padding !== "number" ? expandPaddingObject(padding) : {
60359
+ top: padding,
60360
+ right: padding,
60361
+ bottom: padding,
60362
+ left: padding
60363
+ };
60364
+ }
60365
+ function rectToClientRect(rect) {
60366
+ const {
60367
+ x,
60368
+ y,
60369
+ width,
60370
+ height
60371
+ } = rect;
60372
+ return {
60373
+ width,
60374
+ height,
60375
+ top: y,
60376
+ left: x,
60377
+ right: x + width,
60378
+ bottom: y + height,
60379
+ x,
60380
+ y
60381
+ };
60382
+ }
60383
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
60384
+ let {
60385
+ reference: reference2,
60386
+ floating
60387
+ } = _ref;
60388
+ const sideAxis = getSideAxis(placement);
60389
+ const alignmentAxis = getAlignmentAxis(placement);
60390
+ const alignLength = getAxisLength(alignmentAxis);
60391
+ const side = getSide(placement);
60392
+ const isVertical = sideAxis === "y";
60393
+ const commonX = reference2.x + reference2.width / 2 - floating.width / 2;
60394
+ const commonY = reference2.y + reference2.height / 2 - floating.height / 2;
60395
+ const commonAlign = reference2[alignLength] / 2 - floating[alignLength] / 2;
60396
+ let coords;
60397
+ switch (side) {
60398
+ case "top":
60399
+ coords = {
60400
+ x: commonX,
60401
+ y: reference2.y - floating.height
60402
+ };
60403
+ break;
60404
+ case "bottom":
60405
+ coords = {
60406
+ x: commonX,
60407
+ y: reference2.y + reference2.height
60408
+ };
60409
+ break;
60410
+ case "right":
60411
+ coords = {
60412
+ x: reference2.x + reference2.width,
60413
+ y: commonY
60414
+ };
60415
+ break;
60416
+ case "left":
60417
+ coords = {
60418
+ x: reference2.x - floating.width,
60419
+ y: commonY
60420
+ };
60421
+ break;
60422
+ default:
60423
+ coords = {
60424
+ x: reference2.x,
60425
+ y: reference2.y
60426
+ };
60427
+ }
60428
+ switch (getAlignment(placement)) {
60429
+ case "start":
60430
+ coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
60431
+ break;
60432
+ case "end":
60433
+ coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
60434
+ break;
60435
+ }
60436
+ return coords;
60437
+ }
60438
+ const computePosition$1 = async (reference2, floating, config) => {
60439
+ const {
60440
+ placement = "bottom",
60441
+ strategy = "absolute",
60442
+ middleware = [],
60443
+ platform: platform2
60444
+ } = config;
60445
+ const validMiddleware = middleware.filter(Boolean);
60446
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
60447
+ let rects = await platform2.getElementRects({
60448
+ reference: reference2,
60449
+ floating,
60450
+ strategy
60451
+ });
60452
+ let {
60453
+ x,
60454
+ y
60455
+ } = computeCoordsFromPlacement(rects, placement, rtl);
60456
+ let statefulPlacement = placement;
60457
+ let middlewareData = {};
60458
+ let resetCount = 0;
60459
+ for (let i2 = 0; i2 < validMiddleware.length; i2++) {
60460
+ const {
60461
+ name,
60462
+ fn: fn2
60463
+ } = validMiddleware[i2];
60464
+ const {
60465
+ x: nextX,
60466
+ y: nextY,
60467
+ data,
60468
+ reset
60469
+ } = await fn2({
60470
+ x,
60471
+ y,
60472
+ initialPlacement: placement,
60473
+ placement: statefulPlacement,
60474
+ strategy,
60475
+ middlewareData,
60476
+ rects,
60477
+ platform: platform2,
60478
+ elements: {
60479
+ reference: reference2,
60480
+ floating
60481
+ }
60482
+ });
60483
+ x = nextX != null ? nextX : x;
60484
+ y = nextY != null ? nextY : y;
60485
+ middlewareData = {
60486
+ ...middlewareData,
60487
+ [name]: {
60488
+ ...middlewareData[name],
60489
+ ...data
60490
+ }
60491
+ };
60492
+ if (reset && resetCount <= 50) {
60493
+ resetCount++;
60494
+ if (typeof reset === "object") {
60495
+ if (reset.placement) {
60496
+ statefulPlacement = reset.placement;
60497
+ }
60498
+ if (reset.rects) {
60499
+ rects = reset.rects === true ? await platform2.getElementRects({
60500
+ reference: reference2,
60501
+ floating,
60502
+ strategy
60503
+ }) : reset.rects;
60504
+ }
60505
+ ({
60506
+ x,
60507
+ y
60508
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
60509
+ }
60510
+ i2 = -1;
60511
+ }
60512
+ }
60513
+ return {
60514
+ x,
60515
+ y,
60516
+ placement: statefulPlacement,
60517
+ strategy,
60518
+ middlewareData
60519
+ };
60520
+ };
60521
+ async function detectOverflow(state2, options2) {
60522
+ var _await$platform$isEle;
60523
+ if (options2 === void 0) {
60524
+ options2 = {};
60525
+ }
60526
+ const {
60527
+ x,
60528
+ y,
60529
+ platform: platform2,
60530
+ rects,
60531
+ elements,
60532
+ strategy
60533
+ } = state2;
60534
+ const {
60535
+ boundary = "clippingAncestors",
60536
+ rootBoundary = "viewport",
60537
+ elementContext = "floating",
60538
+ altBoundary = false,
60539
+ padding = 0
60540
+ } = evaluate(options2, state2);
60541
+ const paddingObject = getPaddingObject(padding);
60542
+ const altContext = elementContext === "floating" ? "reference" : "floating";
60543
+ const element = elements[altBoundary ? altContext : elementContext];
60544
+ const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
60545
+ element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
60546
+ boundary,
60547
+ rootBoundary,
60548
+ strategy
60549
+ }));
60550
+ const rect = elementContext === "floating" ? {
60551
+ x,
60552
+ y,
60553
+ width: rects.floating.width,
60554
+ height: rects.floating.height
60555
+ } : rects.reference;
60556
+ const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
60557
+ const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
60558
+ x: 1,
60559
+ y: 1
60560
+ } : {
60561
+ x: 1,
60562
+ y: 1
60563
+ };
60564
+ const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
60565
+ elements,
60566
+ rect,
60567
+ offsetParent,
60568
+ strategy
60569
+ }) : rect);
60570
+ return {
60571
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
60572
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
60573
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
60574
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
60575
+ };
60576
+ }
60577
+ function getSideOffsets(overflow, rect) {
60578
+ return {
60579
+ top: overflow.top - rect.height,
60580
+ right: overflow.right - rect.width,
60581
+ bottom: overflow.bottom - rect.height,
60582
+ left: overflow.left - rect.width
60583
+ };
60584
+ }
60585
+ function isAnySideFullyClipped(overflow) {
60586
+ return sides.some((side) => overflow[side] >= 0);
60587
+ }
60588
+ const hide$1 = function(options2) {
60589
+ if (options2 === void 0) {
60590
+ options2 = {};
60591
+ }
60592
+ return {
60593
+ name: "hide",
60594
+ options: options2,
60595
+ async fn(state2) {
60596
+ const {
60597
+ rects
60598
+ } = state2;
60599
+ const {
60600
+ strategy = "referenceHidden",
60601
+ ...detectOverflowOptions
60602
+ } = evaluate(options2, state2);
60603
+ switch (strategy) {
60604
+ case "referenceHidden": {
60605
+ const overflow = await detectOverflow(state2, {
60606
+ ...detectOverflowOptions,
60607
+ elementContext: "reference"
60608
+ });
60609
+ const offsets = getSideOffsets(overflow, rects.reference);
60610
+ return {
60611
+ data: {
60612
+ referenceHiddenOffsets: offsets,
60613
+ referenceHidden: isAnySideFullyClipped(offsets)
60614
+ }
60615
+ };
60616
+ }
60617
+ case "escaped": {
60618
+ const overflow = await detectOverflow(state2, {
60619
+ ...detectOverflowOptions,
60620
+ altBoundary: true
60621
+ });
60622
+ const offsets = getSideOffsets(overflow, rects.floating);
60623
+ return {
60624
+ data: {
60625
+ escapedOffsets: offsets,
60626
+ escaped: isAnySideFullyClipped(offsets)
60627
+ }
60628
+ };
60629
+ }
60630
+ default: {
60631
+ return {};
60632
+ }
60633
+ }
60634
+ }
60635
+ };
60636
+ };
60637
+ function hasWindow() {
60638
+ return typeof window !== "undefined";
60639
+ }
60640
+ function getNodeName(node2) {
60641
+ if (isNode(node2)) {
60642
+ return (node2.nodeName || "").toLowerCase();
60643
+ }
60644
+ return "#document";
60645
+ }
60646
+ function getWindow(node2) {
60647
+ var _node$ownerDocument;
60648
+ return (node2 == null || (_node$ownerDocument = node2.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
60649
+ }
60650
+ function getDocumentElement(node2) {
60651
+ var _ref;
60652
+ return (_ref = (isNode(node2) ? node2.ownerDocument : node2.document) || window.document) == null ? void 0 : _ref.documentElement;
60653
+ }
60654
+ function isNode(value) {
60655
+ if (!hasWindow()) {
60656
+ return false;
60657
+ }
60658
+ return value instanceof Node || value instanceof getWindow(value).Node;
60659
+ }
60660
+ function isElement$3(value) {
60661
+ if (!hasWindow()) {
60662
+ return false;
60663
+ }
60664
+ return value instanceof Element || value instanceof getWindow(value).Element;
60665
+ }
60666
+ function isHTMLElement$2(value) {
60667
+ if (!hasWindow()) {
60668
+ return false;
60669
+ }
60670
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
60671
+ }
60672
+ function isShadowRoot(value) {
60673
+ if (!hasWindow() || typeof ShadowRoot === "undefined") {
60674
+ return false;
60675
+ }
60676
+ return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
60677
+ }
60678
+ function isOverflowElement(element) {
60679
+ const {
60680
+ overflow,
60681
+ overflowX,
60682
+ overflowY,
60683
+ display
60684
+ } = getComputedStyle$1(element);
60685
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
60686
+ }
60687
+ function isTableElement(element) {
60688
+ return ["table", "td", "th"].includes(getNodeName(element));
60689
+ }
60690
+ function isTopLayer(element) {
60691
+ return [":popover-open", ":modal"].some((selector) => {
60692
+ try {
60693
+ return element.matches(selector);
60694
+ } catch (e) {
60695
+ return false;
60696
+ }
60697
+ });
60698
+ }
60699
+ function isContainingBlock(elementOrCss) {
60700
+ const webkit2 = isWebKit();
60701
+ const css = isElement$3(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
60702
+ return ["transform", "translate", "scale", "rotate", "perspective"].some((value) => css[value] ? css[value] !== "none" : false) || (css.containerType ? css.containerType !== "normal" : false) || !webkit2 && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit2 && (css.filter ? css.filter !== "none" : false) || ["transform", "translate", "scale", "rotate", "perspective", "filter"].some((value) => (css.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css.contain || "").includes(value));
60703
+ }
60704
+ function getContainingBlock(element) {
60705
+ let currentNode = getParentNode$2(element);
60706
+ while (isHTMLElement$2(currentNode) && !isLastTraversableNode(currentNode)) {
60707
+ if (isContainingBlock(currentNode)) {
60708
+ return currentNode;
60709
+ } else if (isTopLayer(currentNode)) {
60710
+ return null;
60711
+ }
60712
+ currentNode = getParentNode$2(currentNode);
60713
+ }
60714
+ return null;
60715
+ }
60716
+ function isWebKit() {
60717
+ if (typeof CSS === "undefined" || !CSS.supports) return false;
60718
+ return CSS.supports("-webkit-backdrop-filter", "none");
60719
+ }
60720
+ function isLastTraversableNode(node2) {
60721
+ return ["html", "body", "#document"].includes(getNodeName(node2));
60722
+ }
60723
+ function getComputedStyle$1(element) {
60724
+ return getWindow(element).getComputedStyle(element);
60725
+ }
60726
+ function getNodeScroll(element) {
60727
+ if (isElement$3(element)) {
60728
+ return {
60729
+ scrollLeft: element.scrollLeft,
60730
+ scrollTop: element.scrollTop
60731
+ };
60732
+ }
60733
+ return {
60734
+ scrollLeft: element.scrollX,
60735
+ scrollTop: element.scrollY
60736
+ };
60737
+ }
60738
+ function getParentNode$2(node2) {
60739
+ if (getNodeName(node2) === "html") {
60740
+ return node2;
60741
+ }
60742
+ const result = (
60743
+ // Step into the shadow DOM of the parent of a slotted node.
60744
+ node2.assignedSlot || // DOM Element detected.
60745
+ node2.parentNode || // ShadowRoot detected.
60746
+ isShadowRoot(node2) && node2.host || // Fallback.
60747
+ getDocumentElement(node2)
60748
+ );
60749
+ return isShadowRoot(result) ? result.host : result;
60750
+ }
60751
+ function getNearestOverflowAncestor(node2) {
60752
+ const parentNode2 = getParentNode$2(node2);
60753
+ if (isLastTraversableNode(parentNode2)) {
60754
+ return node2.ownerDocument ? node2.ownerDocument.body : node2.body;
60755
+ }
60756
+ if (isHTMLElement$2(parentNode2) && isOverflowElement(parentNode2)) {
60757
+ return parentNode2;
60758
+ }
60759
+ return getNearestOverflowAncestor(parentNode2);
60760
+ }
60761
+ function getOverflowAncestors(node2, list, traverseIframes) {
60762
+ var _node$ownerDocument2;
60763
+ if (list === void 0) {
60764
+ list = [];
60765
+ }
60766
+ if (traverseIframes === void 0) {
60767
+ traverseIframes = true;
60768
+ }
60769
+ const scrollableAncestor = getNearestOverflowAncestor(node2);
60770
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node2.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
60771
+ const win = getWindow(scrollableAncestor);
60772
+ if (isBody) {
60773
+ const frameElement = getFrameElement(win);
60774
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
60775
+ }
60776
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
60777
+ }
60778
+ function getFrameElement(win) {
60779
+ return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
60780
+ }
60781
+ function getCssDimensions(element) {
60782
+ const css = getComputedStyle$1(element);
60783
+ let width = parseFloat(css.width) || 0;
60784
+ let height = parseFloat(css.height) || 0;
60785
+ const hasOffset = isHTMLElement$2(element);
60786
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
60787
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
60788
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
60789
+ if (shouldFallback) {
60790
+ width = offsetWidth;
60791
+ height = offsetHeight;
60792
+ }
60793
+ return {
60794
+ width,
60795
+ height,
60796
+ $: shouldFallback
60797
+ };
60798
+ }
60799
+ function unwrapElement(element) {
60800
+ return !isElement$3(element) ? element.contextElement : element;
60801
+ }
60802
+ function getScale(element) {
60803
+ const domElement = unwrapElement(element);
60804
+ if (!isHTMLElement$2(domElement)) {
60805
+ return createCoords(1);
60806
+ }
60807
+ const rect = domElement.getBoundingClientRect();
60808
+ const {
60809
+ width,
60810
+ height,
60811
+ $
60812
+ } = getCssDimensions(domElement);
60813
+ let x = ($ ? round(rect.width) : rect.width) / width;
60814
+ let y = ($ ? round(rect.height) : rect.height) / height;
60815
+ if (!x || !Number.isFinite(x)) {
60816
+ x = 1;
60817
+ }
60818
+ if (!y || !Number.isFinite(y)) {
60819
+ y = 1;
60820
+ }
60821
+ return {
60822
+ x,
60823
+ y
60824
+ };
60825
+ }
60826
+ const noOffsets = /* @__PURE__ */ createCoords(0);
60827
+ function getVisualOffsets(element) {
60828
+ const win = getWindow(element);
60829
+ if (!isWebKit() || !win.visualViewport) {
60830
+ return noOffsets;
60831
+ }
60832
+ return {
60833
+ x: win.visualViewport.offsetLeft,
60834
+ y: win.visualViewport.offsetTop
60835
+ };
60836
+ }
60837
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
60838
+ if (isFixed === void 0) {
60839
+ isFixed = false;
60840
+ }
60841
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
60842
+ return false;
60843
+ }
60844
+ return isFixed;
60845
+ }
60846
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
60847
+ if (includeScale === void 0) {
60848
+ includeScale = false;
60849
+ }
60850
+ if (isFixedStrategy === void 0) {
60851
+ isFixedStrategy = false;
60852
+ }
60853
+ const clientRect2 = element.getBoundingClientRect();
60854
+ const domElement = unwrapElement(element);
60855
+ let scale = createCoords(1);
60856
+ if (includeScale) {
60857
+ if (offsetParent) {
60858
+ if (isElement$3(offsetParent)) {
60859
+ scale = getScale(offsetParent);
60860
+ }
60861
+ } else {
60862
+ scale = getScale(element);
60863
+ }
60864
+ }
60865
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
60866
+ let x = (clientRect2.left + visualOffsets.x) / scale.x;
60867
+ let y = (clientRect2.top + visualOffsets.y) / scale.y;
60868
+ let width = clientRect2.width / scale.x;
60869
+ let height = clientRect2.height / scale.y;
60870
+ if (domElement) {
60871
+ const win = getWindow(domElement);
60872
+ const offsetWin = offsetParent && isElement$3(offsetParent) ? getWindow(offsetParent) : offsetParent;
60873
+ let currentWin = win;
60874
+ let currentIFrame = getFrameElement(currentWin);
60875
+ while (currentIFrame && offsetParent && offsetWin !== currentWin) {
60876
+ const iframeScale = getScale(currentIFrame);
60877
+ const iframeRect = currentIFrame.getBoundingClientRect();
60878
+ const css = getComputedStyle$1(currentIFrame);
60879
+ const left2 = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
60880
+ const top2 = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
60881
+ x *= iframeScale.x;
60882
+ y *= iframeScale.y;
60883
+ width *= iframeScale.x;
60884
+ height *= iframeScale.y;
60885
+ x += left2;
60886
+ y += top2;
60887
+ currentWin = getWindow(currentIFrame);
60888
+ currentIFrame = getFrameElement(currentWin);
60889
+ }
60890
+ }
60891
+ return rectToClientRect({
60892
+ width,
60893
+ height,
60894
+ x,
60895
+ y
60896
+ });
60897
+ }
60898
+ function getWindowScrollBarX(element, rect) {
60899
+ const leftScroll = getNodeScroll(element).scrollLeft;
60900
+ if (!rect) {
60901
+ return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
60902
+ }
60903
+ return rect.left + leftScroll;
60904
+ }
60905
+ function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
60906
+ if (ignoreScrollbarX === void 0) {
60907
+ ignoreScrollbarX = false;
60908
+ }
60909
+ const htmlRect = documentElement.getBoundingClientRect();
60910
+ const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 : (
60911
+ // RTL <body> scrollbar.
60912
+ getWindowScrollBarX(documentElement, htmlRect)
60913
+ ));
60914
+ const y = htmlRect.top + scroll.scrollTop;
60915
+ return {
60916
+ x,
60917
+ y
60918
+ };
60919
+ }
60920
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
60921
+ let {
60922
+ elements,
60923
+ rect,
60924
+ offsetParent,
60925
+ strategy
60926
+ } = _ref;
60927
+ const isFixed = strategy === "fixed";
60928
+ const documentElement = getDocumentElement(offsetParent);
60929
+ const topLayer = elements ? isTopLayer(elements.floating) : false;
60930
+ if (offsetParent === documentElement || topLayer && isFixed) {
60931
+ return rect;
60932
+ }
60933
+ let scroll = {
60934
+ scrollLeft: 0,
60935
+ scrollTop: 0
60936
+ };
60937
+ let scale = createCoords(1);
60938
+ const offsets = createCoords(0);
60939
+ const isOffsetParentAnElement = isHTMLElement$2(offsetParent);
60940
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
60941
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
60942
+ scroll = getNodeScroll(offsetParent);
60943
+ }
60944
+ if (isHTMLElement$2(offsetParent)) {
60945
+ const offsetRect = getBoundingClientRect(offsetParent);
60946
+ scale = getScale(offsetParent);
60947
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
60948
+ offsets.y = offsetRect.y + offsetParent.clientTop;
60949
+ }
60950
+ }
60951
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
60952
+ return {
60953
+ width: rect.width * scale.x,
60954
+ height: rect.height * scale.y,
60955
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
60956
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
60957
+ };
60958
+ }
60959
+ function getClientRects(element) {
60960
+ return Array.from(element.getClientRects());
60961
+ }
60962
+ function getDocumentRect(element) {
60963
+ const html = getDocumentElement(element);
60964
+ const scroll = getNodeScroll(element);
60965
+ const body = element.ownerDocument.body;
60966
+ const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
60967
+ const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
60968
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
60969
+ const y = -scroll.scrollTop;
60970
+ if (getComputedStyle$1(body).direction === "rtl") {
60971
+ x += max(html.clientWidth, body.clientWidth) - width;
60972
+ }
60973
+ return {
60974
+ width,
60975
+ height,
60976
+ x,
60977
+ y
60978
+ };
60979
+ }
60980
+ function getViewportRect(element, strategy) {
60981
+ const win = getWindow(element);
60982
+ const html = getDocumentElement(element);
60983
+ const visualViewport = win.visualViewport;
60984
+ let width = html.clientWidth;
60985
+ let height = html.clientHeight;
60986
+ let x = 0;
60987
+ let y = 0;
60988
+ if (visualViewport) {
60989
+ width = visualViewport.width;
60990
+ height = visualViewport.height;
60991
+ const visualViewportBased = isWebKit();
60992
+ if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
60993
+ x = visualViewport.offsetLeft;
60994
+ y = visualViewport.offsetTop;
60995
+ }
60996
+ }
60997
+ return {
60998
+ width,
60999
+ height,
61000
+ x,
61001
+ y
61002
+ };
61003
+ }
61004
+ function getInnerBoundingClientRect(element, strategy) {
61005
+ const clientRect2 = getBoundingClientRect(element, true, strategy === "fixed");
61006
+ const top2 = clientRect2.top + element.clientTop;
61007
+ const left2 = clientRect2.left + element.clientLeft;
61008
+ const scale = isHTMLElement$2(element) ? getScale(element) : createCoords(1);
61009
+ const width = element.clientWidth * scale.x;
61010
+ const height = element.clientHeight * scale.y;
61011
+ const x = left2 * scale.x;
61012
+ const y = top2 * scale.y;
61013
+ return {
61014
+ width,
61015
+ height,
61016
+ x,
61017
+ y
61018
+ };
61019
+ }
61020
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
61021
+ let rect;
61022
+ if (clippingAncestor === "viewport") {
61023
+ rect = getViewportRect(element, strategy);
61024
+ } else if (clippingAncestor === "document") {
61025
+ rect = getDocumentRect(getDocumentElement(element));
61026
+ } else if (isElement$3(clippingAncestor)) {
61027
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
61028
+ } else {
61029
+ const visualOffsets = getVisualOffsets(element);
61030
+ rect = {
61031
+ x: clippingAncestor.x - visualOffsets.x,
61032
+ y: clippingAncestor.y - visualOffsets.y,
61033
+ width: clippingAncestor.width,
61034
+ height: clippingAncestor.height
61035
+ };
61036
+ }
61037
+ return rectToClientRect(rect);
61038
+ }
61039
+ function hasFixedPositionAncestor(element, stopNode) {
61040
+ const parentNode2 = getParentNode$2(element);
61041
+ if (parentNode2 === stopNode || !isElement$3(parentNode2) || isLastTraversableNode(parentNode2)) {
61042
+ return false;
61043
+ }
61044
+ return getComputedStyle$1(parentNode2).position === "fixed" || hasFixedPositionAncestor(parentNode2, stopNode);
61045
+ }
61046
+ function getClippingElementAncestors(element, cache2) {
61047
+ const cachedResult2 = cache2.get(element);
61048
+ if (cachedResult2) {
61049
+ return cachedResult2;
61050
+ }
61051
+ let result = getOverflowAncestors(element, [], false).filter((el) => isElement$3(el) && getNodeName(el) !== "body");
61052
+ let currentContainingBlockComputedStyle = null;
61053
+ const elementIsFixed = getComputedStyle$1(element).position === "fixed";
61054
+ let currentNode = elementIsFixed ? getParentNode$2(element) : element;
61055
+ while (isElement$3(currentNode) && !isLastTraversableNode(currentNode)) {
61056
+ const computedStyle = getComputedStyle$1(currentNode);
61057
+ const currentNodeIsContaining = isContainingBlock(currentNode);
61058
+ if (!currentNodeIsContaining && computedStyle.position === "fixed") {
61059
+ currentContainingBlockComputedStyle = null;
61060
+ }
61061
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
61062
+ if (shouldDropCurrentNode) {
61063
+ result = result.filter((ancestor) => ancestor !== currentNode);
61064
+ } else {
61065
+ currentContainingBlockComputedStyle = computedStyle;
61066
+ }
61067
+ currentNode = getParentNode$2(currentNode);
61068
+ }
61069
+ cache2.set(element, result);
61070
+ return result;
61071
+ }
61072
+ function getClippingRect(_ref) {
61073
+ let {
61074
+ element,
61075
+ boundary,
61076
+ rootBoundary,
61077
+ strategy
61078
+ } = _ref;
61079
+ const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
61080
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
61081
+ const firstClippingAncestor = clippingAncestors[0];
61082
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
61083
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
61084
+ accRect.top = max(rect.top, accRect.top);
61085
+ accRect.right = min(rect.right, accRect.right);
61086
+ accRect.bottom = min(rect.bottom, accRect.bottom);
61087
+ accRect.left = max(rect.left, accRect.left);
61088
+ return accRect;
61089
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
61090
+ return {
61091
+ width: clippingRect.right - clippingRect.left,
61092
+ height: clippingRect.bottom - clippingRect.top,
61093
+ x: clippingRect.left,
61094
+ y: clippingRect.top
61095
+ };
61096
+ }
61097
+ function getDimensions(element) {
61098
+ const {
61099
+ width,
61100
+ height
61101
+ } = getCssDimensions(element);
61102
+ return {
61103
+ width,
61104
+ height
61105
+ };
61106
+ }
61107
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
61108
+ const isOffsetParentAnElement = isHTMLElement$2(offsetParent);
61109
+ const documentElement = getDocumentElement(offsetParent);
61110
+ const isFixed = strategy === "fixed";
61111
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
61112
+ let scroll = {
61113
+ scrollLeft: 0,
61114
+ scrollTop: 0
61115
+ };
61116
+ const offsets = createCoords(0);
61117
+ function setLeftRTLScrollbarOffset() {
61118
+ offsets.x = getWindowScrollBarX(documentElement);
61119
+ }
61120
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
61121
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
61122
+ scroll = getNodeScroll(offsetParent);
61123
+ }
61124
+ if (isOffsetParentAnElement) {
61125
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
61126
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
61127
+ offsets.y = offsetRect.y + offsetParent.clientTop;
61128
+ } else if (documentElement) {
61129
+ setLeftRTLScrollbarOffset();
61130
+ }
61131
+ }
61132
+ if (isFixed && !isOffsetParentAnElement && documentElement) {
61133
+ setLeftRTLScrollbarOffset();
61134
+ }
61135
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
61136
+ const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
61137
+ const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
61138
+ return {
61139
+ x,
61140
+ y,
61141
+ width: rect.width,
61142
+ height: rect.height
61143
+ };
61144
+ }
61145
+ function isStaticPositioned(element) {
61146
+ return getComputedStyle$1(element).position === "static";
61147
+ }
61148
+ function getTrueOffsetParent(element, polyfill) {
61149
+ if (!isHTMLElement$2(element) || getComputedStyle$1(element).position === "fixed") {
61150
+ return null;
61151
+ }
61152
+ if (polyfill) {
61153
+ return polyfill(element);
61154
+ }
61155
+ let rawOffsetParent = element.offsetParent;
61156
+ if (getDocumentElement(element) === rawOffsetParent) {
61157
+ rawOffsetParent = rawOffsetParent.ownerDocument.body;
61158
+ }
61159
+ return rawOffsetParent;
61160
+ }
61161
+ function getOffsetParent(element, polyfill) {
61162
+ const win = getWindow(element);
61163
+ if (isTopLayer(element)) {
61164
+ return win;
61165
+ }
61166
+ if (!isHTMLElement$2(element)) {
61167
+ let svgOffsetParent = getParentNode$2(element);
61168
+ while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
61169
+ if (isElement$3(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
61170
+ return svgOffsetParent;
61171
+ }
61172
+ svgOffsetParent = getParentNode$2(svgOffsetParent);
61173
+ }
61174
+ return win;
61175
+ }
61176
+ let offsetParent = getTrueOffsetParent(element, polyfill);
61177
+ while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
61178
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
61179
+ }
61180
+ if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
61181
+ return win;
61182
+ }
61183
+ return offsetParent || getContainingBlock(element) || win;
61184
+ }
61185
+ const getElementRects = async function(data) {
61186
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
61187
+ const getDimensionsFn = this.getDimensions;
61188
+ const floatingDimensions = await getDimensionsFn(data.floating);
61189
+ return {
61190
+ reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
61191
+ floating: {
61192
+ x: 0,
61193
+ y: 0,
61194
+ width: floatingDimensions.width,
61195
+ height: floatingDimensions.height
61196
+ }
61197
+ };
61198
+ };
61199
+ function isRTL(element) {
61200
+ return getComputedStyle$1(element).direction === "rtl";
61201
+ }
61202
+ const platform = {
61203
+ convertOffsetParentRelativeRectToViewportRelativeRect,
61204
+ getDocumentElement,
61205
+ getClippingRect,
61206
+ getOffsetParent,
61207
+ getElementRects,
61208
+ getClientRects,
61209
+ getDimensions,
61210
+ getScale,
61211
+ isElement: isElement$3,
61212
+ isRTL
61213
+ };
61214
+ function rectsAreEqual(a, b) {
61215
+ return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
61216
+ }
61217
+ function observeMove(element, onMove) {
61218
+ let io = null;
61219
+ let timeoutId;
61220
+ const root2 = getDocumentElement(element);
61221
+ function cleanup() {
61222
+ var _io;
61223
+ clearTimeout(timeoutId);
61224
+ (_io = io) == null || _io.disconnect();
61225
+ io = null;
61226
+ }
61227
+ function refresh(skip, threshold) {
61228
+ if (skip === void 0) {
61229
+ skip = false;
61230
+ }
61231
+ if (threshold === void 0) {
61232
+ threshold = 1;
61233
+ }
61234
+ cleanup();
61235
+ const elementRectForRootMargin = element.getBoundingClientRect();
61236
+ const {
61237
+ left: left2,
61238
+ top: top2,
61239
+ width,
61240
+ height
61241
+ } = elementRectForRootMargin;
61242
+ if (!skip) {
61243
+ onMove();
61244
+ }
61245
+ if (!width || !height) {
61246
+ return;
61247
+ }
61248
+ const insetTop = floor(top2);
61249
+ const insetRight = floor(root2.clientWidth - (left2 + width));
61250
+ const insetBottom = floor(root2.clientHeight - (top2 + height));
61251
+ const insetLeft = floor(left2);
61252
+ const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
61253
+ const options2 = {
61254
+ rootMargin,
61255
+ threshold: max(0, min(1, threshold)) || 1
61256
+ };
61257
+ let isFirstUpdate = true;
61258
+ function handleObserve(entries) {
61259
+ const ratio = entries[0].intersectionRatio;
61260
+ if (ratio !== threshold) {
61261
+ if (!isFirstUpdate) {
61262
+ return refresh();
61263
+ }
61264
+ if (!ratio) {
61265
+ timeoutId = setTimeout(() => {
61266
+ refresh(false, 1e-7);
61267
+ }, 1e3);
61268
+ } else {
61269
+ refresh(false, ratio);
61270
+ }
61271
+ }
61272
+ if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
61273
+ refresh();
61274
+ }
61275
+ isFirstUpdate = false;
61276
+ }
61277
+ try {
61278
+ io = new IntersectionObserver(handleObserve, {
61279
+ ...options2,
61280
+ // Handle <iframe>s
61281
+ root: root2.ownerDocument
61282
+ });
61283
+ } catch (_e) {
61284
+ io = new IntersectionObserver(handleObserve, options2);
61285
+ }
61286
+ io.observe(element);
61287
+ }
61288
+ refresh(true);
61289
+ return cleanup;
61290
+ }
61291
+ function autoUpdate(reference2, floating, update, options2) {
61292
+ if (options2 === void 0) {
61293
+ options2 = {};
61294
+ }
61295
+ const {
61296
+ ancestorScroll = true,
61297
+ ancestorResize = true,
61298
+ elementResize = typeof ResizeObserver === "function",
61299
+ layoutShift = typeof IntersectionObserver === "function",
61300
+ animationFrame = false
61301
+ } = options2;
61302
+ const referenceEl = unwrapElement(reference2);
61303
+ const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : [];
61304
+ ancestors.forEach((ancestor) => {
61305
+ ancestorScroll && ancestor.addEventListener("scroll", update, {
61306
+ passive: true
61307
+ });
61308
+ ancestorResize && ancestor.addEventListener("resize", update);
61309
+ });
61310
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
61311
+ let reobserveFrame = -1;
61312
+ let resizeObserver = null;
61313
+ if (elementResize) {
61314
+ resizeObserver = new ResizeObserver((_ref) => {
61315
+ let [firstEntry] = _ref;
61316
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
61317
+ resizeObserver.unobserve(floating);
61318
+ cancelAnimationFrame(reobserveFrame);
61319
+ reobserveFrame = requestAnimationFrame(() => {
61320
+ var _resizeObserver;
61321
+ (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
61322
+ });
61323
+ }
61324
+ update();
61325
+ });
61326
+ if (referenceEl && !animationFrame) {
61327
+ resizeObserver.observe(referenceEl);
61328
+ }
61329
+ resizeObserver.observe(floating);
61330
+ }
61331
+ let frameId;
61332
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference2) : null;
61333
+ if (animationFrame) {
61334
+ frameLoop();
61335
+ }
61336
+ function frameLoop() {
61337
+ const nextRefRect = getBoundingClientRect(reference2);
61338
+ if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
61339
+ update();
61340
+ }
61341
+ prevRefRect = nextRefRect;
61342
+ frameId = requestAnimationFrame(frameLoop);
61343
+ }
61344
+ update();
61345
+ return () => {
61346
+ var _resizeObserver2;
61347
+ ancestors.forEach((ancestor) => {
61348
+ ancestorScroll && ancestor.removeEventListener("scroll", update);
61349
+ ancestorResize && ancestor.removeEventListener("resize", update);
61350
+ });
61351
+ cleanupIo == null || cleanupIo();
61352
+ (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
61353
+ resizeObserver = null;
61354
+ if (animationFrame) {
61355
+ cancelAnimationFrame(frameId);
61356
+ }
61357
+ };
61358
+ }
61359
+ const hide = hide$1;
61360
+ const computePosition = (reference2, floating, options2) => {
61361
+ const cache2 = /* @__PURE__ */ new Map();
61362
+ const mergedOptions = {
61363
+ platform,
61364
+ ...options2
61365
+ };
61366
+ const platformWithCache = {
61367
+ ...mergedOptions.platform,
61368
+ _c: cache2
61369
+ };
61370
+ return computePosition$1(reference2, floating, {
61371
+ ...mergedOptions,
61372
+ platform: platformWithCache
61373
+ });
61374
+ };
61375
+ const SEPARATOR_CLASS = "pagination-separator";
61376
+ const SEPARATOR_FLOATING_CLASS = "pagination-separator-floating";
59938
61377
  const isDebugging = false;
61378
+ const cleanupFunctions = /* @__PURE__ */ new Set();
59939
61379
  const Pagination = Extension.create({
59940
61380
  name: "pagination",
59941
61381
  addStorage() {
@@ -60025,7 +61465,7 @@
60025
61465
  view: (view) => {
60026
61466
  let previousDecorations = DecorationSet.empty;
60027
61467
  return {
60028
- update: (view2) => {
61468
+ update: (view2, prevState) => {
60029
61469
  if (!shouldUpdate || isUpdating) return;
60030
61470
  isUpdating = true;
60031
61471
  hasInitialized = true;
@@ -60042,6 +61482,9 @@
60042
61482
  }
60043
61483
  });
60044
61484
  return [paginationPlugin];
61485
+ },
61486
+ onDestroy() {
61487
+ cleanupFloatingSeparators();
60045
61488
  }
60046
61489
  });
60047
61490
  const getHeaderFooterId = (currentPageNumber, sectionType, editor, node2 = null) => {
@@ -60079,12 +61522,23 @@
60079
61522
  const performUpdate = (editor, view, previousDecorations) => {
60080
61523
  const sectionData = editor.storage.pagination.sectionData;
60081
61524
  const newDecorations = calculatePageBreaks(view, editor, sectionData);
61525
+ const editorElement = editor.options.element;
60082
61526
  if (!previousDecorations.eq(newDecorations)) {
60083
61527
  const updateTransaction = view.state.tr.setMeta(
60084
61528
  PaginationPluginKey,
60085
61529
  { decorations: newDecorations }
60086
61530
  );
60087
61531
  view.dispatch(updateTransaction);
61532
+ requestAnimationFrame(() => {
61533
+ requestAnimationFrame(() => {
61534
+ cleanupFloatingSeparators();
61535
+ const separators = [...editorElement.querySelectorAll(`.${SEPARATOR_CLASS}--table`)];
61536
+ separators.forEach((separator) => {
61537
+ const { cleanup } = createFloatingSeparator(separator, editor);
61538
+ cleanupFunctions.add(cleanup);
61539
+ });
61540
+ });
61541
+ });
60088
61542
  }
60089
61543
  editor.emit("paginationUpdate");
60090
61544
  };
@@ -60125,16 +61579,15 @@
60125
61579
  const decorations = [];
60126
61580
  const { pageSize, pageMargins } = editor.converter.pageStyles;
60127
61581
  const pageHeight = pageSize.height * 96;
60128
- editor.options.scale;
60129
61582
  let currentPageNumber = 1;
60130
61583
  let pageHeightThreshold = pageHeight;
60131
61584
  let footer = null, header = null;
60132
61585
  const firstHeaderId = getHeaderFooterId(currentPageNumber, "headerIds", editor);
60133
- const firstHeader = createHeader(pageMargins, pageSize, sectionData, firstHeaderId, editor);
61586
+ const firstHeader = createHeader(pageMargins, pageSize, sectionData, firstHeaderId, editor, currentPageNumber);
60134
61587
  const pageBreak = createPageBreak({ editor, header: firstHeader, isFirstHeader: true });
60135
61588
  decorations.push(Decoration.widget(0, pageBreak, { key: "stable-key" }));
60136
61589
  const lastFooterId = getHeaderFooterId(currentPageNumber, "footerIds", editor);
60137
- const lastFooter = createFooter(pageMargins, pageSize, sectionData, lastFooterId, editor);
61590
+ const lastFooter = createFooter(pageMargins, pageSize, sectionData, lastFooterId, editor, currentPageNumber);
60138
61591
  pageHeightThreshold -= firstHeader.headerHeight + lastFooter.footerHeight;
60139
61592
  let coords = view?.coordsAtPos(doc2.content.size);
60140
61593
  if (!coords) return [];
@@ -60153,7 +61606,7 @@
60153
61606
  if (currentPageNumber === 1) {
60154
61607
  const headerId2 = getHeaderFooterId(currentPageNumber, "headerIds", editor, currentNode);
60155
61608
  decorations.pop();
60156
- const newFirstHeader = createHeader(pageMargins, pageSize, sectionData, headerId2, editor);
61609
+ const newFirstHeader = createHeader(pageMargins, pageSize, sectionData, headerId2, editor, currentPageNumber - 1);
60157
61610
  const pageBreak2 = createPageBreak({ editor, header: newFirstHeader, isFirstHeader: true });
60158
61611
  decorations.push(Decoration.widget(0, pageBreak2, { key: "stable-key" }));
60159
61612
  }
@@ -60169,7 +61622,9 @@
60169
61622
  }
60170
61623
  if (isHardBreakNode || shouldAddPageBreak) {
60171
61624
  const $currentPos = view.state.doc.resolve(currentPos);
61625
+ const table = findParentNodeClosestToPos($currentPos, (node22) => node22.type.name === "table");
60172
61626
  const tableRow = findParentNodeClosestToPos($currentPos, (node22) => node22.type.name === "tableRow");
61627
+ let isInTable2 = table || tableRow ? true : false;
60173
61628
  if (tableRow) {
60174
61629
  currentNode = tableRow.node;
60175
61630
  currentPos = tableRow.pos;
@@ -60182,13 +61637,13 @@
60182
61637
  const footerId2 = getHeaderFooterId(currentPageNumber, "footerIds", editor, currentNode);
60183
61638
  currentPageNumber++;
60184
61639
  const headerId2 = getHeaderFooterId(currentPageNumber, "headerIds", editor);
60185
- header = createHeader(pageMargins, pageSize, sectionData, headerId2, editor);
61640
+ header = createHeader(pageMargins, pageSize, sectionData, headerId2, editor, currentPageNumber - 1);
60186
61641
  footer = createFooter(pageMargins, pageSize, sectionData, footerId2, editor, currentPageNumber - 1);
60187
61642
  const bufferHeight2 = pageHeightThreshold - actualBreakBottom;
60188
61643
  const { node: spacingNode2 } = createFinalPagePadding(bufferHeight2);
60189
61644
  const pageSpacer2 = Decoration.widget(breakPos, spacingNode2, { key: "stable-key" });
60190
61645
  decorations.push(pageSpacer2);
60191
- const pageBreak2 = createPageBreak({ editor, header, footer });
61646
+ const pageBreak2 = createPageBreak({ editor, header, footer, isInTable: isInTable2 });
60192
61647
  decorations.push(Decoration.widget(breakPos, pageBreak2, { key: "stable-key" }));
60193
61648
  pageHeightThreshold = actualBreakBottom + (pageHeight - header.headerHeight - footer.footerHeight);
60194
61649
  }
@@ -60197,7 +61652,7 @@
60197
61652
  const lastNodeCoords = view.coordsAtPos(finalPos);
60198
61653
  const headerId = getHeaderFooterId(currentPageNumber, "headerIds", editor);
60199
61654
  const footerId = getHeaderFooterId(currentPageNumber, "footerIds", editor);
60200
- header = createHeader(pageMargins, pageSize, sectionData, headerId, editor);
61655
+ header = createHeader(pageMargins, pageSize, sectionData, headerId, editor, currentPageNumber);
60201
61656
  footer = createFooter(pageMargins, pageSize, sectionData, footerId, editor, currentPageNumber);
60202
61657
  const bufferHeight = pageHeightThreshold - lastNodeCoords.bottom;
60203
61658
  const { node: spacingNode } = createFinalPagePadding(bufferHeight);
@@ -60214,6 +61669,7 @@
60214
61669
  totalPageNumber.innerText = currentPageNumber;
60215
61670
  }
60216
61671
  });
61672
+ editor.currentTotalPages = currentPageNumber;
60217
61673
  return decorations;
60218
61674
  }
60219
61675
  function createFinalPagePadding(bufferHeight) {
@@ -60224,7 +61680,7 @@
60224
61680
  div2.style.height = bufferHeight + "px";
60225
61681
  return { nodeHeight: bufferHeight, node: div2 };
60226
61682
  }
60227
- function createHeader(pageMargins, pageSize, sectionData, headerId, editor) {
61683
+ function createHeader(pageMargins, pageSize, sectionData, headerId, editor, currentPageNumber) {
60228
61684
  const headerDef = sectionData.headers?.[headerId];
60229
61685
  const minHeaderHeight = pageMargins.top * 96;
60230
61686
  const headerMargin = pageMargins.header * 96;
@@ -60251,7 +61707,8 @@
60251
61707
  appendToBody: false,
60252
61708
  sectionId: headerId,
60253
61709
  type: "header",
60254
- availableHeight
61710
+ availableHeight,
61711
+ currentPageNumber
60255
61712
  });
60256
61713
  editor.converter.headerEditors.push({
60257
61714
  id: headerId,
@@ -60277,13 +61734,6 @@
60277
61734
  const minFooterHeight = pageMargins.bottom * 96;
60278
61735
  const footerPaddingFromEdge = pageMargins.footer * 96;
60279
61736
  const footerHeight = Math.max(footerDef?.height || 0, minFooterHeight - footerPaddingFromEdge);
60280
- const sectionContainer = footerDef?.sectionContainer?.cloneNode(true);
60281
- const autoPageNumber = sectionContainer?.querySelector('span[data-id="auto-page-number"]');
60282
- if (autoPageNumber) {
60283
- const fontSize2 = autoPageNumber.previousElementSibling?.style?.fontSize || autoPageNumber.nextElementSibling?.style?.fontSize;
60284
- if (fontSize2) autoPageNumber.style.fontSize = fontSize2;
60285
- autoPageNumber.innerText = currentPageNumber;
60286
- }
60287
61737
  const editorContainer = document.createElement("div");
60288
61738
  if (!footerId && !editor.converter.footerIds["default"]) {
60289
61739
  footerId = "rId" + generateDocxRandomId();
@@ -60303,7 +61753,8 @@
60303
61753
  appendToBody: false,
60304
61754
  sectionId: footerId,
60305
61755
  type: "footer",
60306
- availableHeight: footerHeight
61756
+ availableHeight: footerHeight,
61757
+ currentPageNumber
60307
61758
  });
60308
61759
  editor.converter.footerEditors.push({
60309
61760
  id: footerId,
@@ -60329,7 +61780,7 @@
60329
61780
  editor.setEditable(false, false);
60330
61781
  toggleHeaderFooterEditMode(editor, currentFocusedSectionEditor, true);
60331
61782
  };
60332
- function createPageBreak({ editor, header, footer, footerBottom = null, isFirstHeader, isLastFooter }) {
61783
+ function createPageBreak({ editor, header, footer, footerBottom = null, isFirstHeader, isLastFooter, isInTable: isInTable2 = false }) {
60333
61784
  const { pageSize, pageMargins } = editor.converter.pageStyles;
60334
61785
  let sectionHeight = 0;
60335
61786
  const paginationDiv = document.createElement("div");
@@ -60348,7 +61799,10 @@
60348
61799
  const separatorHeight = 20;
60349
61800
  sectionHeight += separatorHeight;
60350
61801
  const separator = document.createElement("div");
60351
- separator.className = "pagination-separator";
61802
+ separator.classList.add(SEPARATOR_CLASS);
61803
+ if (isInTable2) {
61804
+ separator.classList.add(`${SEPARATOR_CLASS}--table`);
61805
+ }
60352
61806
  innerDiv.appendChild(separator);
60353
61807
  }
60354
61808
  if (header) {
@@ -60387,6 +61841,85 @@
60387
61841
  editor.view.dispatch(newTr);
60388
61842
  });
60389
61843
  };
61844
+ function createFloatingSeparator(separator, editor) {
61845
+ const floatingSeparator = document.createElement("div");
61846
+ floatingSeparator.classList.add(SEPARATOR_FLOATING_CLASS);
61847
+ floatingSeparator.dataset.floatingSeparator = "";
61848
+ const editorElement = editor.options.element;
61849
+ editorElement.append(floatingSeparator);
61850
+ const updatePosition2 = () => {
61851
+ computePosition(separator, floatingSeparator, {
61852
+ strategy: "absolute",
61853
+ placement: "top-start",
61854
+ middleware: [
61855
+ hide(),
61856
+ {
61857
+ name: "copy",
61858
+ fn: ({ elements }) => {
61859
+ const rect = elements.reference.getBoundingClientRect();
61860
+ const containerRect = editorElement.getBoundingClientRect();
61861
+ const scaleFactor = getScaleFactor(editorElement);
61862
+ const x = Math.round((rect.left - containerRect.left) / scaleFactor);
61863
+ const y = Math.round((rect.top - containerRect.top) / scaleFactor);
61864
+ const width = Math.round(rect.width / scaleFactor);
61865
+ const height = Math.round(rect.height / scaleFactor);
61866
+ return {
61867
+ x,
61868
+ y,
61869
+ data: { width, height }
61870
+ };
61871
+ }
61872
+ }
61873
+ ]
61874
+ }).then(({ x, y, middlewareData }) => {
61875
+ Object.assign(floatingSeparator.style, {
61876
+ top: `${y}px`,
61877
+ left: `${x}px`,
61878
+ width: `${middlewareData.copy.width}px`,
61879
+ height: `${middlewareData.copy.height}px`,
61880
+ visibility: middlewareData.hide?.referenceHidden ? "hidden" : "visible"
61881
+ });
61882
+ });
61883
+ };
61884
+ const cleanup = autoUpdate(
61885
+ separator,
61886
+ floatingSeparator,
61887
+ updatePosition2
61888
+ );
61889
+ const extendedCleanup = () => {
61890
+ floatingSeparator?.remove();
61891
+ cleanup();
61892
+ };
61893
+ return {
61894
+ cleanup: extendedCleanup,
61895
+ updatePosition: updatePosition2
61896
+ };
61897
+ }
61898
+ function cleanupFloatingSeparators() {
61899
+ cleanupFunctions.forEach((cleanup) => cleanup());
61900
+ cleanupFunctions.clear();
61901
+ }
61902
+ function getScaleFactor(element) {
61903
+ let scale = 1;
61904
+ let currentElement2 = element;
61905
+ while (currentElement2 && currentElement2 !== document.documentElement) {
61906
+ let zoomStyle = currentElement2.style.zoom;
61907
+ if (zoomStyle) {
61908
+ let zoom = parseFloat(zoomStyle) || 1;
61909
+ scale *= zoom;
61910
+ }
61911
+ let transformStyle = currentElement2.style.transform;
61912
+ if (transformStyle) {
61913
+ let scaleMatch = transformStyle.match(/scale\(([^)]+)\)/);
61914
+ if (scaleMatch) {
61915
+ let scaleValue = parseFloat(scaleMatch[1]) || 1;
61916
+ scale *= scaleValue;
61917
+ }
61918
+ }
61919
+ currentElement2 = currentElement2.parentElement;
61920
+ }
61921
+ return scale;
61922
+ }
60390
61923
  class SearchQuery {
60391
61924
  /**
60392
61925
  Create a query object.
@@ -64426,7 +65959,7 @@ ${style2}
64426
65959
  };
64427
65960
  return ResizeObserverController2;
64428
65961
  }();
64429
- var ResizeObserver$1 = function() {
65962
+ var ResizeObserver$2 = function() {
64430
65963
  function ResizeObserver2(callback) {
64431
65964
  if (arguments.length === 0) {
64432
65965
  throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");
@@ -64465,7 +65998,7 @@ ${style2}
64465
65998
  let ResizeObserverDelegate$1 = class ResizeObserverDelegate {
64466
65999
  constructor() {
64467
66000
  this.handleResize = this.handleResize.bind(this);
64468
- this.observer = new (typeof window !== "undefined" && window.ResizeObserver || ResizeObserver$1)(this.handleResize);
66001
+ this.observer = new (typeof window !== "undefined" && window.ResizeObserver || ResizeObserver$2)(this.handleResize);
64469
66002
  this.elHandlersMap = /* @__PURE__ */ new Map();
64470
66003
  }
64471
66004
  handleResize(entries) {
@@ -74871,7 +76404,7 @@ ${style2}
74871
76404
  };
74872
76405
  }
74873
76406
  };
74874
- const SuperEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$2$1, [["__scopeId", "data-v-199a4ecf"]]);
76407
+ const SuperEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$2$1, [["__scopeId", "data-v-4b700df1"]]);
74875
76408
  const _hoisted_1$h = ["innerHTML"];
74876
76409
  const _sfc_main$i = {
74877
76410
  __name: "SuperInput",
@@ -80361,7 +81894,7 @@ ${style2}
80361
81894
  };
80362
81895
  return ResizeObserverController2;
80363
81896
  }();
80364
- var ResizeObserver = function() {
81897
+ var ResizeObserver$1 = function() {
80365
81898
  function ResizeObserver2(callback) {
80366
81899
  if (arguments.length === 0) {
80367
81900
  throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");
@@ -80400,7 +81933,7 @@ ${style2}
80400
81933
  class ResizeObserverDelegate {
80401
81934
  constructor() {
80402
81935
  this.handleResize = this.handleResize.bind(this);
80403
- this.observer = new (typeof window !== "undefined" && window.ResizeObserver || ResizeObserver)(this.handleResize);
81936
+ this.observer = new (typeof window !== "undefined" && window.ResizeObserver || ResizeObserver$1)(this.handleResize);
80404
81937
  this.elHandlersMap = /* @__PURE__ */ new Map();
80405
81938
  }
80406
81939
  handleResize(entries) {
@@ -89965,7 +91498,7 @@ ${style2}
89965
91498
  this.config.colors = shuffleArray(this.config.colors);
89966
91499
  this.userColorMap = /* @__PURE__ */ new Map();
89967
91500
  this.colorIndex = 0;
89968
- this.version = "0.12.35";
91501
+ this.version = "0.12.36-next.10";
89969
91502
  console.debug("🦋 [superdoc] Using SuperDoc version:", this.version);
89970
91503
  this.superdocId = config.superdocId || v4();
89971
91504
  this.colors = this.config.colors;