@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
@@ -9,12 +9,12 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
11
11
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
12
- 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;
12
+ 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;
13
13
  import * as Y from "yjs";
14
14
  import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
15
- import { P as PluginKey, a as Plugin, M as Mapping, c as callOrGet, i as isEmptyObject, S as Schema$1, T as TextSelection, b as canSplit, l as liftTarget, A as AllSelection, d as canJoin, j as joinPoint, N as NodeSelection, r as replaceStep$1, e as Selection, F as Fragment, R as ReplaceAroundStep, f as Slice, o as objectIncludes, g as deleteProps, D as DOMParser$1, h as ReplaceStep, k as NodeRange, m as findWrapping, n as isMacOS, p as isIOS, q as generateDocxRandomId, s as minMax, t as generateRandom32BitHex, u as DOMSerializer, v as Mark$1, w as dropPoint, x as process$1, B as Buffer2, y as isRegExp, z as TrackDeleteMarkName, C as TrackInsertMarkName, E as v4, G as TrackFormatMarkName, H as comments_module_events, I as AddMarkStep, J as RemoveMarkStep, K as twipsToLines, L as pixelsToTwips, O as SuperConverter, Q as EditorState, U as hasSomeParentWithClass, V as parseSizeUnit, W as getLineHeightValueString, X as toKebabCase, Y as kebabCase, Z as getColStyleDeclaration, _ as SelectionRange, $ as Transform, a0 as createColGroup } from "./converter-DQPyKWs_.js";
15
+ import { P as PluginKey, a as Plugin, M as Mapping, c as callOrGet, i as isEmptyObject, S as Schema$1, T as TextSelection, b as canSplit, l as liftTarget, A as AllSelection, d as canJoin, j as joinPoint, N as NodeSelection, r as replaceStep$1, e as Selection, F as Fragment, R as ReplaceAroundStep, f as Slice, o as objectIncludes, g as deleteProps, D as DOMParser$1, h as ReplaceStep, k as NodeRange, m as findWrapping, n as isMacOS, p as isIOS, q as generateDocxRandomId, s as minMax, t as generateRandom32BitHex, u as DOMSerializer, v as Mark$1, w as dropPoint, x as process$1, B as Buffer2, y as isRegExp, z as TrackDeleteMarkName, C as TrackInsertMarkName, E as v4, G as TrackFormatMarkName, H as comments_module_events, I as AddMarkStep, J as RemoveMarkStep, K as twipsToLines, L as pixelsToTwips, O as SuperConverter, Q as EditorState, U as hasSomeParentWithClass, V as parseSizeUnit, W as getLineHeightValueString, X as toKebabCase, Y as kebabCase, Z as getColStyleDeclaration, _ as SelectionRange, $ as Transform, a0 as createColGroup } from "./converter-Dhv5kzsP.js";
16
16
  import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
17
- import { D as DocxZipper } from "./docx-zipper-cJ42om_0.js";
17
+ import { D as DocxZipper } from "./docx-zipper-Co1uS6tK.js";
18
18
  function getMarksFromSelection(state) {
19
19
  const { from: from2, to, empty: empty2 } = state.selection;
20
20
  const marks = [];
@@ -4423,7 +4423,7 @@ function windowRect(doc2) {
4423
4423
  bottom: doc2.documentElement.clientHeight
4424
4424
  };
4425
4425
  }
4426
- function getSide(value, side) {
4426
+ function getSide$1(value, side) {
4427
4427
  return typeof value == "number" ? value : value[side];
4428
4428
  }
4429
4429
  function clientRect(node) {
@@ -4451,14 +4451,14 @@ function scrollRectIntoView(view, rect, startDOM) {
4451
4451
  let atTop = elt == doc2.body;
4452
4452
  let bounding = atTop ? windowRect(doc2) : clientRect(elt);
4453
4453
  let moveX = 0, moveY = 0;
4454
- if (rect.top < bounding.top + getSide(scrollThreshold, "top"))
4455
- moveY = -(bounding.top - rect.top + getSide(scrollMargin, "top"));
4456
- else if (rect.bottom > bounding.bottom - getSide(scrollThreshold, "bottom"))
4457
- moveY = rect.bottom - rect.top > bounding.bottom - bounding.top ? rect.top + getSide(scrollMargin, "top") - bounding.top : rect.bottom - bounding.bottom + getSide(scrollMargin, "bottom");
4458
- if (rect.left < bounding.left + getSide(scrollThreshold, "left"))
4459
- moveX = -(bounding.left - rect.left + getSide(scrollMargin, "left"));
4460
- else if (rect.right > bounding.right - getSide(scrollThreshold, "right"))
4461
- moveX = rect.right - bounding.right + getSide(scrollMargin, "right");
4454
+ if (rect.top < bounding.top + getSide$1(scrollThreshold, "top"))
4455
+ moveY = -(bounding.top - rect.top + getSide$1(scrollMargin, "top"));
4456
+ else if (rect.bottom > bounding.bottom - getSide$1(scrollThreshold, "bottom"))
4457
+ 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");
4458
+ if (rect.left < bounding.left + getSide$1(scrollThreshold, "left"))
4459
+ moveX = -(bounding.left - rect.left + getSide$1(scrollMargin, "left"));
4460
+ else if (rect.right > bounding.right - getSide$1(scrollThreshold, "right"))
4461
+ moveX = rect.right - bounding.right + getSide$1(scrollMargin, "right");
4462
4462
  if (moveX || moveY) {
4463
4463
  if (atTop) {
4464
4464
  doc2.defaultView.scrollBy(moveX, moveY);
@@ -9397,10 +9397,10 @@ function checkStateComponent(plugin) {
9397
9397
  if (plugin.spec.state || plugin.spec.filterTransaction || plugin.spec.appendTransaction)
9398
9398
  throw new RangeError("Plugins passed directly to the view must not have a state component");
9399
9399
  }
9400
- const floor = Math.floor;
9400
+ const floor$1 = Math.floor;
9401
9401
  const abs = Math.abs;
9402
- const min$1 = (a, b) => a < b ? a : b;
9403
- const max$1 = (a, b) => a > b ? a : b;
9402
+ const min$2 = (a, b) => a < b ? a : b;
9403
+ const max$2 = (a, b) => a > b ? a : b;
9404
9404
  const isNegativeZero = (n) => n !== 0 ? n < 0 : 1 / n < 0;
9405
9405
  const BIT7 = 64;
9406
9406
  const BIT8 = 128;
@@ -9408,7 +9408,7 @@ const BIT30 = 1 << 29;
9408
9408
  const BITS6 = 63;
9409
9409
  const BITS7 = 127;
9410
9410
  const BITS31 = 2147483647;
9411
- const isInteger = Number.isInteger || ((num) => typeof num === "number" && isFinite(num) && floor(num) === num);
9411
+ const isInteger = Number.isInteger || ((num) => typeof num === "number" && isFinite(num) && floor$1(num) === num);
9412
9412
  const create$2 = () => /* @__PURE__ */ new Set();
9413
9413
  const isArray = Array.isArray;
9414
9414
  const fromCharCode = String.fromCharCode;
@@ -9472,7 +9472,7 @@ const verifyLen = (encoder, len) => {
9472
9472
  const bufferLen = encoder.cbuf.length;
9473
9473
  if (bufferLen - encoder.cpos < len) {
9474
9474
  encoder.bufs.push(new Uint8Array(encoder.cbuf.buffer, 0, encoder.cpos));
9475
- encoder.cbuf = new Uint8Array(max$1(bufferLen, len) * 2);
9475
+ encoder.cbuf = new Uint8Array(max$2(bufferLen, len) * 2);
9476
9476
  encoder.cpos = 0;
9477
9477
  }
9478
9478
  };
@@ -9488,7 +9488,7 @@ const write$1 = (encoder, num) => {
9488
9488
  const writeVarUint = (encoder, num) => {
9489
9489
  while (num > BITS7) {
9490
9490
  write$1(encoder, BIT8 | BITS7 & num);
9491
- num = floor(num / 128);
9491
+ num = floor$1(num / 128);
9492
9492
  }
9493
9493
  write$1(encoder, BITS7 & num);
9494
9494
  };
@@ -9498,10 +9498,10 @@ const writeVarInt = (encoder, num) => {
9498
9498
  num = -num;
9499
9499
  }
9500
9500
  write$1(encoder, (num > BITS6 ? BIT8 : 0) | (isNegative ? BIT7 : 0) | BITS6 & num);
9501
- num = floor(num / 64);
9501
+ num = floor$1(num / 64);
9502
9502
  while (num > 0) {
9503
9503
  write$1(encoder, (num > BITS7 ? BIT8 : 0) | BITS7 & num);
9504
- num = floor(num / 128);
9504
+ num = floor$1(num / 128);
9505
9505
  }
9506
9506
  };
9507
9507
  const _strBuffer = new Uint8Array(3e4);
@@ -9534,13 +9534,13 @@ utf8TextEncoder.encodeInto ? _writeVarStringNative : _writeVarStringPolyfill;
9534
9534
  const writeUint8Array = (encoder, uint8Array) => {
9535
9535
  const bufferLen = encoder.cbuf.length;
9536
9536
  const cpos = encoder.cpos;
9537
- const leftCopyLen = min$1(bufferLen - cpos, uint8Array.length);
9537
+ const leftCopyLen = min$2(bufferLen - cpos, uint8Array.length);
9538
9538
  const rightCopyLen = uint8Array.length - leftCopyLen;
9539
9539
  encoder.cbuf.set(uint8Array.subarray(0, leftCopyLen), cpos);
9540
9540
  encoder.cpos += leftCopyLen;
9541
9541
  if (rightCopyLen > 0) {
9542
9542
  encoder.bufs.push(encoder.cbuf);
9543
- encoder.cbuf = new Uint8Array(max$1(bufferLen * 2, rightCopyLen));
9543
+ encoder.cbuf = new Uint8Array(max$2(bufferLen * 2, rightCopyLen));
9544
9544
  encoder.cbuf.set(uint8Array.subarray(leftCopyLen));
9545
9545
  encoder.cpos = rightCopyLen;
9546
9546
  }
@@ -9682,7 +9682,7 @@ const ySyncPluginKey = new PluginKey("y-sync");
9682
9682
  const yUndoPluginKey = new PluginKey("y-undo");
9683
9683
  const yCursorPluginKey = new PluginKey("yjs-cursor");
9684
9684
  const rand = Math.random;
9685
- const oneOf = (arr) => arr[floor(rand() * arr.length)];
9685
+ const oneOf = (arr) => arr[floor$1(rand() * arr.length)];
9686
9686
  const undefinedToNull = (v) => v === void 0 ? null : v;
9687
9687
  class VarStoragePolyfill {
9688
9688
  constructor() {
@@ -9712,12 +9712,12 @@ try {
9712
9712
  } catch (e) {
9713
9713
  }
9714
9714
  const varStorage = _localStorage;
9715
- const isNode = typeof process$1 !== "undefined" && process$1.release && /node|io\.js/.test(process$1.release.name) && Object.prototype.toString.call(typeof process$1 !== "undefined" ? process$1 : 0) === "[object process]";
9716
- const isBrowser$1 = typeof window !== "undefined" && typeof document !== "undefined" && !isNode;
9715
+ const isNode$1 = typeof process$1 !== "undefined" && process$1.release && /node|io\.js/.test(process$1.release.name) && Object.prototype.toString.call(typeof process$1 !== "undefined" ? process$1 : 0) === "[object process]";
9716
+ const isBrowser$1 = typeof window !== "undefined" && typeof document !== "undefined" && !isNode$1;
9717
9717
  let params;
9718
9718
  const computeParams = () => {
9719
9719
  if (params === void 0) {
9720
- if (isNode) {
9720
+ if (isNode$1) {
9721
9721
  params = create();
9722
9722
  const pargs = process$1.argv;
9723
9723
  let currParamName = null;
@@ -9754,12 +9754,12 @@ const computeParams = () => {
9754
9754
  return params;
9755
9755
  };
9756
9756
  const hasParam = (name) => computeParams().has(name);
9757
- const getVariable = (name) => isNode ? undefinedToNull(process$1.env[name.toUpperCase().replaceAll("-", "_")]) : undefinedToNull(varStorage.getItem(name));
9757
+ const getVariable = (name) => isNode$1 ? undefinedToNull(process$1.env[name.toUpperCase().replaceAll("-", "_")]) : undefinedToNull(varStorage.getItem(name));
9758
9758
  const hasConf = (name) => hasParam("--" + name) || getVariable(name) !== null;
9759
9759
  hasConf("production");
9760
- const forceColor = isNode && isOneOf(process$1.env.FORCE_COLOR, ["true", "1", "2"]);
9760
+ const forceColor = isNode$1 && isOneOf(process$1.env.FORCE_COLOR, ["true", "1", "2"]);
9761
9761
  forceColor || !hasParam("--no-colors") && // @todo deprecate --no-colors
9762
- !hasConf("no-color") && (!isNode || process$1.stdout.isTTY) && (!isNode || hasParam("--color") || getVariable("COLORTERM") !== null || (getVariable("TERM") || "").includes("color"));
9762
+ !hasConf("no-color") && (!isNode$1 || process$1.stdout.isTTY) && (!isNode$1 || hasParam("--color") || getVariable("COLORTERM") !== null || (getVariable("TERM") || "").includes("color"));
9763
9763
  const doc = (
9764
9764
  /** @type {Document} */
9765
9765
  typeof document !== "undefined" ? document : {}
@@ -10268,8 +10268,8 @@ class ProsemirrorBinding {
10268
10268
  new Slice(Fragment.from(fragmentContent), 0, 0)
10269
10269
  );
10270
10270
  if (sel) {
10271
- const clampedAnchor = min$1(max$1(sel.anchor, 0), tr.doc.content.size);
10272
- const clampedHead = min$1(max$1(sel.head, 0), tr.doc.content.size);
10271
+ const clampedAnchor = min$2(max$2(sel.anchor, 0), tr.doc.content.size);
10272
+ const clampedHead = min$2(max$2(sel.head, 0), tr.doc.content.size);
10273
10273
  tr.setSelection(TextSelection.create(tr.doc, clampedAnchor, clampedHead));
10274
10274
  }
10275
10275
  this.prosemirrorView.dispatch(
@@ -10666,7 +10666,7 @@ const computeChildEqualityFactor = (ytype, pnode, meta) => {
10666
10666
  const pChildren = normalizePNodeContent(pnode);
10667
10667
  const pChildCnt = pChildren.length;
10668
10668
  const yChildCnt = yChildren.length;
10669
- const minCnt = min$1(yChildCnt, pChildCnt);
10669
+ const minCnt = min$2(yChildCnt, pChildCnt);
10670
10670
  let left2 = 0;
10671
10671
  let right2 = 0;
10672
10672
  let foundMappedChild = false;
@@ -10778,7 +10778,7 @@ const updateYFragment = (y, yDomFragment, pNode, meta) => {
10778
10778
  const pChildCnt = pChildren.length;
10779
10779
  const yChildren = yDomFragment.toArray();
10780
10780
  const yChildCnt = yChildren.length;
10781
- const minCnt = min$1(pChildCnt, yChildCnt);
10781
+ const minCnt = min$2(pChildCnt, yChildCnt);
10782
10782
  let left2 = 0;
10783
10783
  let right2 = 0;
10784
10784
  for (; left2 < minCnt; left2++) {
@@ -11151,17 +11151,17 @@ const createDecorations = (state, awareness, awarenessFilter, createCursor, crea
11151
11151
  ystate.binding.mapping
11152
11152
  );
11153
11153
  if (anchor !== null && head !== null) {
11154
- const maxsize = max$1(state.doc.content.size - 1, 0);
11155
- anchor = min$1(anchor, maxsize);
11156
- head = min$1(head, maxsize);
11154
+ const maxsize = max$2(state.doc.content.size - 1, 0);
11155
+ anchor = min$2(anchor, maxsize);
11156
+ head = min$2(head, maxsize);
11157
11157
  decorations.push(
11158
11158
  Decoration.widget(head, () => createCursor(user, clientId), {
11159
11159
  key: clientId + "",
11160
11160
  side: 10
11161
11161
  })
11162
11162
  );
11163
- const from2 = min$1(anchor, head);
11164
- const to = max$1(anchor, head);
11163
+ const from2 = min$2(anchor, head);
11164
+ const to = max$2(anchor, head);
11165
11165
  decorations.push(
11166
11166
  Decoration.inline(from2, to, createSelection(user, clientId), {
11167
11167
  inclusiveEnd: true,
@@ -12792,7 +12792,8 @@ const createHeaderFooterEditor = ({
12792
12792
  appendToBody = true,
12793
12793
  sectionId,
12794
12794
  type,
12795
- availableHeight
12795
+ availableHeight,
12796
+ currentPageNumber
12796
12797
  }) => {
12797
12798
  const parentStyles = editor.converter.getDocumentDefaultStyles();
12798
12799
  const { fontSizePt, typeface } = parentStyles;
@@ -12828,11 +12829,13 @@ const createHeaderFooterEditor = ({
12828
12829
  content: data,
12829
12830
  extensions: getStarterExtensions(),
12830
12831
  documentId: sectionId || "sectionId",
12831
- media: editor.options.media,
12832
- mediaFiles: editor.options.mediaFiles,
12832
+ media: editor.storage.image.media,
12833
+ mediaFiles: editor.storage.image.media,
12833
12834
  fonts: editor.options.fonts,
12834
12835
  isHeaderOrFooter: true,
12835
12836
  annotations: true,
12837
+ currentPageNumber,
12838
+ parentEditor: editor,
12836
12839
  onCreate: (evt) => setEditorToolbar(evt, editor),
12837
12840
  onBlur: (evt) => onHeaderFooterDataUpdate(evt, editor, sectionId, type)
12838
12841
  });
@@ -13950,6 +13953,68 @@ const deleteHeaderFooterFieldAnnotations = ({ editor, fieldIdOrArray }) => {
13950
13953
  );
13951
13954
  });
13952
13955
  };
13956
+ const cleanUpListsWithAnnotations = (fieldsToDelete = [], editor) => {
13957
+ if (!Array.isArray(fieldsToDelete)) fieldsToDelete = [fieldsToDelete];
13958
+ const { doc: doc2 } = editor.state;
13959
+ const docxAnnotations = getAllFieldAnnotations(editor.state) || [];
13960
+ const nodesToDelete = [];
13961
+ fieldsToDelete.forEach((fieldId) => {
13962
+ const matched = docxAnnotations.find((a) => a.node.attrs.fieldId === fieldId);
13963
+ if (!matched) return;
13964
+ const listItem = findParentNodeClosestToPos(
13965
+ doc2.resolve(matched.pos),
13966
+ (node2) => node2.type.name === "listItem"
13967
+ );
13968
+ if (!listItem) return;
13969
+ let remainingNodes = 0;
13970
+ listItem.node.descendants((node2) => {
13971
+ if (node2.type.name === "fieldAnnotation") {
13972
+ remainingNodes += 1;
13973
+ }
13974
+ });
13975
+ let matchingNodesFound = 0;
13976
+ let hasOtherNodes = false;
13977
+ listItem.node.children.forEach((child, index2) => {
13978
+ const { type } = child;
13979
+ if (type.name !== "paragraph" && type.name !== "fieldAnnotation") return;
13980
+ child.children.forEach((inline) => {
13981
+ const isFieldToDelete = fieldsToDelete.includes(inline.attrs.fieldId);
13982
+ const isFieldType = inline.type.name === "fieldAnnotation";
13983
+ const isMatchingField = isFieldType && isFieldToDelete;
13984
+ if (!isFieldType && !isMatchingField) hasOtherNodes = true;
13985
+ if (isMatchingField) matchingNodesFound += 1;
13986
+ });
13987
+ });
13988
+ if (!hasOtherNodes && matchingNodesFound > 0) {
13989
+ remainingNodes -= matchingNodesFound;
13990
+ }
13991
+ if (remainingNodes > 0) {
13992
+ return;
13993
+ }
13994
+ let { pos, node, depth } = listItem;
13995
+ let $pos = doc2.resolve(pos);
13996
+ while (depth > 0) {
13997
+ const parent = $pos.node(depth - 1);
13998
+ if (parent.childCount === 1) {
13999
+ depth -= 1;
14000
+ pos = $pos.before(depth);
14001
+ node = parent;
14002
+ $pos = doc2.resolve(pos);
14003
+ } else {
14004
+ break;
14005
+ }
14006
+ }
14007
+ if (!nodesToDelete.some((n) => n.pos === pos)) {
14008
+ nodesToDelete.push({ pos, node });
14009
+ }
14010
+ });
14011
+ if (!nodesToDelete.length) return;
14012
+ const tr = editor.state.tr;
14013
+ nodesToDelete.sort((a, b) => b.pos - a.pos).forEach(({ pos, node }) => {
14014
+ tr.delete(pos, pos + node.nodeSize);
14015
+ });
14016
+ editor.view.dispatch(tr);
14017
+ };
13953
14018
  const AnnotatorHelpers = {
13954
14019
  getFieldAttrs,
13955
14020
  processTables,
@@ -13957,7 +14022,8 @@ const AnnotatorHelpers = {
13957
14022
  annotateHeadersAndFooters,
13958
14023
  getAllHeaderFooterEditors,
13959
14024
  updateHeaderFooterFieldAnnotations,
13960
- deleteHeaderFooterFieldAnnotations
14025
+ deleteHeaderFooterFieldAnnotations,
14026
+ cleanUpListsWithAnnotations
13961
14027
  };
13962
14028
  const CollaborationPluginKey = new PluginKey("collaboration");
13963
14029
  const Collaboration = Extension.create({
@@ -14117,6 +14183,19 @@ function useHighContrastMode() {
14117
14183
  setHighContrastMode
14118
14184
  };
14119
14185
  }
14186
+ const findWordBounds = (doc2, pos) => {
14187
+ const $pos = doc2.resolve(pos);
14188
+ const parent = $pos.parent;
14189
+ const offset2 = $pos.parentOffset;
14190
+ const text = parent.textContent;
14191
+ if (!text) return { from: pos, to: pos };
14192
+ let start2 = offset2, end2 = offset2;
14193
+ while (start2 > 0 && /\w/.test(text[start2 - 1])) start2--;
14194
+ while (end2 < text.length && /\w/.test(text[end2])) end2++;
14195
+ const from2 = $pos.start() + start2;
14196
+ const to = $pos.start() + end2;
14197
+ return { from: from2, to };
14198
+ };
14120
14199
  const _Editor = class _Editor extends EventEmitter {
14121
14200
  /**
14122
14201
  * Create a new Editor instance
@@ -14388,6 +14467,7 @@ const _Editor = class _Editor extends EventEmitter {
14388
14467
  __privateMethod(this, _Editor_instances, initMedia_fn).call(this);
14389
14468
  const doc2 = __privateMethod(this, _Editor_instances, generatePmData_fn).call(this);
14390
14469
  const tr = this.state.tr.replaceWith(0, this.state.doc.content.size, doc2);
14470
+ tr.setMeta("replaceContent", true);
14391
14471
  this.view.dispatch(tr);
14392
14472
  }
14393
14473
  /**
@@ -14795,7 +14875,7 @@ const _Editor = class _Editor extends EventEmitter {
14795
14875
  * @returns {Object | void} Migration results
14796
14876
  */
14797
14877
  processCollaborationMigrations() {
14798
- console.debug("[checkVersionMigrations] Current editor version", "0.12.35");
14878
+ console.debug("[checkVersionMigrations] Current editor version", "0.12.36-next.10");
14799
14879
  if (!this.options.ydoc) return;
14800
14880
  const metaMap = this.options.ydoc.getMap("meta");
14801
14881
  let docVersion = metaMap.get("version");
@@ -15256,6 +15336,10 @@ createView_fn = function() {
15256
15336
  pm.classList.remove("header-footer-edit");
15257
15337
  pm.setAttribute("aria-readonly", false);
15258
15338
  }
15339
+ const { state: state2, dispatch } = view;
15340
+ const word = findWordBounds(state2.doc, pos);
15341
+ const tr = state2.tr.setSelection(TextSelection.create(state2.doc, word.from, word.to));
15342
+ dispatch(tr);
15259
15343
  }
15260
15344
  });
15261
15345
  const newState = this.state.reconfigure({
@@ -15694,7 +15778,14 @@ const LineHeight = Extension.create({
15694
15778
  parseDOM: (el) => el.style.lineHeight,
15695
15779
  renderDOM: (attrs) => {
15696
15780
  if (!attrs.lineHeight) return {};
15697
- return { style: getLineHeightValueString(attrs.lineHeight, this.options.defaults.unit, attrs.spacing?.lineRule) };
15781
+ const lineHeightStyle = getLineHeightValueString(
15782
+ attrs.lineHeight,
15783
+ this.options.defaults.unit,
15784
+ attrs.spacing?.lineRule
15785
+ );
15786
+ return {
15787
+ style: `${lineHeightStyle}`
15788
+ };
15698
15789
  }
15699
15790
  }
15700
15791
  }
@@ -17619,7 +17710,9 @@ const Paragraph = Node$1.create({
17619
17710
  renderDOM: (attrs) => {
17620
17711
  const { spacing } = attrs;
17621
17712
  if (!spacing) return {};
17622
- const style = getSpacingStyleString(spacing);
17713
+ const spacingCopy = { ...spacing };
17714
+ if (attrs.lineHeight) delete spacingCopy.line;
17715
+ const style = getSpacingStyleString(spacingCopy);
17623
17716
  if (style) return { style };
17624
17717
  return {};
17625
17718
  }
@@ -20796,8 +20889,8 @@ const TableCell = Node$1.create({
20796
20889
  cellMargins: {
20797
20890
  renderDOM({ cellMargins }) {
20798
20891
  if (!cellMargins) return {};
20799
- const sides = ["top", "right", "bottom", "left"];
20800
- const style = sides.map((side) => {
20892
+ const sides2 = ["top", "right", "bottom", "left"];
20893
+ const style = sides2.map((side) => {
20801
20894
  const margin = cellMargins?.[side];
20802
20895
  if (margin) return `padding-${side}: ${margin}px;`;
20803
20896
  return "";
@@ -20809,8 +20902,8 @@ const TableCell = Node$1.create({
20809
20902
  default: () => createCellBorders(),
20810
20903
  renderDOM({ borders }) {
20811
20904
  if (!borders) return {};
20812
- const sides = ["top", "right", "bottom", "left"];
20813
- const style = sides.map((side) => {
20905
+ const sides2 = ["top", "right", "bottom", "left"];
20906
+ const style = sides2.map((side) => {
20814
20907
  const border = borders?.[side];
20815
20908
  if (border && border.val === "none") return `border-${side}: ${border.val};`;
20816
20909
  if (border) return `border-${side}: ${border.size}px solid ${border.color || "black"};`;
@@ -22568,32 +22661,89 @@ const PageNumber = Node$1.create({
22568
22661
  name: "page-number",
22569
22662
  group: "inline",
22570
22663
  inline: true,
22571
- content: "text*",
22664
+ atom: true,
22665
+ selectable: false,
22666
+ draggable: false,
22667
+ selectable: false,
22668
+ defining: true,
22669
+ content: "",
22572
22670
  addOptions() {
22573
22671
  return {
22574
22672
  htmlAttributes: {
22673
+ contenteditable: false,
22575
22674
  "data-id": "auto-page-number",
22576
22675
  "aria-label": "Page number node"
22577
22676
  }
22578
22677
  };
22579
22678
  },
22679
+ addAttributes() {
22680
+ return {
22681
+ marksAsAttrs: {
22682
+ default: null,
22683
+ rendered: false
22684
+ }
22685
+ };
22686
+ },
22687
+ addNodeView() {
22688
+ return ({ node, editor, getPos, decorations }) => {
22689
+ const htmlAttributes = this.options.htmlAttributes;
22690
+ return new AutoPageNumberNodeView(node, getPos, decorations, editor, htmlAttributes);
22691
+ };
22692
+ },
22580
22693
  parseDOM() {
22581
22694
  return [{ tag: 'span[data-id="auto-page-number"' }];
22582
22695
  },
22583
22696
  renderDOM({ htmlAttributes }) {
22584
- return ["span", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
22697
+ return ["span", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes)];
22698
+ },
22699
+ addCommands() {
22700
+ return {
22701
+ addAutoPageNumber: () => ({ tr, dispatch, state, editor }) => {
22702
+ const { options } = editor;
22703
+ if (!options.isHeaderOrFooter) return false;
22704
+ const { schema } = state;
22705
+ const pageNumberType = schema?.nodes?.["page-number"];
22706
+ if (!pageNumberType) return false;
22707
+ const pageNumberNodeJSON = { type: "page-number" };
22708
+ const pageNumberNode = schema.nodeFromJSON(pageNumberNodeJSON);
22709
+ if (dispatch) {
22710
+ tr.replaceSelectionWith(pageNumberNode, false);
22711
+ tr.setMeta("forceUpdatePagination", true);
22712
+ }
22713
+ return true;
22714
+ }
22715
+ };
22716
+ },
22717
+ addShortcuts() {
22718
+ return {
22719
+ "Mod-Shift-alt-p": () => this.editor.commands.addAutoPageNumber()
22720
+ };
22585
22721
  }
22586
22722
  });
22587
22723
  const TotalPageCount = Node$1.create({
22588
22724
  name: "total-page-number",
22589
22725
  group: "inline",
22590
22726
  inline: true,
22727
+ atom: true,
22728
+ selectable: false,
22729
+ draggable: false,
22730
+ selectable: false,
22591
22731
  content: "text*",
22592
22732
  addOptions() {
22593
22733
  return {
22594
22734
  htmlAttributes: {
22735
+ contenteditable: false,
22595
22736
  "data-id": "auto-total-pages",
22596
- "aria-label": "Total page count node"
22737
+ "aria-label": "Total page count node",
22738
+ "class": "sd-editor-auto-total-pages"
22739
+ }
22740
+ };
22741
+ },
22742
+ addAttributes() {
22743
+ return {
22744
+ marksAsAttrs: {
22745
+ default: null,
22746
+ rendered: false
22597
22747
  }
22598
22748
  };
22599
22749
  },
@@ -22602,8 +22752,139 @@ const TotalPageCount = Node$1.create({
22602
22752
  },
22603
22753
  renderDOM({ htmlAttributes }) {
22604
22754
  return ["span", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
22755
+ },
22756
+ addCommands() {
22757
+ return {
22758
+ addTotalPageCount: () => ({ tr, dispatch, state, editor }) => {
22759
+ const { options } = editor;
22760
+ if (!options.isHeaderOrFooter) return false;
22761
+ const { schema } = state;
22762
+ const pageNumberType = schema.nodes?.["total-page-number"];
22763
+ if (!pageNumberType) return false;
22764
+ const currentPages = editor?.options?.parentEditor?.currentTotalPages || 1;
22765
+ const pageNumberNode = {
22766
+ type: "total-page-number",
22767
+ content: [{ type: "text", text: String(currentPages) }]
22768
+ };
22769
+ const pageNode = schema.nodeFromJSON(pageNumberNode);
22770
+ if (dispatch) {
22771
+ tr.replaceSelectionWith(pageNode, false);
22772
+ }
22773
+ return true;
22774
+ }
22775
+ };
22776
+ },
22777
+ addShortcuts() {
22778
+ return {
22779
+ "Mod-Shift-alt-c": () => this.editor.commands.addTotalPageCount()
22780
+ };
22605
22781
  }
22606
22782
  });
22783
+ class AutoPageNumberNodeView {
22784
+ constructor(node, getPos, decorations, editor, htmlAttributes = {}) {
22785
+ __privateAdd(this, _AutoPageNumberNodeView_instances);
22786
+ this.node = node;
22787
+ this.editor = editor;
22788
+ this.view = editor.view;
22789
+ this.getPos = getPos;
22790
+ this.editor = editor;
22791
+ this.dom = __privateMethod(this, _AutoPageNumberNodeView_instances, renderDom_fn).call(this, node, htmlAttributes);
22792
+ }
22793
+ update(node) {
22794
+ if (node.type !== this.node.type) return false;
22795
+ this.node = node;
22796
+ return true;
22797
+ }
22798
+ }
22799
+ _AutoPageNumberNodeView_instances = new WeakSet();
22800
+ renderDom_fn = function(node, htmlAttributes) {
22801
+ const pageText = this.editor.options.currentPageNumber || "1";
22802
+ const content = document.createTextNode(String(pageText));
22803
+ const nodeContent = document.createElement("span");
22804
+ nodeContent.className = "sd-editor-auto-page-number";
22805
+ nodeContent.setAttribute("data-id", "auto-page-number");
22806
+ nodeContent.setAttribute("aria-label", "Page number node");
22807
+ const currentPos = this.getPos();
22808
+ const { styles, marks } = getMarksFromNeighbors(currentPos, this.view);
22809
+ __privateMethod(this, _AutoPageNumberNodeView_instances, scheduleUpdateNodeStyle_fn).call(this, currentPos, marks);
22810
+ Object.assign(nodeContent.style, styles);
22811
+ nodeContent.appendChild(content);
22812
+ Object.entries(htmlAttributes).forEach(([key, value]) => {
22813
+ if (value) nodeContent.setAttribute(key, value);
22814
+ });
22815
+ return nodeContent;
22816
+ };
22817
+ scheduleUpdateNodeStyle_fn = function(pos, marks) {
22818
+ setTimeout(() => {
22819
+ const { state } = this.editor;
22820
+ const { dispatch } = this.view;
22821
+ const node = state.doc.nodeAt(pos);
22822
+ if (!node) return;
22823
+ const currentMarks = node.attrs.marksAsAttrs || [];
22824
+ const newMarks = marks.map((m) => ({ type: m.type.name, attrs: m.attrs }));
22825
+ const isEqual = JSON.stringify(currentMarks) === JSON.stringify(newMarks);
22826
+ if (isEqual) return;
22827
+ const newAttrs = {
22828
+ ...node.attrs,
22829
+ marksAsAttrs: newMarks
22830
+ };
22831
+ const tr = state.tr.setNodeMarkup(pos, void 0, newAttrs);
22832
+ dispatch(tr);
22833
+ }, 0);
22834
+ };
22835
+ const getMarksFromNeighbors = (currentPos, view) => {
22836
+ const $pos = view.state.doc.resolve(currentPos);
22837
+ const styles = {};
22838
+ const marks = [];
22839
+ const before = $pos.nodeBefore;
22840
+ if (before) {
22841
+ Object.assign(styles, processMarks(before.marks));
22842
+ marks.push(...before.marks);
22843
+ }
22844
+ const after = $pos.nodeAfter;
22845
+ if (after) {
22846
+ Object.assign(styles, { ...styles, ...processMarks(after.marks) });
22847
+ marks.push(...after.marks);
22848
+ }
22849
+ return {
22850
+ styles,
22851
+ marks
22852
+ };
22853
+ };
22854
+ const processMarks = (marks) => {
22855
+ const styles = {};
22856
+ marks.forEach((mark) => {
22857
+ const { type, attrs } = mark;
22858
+ switch (type.name) {
22859
+ case "textStyle":
22860
+ if (attrs.fontFamily) styles["font-family"] = attrs.fontFamily;
22861
+ if (attrs.fontSize) styles["font-size"] = attrs.fontSize;
22862
+ if (attrs.color) styles["color"] = attrs.color;
22863
+ if (attrs.backgroundColor) styles["background-color"] = attrs.backgroundColor;
22864
+ break;
22865
+ case "bold":
22866
+ styles["font-weight"] = "bold";
22867
+ break;
22868
+ case "italic":
22869
+ styles["font-style"] = "italic";
22870
+ break;
22871
+ case "underline":
22872
+ styles["text-decoration"] = (styles["text-decoration"] || "") + " underline";
22873
+ break;
22874
+ case "strike":
22875
+ styles["text-decoration"] = (styles["text-decoration"] || "") + " line-through";
22876
+ break;
22877
+ default:
22878
+ if (attrs?.style) {
22879
+ Object.entries(attrs.style).forEach(([key, value]) => {
22880
+ styles[key] = value;
22881
+ });
22882
+ }
22883
+ break;
22884
+ }
22885
+ });
22886
+ return styles;
22887
+ };
22607
22888
  const ShapeContainer = Node$1.create({
22608
22889
  name: "shapeContainer",
22609
22890
  group: "block",
@@ -23616,10 +23897,10 @@ var beforeWrite = "beforeWrite";
23616
23897
  var write = "write";
23617
23898
  var afterWrite = "afterWrite";
23618
23899
  var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
23619
- function getNodeName(element) {
23900
+ function getNodeName$1(element) {
23620
23901
  return element ? (element.nodeName || "").toLowerCase() : null;
23621
23902
  }
23622
- function getWindow(node) {
23903
+ function getWindow$1(node) {
23623
23904
  if (node == null) {
23624
23905
  return window;
23625
23906
  }
@@ -23629,19 +23910,19 @@ function getWindow(node) {
23629
23910
  }
23630
23911
  return node;
23631
23912
  }
23632
- function isElement$1(node) {
23633
- var OwnElement = getWindow(node).Element;
23913
+ function isElement$2(node) {
23914
+ var OwnElement = getWindow$1(node).Element;
23634
23915
  return node instanceof OwnElement || node instanceof Element;
23635
23916
  }
23636
- function isHTMLElement(node) {
23637
- var OwnElement = getWindow(node).HTMLElement;
23917
+ function isHTMLElement$1(node) {
23918
+ var OwnElement = getWindow$1(node).HTMLElement;
23638
23919
  return node instanceof OwnElement || node instanceof HTMLElement;
23639
23920
  }
23640
- function isShadowRoot(node) {
23921
+ function isShadowRoot$1(node) {
23641
23922
  if (typeof ShadowRoot === "undefined") {
23642
23923
  return false;
23643
23924
  }
23644
- var OwnElement = getWindow(node).ShadowRoot;
23925
+ var OwnElement = getWindow$1(node).ShadowRoot;
23645
23926
  return node instanceof OwnElement || node instanceof ShadowRoot;
23646
23927
  }
23647
23928
  function applyStyles(_ref) {
@@ -23650,7 +23931,7 @@ function applyStyles(_ref) {
23650
23931
  var style = state.styles[name] || {};
23651
23932
  var attributes = state.attributes[name] || {};
23652
23933
  var element = state.elements[name];
23653
- if (!isHTMLElement(element) || !getNodeName(element)) {
23934
+ if (!isHTMLElement$1(element) || !getNodeName$1(element)) {
23654
23935
  return;
23655
23936
  }
23656
23937
  Object.assign(element.style, style);
@@ -23692,7 +23973,7 @@ function effect$2(_ref2) {
23692
23973
  style2[property] = "";
23693
23974
  return style2;
23694
23975
  }, {});
23695
- if (!isHTMLElement(element) || !getNodeName(element)) {
23976
+ if (!isHTMLElement$1(element) || !getNodeName$1(element)) {
23696
23977
  return;
23697
23978
  }
23698
23979
  Object.assign(element.style, style);
@@ -23713,9 +23994,9 @@ const applyStyles$1 = {
23713
23994
  function getBasePlacement$1(placement) {
23714
23995
  return placement.split("-")[0];
23715
23996
  }
23716
- var max = Math.max;
23717
- var min = Math.min;
23718
- var round = Math.round;
23997
+ var max$1 = Math.max;
23998
+ var min$1 = Math.min;
23999
+ var round$1 = Math.round;
23719
24000
  function getUAString() {
23720
24001
  var uaData = navigator.userAgentData;
23721
24002
  if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
@@ -23728,7 +24009,7 @@ function getUAString() {
23728
24009
  function isLayoutViewport() {
23729
24010
  return !/^((?!chrome|android).)*safari/i.test(getUAString());
23730
24011
  }
23731
- function getBoundingClientRect(element, includeScale, isFixedStrategy) {
24012
+ function getBoundingClientRect$1(element, includeScale, isFixedStrategy) {
23732
24013
  if (includeScale === void 0) {
23733
24014
  includeScale = false;
23734
24015
  }
@@ -23738,11 +24019,11 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy) {
23738
24019
  var clientRect2 = element.getBoundingClientRect();
23739
24020
  var scaleX = 1;
23740
24021
  var scaleY = 1;
23741
- if (includeScale && isHTMLElement(element)) {
23742
- scaleX = element.offsetWidth > 0 ? round(clientRect2.width) / element.offsetWidth || 1 : 1;
23743
- scaleY = element.offsetHeight > 0 ? round(clientRect2.height) / element.offsetHeight || 1 : 1;
24022
+ if (includeScale && isHTMLElement$1(element)) {
24023
+ scaleX = element.offsetWidth > 0 ? round$1(clientRect2.width) / element.offsetWidth || 1 : 1;
24024
+ scaleY = element.offsetHeight > 0 ? round$1(clientRect2.height) / element.offsetHeight || 1 : 1;
23744
24025
  }
23745
- var _ref = isElement$1(element) ? getWindow(element) : window, visualViewport = _ref.visualViewport;
24026
+ var _ref = isElement$2(element) ? getWindow$1(element) : window, visualViewport = _ref.visualViewport;
23746
24027
  var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
23747
24028
  var x = (clientRect2.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
23748
24029
  var y = (clientRect2.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
@@ -23760,7 +24041,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy) {
23760
24041
  };
23761
24042
  }
23762
24043
  function getLayoutRect(element) {
23763
- var clientRect2 = getBoundingClientRect(element);
24044
+ var clientRect2 = getBoundingClientRect$1(element);
23764
24045
  var width = element.offsetWidth;
23765
24046
  var height = element.offsetHeight;
23766
24047
  if (Math.abs(clientRect2.width - width) <= 1) {
@@ -23780,7 +24061,7 @@ function contains(parent, child) {
23780
24061
  var rootNode = child.getRootNode && child.getRootNode();
23781
24062
  if (parent.contains(child)) {
23782
24063
  return true;
23783
- } else if (rootNode && isShadowRoot(rootNode)) {
24064
+ } else if (rootNode && isShadowRoot$1(rootNode)) {
23784
24065
  var next = child;
23785
24066
  do {
23786
24067
  if (next && parent.isSameNode(next)) {
@@ -23791,20 +24072,20 @@ function contains(parent, child) {
23791
24072
  }
23792
24073
  return false;
23793
24074
  }
23794
- function getComputedStyle$1(element) {
23795
- return getWindow(element).getComputedStyle(element);
24075
+ function getComputedStyle$2(element) {
24076
+ return getWindow$1(element).getComputedStyle(element);
23796
24077
  }
23797
- function isTableElement(element) {
23798
- return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0;
24078
+ function isTableElement$1(element) {
24079
+ return ["table", "td", "th"].indexOf(getNodeName$1(element)) >= 0;
23799
24080
  }
23800
- function getDocumentElement(element) {
23801
- return ((isElement$1(element) ? element.ownerDocument : (
24081
+ function getDocumentElement$1(element) {
24082
+ return ((isElement$2(element) ? element.ownerDocument : (
23802
24083
  // $FlowFixMe[prop-missing]
23803
24084
  element.document
23804
24085
  )) || window.document).documentElement;
23805
24086
  }
23806
- function getParentNode(element) {
23807
- if (getNodeName(element) === "html") {
24087
+ function getParentNode$1(element) {
24088
+ if (getNodeName$1(element) === "html") {
23808
24089
  return element;
23809
24090
  }
23810
24091
  return (
@@ -23813,33 +24094,33 @@ function getParentNode(element) {
23813
24094
  // $FlowFixMe[prop-missing]
23814
24095
  element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
23815
24096
  element.parentNode || // DOM Element detected
23816
- (isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
24097
+ (isShadowRoot$1(element) ? element.host : null) || // ShadowRoot detected
23817
24098
  // $FlowFixMe[incompatible-call]: HTMLElement is a Node
23818
- getDocumentElement(element)
24099
+ getDocumentElement$1(element)
23819
24100
  );
23820
24101
  }
23821
- function getTrueOffsetParent(element) {
23822
- if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
23823
- getComputedStyle$1(element).position === "fixed") {
24102
+ function getTrueOffsetParent$1(element) {
24103
+ if (!isHTMLElement$1(element) || // https://github.com/popperjs/popper-core/issues/837
24104
+ getComputedStyle$2(element).position === "fixed") {
23824
24105
  return null;
23825
24106
  }
23826
24107
  return element.offsetParent;
23827
24108
  }
23828
- function getContainingBlock(element) {
24109
+ function getContainingBlock$1(element) {
23829
24110
  var isFirefox = /firefox/i.test(getUAString());
23830
24111
  var isIE = /Trident/i.test(getUAString());
23831
- if (isIE && isHTMLElement(element)) {
23832
- var elementCss = getComputedStyle$1(element);
24112
+ if (isIE && isHTMLElement$1(element)) {
24113
+ var elementCss = getComputedStyle$2(element);
23833
24114
  if (elementCss.position === "fixed") {
23834
24115
  return null;
23835
24116
  }
23836
24117
  }
23837
- var currentNode = getParentNode(element);
23838
- if (isShadowRoot(currentNode)) {
24118
+ var currentNode = getParentNode$1(element);
24119
+ if (isShadowRoot$1(currentNode)) {
23839
24120
  currentNode = currentNode.host;
23840
24121
  }
23841
- while (isHTMLElement(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
23842
- var css = getComputedStyle$1(currentNode);
24122
+ while (isHTMLElement$1(currentNode) && ["html", "body"].indexOf(getNodeName$1(currentNode)) < 0) {
24123
+ var css = getComputedStyle$2(currentNode);
23843
24124
  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") {
23844
24125
  return currentNode;
23845
24126
  } else {
@@ -23848,22 +24129,22 @@ function getContainingBlock(element) {
23848
24129
  }
23849
24130
  return null;
23850
24131
  }
23851
- function getOffsetParent(element) {
23852
- var window2 = getWindow(element);
23853
- var offsetParent = getTrueOffsetParent(element);
23854
- while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === "static") {
23855
- offsetParent = getTrueOffsetParent(offsetParent);
24132
+ function getOffsetParent$1(element) {
24133
+ var window2 = getWindow$1(element);
24134
+ var offsetParent = getTrueOffsetParent$1(element);
24135
+ while (offsetParent && isTableElement$1(offsetParent) && getComputedStyle$2(offsetParent).position === "static") {
24136
+ offsetParent = getTrueOffsetParent$1(offsetParent);
23856
24137
  }
23857
- if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle$1(offsetParent).position === "static")) {
24138
+ if (offsetParent && (getNodeName$1(offsetParent) === "html" || getNodeName$1(offsetParent) === "body" && getComputedStyle$2(offsetParent).position === "static")) {
23858
24139
  return window2;
23859
24140
  }
23860
- return offsetParent || getContainingBlock(element) || window2;
24141
+ return offsetParent || getContainingBlock$1(element) || window2;
23861
24142
  }
23862
24143
  function getMainAxisFromPlacement(placement) {
23863
24144
  return ["top", "bottom"].indexOf(placement) >= 0 ? "x" : "y";
23864
24145
  }
23865
- function within(min$12, value, max$12) {
23866
- return max(min$12, min(value, max$12));
24146
+ function within(min2, value, max2) {
24147
+ return max$1(min2, min$1(value, max2));
23867
24148
  }
23868
24149
  function withinMaxClamp(min2, value, max2) {
23869
24150
  var v = within(min2, value, max2);
@@ -23910,7 +24191,7 @@ function arrow(_ref) {
23910
24191
  var maxProp = axis === "y" ? bottom : right;
23911
24192
  var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets2[axis] - state.rects.popper[len];
23912
24193
  var startDiff = popperOffsets2[axis] - state.rects.reference[axis];
23913
- var arrowOffsetParent = getOffsetParent(arrowElement);
24194
+ var arrowOffsetParent = getOffsetParent$1(arrowElement);
23914
24195
  var clientSize = arrowOffsetParent ? axis === "y" ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
23915
24196
  var centerToReference = endDiff / 2 - startDiff / 2;
23916
24197
  var min2 = paddingObject[minProp];
@@ -23959,8 +24240,8 @@ function roundOffsetsByDPR(_ref, win) {
23959
24240
  var x = _ref.x, y = _ref.y;
23960
24241
  var dpr = win.devicePixelRatio || 1;
23961
24242
  return {
23962
- x: round(x * dpr) / dpr || 0,
23963
- y: round(y * dpr) / dpr || 0
24243
+ x: round$1(x * dpr) / dpr || 0,
24244
+ y: round$1(y * dpr) / dpr || 0
23964
24245
  };
23965
24246
  }
23966
24247
  function mapToStyles(_ref2) {
@@ -23982,12 +24263,12 @@ function mapToStyles(_ref2) {
23982
24263
  var sideY = top;
23983
24264
  var win = window;
23984
24265
  if (adaptive) {
23985
- var offsetParent = getOffsetParent(popper2);
24266
+ var offsetParent = getOffsetParent$1(popper2);
23986
24267
  var heightProp = "clientHeight";
23987
24268
  var widthProp = "clientWidth";
23988
- if (offsetParent === getWindow(popper2)) {
23989
- offsetParent = getDocumentElement(popper2);
23990
- if (getComputedStyle$1(offsetParent).position !== "static" && position === "absolute") {
24269
+ if (offsetParent === getWindow$1(popper2)) {
24270
+ offsetParent = getDocumentElement$1(popper2);
24271
+ if (getComputedStyle$2(offsetParent).position !== "static" && position === "absolute") {
23991
24272
  heightProp = "scrollHeight";
23992
24273
  widthProp = "scrollWidth";
23993
24274
  }
@@ -24018,7 +24299,7 @@ function mapToStyles(_ref2) {
24018
24299
  var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
24019
24300
  x,
24020
24301
  y
24021
- }, getWindow(popper2)) : {
24302
+ }, getWindow$1(popper2)) : {
24022
24303
  x,
24023
24304
  y
24024
24305
  };
@@ -24074,7 +24355,7 @@ var passive = {
24074
24355
  function effect(_ref) {
24075
24356
  var state = _ref.state, instance = _ref.instance, options = _ref.options;
24076
24357
  var _options$scroll = options.scroll, scroll = _options$scroll === void 0 ? true : _options$scroll, _options$resize = options.resize, resize = _options$resize === void 0 ? true : _options$resize;
24077
- var window2 = getWindow(state.elements.popper);
24358
+ var window2 = getWindow$1(state.elements.popper);
24078
24359
  var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
24079
24360
  if (scroll) {
24080
24361
  scrollParents.forEach(function(scrollParent) {
@@ -24125,7 +24406,7 @@ function getOppositeVariationPlacement(placement) {
24125
24406
  });
24126
24407
  }
24127
24408
  function getWindowScroll(node) {
24128
- var win = getWindow(node);
24409
+ var win = getWindow$1(node);
24129
24410
  var scrollLeft = win.pageXOffset;
24130
24411
  var scrollTop = win.pageYOffset;
24131
24412
  return {
@@ -24133,12 +24414,12 @@ function getWindowScroll(node) {
24133
24414
  scrollTop
24134
24415
  };
24135
24416
  }
24136
- function getWindowScrollBarX(element) {
24137
- return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
24417
+ function getWindowScrollBarX$1(element) {
24418
+ return getBoundingClientRect$1(getDocumentElement$1(element)).left + getWindowScroll(element).scrollLeft;
24138
24419
  }
24139
- function getViewportRect(element, strategy) {
24140
- var win = getWindow(element);
24141
- var html = getDocumentElement(element);
24420
+ function getViewportRect$1(element, strategy) {
24421
+ var win = getWindow$1(element);
24422
+ var html = getDocumentElement$1(element);
24142
24423
  var visualViewport = win.visualViewport;
24143
24424
  var width = html.clientWidth;
24144
24425
  var height = html.clientHeight;
@@ -24156,21 +24437,21 @@ function getViewportRect(element, strategy) {
24156
24437
  return {
24157
24438
  width,
24158
24439
  height,
24159
- x: x + getWindowScrollBarX(element),
24440
+ x: x + getWindowScrollBarX$1(element),
24160
24441
  y
24161
24442
  };
24162
24443
  }
24163
- function getDocumentRect(element) {
24444
+ function getDocumentRect$1(element) {
24164
24445
  var _element$ownerDocumen;
24165
- var html = getDocumentElement(element);
24446
+ var html = getDocumentElement$1(element);
24166
24447
  var winScroll = getWindowScroll(element);
24167
24448
  var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
24168
- var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
24169
- var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
24170
- var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
24449
+ var width = max$1(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
24450
+ var height = max$1(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
24451
+ var x = -winScroll.scrollLeft + getWindowScrollBarX$1(element);
24171
24452
  var y = -winScroll.scrollTop;
24172
- if (getComputedStyle$1(body || html).direction === "rtl") {
24173
- x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
24453
+ if (getComputedStyle$2(body || html).direction === "rtl") {
24454
+ x += max$1(html.clientWidth, body ? body.clientWidth : 0) - width;
24174
24455
  }
24175
24456
  return {
24176
24457
  width,
@@ -24180,17 +24461,17 @@ function getDocumentRect(element) {
24180
24461
  };
24181
24462
  }
24182
24463
  function isScrollParent(element) {
24183
- var _getComputedStyle = getComputedStyle$1(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
24464
+ var _getComputedStyle = getComputedStyle$2(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
24184
24465
  return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
24185
24466
  }
24186
24467
  function getScrollParent(node) {
24187
- if (["html", "body", "#document"].indexOf(getNodeName(node)) >= 0) {
24468
+ if (["html", "body", "#document"].indexOf(getNodeName$1(node)) >= 0) {
24188
24469
  return node.ownerDocument.body;
24189
24470
  }
24190
- if (isHTMLElement(node) && isScrollParent(node)) {
24471
+ if (isHTMLElement$1(node) && isScrollParent(node)) {
24191
24472
  return node;
24192
24473
  }
24193
- return getScrollParent(getParentNode(node));
24474
+ return getScrollParent(getParentNode$1(node));
24194
24475
  }
24195
24476
  function listScrollParents(element, list) {
24196
24477
  var _element$ownerDocumen;
@@ -24199,15 +24480,15 @@ function listScrollParents(element, list) {
24199
24480
  }
24200
24481
  var scrollParent = getScrollParent(element);
24201
24482
  var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
24202
- var win = getWindow(scrollParent);
24483
+ var win = getWindow$1(scrollParent);
24203
24484
  var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
24204
24485
  var updatedList = list.concat(target);
24205
24486
  return isBody ? updatedList : (
24206
24487
  // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
24207
- updatedList.concat(listScrollParents(getParentNode(target)))
24488
+ updatedList.concat(listScrollParents(getParentNode$1(target)))
24208
24489
  );
24209
24490
  }
24210
- function rectToClientRect(rect) {
24491
+ function rectToClientRect$1(rect) {
24211
24492
  return Object.assign({}, rect, {
24212
24493
  left: rect.x,
24213
24494
  top: rect.y,
@@ -24215,8 +24496,8 @@ function rectToClientRect(rect) {
24215
24496
  bottom: rect.y + rect.height
24216
24497
  });
24217
24498
  }
24218
- function getInnerBoundingClientRect(element, strategy) {
24219
- var rect = getBoundingClientRect(element, false, strategy === "fixed");
24499
+ function getInnerBoundingClientRect$1(element, strategy) {
24500
+ var rect = getBoundingClientRect$1(element, false, strategy === "fixed");
24220
24501
  rect.top = rect.top + element.clientTop;
24221
24502
  rect.left = rect.left + element.clientLeft;
24222
24503
  rect.bottom = rect.top + element.clientHeight;
@@ -24228,29 +24509,29 @@ function getInnerBoundingClientRect(element, strategy) {
24228
24509
  return rect;
24229
24510
  }
24230
24511
  function getClientRectFromMixedType(element, clippingParent, strategy) {
24231
- return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement$1(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
24512
+ return clippingParent === viewport ? rectToClientRect$1(getViewportRect$1(element, strategy)) : isElement$2(clippingParent) ? getInnerBoundingClientRect$1(clippingParent, strategy) : rectToClientRect$1(getDocumentRect$1(getDocumentElement$1(element)));
24232
24513
  }
24233
24514
  function getClippingParents(element) {
24234
- var clippingParents2 = listScrollParents(getParentNode(element));
24235
- var canEscapeClipping = ["absolute", "fixed"].indexOf(getComputedStyle$1(element).position) >= 0;
24236
- var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
24237
- if (!isElement$1(clipperElement)) {
24515
+ var clippingParents2 = listScrollParents(getParentNode$1(element));
24516
+ var canEscapeClipping = ["absolute", "fixed"].indexOf(getComputedStyle$2(element).position) >= 0;
24517
+ var clipperElement = canEscapeClipping && isHTMLElement$1(element) ? getOffsetParent$1(element) : element;
24518
+ if (!isElement$2(clipperElement)) {
24238
24519
  return [];
24239
24520
  }
24240
24521
  return clippingParents2.filter(function(clippingParent) {
24241
- return isElement$1(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== "body";
24522
+ return isElement$2(clippingParent) && contains(clippingParent, clipperElement) && getNodeName$1(clippingParent) !== "body";
24242
24523
  });
24243
24524
  }
24244
- function getClippingRect(element, boundary, rootBoundary, strategy) {
24525
+ function getClippingRect$1(element, boundary, rootBoundary, strategy) {
24245
24526
  var mainClippingParents = boundary === "clippingParents" ? getClippingParents(element) : [].concat(boundary);
24246
24527
  var clippingParents2 = [].concat(mainClippingParents, [rootBoundary]);
24247
24528
  var firstClippingParent = clippingParents2[0];
24248
24529
  var clippingRect = clippingParents2.reduce(function(accRect, clippingParent) {
24249
24530
  var rect = getClientRectFromMixedType(element, clippingParent, strategy);
24250
- accRect.top = max(rect.top, accRect.top);
24251
- accRect.right = min(rect.right, accRect.right);
24252
- accRect.bottom = min(rect.bottom, accRect.bottom);
24253
- accRect.left = max(rect.left, accRect.left);
24531
+ accRect.top = max$1(rect.top, accRect.top);
24532
+ accRect.right = min$1(rect.right, accRect.right);
24533
+ accRect.bottom = min$1(rect.bottom, accRect.bottom);
24534
+ accRect.left = max$1(rect.left, accRect.left);
24254
24535
  return accRect;
24255
24536
  }, getClientRectFromMixedType(element, firstClippingParent, strategy));
24256
24537
  clippingRect.width = clippingRect.right - clippingRect.left;
@@ -24311,7 +24592,7 @@ function computeOffsets(_ref) {
24311
24592
  }
24312
24593
  return offsets;
24313
24594
  }
24314
- function detectOverflow(state, options) {
24595
+ function detectOverflow$1(state, options) {
24315
24596
  if (options === void 0) {
24316
24597
  options = {};
24317
24598
  }
@@ -24320,14 +24601,14 @@ function detectOverflow(state, options) {
24320
24601
  var altContext = elementContext === popper ? reference : popper;
24321
24602
  var popperRect = state.rects.popper;
24322
24603
  var element = state.elements[altBoundary ? altContext : elementContext];
24323
- var clippingClientRect = getClippingRect(isElement$1(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
24324
- var referenceClientRect = getBoundingClientRect(state.elements.reference);
24604
+ var clippingClientRect = getClippingRect$1(isElement$2(element) ? element : element.contextElement || getDocumentElement$1(state.elements.popper), boundary, rootBoundary, strategy);
24605
+ var referenceClientRect = getBoundingClientRect$1(state.elements.reference);
24325
24606
  var popperOffsets2 = computeOffsets({
24326
24607
  reference: referenceClientRect,
24327
24608
  element: popperRect,
24328
24609
  placement
24329
24610
  });
24330
- var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets2));
24611
+ var popperClientRect = rectToClientRect$1(Object.assign({}, popperRect, popperOffsets2));
24331
24612
  var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect;
24332
24613
  var overflowOffsets = {
24333
24614
  top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
@@ -24362,7 +24643,7 @@ function computeAutoPlacement(state, options) {
24362
24643
  allowedPlacements = placements$1;
24363
24644
  }
24364
24645
  var overflows = allowedPlacements.reduce(function(acc, placement2) {
24365
- acc[placement2] = detectOverflow(state, {
24646
+ acc[placement2] = detectOverflow$1(state, {
24366
24647
  placement: placement2,
24367
24648
  boundary,
24368
24649
  rootBoundary,
@@ -24412,7 +24693,7 @@ function flip(_ref) {
24412
24693
  var isStartVariation = getVariation(placement) === start;
24413
24694
  var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
24414
24695
  var len = isVertical ? "width" : "height";
24415
- var overflow = detectOverflow(state, {
24696
+ var overflow = detectOverflow$1(state, {
24416
24697
  placement,
24417
24698
  boundary,
24418
24699
  rootBoundary,
@@ -24477,7 +24758,7 @@ const flip$1 = {
24477
24758
  _skip: false
24478
24759
  }
24479
24760
  };
24480
- function getSideOffsets(overflow, rect, preventedOffsets) {
24761
+ function getSideOffsets$1(overflow, rect, preventedOffsets) {
24481
24762
  if (preventedOffsets === void 0) {
24482
24763
  preventedOffsets = {
24483
24764
  x: 0,
@@ -24491,26 +24772,26 @@ function getSideOffsets(overflow, rect, preventedOffsets) {
24491
24772
  left: overflow.left - rect.width - preventedOffsets.x
24492
24773
  };
24493
24774
  }
24494
- function isAnySideFullyClipped(overflow) {
24775
+ function isAnySideFullyClipped$1(overflow) {
24495
24776
  return [top, right, bottom, left].some(function(side) {
24496
24777
  return overflow[side] >= 0;
24497
24778
  });
24498
24779
  }
24499
- function hide(_ref) {
24780
+ function hide$2(_ref) {
24500
24781
  var state = _ref.state, name = _ref.name;
24501
24782
  var referenceRect = state.rects.reference;
24502
24783
  var popperRect = state.rects.popper;
24503
24784
  var preventedOffsets = state.modifiersData.preventOverflow;
24504
- var referenceOverflow = detectOverflow(state, {
24785
+ var referenceOverflow = detectOverflow$1(state, {
24505
24786
  elementContext: "reference"
24506
24787
  });
24507
- var popperAltOverflow = detectOverflow(state, {
24788
+ var popperAltOverflow = detectOverflow$1(state, {
24508
24789
  altBoundary: true
24509
24790
  });
24510
- var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
24511
- var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
24512
- var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
24513
- var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
24791
+ var referenceClippingOffsets = getSideOffsets$1(referenceOverflow, referenceRect);
24792
+ var popperEscapeOffsets = getSideOffsets$1(popperAltOverflow, popperRect, preventedOffsets);
24793
+ var isReferenceHidden = isAnySideFullyClipped$1(referenceClippingOffsets);
24794
+ var hasPopperEscaped = isAnySideFullyClipped$1(popperEscapeOffsets);
24514
24795
  state.modifiersData[name] = {
24515
24796
  referenceClippingOffsets,
24516
24797
  popperEscapeOffsets,
@@ -24522,12 +24803,12 @@ function hide(_ref) {
24522
24803
  "data-popper-escaped": hasPopperEscaped
24523
24804
  });
24524
24805
  }
24525
- const hide$1 = {
24806
+ const hide$3 = {
24526
24807
  name: "hide",
24527
24808
  enabled: true,
24528
24809
  phase: "main",
24529
24810
  requiresIfExists: ["preventOverflow"],
24530
- fn: hide
24811
+ fn: hide$2
24531
24812
  };
24532
24813
  function distanceAndSkiddingToXY(placement, rects, offset2) {
24533
24814
  var basePlacement = getBasePlacement$1(placement);
@@ -24587,7 +24868,7 @@ function getAltAxis(axis) {
24587
24868
  function preventOverflow(_ref) {
24588
24869
  var state = _ref.state, options = _ref.options, name = _ref.name;
24589
24870
  var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, padding = options.padding, _options$tether = options.tether, tether = _options$tether === void 0 ? true : _options$tether, _options$tetherOffset = options.tetherOffset, tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
24590
- var overflow = detectOverflow(state, {
24871
+ var overflow = detectOverflow$1(state, {
24591
24872
  boundary,
24592
24873
  rootBoundary,
24593
24874
  padding,
@@ -24625,8 +24906,8 @@ function preventOverflow(_ref) {
24625
24906
  var altSide = mainAxis === "y" ? bottom : right;
24626
24907
  var len = mainAxis === "y" ? "height" : "width";
24627
24908
  var offset2 = popperOffsets2[mainAxis];
24628
- var min$12 = offset2 + overflow[mainSide];
24629
- var max$12 = offset2 - overflow[altSide];
24909
+ var min2 = offset2 + overflow[mainSide];
24910
+ var max2 = offset2 - overflow[altSide];
24630
24911
  var additive = tether ? -popperRect[len] / 2 : 0;
24631
24912
  var minLen = variation === start ? referenceRect[len] : popperRect[len];
24632
24913
  var maxLen = variation === start ? -popperRect[len] : -referenceRect[len];
@@ -24641,12 +24922,12 @@ function preventOverflow(_ref) {
24641
24922
  var arrowLen = within(0, referenceRect[len], arrowRect[len]);
24642
24923
  var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
24643
24924
  var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
24644
- var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
24925
+ var arrowOffsetParent = state.elements.arrow && getOffsetParent$1(state.elements.arrow);
24645
24926
  var clientOffset = arrowOffsetParent ? mainAxis === "y" ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
24646
24927
  var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
24647
24928
  var tetherMin = offset2 + minOffset - offsetModifierValue - clientOffset;
24648
24929
  var tetherMax = offset2 + maxOffset - offsetModifierValue;
24649
- var preventedOffset = within(tether ? min(min$12, tetherMin) : min$12, offset2, tether ? max(max$12, tetherMax) : max$12);
24930
+ var preventedOffset = within(tether ? min$1(min2, tetherMin) : min2, offset2, tether ? max$1(max2, tetherMax) : max2);
24650
24931
  popperOffsets2[mainAxis] = preventedOffset;
24651
24932
  data[mainAxis] = preventedOffset - offset2;
24652
24933
  }
@@ -24681,8 +24962,8 @@ function getHTMLElementScroll(element) {
24681
24962
  scrollTop: element.scrollTop
24682
24963
  };
24683
24964
  }
24684
- function getNodeScroll(node) {
24685
- if (node === getWindow(node) || !isHTMLElement(node)) {
24965
+ function getNodeScroll$1(node) {
24966
+ if (node === getWindow$1(node) || !isHTMLElement$1(node)) {
24686
24967
  return getWindowScroll(node);
24687
24968
  } else {
24688
24969
  return getHTMLElementScroll(node);
@@ -24690,18 +24971,18 @@ function getNodeScroll(node) {
24690
24971
  }
24691
24972
  function isElementScaled(element) {
24692
24973
  var rect = element.getBoundingClientRect();
24693
- var scaleX = round(rect.width) / element.offsetWidth || 1;
24694
- var scaleY = round(rect.height) / element.offsetHeight || 1;
24974
+ var scaleX = round$1(rect.width) / element.offsetWidth || 1;
24975
+ var scaleY = round$1(rect.height) / element.offsetHeight || 1;
24695
24976
  return scaleX !== 1 || scaleY !== 1;
24696
24977
  }
24697
24978
  function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
24698
24979
  if (isFixed === void 0) {
24699
24980
  isFixed = false;
24700
24981
  }
24701
- var isOffsetParentAnElement = isHTMLElement(offsetParent);
24702
- var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
24703
- var documentElement = getDocumentElement(offsetParent);
24704
- var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
24982
+ var isOffsetParentAnElement = isHTMLElement$1(offsetParent);
24983
+ var offsetParentIsScaled = isHTMLElement$1(offsetParent) && isElementScaled(offsetParent);
24984
+ var documentElement = getDocumentElement$1(offsetParent);
24985
+ var rect = getBoundingClientRect$1(elementOrVirtualElement, offsetParentIsScaled, isFixed);
24705
24986
  var scroll = {
24706
24987
  scrollLeft: 0,
24707
24988
  scrollTop: 0
@@ -24711,16 +24992,16 @@ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
24711
24992
  y: 0
24712
24993
  };
24713
24994
  if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
24714
- if (getNodeName(offsetParent) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
24995
+ if (getNodeName$1(offsetParent) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
24715
24996
  isScrollParent(documentElement)) {
24716
- scroll = getNodeScroll(offsetParent);
24997
+ scroll = getNodeScroll$1(offsetParent);
24717
24998
  }
24718
- if (isHTMLElement(offsetParent)) {
24719
- offsets = getBoundingClientRect(offsetParent, true);
24999
+ if (isHTMLElement$1(offsetParent)) {
25000
+ offsets = getBoundingClientRect$1(offsetParent, true);
24720
25001
  offsets.x += offsetParent.clientLeft;
24721
25002
  offsets.y += offsetParent.clientTop;
24722
25003
  } else if (documentElement) {
24723
- offsets.x = getWindowScrollBarX(documentElement);
25004
+ offsets.x = getWindowScrollBarX$1(documentElement);
24724
25005
  }
24725
25006
  }
24726
25007
  return {
@@ -24835,7 +25116,7 @@ function popperGenerator(generatorOptions) {
24835
25116
  cleanupModifierEffects();
24836
25117
  state.options = Object.assign({}, defaultOptions, state.options, options2);
24837
25118
  state.scrollParents = {
24838
- reference: isElement$1(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
25119
+ reference: isElement$2(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
24839
25120
  popper: listScrollParents(popper2)
24840
25121
  };
24841
25122
  var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state.options.modifiers)));
@@ -24859,7 +25140,7 @@ function popperGenerator(generatorOptions) {
24859
25140
  return;
24860
25141
  }
24861
25142
  state.rects = {
24862
- reference: getCompositeRect(reference3, getOffsetParent(popper3), state.options.strategy === "fixed"),
25143
+ reference: getCompositeRect(reference3, getOffsetParent$1(popper3), state.options.strategy === "fixed"),
24863
25144
  popper: getLayoutRect(popper3)
24864
25145
  };
24865
25146
  state.reset = false;
@@ -24930,7 +25211,7 @@ function popperGenerator(generatorOptions) {
24930
25211
  return instance;
24931
25212
  };
24932
25213
  }
24933
- var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
25214
+ var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$3];
24934
25215
  var createPopper = /* @__PURE__ */ popperGenerator({
24935
25216
  defaultModifiers
24936
25217
  });
@@ -25015,7 +25296,7 @@ function removeUndefinedProps(obj) {
25015
25296
  function div() {
25016
25297
  return document.createElement("div");
25017
25298
  }
25018
- function isElement(value) {
25299
+ function isElement$1(value) {
25019
25300
  return ["Element", "Fragment"].some(function(type) {
25020
25301
  return isType(value, type);
25021
25302
  });
@@ -25030,7 +25311,7 @@ function isReferenceElement(value) {
25030
25311
  return !!(value && value._tippy && value._tippy.reference === value);
25031
25312
  }
25032
25313
  function getArrayOfElements(value) {
25033
- if (isElement(value)) {
25314
+ if (isElement$1(value)) {
25034
25315
  return [value];
25035
25316
  }
25036
25317
  if (isNodeList(value)) {
@@ -25339,7 +25620,7 @@ function createArrowElement(value) {
25339
25620
  arrow2.className = ARROW_CLASS;
25340
25621
  } else {
25341
25622
  arrow2.className = SVG_ARROW_CLASS;
25342
- if (isElement(value)) {
25623
+ if (isElement$1(value)) {
25343
25624
  arrow2.appendChild(value);
25344
25625
  } else {
25345
25626
  dangerouslySetInnerHTML(arrow2, value);
@@ -25348,7 +25629,7 @@ function createArrowElement(value) {
25348
25629
  return arrow2;
25349
25630
  }
25350
25631
  function setContent(content, props) {
25351
- if (isElement(props.content)) {
25632
+ if (isElement$1(props.content)) {
25352
25633
  dangerouslySetInnerHTML(content, "");
25353
25634
  content.appendChild(props.content);
25354
25635
  } else if (typeof props.content !== "function") {
@@ -26171,7 +26452,7 @@ function tippy(targets, optionalProps) {
26171
26452
  });
26172
26453
  var elements = getArrayOfElements(targets);
26173
26454
  if (process$1.env.NODE_ENV !== "production") {
26174
- var isSingleContentElement = isElement(passedProps.content);
26455
+ var isSingleContentElement = isElement$1(passedProps.content);
26175
26456
  var isMoreThanOneReferenceElement = elements.length > 1;
26176
26457
  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(" "));
26177
26458
  }
@@ -26182,7 +26463,7 @@ function tippy(targets, optionalProps) {
26182
26463
  }
26183
26464
  return acc;
26184
26465
  }, []);
26185
- return isElement(targets) ? instances[0] : instances;
26466
+ return isElement$1(targets) ? instances[0] : instances;
26186
26467
  }
26187
26468
  tippy.defaultProps = defaultProps;
26188
26469
  tippy.setDefaultProps = setDefaultProps;
@@ -26451,54 +26732,1114 @@ class Popover {
26451
26732
  this.popover.remove();
26452
26733
  }
26453
26734
  }
26454
- const isDebugging = false;
26455
- const Pagination = Extension.create({
26456
- name: "pagination",
26457
- addStorage() {
26458
- return {
26459
- height: 0,
26460
- sectionData: null
26461
- };
26462
- },
26463
- addCommands() {
26464
- return {
26465
- insertPageBreak: () => ({ commands: commands2 }) => {
26466
- return commands2.insertContent({
26467
- type: "hardBreak"
26468
- });
26735
+ const sides = ["top", "right", "bottom", "left"];
26736
+ const min = Math.min;
26737
+ const max = Math.max;
26738
+ const round = Math.round;
26739
+ const floor = Math.floor;
26740
+ const createCoords = (v) => ({
26741
+ x: v,
26742
+ y: v
26743
+ });
26744
+ function evaluate(value, param) {
26745
+ return typeof value === "function" ? value(param) : value;
26746
+ }
26747
+ function getSide(placement) {
26748
+ return placement.split("-")[0];
26749
+ }
26750
+ function getAlignment(placement) {
26751
+ return placement.split("-")[1];
26752
+ }
26753
+ function getOppositeAxis(axis) {
26754
+ return axis === "x" ? "y" : "x";
26755
+ }
26756
+ function getAxisLength(axis) {
26757
+ return axis === "y" ? "height" : "width";
26758
+ }
26759
+ function getSideAxis(placement) {
26760
+ return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x";
26761
+ }
26762
+ function getAlignmentAxis(placement) {
26763
+ return getOppositeAxis(getSideAxis(placement));
26764
+ }
26765
+ function expandPaddingObject(padding) {
26766
+ return {
26767
+ top: 0,
26768
+ right: 0,
26769
+ bottom: 0,
26770
+ left: 0,
26771
+ ...padding
26772
+ };
26773
+ }
26774
+ function getPaddingObject(padding) {
26775
+ return typeof padding !== "number" ? expandPaddingObject(padding) : {
26776
+ top: padding,
26777
+ right: padding,
26778
+ bottom: padding,
26779
+ left: padding
26780
+ };
26781
+ }
26782
+ function rectToClientRect(rect) {
26783
+ const {
26784
+ x,
26785
+ y,
26786
+ width,
26787
+ height
26788
+ } = rect;
26789
+ return {
26790
+ width,
26791
+ height,
26792
+ top: y,
26793
+ left: x,
26794
+ right: x + width,
26795
+ bottom: y + height,
26796
+ x,
26797
+ y
26798
+ };
26799
+ }
26800
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
26801
+ let {
26802
+ reference: reference2,
26803
+ floating
26804
+ } = _ref;
26805
+ const sideAxis = getSideAxis(placement);
26806
+ const alignmentAxis = getAlignmentAxis(placement);
26807
+ const alignLength = getAxisLength(alignmentAxis);
26808
+ const side = getSide(placement);
26809
+ const isVertical = sideAxis === "y";
26810
+ const commonX = reference2.x + reference2.width / 2 - floating.width / 2;
26811
+ const commonY = reference2.y + reference2.height / 2 - floating.height / 2;
26812
+ const commonAlign = reference2[alignLength] / 2 - floating[alignLength] / 2;
26813
+ let coords;
26814
+ switch (side) {
26815
+ case "top":
26816
+ coords = {
26817
+ x: commonX,
26818
+ y: reference2.y - floating.height
26819
+ };
26820
+ break;
26821
+ case "bottom":
26822
+ coords = {
26823
+ x: commonX,
26824
+ y: reference2.y + reference2.height
26825
+ };
26826
+ break;
26827
+ case "right":
26828
+ coords = {
26829
+ x: reference2.x + reference2.width,
26830
+ y: commonY
26831
+ };
26832
+ break;
26833
+ case "left":
26834
+ coords = {
26835
+ x: reference2.x - floating.width,
26836
+ y: commonY
26837
+ };
26838
+ break;
26839
+ default:
26840
+ coords = {
26841
+ x: reference2.x,
26842
+ y: reference2.y
26843
+ };
26844
+ }
26845
+ switch (getAlignment(placement)) {
26846
+ case "start":
26847
+ coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
26848
+ break;
26849
+ case "end":
26850
+ coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
26851
+ break;
26852
+ }
26853
+ return coords;
26854
+ }
26855
+ const computePosition$1 = async (reference2, floating, config) => {
26856
+ const {
26857
+ placement = "bottom",
26858
+ strategy = "absolute",
26859
+ middleware = [],
26860
+ platform: platform2
26861
+ } = config;
26862
+ const validMiddleware = middleware.filter(Boolean);
26863
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
26864
+ let rects = await platform2.getElementRects({
26865
+ reference: reference2,
26866
+ floating,
26867
+ strategy
26868
+ });
26869
+ let {
26870
+ x,
26871
+ y
26872
+ } = computeCoordsFromPlacement(rects, placement, rtl);
26873
+ let statefulPlacement = placement;
26874
+ let middlewareData = {};
26875
+ let resetCount = 0;
26876
+ for (let i = 0; i < validMiddleware.length; i++) {
26877
+ const {
26878
+ name,
26879
+ fn: fn2
26880
+ } = validMiddleware[i];
26881
+ const {
26882
+ x: nextX,
26883
+ y: nextY,
26884
+ data,
26885
+ reset
26886
+ } = await fn2({
26887
+ x,
26888
+ y,
26889
+ initialPlacement: placement,
26890
+ placement: statefulPlacement,
26891
+ strategy,
26892
+ middlewareData,
26893
+ rects,
26894
+ platform: platform2,
26895
+ elements: {
26896
+ reference: reference2,
26897
+ floating
26898
+ }
26899
+ });
26900
+ x = nextX != null ? nextX : x;
26901
+ y = nextY != null ? nextY : y;
26902
+ middlewareData = {
26903
+ ...middlewareData,
26904
+ [name]: {
26905
+ ...middlewareData[name],
26906
+ ...data
26469
26907
  }
26470
26908
  };
26471
- },
26472
- addShortcuts() {
26473
- return {
26474
- "Mod-Enter": () => this.editor.commands.insertPageBreak()
26475
- };
26476
- },
26477
- /**
26478
- * The pagination plugin is responsible for calculating page breaks, and redering them using decorations.
26479
- */
26480
- addPmPlugins() {
26481
- const editor = this.editor;
26482
- let isUpdating = false;
26483
- let shouldUpdate = false;
26484
- let hasInitialized = false;
26485
- let shouldInitialize = false;
26486
- const paginationPlugin = new Plugin({
26487
- key: PaginationPluginKey,
26488
- state: {
26489
- isReadyToInit: false,
26490
- init(_, state) {
26491
- return {
26492
- isReadyToInit: false,
26493
- decorations: DecorationSet.empty,
26494
- isDebugging
26495
- };
26496
- },
26497
- apply(tr, oldState, prevEditorState, newEditorState) {
26498
- const meta = tr.getMeta(PaginationPluginKey);
26499
- if (meta && meta.isReadyToInit) {
26500
- shouldUpdate = true;
26501
- shouldInitialize = meta.isReadyToInit;
26909
+ if (reset && resetCount <= 50) {
26910
+ resetCount++;
26911
+ if (typeof reset === "object") {
26912
+ if (reset.placement) {
26913
+ statefulPlacement = reset.placement;
26914
+ }
26915
+ if (reset.rects) {
26916
+ rects = reset.rects === true ? await platform2.getElementRects({
26917
+ reference: reference2,
26918
+ floating,
26919
+ strategy
26920
+ }) : reset.rects;
26921
+ }
26922
+ ({
26923
+ x,
26924
+ y
26925
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
26926
+ }
26927
+ i = -1;
26928
+ }
26929
+ }
26930
+ return {
26931
+ x,
26932
+ y,
26933
+ placement: statefulPlacement,
26934
+ strategy,
26935
+ middlewareData
26936
+ };
26937
+ };
26938
+ async function detectOverflow(state, options) {
26939
+ var _await$platform$isEle;
26940
+ if (options === void 0) {
26941
+ options = {};
26942
+ }
26943
+ const {
26944
+ x,
26945
+ y,
26946
+ platform: platform2,
26947
+ rects,
26948
+ elements,
26949
+ strategy
26950
+ } = state;
26951
+ const {
26952
+ boundary = "clippingAncestors",
26953
+ rootBoundary = "viewport",
26954
+ elementContext = "floating",
26955
+ altBoundary = false,
26956
+ padding = 0
26957
+ } = evaluate(options, state);
26958
+ const paddingObject = getPaddingObject(padding);
26959
+ const altContext = elementContext === "floating" ? "reference" : "floating";
26960
+ const element = elements[altBoundary ? altContext : elementContext];
26961
+ const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
26962
+ 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)),
26963
+ boundary,
26964
+ rootBoundary,
26965
+ strategy
26966
+ }));
26967
+ const rect = elementContext === "floating" ? {
26968
+ x,
26969
+ y,
26970
+ width: rects.floating.width,
26971
+ height: rects.floating.height
26972
+ } : rects.reference;
26973
+ const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
26974
+ const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
26975
+ x: 1,
26976
+ y: 1
26977
+ } : {
26978
+ x: 1,
26979
+ y: 1
26980
+ };
26981
+ const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
26982
+ elements,
26983
+ rect,
26984
+ offsetParent,
26985
+ strategy
26986
+ }) : rect);
26987
+ return {
26988
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
26989
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
26990
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
26991
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
26992
+ };
26993
+ }
26994
+ function getSideOffsets(overflow, rect) {
26995
+ return {
26996
+ top: overflow.top - rect.height,
26997
+ right: overflow.right - rect.width,
26998
+ bottom: overflow.bottom - rect.height,
26999
+ left: overflow.left - rect.width
27000
+ };
27001
+ }
27002
+ function isAnySideFullyClipped(overflow) {
27003
+ return sides.some((side) => overflow[side] >= 0);
27004
+ }
27005
+ const hide$1 = function(options) {
27006
+ if (options === void 0) {
27007
+ options = {};
27008
+ }
27009
+ return {
27010
+ name: "hide",
27011
+ options,
27012
+ async fn(state) {
27013
+ const {
27014
+ rects
27015
+ } = state;
27016
+ const {
27017
+ strategy = "referenceHidden",
27018
+ ...detectOverflowOptions
27019
+ } = evaluate(options, state);
27020
+ switch (strategy) {
27021
+ case "referenceHidden": {
27022
+ const overflow = await detectOverflow(state, {
27023
+ ...detectOverflowOptions,
27024
+ elementContext: "reference"
27025
+ });
27026
+ const offsets = getSideOffsets(overflow, rects.reference);
27027
+ return {
27028
+ data: {
27029
+ referenceHiddenOffsets: offsets,
27030
+ referenceHidden: isAnySideFullyClipped(offsets)
27031
+ }
27032
+ };
27033
+ }
27034
+ case "escaped": {
27035
+ const overflow = await detectOverflow(state, {
27036
+ ...detectOverflowOptions,
27037
+ altBoundary: true
27038
+ });
27039
+ const offsets = getSideOffsets(overflow, rects.floating);
27040
+ return {
27041
+ data: {
27042
+ escapedOffsets: offsets,
27043
+ escaped: isAnySideFullyClipped(offsets)
27044
+ }
27045
+ };
27046
+ }
27047
+ default: {
27048
+ return {};
27049
+ }
27050
+ }
27051
+ }
27052
+ };
27053
+ };
27054
+ function hasWindow() {
27055
+ return typeof window !== "undefined";
27056
+ }
27057
+ function getNodeName(node) {
27058
+ if (isNode(node)) {
27059
+ return (node.nodeName || "").toLowerCase();
27060
+ }
27061
+ return "#document";
27062
+ }
27063
+ function getWindow(node) {
27064
+ var _node$ownerDocument;
27065
+ return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
27066
+ }
27067
+ function getDocumentElement(node) {
27068
+ var _ref;
27069
+ return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
27070
+ }
27071
+ function isNode(value) {
27072
+ if (!hasWindow()) {
27073
+ return false;
27074
+ }
27075
+ return value instanceof Node || value instanceof getWindow(value).Node;
27076
+ }
27077
+ function isElement(value) {
27078
+ if (!hasWindow()) {
27079
+ return false;
27080
+ }
27081
+ return value instanceof Element || value instanceof getWindow(value).Element;
27082
+ }
27083
+ function isHTMLElement(value) {
27084
+ if (!hasWindow()) {
27085
+ return false;
27086
+ }
27087
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
27088
+ }
27089
+ function isShadowRoot(value) {
27090
+ if (!hasWindow() || typeof ShadowRoot === "undefined") {
27091
+ return false;
27092
+ }
27093
+ return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
27094
+ }
27095
+ function isOverflowElement(element) {
27096
+ const {
27097
+ overflow,
27098
+ overflowX,
27099
+ overflowY,
27100
+ display
27101
+ } = getComputedStyle$1(element);
27102
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
27103
+ }
27104
+ function isTableElement(element) {
27105
+ return ["table", "td", "th"].includes(getNodeName(element));
27106
+ }
27107
+ function isTopLayer(element) {
27108
+ return [":popover-open", ":modal"].some((selector) => {
27109
+ try {
27110
+ return element.matches(selector);
27111
+ } catch (e) {
27112
+ return false;
27113
+ }
27114
+ });
27115
+ }
27116
+ function isContainingBlock(elementOrCss) {
27117
+ const webkit2 = isWebKit();
27118
+ const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
27119
+ 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));
27120
+ }
27121
+ function getContainingBlock(element) {
27122
+ let currentNode = getParentNode(element);
27123
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
27124
+ if (isContainingBlock(currentNode)) {
27125
+ return currentNode;
27126
+ } else if (isTopLayer(currentNode)) {
27127
+ return null;
27128
+ }
27129
+ currentNode = getParentNode(currentNode);
27130
+ }
27131
+ return null;
27132
+ }
27133
+ function isWebKit() {
27134
+ if (typeof CSS === "undefined" || !CSS.supports) return false;
27135
+ return CSS.supports("-webkit-backdrop-filter", "none");
27136
+ }
27137
+ function isLastTraversableNode(node) {
27138
+ return ["html", "body", "#document"].includes(getNodeName(node));
27139
+ }
27140
+ function getComputedStyle$1(element) {
27141
+ return getWindow(element).getComputedStyle(element);
27142
+ }
27143
+ function getNodeScroll(element) {
27144
+ if (isElement(element)) {
27145
+ return {
27146
+ scrollLeft: element.scrollLeft,
27147
+ scrollTop: element.scrollTop
27148
+ };
27149
+ }
27150
+ return {
27151
+ scrollLeft: element.scrollX,
27152
+ scrollTop: element.scrollY
27153
+ };
27154
+ }
27155
+ function getParentNode(node) {
27156
+ if (getNodeName(node) === "html") {
27157
+ return node;
27158
+ }
27159
+ const result = (
27160
+ // Step into the shadow DOM of the parent of a slotted node.
27161
+ node.assignedSlot || // DOM Element detected.
27162
+ node.parentNode || // ShadowRoot detected.
27163
+ isShadowRoot(node) && node.host || // Fallback.
27164
+ getDocumentElement(node)
27165
+ );
27166
+ return isShadowRoot(result) ? result.host : result;
27167
+ }
27168
+ function getNearestOverflowAncestor(node) {
27169
+ const parentNode2 = getParentNode(node);
27170
+ if (isLastTraversableNode(parentNode2)) {
27171
+ return node.ownerDocument ? node.ownerDocument.body : node.body;
27172
+ }
27173
+ if (isHTMLElement(parentNode2) && isOverflowElement(parentNode2)) {
27174
+ return parentNode2;
27175
+ }
27176
+ return getNearestOverflowAncestor(parentNode2);
27177
+ }
27178
+ function getOverflowAncestors(node, list, traverseIframes) {
27179
+ var _node$ownerDocument2;
27180
+ if (list === void 0) {
27181
+ list = [];
27182
+ }
27183
+ if (traverseIframes === void 0) {
27184
+ traverseIframes = true;
27185
+ }
27186
+ const scrollableAncestor = getNearestOverflowAncestor(node);
27187
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
27188
+ const win = getWindow(scrollableAncestor);
27189
+ if (isBody) {
27190
+ const frameElement = getFrameElement(win);
27191
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
27192
+ }
27193
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
27194
+ }
27195
+ function getFrameElement(win) {
27196
+ return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
27197
+ }
27198
+ function getCssDimensions(element) {
27199
+ const css = getComputedStyle$1(element);
27200
+ let width = parseFloat(css.width) || 0;
27201
+ let height = parseFloat(css.height) || 0;
27202
+ const hasOffset = isHTMLElement(element);
27203
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
27204
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
27205
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
27206
+ if (shouldFallback) {
27207
+ width = offsetWidth;
27208
+ height = offsetHeight;
27209
+ }
27210
+ return {
27211
+ width,
27212
+ height,
27213
+ $: shouldFallback
27214
+ };
27215
+ }
27216
+ function unwrapElement(element) {
27217
+ return !isElement(element) ? element.contextElement : element;
27218
+ }
27219
+ function getScale(element) {
27220
+ const domElement = unwrapElement(element);
27221
+ if (!isHTMLElement(domElement)) {
27222
+ return createCoords(1);
27223
+ }
27224
+ const rect = domElement.getBoundingClientRect();
27225
+ const {
27226
+ width,
27227
+ height,
27228
+ $
27229
+ } = getCssDimensions(domElement);
27230
+ let x = ($ ? round(rect.width) : rect.width) / width;
27231
+ let y = ($ ? round(rect.height) : rect.height) / height;
27232
+ if (!x || !Number.isFinite(x)) {
27233
+ x = 1;
27234
+ }
27235
+ if (!y || !Number.isFinite(y)) {
27236
+ y = 1;
27237
+ }
27238
+ return {
27239
+ x,
27240
+ y
27241
+ };
27242
+ }
27243
+ const noOffsets = /* @__PURE__ */ createCoords(0);
27244
+ function getVisualOffsets(element) {
27245
+ const win = getWindow(element);
27246
+ if (!isWebKit() || !win.visualViewport) {
27247
+ return noOffsets;
27248
+ }
27249
+ return {
27250
+ x: win.visualViewport.offsetLeft,
27251
+ y: win.visualViewport.offsetTop
27252
+ };
27253
+ }
27254
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
27255
+ if (isFixed === void 0) {
27256
+ isFixed = false;
27257
+ }
27258
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
27259
+ return false;
27260
+ }
27261
+ return isFixed;
27262
+ }
27263
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
27264
+ if (includeScale === void 0) {
27265
+ includeScale = false;
27266
+ }
27267
+ if (isFixedStrategy === void 0) {
27268
+ isFixedStrategy = false;
27269
+ }
27270
+ const clientRect2 = element.getBoundingClientRect();
27271
+ const domElement = unwrapElement(element);
27272
+ let scale = createCoords(1);
27273
+ if (includeScale) {
27274
+ if (offsetParent) {
27275
+ if (isElement(offsetParent)) {
27276
+ scale = getScale(offsetParent);
27277
+ }
27278
+ } else {
27279
+ scale = getScale(element);
27280
+ }
27281
+ }
27282
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
27283
+ let x = (clientRect2.left + visualOffsets.x) / scale.x;
27284
+ let y = (clientRect2.top + visualOffsets.y) / scale.y;
27285
+ let width = clientRect2.width / scale.x;
27286
+ let height = clientRect2.height / scale.y;
27287
+ if (domElement) {
27288
+ const win = getWindow(domElement);
27289
+ const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
27290
+ let currentWin = win;
27291
+ let currentIFrame = getFrameElement(currentWin);
27292
+ while (currentIFrame && offsetParent && offsetWin !== currentWin) {
27293
+ const iframeScale = getScale(currentIFrame);
27294
+ const iframeRect = currentIFrame.getBoundingClientRect();
27295
+ const css = getComputedStyle$1(currentIFrame);
27296
+ const left2 = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
27297
+ const top2 = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
27298
+ x *= iframeScale.x;
27299
+ y *= iframeScale.y;
27300
+ width *= iframeScale.x;
27301
+ height *= iframeScale.y;
27302
+ x += left2;
27303
+ y += top2;
27304
+ currentWin = getWindow(currentIFrame);
27305
+ currentIFrame = getFrameElement(currentWin);
27306
+ }
27307
+ }
27308
+ return rectToClientRect({
27309
+ width,
27310
+ height,
27311
+ x,
27312
+ y
27313
+ });
27314
+ }
27315
+ function getWindowScrollBarX(element, rect) {
27316
+ const leftScroll = getNodeScroll(element).scrollLeft;
27317
+ if (!rect) {
27318
+ return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
27319
+ }
27320
+ return rect.left + leftScroll;
27321
+ }
27322
+ function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
27323
+ if (ignoreScrollbarX === void 0) {
27324
+ ignoreScrollbarX = false;
27325
+ }
27326
+ const htmlRect = documentElement.getBoundingClientRect();
27327
+ const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 : (
27328
+ // RTL <body> scrollbar.
27329
+ getWindowScrollBarX(documentElement, htmlRect)
27330
+ ));
27331
+ const y = htmlRect.top + scroll.scrollTop;
27332
+ return {
27333
+ x,
27334
+ y
27335
+ };
27336
+ }
27337
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
27338
+ let {
27339
+ elements,
27340
+ rect,
27341
+ offsetParent,
27342
+ strategy
27343
+ } = _ref;
27344
+ const isFixed = strategy === "fixed";
27345
+ const documentElement = getDocumentElement(offsetParent);
27346
+ const topLayer = elements ? isTopLayer(elements.floating) : false;
27347
+ if (offsetParent === documentElement || topLayer && isFixed) {
27348
+ return rect;
27349
+ }
27350
+ let scroll = {
27351
+ scrollLeft: 0,
27352
+ scrollTop: 0
27353
+ };
27354
+ let scale = createCoords(1);
27355
+ const offsets = createCoords(0);
27356
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
27357
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
27358
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
27359
+ scroll = getNodeScroll(offsetParent);
27360
+ }
27361
+ if (isHTMLElement(offsetParent)) {
27362
+ const offsetRect = getBoundingClientRect(offsetParent);
27363
+ scale = getScale(offsetParent);
27364
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
27365
+ offsets.y = offsetRect.y + offsetParent.clientTop;
27366
+ }
27367
+ }
27368
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
27369
+ return {
27370
+ width: rect.width * scale.x,
27371
+ height: rect.height * scale.y,
27372
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
27373
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
27374
+ };
27375
+ }
27376
+ function getClientRects(element) {
27377
+ return Array.from(element.getClientRects());
27378
+ }
27379
+ function getDocumentRect(element) {
27380
+ const html = getDocumentElement(element);
27381
+ const scroll = getNodeScroll(element);
27382
+ const body = element.ownerDocument.body;
27383
+ const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
27384
+ const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
27385
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
27386
+ const y = -scroll.scrollTop;
27387
+ if (getComputedStyle$1(body).direction === "rtl") {
27388
+ x += max(html.clientWidth, body.clientWidth) - width;
27389
+ }
27390
+ return {
27391
+ width,
27392
+ height,
27393
+ x,
27394
+ y
27395
+ };
27396
+ }
27397
+ function getViewportRect(element, strategy) {
27398
+ const win = getWindow(element);
27399
+ const html = getDocumentElement(element);
27400
+ const visualViewport = win.visualViewport;
27401
+ let width = html.clientWidth;
27402
+ let height = html.clientHeight;
27403
+ let x = 0;
27404
+ let y = 0;
27405
+ if (visualViewport) {
27406
+ width = visualViewport.width;
27407
+ height = visualViewport.height;
27408
+ const visualViewportBased = isWebKit();
27409
+ if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
27410
+ x = visualViewport.offsetLeft;
27411
+ y = visualViewport.offsetTop;
27412
+ }
27413
+ }
27414
+ return {
27415
+ width,
27416
+ height,
27417
+ x,
27418
+ y
27419
+ };
27420
+ }
27421
+ function getInnerBoundingClientRect(element, strategy) {
27422
+ const clientRect2 = getBoundingClientRect(element, true, strategy === "fixed");
27423
+ const top2 = clientRect2.top + element.clientTop;
27424
+ const left2 = clientRect2.left + element.clientLeft;
27425
+ const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
27426
+ const width = element.clientWidth * scale.x;
27427
+ const height = element.clientHeight * scale.y;
27428
+ const x = left2 * scale.x;
27429
+ const y = top2 * scale.y;
27430
+ return {
27431
+ width,
27432
+ height,
27433
+ x,
27434
+ y
27435
+ };
27436
+ }
27437
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
27438
+ let rect;
27439
+ if (clippingAncestor === "viewport") {
27440
+ rect = getViewportRect(element, strategy);
27441
+ } else if (clippingAncestor === "document") {
27442
+ rect = getDocumentRect(getDocumentElement(element));
27443
+ } else if (isElement(clippingAncestor)) {
27444
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
27445
+ } else {
27446
+ const visualOffsets = getVisualOffsets(element);
27447
+ rect = {
27448
+ x: clippingAncestor.x - visualOffsets.x,
27449
+ y: clippingAncestor.y - visualOffsets.y,
27450
+ width: clippingAncestor.width,
27451
+ height: clippingAncestor.height
27452
+ };
27453
+ }
27454
+ return rectToClientRect(rect);
27455
+ }
27456
+ function hasFixedPositionAncestor(element, stopNode) {
27457
+ const parentNode2 = getParentNode(element);
27458
+ if (parentNode2 === stopNode || !isElement(parentNode2) || isLastTraversableNode(parentNode2)) {
27459
+ return false;
27460
+ }
27461
+ return getComputedStyle$1(parentNode2).position === "fixed" || hasFixedPositionAncestor(parentNode2, stopNode);
27462
+ }
27463
+ function getClippingElementAncestors(element, cache) {
27464
+ const cachedResult2 = cache.get(element);
27465
+ if (cachedResult2) {
27466
+ return cachedResult2;
27467
+ }
27468
+ let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
27469
+ let currentContainingBlockComputedStyle = null;
27470
+ const elementIsFixed = getComputedStyle$1(element).position === "fixed";
27471
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
27472
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
27473
+ const computedStyle = getComputedStyle$1(currentNode);
27474
+ const currentNodeIsContaining = isContainingBlock(currentNode);
27475
+ if (!currentNodeIsContaining && computedStyle.position === "fixed") {
27476
+ currentContainingBlockComputedStyle = null;
27477
+ }
27478
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
27479
+ if (shouldDropCurrentNode) {
27480
+ result = result.filter((ancestor) => ancestor !== currentNode);
27481
+ } else {
27482
+ currentContainingBlockComputedStyle = computedStyle;
27483
+ }
27484
+ currentNode = getParentNode(currentNode);
27485
+ }
27486
+ cache.set(element, result);
27487
+ return result;
27488
+ }
27489
+ function getClippingRect(_ref) {
27490
+ let {
27491
+ element,
27492
+ boundary,
27493
+ rootBoundary,
27494
+ strategy
27495
+ } = _ref;
27496
+ const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
27497
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
27498
+ const firstClippingAncestor = clippingAncestors[0];
27499
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
27500
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
27501
+ accRect.top = max(rect.top, accRect.top);
27502
+ accRect.right = min(rect.right, accRect.right);
27503
+ accRect.bottom = min(rect.bottom, accRect.bottom);
27504
+ accRect.left = max(rect.left, accRect.left);
27505
+ return accRect;
27506
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
27507
+ return {
27508
+ width: clippingRect.right - clippingRect.left,
27509
+ height: clippingRect.bottom - clippingRect.top,
27510
+ x: clippingRect.left,
27511
+ y: clippingRect.top
27512
+ };
27513
+ }
27514
+ function getDimensions(element) {
27515
+ const {
27516
+ width,
27517
+ height
27518
+ } = getCssDimensions(element);
27519
+ return {
27520
+ width,
27521
+ height
27522
+ };
27523
+ }
27524
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
27525
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
27526
+ const documentElement = getDocumentElement(offsetParent);
27527
+ const isFixed = strategy === "fixed";
27528
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
27529
+ let scroll = {
27530
+ scrollLeft: 0,
27531
+ scrollTop: 0
27532
+ };
27533
+ const offsets = createCoords(0);
27534
+ function setLeftRTLScrollbarOffset() {
27535
+ offsets.x = getWindowScrollBarX(documentElement);
27536
+ }
27537
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
27538
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
27539
+ scroll = getNodeScroll(offsetParent);
27540
+ }
27541
+ if (isOffsetParentAnElement) {
27542
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
27543
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
27544
+ offsets.y = offsetRect.y + offsetParent.clientTop;
27545
+ } else if (documentElement) {
27546
+ setLeftRTLScrollbarOffset();
27547
+ }
27548
+ }
27549
+ if (isFixed && !isOffsetParentAnElement && documentElement) {
27550
+ setLeftRTLScrollbarOffset();
27551
+ }
27552
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
27553
+ const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
27554
+ const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
27555
+ return {
27556
+ x,
27557
+ y,
27558
+ width: rect.width,
27559
+ height: rect.height
27560
+ };
27561
+ }
27562
+ function isStaticPositioned(element) {
27563
+ return getComputedStyle$1(element).position === "static";
27564
+ }
27565
+ function getTrueOffsetParent(element, polyfill) {
27566
+ if (!isHTMLElement(element) || getComputedStyle$1(element).position === "fixed") {
27567
+ return null;
27568
+ }
27569
+ if (polyfill) {
27570
+ return polyfill(element);
27571
+ }
27572
+ let rawOffsetParent = element.offsetParent;
27573
+ if (getDocumentElement(element) === rawOffsetParent) {
27574
+ rawOffsetParent = rawOffsetParent.ownerDocument.body;
27575
+ }
27576
+ return rawOffsetParent;
27577
+ }
27578
+ function getOffsetParent(element, polyfill) {
27579
+ const win = getWindow(element);
27580
+ if (isTopLayer(element)) {
27581
+ return win;
27582
+ }
27583
+ if (!isHTMLElement(element)) {
27584
+ let svgOffsetParent = getParentNode(element);
27585
+ while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
27586
+ if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
27587
+ return svgOffsetParent;
27588
+ }
27589
+ svgOffsetParent = getParentNode(svgOffsetParent);
27590
+ }
27591
+ return win;
27592
+ }
27593
+ let offsetParent = getTrueOffsetParent(element, polyfill);
27594
+ while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
27595
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
27596
+ }
27597
+ if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
27598
+ return win;
27599
+ }
27600
+ return offsetParent || getContainingBlock(element) || win;
27601
+ }
27602
+ const getElementRects = async function(data) {
27603
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
27604
+ const getDimensionsFn = this.getDimensions;
27605
+ const floatingDimensions = await getDimensionsFn(data.floating);
27606
+ return {
27607
+ reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
27608
+ floating: {
27609
+ x: 0,
27610
+ y: 0,
27611
+ width: floatingDimensions.width,
27612
+ height: floatingDimensions.height
27613
+ }
27614
+ };
27615
+ };
27616
+ function isRTL(element) {
27617
+ return getComputedStyle$1(element).direction === "rtl";
27618
+ }
27619
+ const platform = {
27620
+ convertOffsetParentRelativeRectToViewportRelativeRect,
27621
+ getDocumentElement,
27622
+ getClippingRect,
27623
+ getOffsetParent,
27624
+ getElementRects,
27625
+ getClientRects,
27626
+ getDimensions,
27627
+ getScale,
27628
+ isElement,
27629
+ isRTL
27630
+ };
27631
+ function rectsAreEqual(a, b) {
27632
+ return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
27633
+ }
27634
+ function observeMove(element, onMove) {
27635
+ let io = null;
27636
+ let timeoutId;
27637
+ const root = getDocumentElement(element);
27638
+ function cleanup() {
27639
+ var _io;
27640
+ clearTimeout(timeoutId);
27641
+ (_io = io) == null || _io.disconnect();
27642
+ io = null;
27643
+ }
27644
+ function refresh(skip, threshold) {
27645
+ if (skip === void 0) {
27646
+ skip = false;
27647
+ }
27648
+ if (threshold === void 0) {
27649
+ threshold = 1;
27650
+ }
27651
+ cleanup();
27652
+ const elementRectForRootMargin = element.getBoundingClientRect();
27653
+ const {
27654
+ left: left2,
27655
+ top: top2,
27656
+ width,
27657
+ height
27658
+ } = elementRectForRootMargin;
27659
+ if (!skip) {
27660
+ onMove();
27661
+ }
27662
+ if (!width || !height) {
27663
+ return;
27664
+ }
27665
+ const insetTop = floor(top2);
27666
+ const insetRight = floor(root.clientWidth - (left2 + width));
27667
+ const insetBottom = floor(root.clientHeight - (top2 + height));
27668
+ const insetLeft = floor(left2);
27669
+ const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
27670
+ const options = {
27671
+ rootMargin,
27672
+ threshold: max(0, min(1, threshold)) || 1
27673
+ };
27674
+ let isFirstUpdate = true;
27675
+ function handleObserve(entries) {
27676
+ const ratio = entries[0].intersectionRatio;
27677
+ if (ratio !== threshold) {
27678
+ if (!isFirstUpdate) {
27679
+ return refresh();
27680
+ }
27681
+ if (!ratio) {
27682
+ timeoutId = setTimeout(() => {
27683
+ refresh(false, 1e-7);
27684
+ }, 1e3);
27685
+ } else {
27686
+ refresh(false, ratio);
27687
+ }
27688
+ }
27689
+ if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
27690
+ refresh();
27691
+ }
27692
+ isFirstUpdate = false;
27693
+ }
27694
+ try {
27695
+ io = new IntersectionObserver(handleObserve, {
27696
+ ...options,
27697
+ // Handle <iframe>s
27698
+ root: root.ownerDocument
27699
+ });
27700
+ } catch (_e) {
27701
+ io = new IntersectionObserver(handleObserve, options);
27702
+ }
27703
+ io.observe(element);
27704
+ }
27705
+ refresh(true);
27706
+ return cleanup;
27707
+ }
27708
+ function autoUpdate(reference2, floating, update, options) {
27709
+ if (options === void 0) {
27710
+ options = {};
27711
+ }
27712
+ const {
27713
+ ancestorScroll = true,
27714
+ ancestorResize = true,
27715
+ elementResize = typeof ResizeObserver === "function",
27716
+ layoutShift = typeof IntersectionObserver === "function",
27717
+ animationFrame = false
27718
+ } = options;
27719
+ const referenceEl = unwrapElement(reference2);
27720
+ const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : [];
27721
+ ancestors.forEach((ancestor) => {
27722
+ ancestorScroll && ancestor.addEventListener("scroll", update, {
27723
+ passive: true
27724
+ });
27725
+ ancestorResize && ancestor.addEventListener("resize", update);
27726
+ });
27727
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
27728
+ let reobserveFrame = -1;
27729
+ let resizeObserver = null;
27730
+ if (elementResize) {
27731
+ resizeObserver = new ResizeObserver((_ref) => {
27732
+ let [firstEntry] = _ref;
27733
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
27734
+ resizeObserver.unobserve(floating);
27735
+ cancelAnimationFrame(reobserveFrame);
27736
+ reobserveFrame = requestAnimationFrame(() => {
27737
+ var _resizeObserver;
27738
+ (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
27739
+ });
27740
+ }
27741
+ update();
27742
+ });
27743
+ if (referenceEl && !animationFrame) {
27744
+ resizeObserver.observe(referenceEl);
27745
+ }
27746
+ resizeObserver.observe(floating);
27747
+ }
27748
+ let frameId;
27749
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference2) : null;
27750
+ if (animationFrame) {
27751
+ frameLoop();
27752
+ }
27753
+ function frameLoop() {
27754
+ const nextRefRect = getBoundingClientRect(reference2);
27755
+ if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
27756
+ update();
27757
+ }
27758
+ prevRefRect = nextRefRect;
27759
+ frameId = requestAnimationFrame(frameLoop);
27760
+ }
27761
+ update();
27762
+ return () => {
27763
+ var _resizeObserver2;
27764
+ ancestors.forEach((ancestor) => {
27765
+ ancestorScroll && ancestor.removeEventListener("scroll", update);
27766
+ ancestorResize && ancestor.removeEventListener("resize", update);
27767
+ });
27768
+ cleanupIo == null || cleanupIo();
27769
+ (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
27770
+ resizeObserver = null;
27771
+ if (animationFrame) {
27772
+ cancelAnimationFrame(frameId);
27773
+ }
27774
+ };
27775
+ }
27776
+ const hide = hide$1;
27777
+ const computePosition = (reference2, floating, options) => {
27778
+ const cache = /* @__PURE__ */ new Map();
27779
+ const mergedOptions = {
27780
+ platform,
27781
+ ...options
27782
+ };
27783
+ const platformWithCache = {
27784
+ ...mergedOptions.platform,
27785
+ _c: cache
27786
+ };
27787
+ return computePosition$1(reference2, floating, {
27788
+ ...mergedOptions,
27789
+ platform: platformWithCache
27790
+ });
27791
+ };
27792
+ const SEPARATOR_CLASS = "pagination-separator";
27793
+ const SEPARATOR_FLOATING_CLASS = "pagination-separator-floating";
27794
+ const isDebugging = false;
27795
+ const cleanupFunctions = /* @__PURE__ */ new Set();
27796
+ const Pagination = Extension.create({
27797
+ name: "pagination",
27798
+ addStorage() {
27799
+ return {
27800
+ height: 0,
27801
+ sectionData: null
27802
+ };
27803
+ },
27804
+ addCommands() {
27805
+ return {
27806
+ insertPageBreak: () => ({ commands: commands2 }) => {
27807
+ return commands2.insertContent({
27808
+ type: "hardBreak"
27809
+ });
27810
+ }
27811
+ };
27812
+ },
27813
+ addShortcuts() {
27814
+ return {
27815
+ "Mod-Enter": () => this.editor.commands.insertPageBreak()
27816
+ };
27817
+ },
27818
+ /**
27819
+ * The pagination plugin is responsible for calculating page breaks, and redering them using decorations.
27820
+ */
27821
+ addPmPlugins() {
27822
+ const editor = this.editor;
27823
+ let isUpdating = false;
27824
+ let shouldUpdate = false;
27825
+ let hasInitialized = false;
27826
+ let shouldInitialize = false;
27827
+ const paginationPlugin = new Plugin({
27828
+ key: PaginationPluginKey,
27829
+ state: {
27830
+ isReadyToInit: false,
27831
+ init(_, state) {
27832
+ return {
27833
+ isReadyToInit: false,
27834
+ decorations: DecorationSet.empty,
27835
+ isDebugging
27836
+ };
27837
+ },
27838
+ apply(tr, oldState, prevEditorState, newEditorState) {
27839
+ const meta = tr.getMeta(PaginationPluginKey);
27840
+ if (meta && meta.isReadyToInit) {
27841
+ shouldUpdate = true;
27842
+ shouldInitialize = meta.isReadyToInit;
26502
27843
  }
26503
27844
  const imagePluginTransaction = tr.getMeta(ImagePlaceholderPluginKey);
26504
27845
  if (imagePluginTransaction) {
@@ -26541,7 +27882,7 @@ const Pagination = Extension.create({
26541
27882
  view: (view) => {
26542
27883
  let previousDecorations = DecorationSet.empty;
26543
27884
  return {
26544
- update: (view2) => {
27885
+ update: (view2, prevState) => {
26545
27886
  if (!shouldUpdate || isUpdating) return;
26546
27887
  isUpdating = true;
26547
27888
  hasInitialized = true;
@@ -26558,6 +27899,9 @@ const Pagination = Extension.create({
26558
27899
  }
26559
27900
  });
26560
27901
  return [paginationPlugin];
27902
+ },
27903
+ onDestroy() {
27904
+ cleanupFloatingSeparators();
26561
27905
  }
26562
27906
  });
26563
27907
  const getHeaderFooterId = (currentPageNumber, sectionType, editor, node = null) => {
@@ -26595,12 +27939,23 @@ const getHeaderFooterId = (currentPageNumber, sectionType, editor, node = null)
26595
27939
  const performUpdate = (editor, view, previousDecorations) => {
26596
27940
  const sectionData = editor.storage.pagination.sectionData;
26597
27941
  const newDecorations = calculatePageBreaks(view, editor, sectionData);
27942
+ const editorElement = editor.options.element;
26598
27943
  if (!previousDecorations.eq(newDecorations)) {
26599
27944
  const updateTransaction = view.state.tr.setMeta(
26600
27945
  PaginationPluginKey,
26601
27946
  { decorations: newDecorations }
26602
27947
  );
26603
27948
  view.dispatch(updateTransaction);
27949
+ requestAnimationFrame(() => {
27950
+ requestAnimationFrame(() => {
27951
+ cleanupFloatingSeparators();
27952
+ const separators = [...editorElement.querySelectorAll(`.${SEPARATOR_CLASS}--table`)];
27953
+ separators.forEach((separator) => {
27954
+ const { cleanup } = createFloatingSeparator(separator, editor);
27955
+ cleanupFunctions.add(cleanup);
27956
+ });
27957
+ });
27958
+ });
26604
27959
  }
26605
27960
  editor.emit("paginationUpdate");
26606
27961
  };
@@ -26641,16 +27996,15 @@ function generateInternalPageBreaks(doc2, view, editor, sectionData) {
26641
27996
  const decorations = [];
26642
27997
  const { pageSize, pageMargins } = editor.converter.pageStyles;
26643
27998
  const pageHeight = pageSize.height * 96;
26644
- editor.options.scale;
26645
27999
  let currentPageNumber = 1;
26646
28000
  let pageHeightThreshold = pageHeight;
26647
28001
  let footer = null, header = null;
26648
28002
  const firstHeaderId = getHeaderFooterId(currentPageNumber, "headerIds", editor);
26649
- const firstHeader = createHeader(pageMargins, pageSize, sectionData, firstHeaderId, editor);
28003
+ const firstHeader = createHeader(pageMargins, pageSize, sectionData, firstHeaderId, editor, currentPageNumber);
26650
28004
  const pageBreak = createPageBreak({ editor, header: firstHeader, isFirstHeader: true });
26651
28005
  decorations.push(Decoration.widget(0, pageBreak, { key: "stable-key" }));
26652
28006
  const lastFooterId = getHeaderFooterId(currentPageNumber, "footerIds", editor);
26653
- const lastFooter = createFooter(pageMargins, pageSize, sectionData, lastFooterId, editor);
28007
+ const lastFooter = createFooter(pageMargins, pageSize, sectionData, lastFooterId, editor, currentPageNumber);
26654
28008
  pageHeightThreshold -= firstHeader.headerHeight + lastFooter.footerHeight;
26655
28009
  let coords = view?.coordsAtPos(doc2.content.size);
26656
28010
  if (!coords) return [];
@@ -26669,7 +28023,7 @@ function generateInternalPageBreaks(doc2, view, editor, sectionData) {
26669
28023
  if (currentPageNumber === 1) {
26670
28024
  const headerId2 = getHeaderFooterId(currentPageNumber, "headerIds", editor, currentNode);
26671
28025
  decorations.pop();
26672
- const newFirstHeader = createHeader(pageMargins, pageSize, sectionData, headerId2, editor);
28026
+ const newFirstHeader = createHeader(pageMargins, pageSize, sectionData, headerId2, editor, currentPageNumber - 1);
26673
28027
  const pageBreak2 = createPageBreak({ editor, header: newFirstHeader, isFirstHeader: true });
26674
28028
  decorations.push(Decoration.widget(0, pageBreak2, { key: "stable-key" }));
26675
28029
  }
@@ -26685,7 +28039,9 @@ function generateInternalPageBreaks(doc2, view, editor, sectionData) {
26685
28039
  }
26686
28040
  if (isHardBreakNode || shouldAddPageBreak) {
26687
28041
  const $currentPos = view.state.doc.resolve(currentPos);
28042
+ const table = findParentNodeClosestToPos($currentPos, (node2) => node2.type.name === "table");
26688
28043
  const tableRow = findParentNodeClosestToPos($currentPos, (node2) => node2.type.name === "tableRow");
28044
+ let isInTable2 = table || tableRow ? true : false;
26689
28045
  if (tableRow) {
26690
28046
  currentNode = tableRow.node;
26691
28047
  currentPos = tableRow.pos;
@@ -26698,13 +28054,13 @@ function generateInternalPageBreaks(doc2, view, editor, sectionData) {
26698
28054
  const footerId2 = getHeaderFooterId(currentPageNumber, "footerIds", editor, currentNode);
26699
28055
  currentPageNumber++;
26700
28056
  const headerId2 = getHeaderFooterId(currentPageNumber, "headerIds", editor);
26701
- header = createHeader(pageMargins, pageSize, sectionData, headerId2, editor);
28057
+ header = createHeader(pageMargins, pageSize, sectionData, headerId2, editor, currentPageNumber - 1);
26702
28058
  footer = createFooter(pageMargins, pageSize, sectionData, footerId2, editor, currentPageNumber - 1);
26703
28059
  const bufferHeight2 = pageHeightThreshold - actualBreakBottom;
26704
28060
  const { node: spacingNode2 } = createFinalPagePadding(bufferHeight2);
26705
28061
  const pageSpacer2 = Decoration.widget(breakPos, spacingNode2, { key: "stable-key" });
26706
28062
  decorations.push(pageSpacer2);
26707
- const pageBreak2 = createPageBreak({ editor, header, footer });
28063
+ const pageBreak2 = createPageBreak({ editor, header, footer, isInTable: isInTable2 });
26708
28064
  decorations.push(Decoration.widget(breakPos, pageBreak2, { key: "stable-key" }));
26709
28065
  pageHeightThreshold = actualBreakBottom + (pageHeight - header.headerHeight - footer.footerHeight);
26710
28066
  }
@@ -26713,7 +28069,7 @@ function generateInternalPageBreaks(doc2, view, editor, sectionData) {
26713
28069
  const lastNodeCoords = view.coordsAtPos(finalPos);
26714
28070
  const headerId = getHeaderFooterId(currentPageNumber, "headerIds", editor);
26715
28071
  const footerId = getHeaderFooterId(currentPageNumber, "footerIds", editor);
26716
- header = createHeader(pageMargins, pageSize, sectionData, headerId, editor);
28072
+ header = createHeader(pageMargins, pageSize, sectionData, headerId, editor, currentPageNumber);
26717
28073
  footer = createFooter(pageMargins, pageSize, sectionData, footerId, editor, currentPageNumber);
26718
28074
  const bufferHeight = pageHeightThreshold - lastNodeCoords.bottom;
26719
28075
  const { node: spacingNode } = createFinalPagePadding(bufferHeight);
@@ -26730,6 +28086,7 @@ function generateInternalPageBreaks(doc2, view, editor, sectionData) {
26730
28086
  totalPageNumber.innerText = currentPageNumber;
26731
28087
  }
26732
28088
  });
28089
+ editor.currentTotalPages = currentPageNumber;
26733
28090
  return decorations;
26734
28091
  }
26735
28092
  function createFinalPagePadding(bufferHeight) {
@@ -26740,7 +28097,7 @@ function createFinalPagePadding(bufferHeight) {
26740
28097
  div2.style.height = bufferHeight + "px";
26741
28098
  return { nodeHeight: bufferHeight, node: div2 };
26742
28099
  }
26743
- function createHeader(pageMargins, pageSize, sectionData, headerId, editor) {
28100
+ function createHeader(pageMargins, pageSize, sectionData, headerId, editor, currentPageNumber) {
26744
28101
  const headerDef = sectionData.headers?.[headerId];
26745
28102
  const minHeaderHeight = pageMargins.top * 96;
26746
28103
  const headerMargin = pageMargins.header * 96;
@@ -26767,7 +28124,8 @@ function createHeader(pageMargins, pageSize, sectionData, headerId, editor) {
26767
28124
  appendToBody: false,
26768
28125
  sectionId: headerId,
26769
28126
  type: "header",
26770
- availableHeight
28127
+ availableHeight,
28128
+ currentPageNumber
26771
28129
  });
26772
28130
  editor.converter.headerEditors.push({
26773
28131
  id: headerId,
@@ -26793,13 +28151,6 @@ function createFooter(pageMargins, pageSize, sectionData, footerId, editor, curr
26793
28151
  const minFooterHeight = pageMargins.bottom * 96;
26794
28152
  const footerPaddingFromEdge = pageMargins.footer * 96;
26795
28153
  const footerHeight = Math.max(footerDef?.height || 0, minFooterHeight - footerPaddingFromEdge);
26796
- const sectionContainer = footerDef?.sectionContainer?.cloneNode(true);
26797
- const autoPageNumber = sectionContainer?.querySelector('span[data-id="auto-page-number"]');
26798
- if (autoPageNumber) {
26799
- const fontSize = autoPageNumber.previousElementSibling?.style?.fontSize || autoPageNumber.nextElementSibling?.style?.fontSize;
26800
- if (fontSize) autoPageNumber.style.fontSize = fontSize;
26801
- autoPageNumber.innerText = currentPageNumber;
26802
- }
26803
28154
  const editorContainer = document.createElement("div");
26804
28155
  if (!footerId && !editor.converter.footerIds["default"]) {
26805
28156
  footerId = "rId" + generateDocxRandomId();
@@ -26819,7 +28170,8 @@ function createFooter(pageMargins, pageSize, sectionData, footerId, editor, curr
26819
28170
  appendToBody: false,
26820
28171
  sectionId: footerId,
26821
28172
  type: "footer",
26822
- availableHeight: footerHeight
28173
+ availableHeight: footerHeight,
28174
+ currentPageNumber
26823
28175
  });
26824
28176
  editor.converter.footerEditors.push({
26825
28177
  id: footerId,
@@ -26845,7 +28197,7 @@ const onHeaderFooterDblClick = (editor, currentFocusedSectionEditor) => {
26845
28197
  editor.setEditable(false, false);
26846
28198
  toggleHeaderFooterEditMode(editor, currentFocusedSectionEditor, true);
26847
28199
  };
26848
- function createPageBreak({ editor, header, footer, footerBottom = null, isFirstHeader, isLastFooter }) {
28200
+ function createPageBreak({ editor, header, footer, footerBottom = null, isFirstHeader, isLastFooter, isInTable: isInTable2 = false }) {
26849
28201
  const { pageSize, pageMargins } = editor.converter.pageStyles;
26850
28202
  let sectionHeight = 0;
26851
28203
  const paginationDiv = document.createElement("div");
@@ -26864,7 +28216,10 @@ function createPageBreak({ editor, header, footer, footerBottom = null, isFirstH
26864
28216
  const separatorHeight = 20;
26865
28217
  sectionHeight += separatorHeight;
26866
28218
  const separator = document.createElement("div");
26867
- separator.className = "pagination-separator";
28219
+ separator.classList.add(SEPARATOR_CLASS);
28220
+ if (isInTable2) {
28221
+ separator.classList.add(`${SEPARATOR_CLASS}--table`);
28222
+ }
26868
28223
  innerDiv.appendChild(separator);
26869
28224
  }
26870
28225
  if (header) {
@@ -26903,6 +28258,85 @@ const onImageLoad = (editor) => {
26903
28258
  editor.view.dispatch(newTr);
26904
28259
  });
26905
28260
  };
28261
+ function createFloatingSeparator(separator, editor) {
28262
+ const floatingSeparator = document.createElement("div");
28263
+ floatingSeparator.classList.add(SEPARATOR_FLOATING_CLASS);
28264
+ floatingSeparator.dataset.floatingSeparator = "";
28265
+ const editorElement = editor.options.element;
28266
+ editorElement.append(floatingSeparator);
28267
+ const updatePosition2 = () => {
28268
+ computePosition(separator, floatingSeparator, {
28269
+ strategy: "absolute",
28270
+ placement: "top-start",
28271
+ middleware: [
28272
+ hide(),
28273
+ {
28274
+ name: "copy",
28275
+ fn: ({ elements }) => {
28276
+ const rect = elements.reference.getBoundingClientRect();
28277
+ const containerRect = editorElement.getBoundingClientRect();
28278
+ const scaleFactor = getScaleFactor(editorElement);
28279
+ const x = Math.round((rect.left - containerRect.left) / scaleFactor);
28280
+ const y = Math.round((rect.top - containerRect.top) / scaleFactor);
28281
+ const width = Math.round(rect.width / scaleFactor);
28282
+ const height = Math.round(rect.height / scaleFactor);
28283
+ return {
28284
+ x,
28285
+ y,
28286
+ data: { width, height }
28287
+ };
28288
+ }
28289
+ }
28290
+ ]
28291
+ }).then(({ x, y, middlewareData }) => {
28292
+ Object.assign(floatingSeparator.style, {
28293
+ top: `${y}px`,
28294
+ left: `${x}px`,
28295
+ width: `${middlewareData.copy.width}px`,
28296
+ height: `${middlewareData.copy.height}px`,
28297
+ visibility: middlewareData.hide?.referenceHidden ? "hidden" : "visible"
28298
+ });
28299
+ });
28300
+ };
28301
+ const cleanup = autoUpdate(
28302
+ separator,
28303
+ floatingSeparator,
28304
+ updatePosition2
28305
+ );
28306
+ const extendedCleanup = () => {
28307
+ floatingSeparator?.remove();
28308
+ cleanup();
28309
+ };
28310
+ return {
28311
+ cleanup: extendedCleanup,
28312
+ updatePosition: updatePosition2
28313
+ };
28314
+ }
28315
+ function cleanupFloatingSeparators() {
28316
+ cleanupFunctions.forEach((cleanup) => cleanup());
28317
+ cleanupFunctions.clear();
28318
+ }
28319
+ function getScaleFactor(element) {
28320
+ let scale = 1;
28321
+ let currentElement = element;
28322
+ while (currentElement && currentElement !== document.documentElement) {
28323
+ let zoomStyle = currentElement.style.zoom;
28324
+ if (zoomStyle) {
28325
+ let zoom = parseFloat(zoomStyle) || 1;
28326
+ scale *= zoom;
28327
+ }
28328
+ let transformStyle = currentElement.style.transform;
28329
+ if (transformStyle) {
28330
+ let scaleMatch = transformStyle.match(/scale\(([^)]+)\)/);
28331
+ if (scaleMatch) {
28332
+ let scaleValue = parseFloat(scaleMatch[1]) || 1;
28333
+ scale *= scaleValue;
28334
+ }
28335
+ }
28336
+ currentElement = currentElement.parentElement;
28337
+ }
28338
+ return scale;
28339
+ }
26906
28340
  class SearchQuery {
26907
28341
  /**
26908
28342
  Create a query object.