@zipify/wysiwyg 3.0.2 → 3.1.0-2

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.
package/dist/wysiwyg.mjs CHANGED
@@ -27,7 +27,7 @@ var __privateMethod = (obj, member, method) => {
27
27
  return method;
28
28
  };
29
29
  var _buildDecorations, buildDecorations_fn, _domParser, _parser, _NodeFilter, NodeFilter_get, _Node, Node_get, _removeComments, removeComments_fn, _normalizeRootTags, normalizeRootTags_fn, _createNodeIterator, createNodeIterator_fn, _iterateNodes, iterateNodes_fn, _runIterator, runIterator_fn, _removeEmptyNodes, removeEmptyNodes_fn, _normalizeListItems, normalizeListItems_fn, _isBlockNode, isBlockNode_fn, _isRootNode, isRootNode_fn, _assignElementProperties, assignElementProperties_fn, _removeStyleProperties, removeStyleProperties_fn, _normalizeBreakLines, normalizeBreakLines_fn, _normalizeBlockTextDecoration, normalizeBlockTextDecoration_fn, _moveTextDecorationToChildren, moveTextDecorationToChildren_fn, _parseTextDecoration, parseTextDecoration_fn, _normalizeBlockBackgroundColor, normalizeBlockBackgroundColor_fn, _moveBackgroundColorToChildren, moveBackgroundColorToChildren_fn, _wrapTextNode, wrapTextNode_fn, _iterateNodes2, iterateNodes_fn2, _iterateChildNodes, iterateChildNodes_fn, _bubbleMarks, bubbleMarks_fn, _canBubbleMark, canBubbleMark_fn, _includesMark, includesMark_fn, _includesMarkType, includesMarkType_fn, _removeMark, removeMark_fn, _addMark, addMark_fn, _findMarkIndexByType, findMarkIndexByType_fn, _buildHtml, buildHtml_fn, _buildJson, buildJson_fn, _schema, _domParser2, _nodeDomParser, _textBlock, textBlock_fn, _normalizeTextBlockArgs, normalizeTextBlockArgs_fn, _contentSerializer, _baseClass, _makeVariable, _linkPresetId, _makeInternalVariableName, makeInternalVariableName_fn, _getWeights, getWeights_fn;
30
- import { computed, unref, toRef, reactive, watch, ref, inject, onUnmounted, nextTick, provide, onMounted } from "vue";
30
+ import { computed, unref, toRef, reactive, watch, ref, inject, nextTick, onUnmounted, provide, onMounted } from "vue";
31
31
  import { ColorModel, ZipifyColorPicker } from "@zipify/colorpicker";
32
32
  function OrderedMap(content) {
33
33
  this.content = content;
@@ -178,12 +178,12 @@ class Fragment {
178
178
  }
179
179
  nodesBetween(from2, to, f, nodeStart = 0, parent) {
180
180
  for (let i = 0, pos = 0; pos < to; i++) {
181
- let child = this.content[i], end2 = pos + child.nodeSize;
182
- if (end2 > from2 && f(child, nodeStart + pos, parent || null, i) !== false && child.content.size) {
183
- let start2 = pos + 1;
184
- child.nodesBetween(Math.max(0, from2 - start2), Math.min(child.content.size, to - start2), f, nodeStart + start2);
181
+ let child = this.content[i], end = pos + child.nodeSize;
182
+ if (end > from2 && f(child, nodeStart + pos, parent || null, i) !== false && child.content.size) {
183
+ let start = pos + 1;
184
+ child.nodesBetween(Math.max(0, from2 - start), Math.min(child.content.size, to - start), f, nodeStart + start);
185
185
  }
186
- pos = end2;
186
+ pos = end;
187
187
  }
188
188
  }
189
189
  descendants(f) {
@@ -229,9 +229,9 @@ class Fragment {
229
229
  let result = [], size2 = 0;
230
230
  if (to > from2)
231
231
  for (let i = 0, pos = 0; pos < to; i++) {
232
- let child = this.content[i], end2 = pos + child.nodeSize;
233
- if (end2 > from2) {
234
- if (pos < from2 || end2 > to) {
232
+ let child = this.content[i], end = pos + child.nodeSize;
233
+ if (end > from2) {
234
+ if (pos < from2 || end > to) {
235
235
  if (child.isText)
236
236
  child = child.cut(Math.max(0, from2 - pos), Math.min(child.text.length, to - pos));
237
237
  else
@@ -240,7 +240,7 @@ class Fragment {
240
240
  result.push(child);
241
241
  size2 += child.nodeSize;
242
242
  }
243
- pos = end2;
243
+ pos = end;
244
244
  }
245
245
  return new Fragment(result, size2);
246
246
  }
@@ -313,13 +313,13 @@ class Fragment {
313
313
  if (pos > this.size || pos < 0)
314
314
  throw new RangeError(`Position ${pos} outside of fragment (${this})`);
315
315
  for (let i = 0, curPos = 0; ; i++) {
316
- let cur = this.child(i), end2 = curPos + cur.nodeSize;
317
- if (end2 >= pos) {
318
- if (end2 == pos || round2 > 0)
319
- return retIndex(i + 1, end2);
316
+ let cur = this.child(i), end = curPos + cur.nodeSize;
317
+ if (end >= pos) {
318
+ if (end == pos || round2 > 0)
319
+ return retIndex(i + 1, end);
320
320
  return retIndex(i, curPos);
321
321
  }
322
- curPos = end2;
322
+ curPos = end;
323
323
  }
324
324
  }
325
325
  toString() {
@@ -575,13 +575,13 @@ function replaceOuter($from, $to, slice2, depth) {
575
575
  let parent = $from.parent, content = parent.content;
576
576
  return close(parent, content.cut(0, $from.parentOffset).append(slice2.content).append(content.cut($to.parentOffset)));
577
577
  } else {
578
- let { start: start2, end: end2 } = prepareSliceForReplace(slice2, $from);
579
- return close(node, replaceThreeWay($from, start2, end2, $to, depth));
578
+ let { start, end } = prepareSliceForReplace(slice2, $from);
579
+ return close(node, replaceThreeWay($from, start, end, $to, depth));
580
580
  }
581
581
  }
582
- function checkJoin(main2, sub) {
583
- if (!sub.type.compatibleContent(main2.type))
584
- throw new ReplaceError("Cannot join " + sub.type.name + " onto " + main2.type.name);
582
+ function checkJoin(main, sub) {
583
+ if (!sub.type.compatibleContent(main.type))
584
+ throw new ReplaceError("Cannot join " + sub.type.name + " onto " + main.type.name);
585
585
  }
586
586
  function joinable$1($before, $after, depth) {
587
587
  let node = $before.node(depth);
@@ -735,13 +735,13 @@ class ResolvedPos {
735
735
  return Mark$1.none;
736
736
  if (this.textOffset)
737
737
  return parent.child(index).marks;
738
- let main2 = parent.maybeChild(index - 1), other = parent.maybeChild(index);
739
- if (!main2) {
740
- let tmp = main2;
741
- main2 = other;
738
+ let main = parent.maybeChild(index - 1), other = parent.maybeChild(index);
739
+ if (!main) {
740
+ let tmp = main;
741
+ main = other;
742
742
  other = tmp;
743
743
  }
744
- let marks = main2.marks;
744
+ let marks = main.marks;
745
745
  for (var i = 0; i < marks.length; i++)
746
746
  if (marks[i].type.spec.inclusive === false && (!other || !marks[i].isInSet(other.marks)))
747
747
  marks = marks[i--].removeFromSet(marks);
@@ -790,18 +790,18 @@ class ResolvedPos {
790
790
  if (!(pos >= 0 && pos <= doc2.content.size))
791
791
  throw new RangeError("Position " + pos + " out of range");
792
792
  let path = [];
793
- let start2 = 0, parentOffset = pos;
793
+ let start = 0, parentOffset = pos;
794
794
  for (let node = doc2; ; ) {
795
795
  let { index, offset: offset2 } = node.content.findIndex(parentOffset);
796
796
  let rem = parentOffset - offset2;
797
- path.push(node, index, start2 + offset2);
797
+ path.push(node, index, start + offset2);
798
798
  if (!rem)
799
799
  break;
800
800
  node = node.child(index);
801
801
  if (node.isText)
802
802
  break;
803
803
  parentOffset = rem - 1;
804
- start2 += offset2 + 1;
804
+ start += offset2 + 1;
805
805
  }
806
806
  return new ResolvedPos(pos, path, parentOffset);
807
807
  }
@@ -907,8 +907,8 @@ class Node$1 {
907
907
  return Slice.empty;
908
908
  let $from = this.resolve(from2), $to = this.resolve(to);
909
909
  let depth = includeParents ? 0 : $from.sharedDepth(to);
910
- let start2 = $from.start(depth), node = $from.node(depth);
911
- let content = node.content.cut($from.pos - start2, $to.pos - start2);
910
+ let start = $from.start(depth), node = $from.node(depth);
911
+ let content = node.content.cut($from.pos - start, $to.pos - start);
912
912
  return new Slice(content, $from.depth - depth, $to.depth - depth);
913
913
  }
914
914
  replace(from2, to, slice2) {
@@ -989,12 +989,12 @@ class Node$1 {
989
989
  throw new Error("Called contentMatchAt on a node with invalid content");
990
990
  return match2;
991
991
  }
992
- canReplace(from2, to, replacement2 = Fragment.empty, start2 = 0, end2 = replacement2.childCount) {
993
- let one = this.contentMatchAt(from2).matchFragment(replacement2, start2, end2);
992
+ canReplace(from2, to, replacement2 = Fragment.empty, start = 0, end = replacement2.childCount) {
993
+ let one = this.contentMatchAt(from2).matchFragment(replacement2, start, end);
994
994
  let two = one && one.matchFragment(this.content, to);
995
995
  if (!two || !two.validEnd)
996
996
  return false;
997
- for (let i = start2; i < end2; i++)
997
+ for (let i = start; i < end; i++)
998
998
  if (!this.type.allowsMarks(replacement2.child(i).marks))
999
999
  return false;
1000
1000
  return true;
@@ -1002,9 +1002,9 @@ class Node$1 {
1002
1002
  canReplaceWith(from2, to, type, marks) {
1003
1003
  if (marks && !this.type.allowsMarks(marks))
1004
1004
  return false;
1005
- let start2 = this.contentMatchAt(from2).matchType(type);
1006
- let end2 = start2 && start2.matchFragment(this.content, to);
1007
- return end2 ? end2.validEnd : false;
1005
+ let start = this.contentMatchAt(from2).matchType(type);
1006
+ let end = start && start.matchFragment(this.content, to);
1007
+ return end ? end.validEnd : false;
1008
1008
  }
1009
1009
  canAppend(other) {
1010
1010
  if (other.content.size)
@@ -1124,9 +1124,9 @@ class ContentMatch {
1124
1124
  return this.next[i].next;
1125
1125
  return null;
1126
1126
  }
1127
- matchFragment(frag, start2 = 0, end2 = frag.childCount) {
1127
+ matchFragment(frag, start = 0, end = frag.childCount) {
1128
1128
  let cur = this;
1129
- for (let i = start2; cur && i < end2; i++)
1129
+ for (let i = start; cur && i < end; i++)
1130
1130
  cur = cur.matchType(frag.child(i).type);
1131
1131
  return cur;
1132
1132
  }
@@ -1884,9 +1884,9 @@ class NodeContext {
1884
1884
  if (fill) {
1885
1885
  this.match = this.type.contentMatch.matchFragment(fill);
1886
1886
  } else {
1887
- let start2 = this.type.contentMatch, wrap2;
1888
- if (wrap2 = start2.findWrapping(node.type)) {
1889
- this.match = start2;
1887
+ let start = this.type.contentMatch, wrap2;
1888
+ if (wrap2 = start.findWrapping(node.type)) {
1889
+ this.match = start;
1890
1890
  return wrap2;
1891
1891
  } else {
1892
1892
  return null;
@@ -1959,29 +1959,29 @@ class ParseContext {
1959
1959
  this.addTextNode(dom);
1960
1960
  } else if (dom.nodeType == 1) {
1961
1961
  let style2 = dom.getAttribute("style");
1962
- let marks = style2 ? this.readStyles(parseStyles(style2)) : null, top2 = this.top;
1962
+ let marks = style2 ? this.readStyles(parseStyles(style2)) : null, top = this.top;
1963
1963
  if (marks != null)
1964
1964
  for (let i = 0; i < marks.length; i++)
1965
1965
  this.addPendingMark(marks[i]);
1966
1966
  this.addElement(dom);
1967
1967
  if (marks != null)
1968
1968
  for (let i = 0; i < marks.length; i++)
1969
- this.removePendingMark(marks[i], top2);
1969
+ this.removePendingMark(marks[i], top);
1970
1970
  }
1971
1971
  }
1972
1972
  addTextNode(dom) {
1973
1973
  let value = dom.nodeValue;
1974
- let top2 = this.top;
1975
- if (top2.options & OPT_PRESERVE_WS_FULL || top2.inlineContext(dom) || /[^ \t\r\n\u000c]/.test(value)) {
1976
- if (!(top2.options & OPT_PRESERVE_WS)) {
1974
+ let top = this.top;
1975
+ if (top.options & OPT_PRESERVE_WS_FULL || top.inlineContext(dom) || /[^ \t\r\n\u000c]/.test(value)) {
1976
+ if (!(top.options & OPT_PRESERVE_WS)) {
1977
1977
  value = value.replace(/[ \t\r\n\u000c]+/g, " ");
1978
1978
  if (/^[ \t\r\n\u000c]/.test(value) && this.open == this.nodes.length - 1) {
1979
- let nodeBefore = top2.content[top2.content.length - 1];
1979
+ let nodeBefore = top.content[top.content.length - 1];
1980
1980
  let domNodeBefore = dom.previousSibling;
1981
1981
  if (!nodeBefore || domNodeBefore && domNodeBefore.nodeName == "BR" || nodeBefore.isText && /[ \t\r\n\u000c]$/.test(nodeBefore.text))
1982
1982
  value = value.slice(1);
1983
1983
  }
1984
- } else if (!(top2.options & OPT_PRESERVE_WS_FULL)) {
1984
+ } else if (!(top.options & OPT_PRESERVE_WS_FULL)) {
1985
1985
  value = value.replace(/\r?\n|\r/g, " ");
1986
1986
  } else {
1987
1987
  value = value.replace(/\r\n?/g, "\n");
@@ -2006,10 +2006,10 @@ class ParseContext {
2006
2006
  this.open = Math.max(0, this.open - 1);
2007
2007
  else if (rule && rule.skip.nodeType)
2008
2008
  dom = rule.skip;
2009
- let sync, top2 = this.top, oldNeedsBlock = this.needsBlock;
2009
+ let sync, top = this.top, oldNeedsBlock = this.needsBlock;
2010
2010
  if (blockTags.hasOwnProperty(name)) {
2011
2011
  sync = true;
2012
- if (!top2.type)
2012
+ if (!top.type)
2013
2013
  this.needsBlock = true;
2014
2014
  } else if (!dom.firstChild) {
2015
2015
  this.leafFallback(dom);
@@ -2017,7 +2017,7 @@ class ParseContext {
2017
2017
  }
2018
2018
  this.addAll(dom);
2019
2019
  if (sync)
2020
- this.sync(top2);
2020
+ this.sync(top);
2021
2021
  this.needsBlock = oldNeedsBlock;
2022
2022
  } else {
2023
2023
  this.addElementByRule(dom, rule, rule.consuming === false ? ruleID : void 0);
@@ -2090,7 +2090,7 @@ class ParseContext {
2090
2090
  }
2091
2091
  addAll(parent, startIndex2, endIndex2) {
2092
2092
  let index = startIndex2 || 0;
2093
- for (let dom = startIndex2 ? parent.childNodes[startIndex2] : parent.firstChild, end2 = endIndex2 == null ? null : parent.childNodes[endIndex2]; dom != end2; dom = dom.nextSibling, ++index) {
2093
+ for (let dom = startIndex2 ? parent.childNodes[startIndex2] : parent.firstChild, end = endIndex2 == null ? null : parent.childNodes[endIndex2]; dom != end; dom = dom.nextSibling, ++index) {
2094
2094
  this.findAtPoint(parent, index);
2095
2095
  this.addDOM(dom);
2096
2096
  }
@@ -2125,15 +2125,15 @@ class ParseContext {
2125
2125
  }
2126
2126
  if (this.findPlace(node)) {
2127
2127
  this.closeExtra();
2128
- let top2 = this.top;
2129
- top2.applyPending(node.type);
2130
- if (top2.match)
2131
- top2.match = top2.match.matchType(node.type);
2132
- let marks = top2.activeMarks;
2128
+ let top = this.top;
2129
+ top.applyPending(node.type);
2130
+ if (top.match)
2131
+ top.match = top.match.matchType(node.type);
2132
+ let marks = top.activeMarks;
2133
2133
  for (let i = 0; i < node.marks.length; i++)
2134
- if (!top2.type || top2.type.allowsMarkType(node.marks[i].type))
2134
+ if (!top.type || top.type.allowsMarkType(node.marks[i].type))
2135
2135
  marks = node.marks[i].addToSet(marks);
2136
- top2.content.push(node.mark(marks));
2136
+ top.content.push(node.mark(marks));
2137
2137
  return true;
2138
2138
  }
2139
2139
  return false;
@@ -2146,13 +2146,13 @@ class ParseContext {
2146
2146
  }
2147
2147
  enterInner(type, attrs = null, solid = false, preserveWS) {
2148
2148
  this.closeExtra();
2149
- let top2 = this.top;
2150
- top2.applyPending(type);
2151
- top2.match = top2.match && top2.match.matchType(type);
2152
- let options = wsOptionsFor(type, preserveWS, top2.options);
2153
- if (top2.options & OPT_OPEN_LEFT && top2.content.length == 0)
2149
+ let top = this.top;
2150
+ top.applyPending(type);
2151
+ top.match = top.match && top.match.matchType(type);
2152
+ let options = wsOptionsFor(type, preserveWS, top.options);
2153
+ if (top.options & OPT_OPEN_LEFT && top.content.length == 0)
2154
2154
  options |= OPT_OPEN_LEFT;
2155
- this.nodes.push(new NodeContext(type, attrs, top2.activeMarks, top2.pendingMarks, solid, null, options));
2155
+ this.nodes.push(new NodeContext(type, attrs, top.activeMarks, top.pendingMarks, solid, null, options));
2156
2156
  this.open++;
2157
2157
  }
2158
2158
  closeExtra(openEnd = false) {
@@ -2346,7 +2346,7 @@ class DOMSerializer {
2346
2346
  serializeFragment(fragment, options = {}, target) {
2347
2347
  if (!target)
2348
2348
  target = doc$1(options).createDocumentFragment();
2349
- let top2 = target, active = [];
2349
+ let top = target, active = [];
2350
2350
  fragment.forEach((node) => {
2351
2351
  if (active.length || node.marks.length) {
2352
2352
  let keep = 0, rendered = 0;
@@ -2362,18 +2362,18 @@ class DOMSerializer {
2362
2362
  rendered++;
2363
2363
  }
2364
2364
  while (keep < active.length)
2365
- top2 = active.pop()[1];
2365
+ top = active.pop()[1];
2366
2366
  while (rendered < node.marks.length) {
2367
2367
  let add = node.marks[rendered++];
2368
2368
  let markDOM = this.serializeMark(add, node.isInline, options);
2369
2369
  if (markDOM) {
2370
- active.push([add, top2]);
2371
- top2.appendChild(markDOM.dom);
2372
- top2 = markDOM.contentDOM || markDOM.dom;
2370
+ active.push([add, top]);
2371
+ top.appendChild(markDOM.dom);
2372
+ top = markDOM.contentDOM || markDOM.dom;
2373
2373
  }
2374
2374
  }
2375
2375
  }
2376
- top2.appendChild(this.serializeNodeInner(node, options));
2376
+ top.appendChild(this.serializeNodeInner(node, options));
2377
2377
  });
2378
2378
  return target;
2379
2379
  }
@@ -2415,9 +2415,9 @@ class DOMSerializer {
2415
2415
  }
2416
2416
  let contentDOM;
2417
2417
  let dom = xmlNS ? doc2.createElementNS(xmlNS, tagName) : doc2.createElement(tagName);
2418
- let attrs = structure[1], start2 = 1;
2418
+ let attrs = structure[1], start = 1;
2419
2419
  if (attrs && typeof attrs == "object" && attrs.nodeType == null && !Array.isArray(attrs)) {
2420
- start2 = 2;
2420
+ start = 2;
2421
2421
  for (let name in attrs)
2422
2422
  if (attrs[name] != null) {
2423
2423
  let space2 = name.indexOf(" ");
@@ -2427,10 +2427,10 @@ class DOMSerializer {
2427
2427
  dom.setAttribute(name, attrs[name]);
2428
2428
  }
2429
2429
  }
2430
- for (let i = start2; i < structure.length; i++) {
2430
+ for (let i = start; i < structure.length; i++) {
2431
2431
  let child = structure[i];
2432
2432
  if (child === 0) {
2433
- if (i < structure.length - 1 || i > start2)
2433
+ if (i < structure.length - 1 || i > start)
2434
2434
  throw new RangeError("Content hole must be the only child of its parent node");
2435
2435
  return { dom, contentDOM: dom };
2436
2436
  } else {
@@ -2524,18 +2524,18 @@ class StepMap {
2524
2524
  _map(pos, assoc, simple) {
2525
2525
  let diff = 0, oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;
2526
2526
  for (let i = 0; i < this.ranges.length; i += 3) {
2527
- let start2 = this.ranges[i] - (this.inverted ? diff : 0);
2528
- if (start2 > pos)
2527
+ let start = this.ranges[i] - (this.inverted ? diff : 0);
2528
+ if (start > pos)
2529
2529
  break;
2530
- let oldSize = this.ranges[i + oldIndex], newSize = this.ranges[i + newIndex], end2 = start2 + oldSize;
2531
- if (pos <= end2) {
2532
- let side = !oldSize ? assoc : pos == start2 ? -1 : pos == end2 ? 1 : assoc;
2533
- let result = start2 + diff + (side < 0 ? 0 : newSize);
2530
+ let oldSize = this.ranges[i + oldIndex], newSize = this.ranges[i + newIndex], end = start + oldSize;
2531
+ if (pos <= end) {
2532
+ let side = !oldSize ? assoc : pos == start ? -1 : pos == end ? 1 : assoc;
2533
+ let result = start + diff + (side < 0 ? 0 : newSize);
2534
2534
  if (simple)
2535
2535
  return result;
2536
- let recover = pos == (assoc < 0 ? start2 : end2) ? null : makeRecover(i / 3, pos - start2);
2537
- let del = pos == start2 ? DEL_AFTER : pos == end2 ? DEL_BEFORE : DEL_ACROSS;
2538
- if (assoc < 0 ? pos != start2 : pos != end2)
2536
+ let recover = pos == (assoc < 0 ? start : end) ? null : makeRecover(i / 3, pos - start);
2537
+ let del = pos == start ? DEL_AFTER : pos == end ? DEL_BEFORE : DEL_ACROSS;
2538
+ if (assoc < 0 ? pos != start : pos != end)
2539
2539
  del |= DEL_SIDE;
2540
2540
  return new MapResult(result, del, recover);
2541
2541
  }
@@ -2547,11 +2547,11 @@ class StepMap {
2547
2547
  let diff = 0, index = recoverIndex(recover);
2548
2548
  let oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;
2549
2549
  for (let i = 0; i < this.ranges.length; i += 3) {
2550
- let start2 = this.ranges[i] - (this.inverted ? diff : 0);
2551
- if (start2 > pos)
2550
+ let start = this.ranges[i] - (this.inverted ? diff : 0);
2551
+ if (start > pos)
2552
2552
  break;
2553
- let oldSize = this.ranges[i + oldIndex], end2 = start2 + oldSize;
2554
- if (pos <= end2 && i == index * 3)
2553
+ let oldSize = this.ranges[i + oldIndex], end = start + oldSize;
2554
+ if (pos <= end && i == index * 3)
2555
2555
  return true;
2556
2556
  diff += this.ranges[i + newIndex] - oldSize;
2557
2557
  }
@@ -2560,7 +2560,7 @@ class StepMap {
2560
2560
  forEach(f) {
2561
2561
  let oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;
2562
2562
  for (let i = 0, diff = 0; i < this.ranges.length; i += 3) {
2563
- let start2 = this.ranges[i], oldStart = start2 - (this.inverted ? diff : 0), newStart = start2 + (this.inverted ? 0 : diff);
2563
+ let start = this.ranges[i], oldStart = start - (this.inverted ? diff : 0), newStart = start + (this.inverted ? 0 : diff);
2564
2564
  let oldSize = this.ranges[i + oldIndex], newSize = this.ranges[i + newIndex];
2565
2565
  f(oldStart, oldStart + oldSize, newStart, newStart + newSize);
2566
2566
  diff += newSize - oldSize;
@@ -2941,20 +2941,20 @@ function addMark(tr, from2, to, mark) {
2941
2941
  return;
2942
2942
  let marks = node.marks;
2943
2943
  if (!mark.isInSet(marks) && parent.type.allowsMarkType(mark.type)) {
2944
- let start2 = Math.max(pos, from2), end2 = Math.min(pos + node.nodeSize, to);
2944
+ let start = Math.max(pos, from2), end = Math.min(pos + node.nodeSize, to);
2945
2945
  let newSet = mark.addToSet(marks);
2946
2946
  for (let i = 0; i < marks.length; i++) {
2947
2947
  if (!marks[i].isInSet(newSet)) {
2948
- if (removing && removing.to == start2 && removing.mark.eq(marks[i]))
2949
- removing.to = end2;
2948
+ if (removing && removing.to == start && removing.mark.eq(marks[i]))
2949
+ removing.to = end;
2950
2950
  else
2951
- removed.push(removing = new RemoveMarkStep(start2, end2, marks[i]));
2951
+ removed.push(removing = new RemoveMarkStep(start, end, marks[i]));
2952
2952
  }
2953
2953
  }
2954
- if (adding && adding.to == start2)
2955
- adding.to = end2;
2954
+ if (adding && adding.to == start)
2955
+ adding.to = end;
2956
2956
  else
2957
- added.push(adding = new AddMarkStep(start2, end2, mark));
2957
+ added.push(adding = new AddMarkStep(start, end, mark));
2958
2958
  }
2959
2959
  });
2960
2960
  removed.forEach((s) => tr.step(s));
@@ -2980,7 +2980,7 @@ function removeMark(tr, from2, to, mark) {
2980
2980
  toRemove = node.marks;
2981
2981
  }
2982
2982
  if (toRemove && toRemove.length) {
2983
- let end2 = Math.min(pos + node.nodeSize, to);
2983
+ let end = Math.min(pos + node.nodeSize, to);
2984
2984
  for (let i = 0; i < toRemove.length; i++) {
2985
2985
  let style2 = toRemove[i], found2;
2986
2986
  for (let j = 0; j < matched.length; j++) {
@@ -2989,10 +2989,10 @@ function removeMark(tr, from2, to, mark) {
2989
2989
  found2 = m;
2990
2990
  }
2991
2991
  if (found2) {
2992
- found2.to = end2;
2992
+ found2.to = end;
2993
2993
  found2.step = step;
2994
2994
  } else {
2995
- matched.push({ style: style2, from: Math.max(pos, from2), to: end2, step });
2995
+ matched.push({ style: style2, from: Math.max(pos, from2), to: end, step });
2996
2996
  }
2997
2997
  }
2998
2998
  }
@@ -3003,17 +3003,17 @@ function clearIncompatible(tr, pos, parentType, match2 = parentType.contentMatch
3003
3003
  let node = tr.doc.nodeAt(pos);
3004
3004
  let delSteps = [], cur = pos + 1;
3005
3005
  for (let i = 0; i < node.childCount; i++) {
3006
- let child = node.child(i), end2 = cur + child.nodeSize;
3006
+ let child = node.child(i), end = cur + child.nodeSize;
3007
3007
  let allowed = match2.matchType(child.type);
3008
3008
  if (!allowed) {
3009
- delSteps.push(new ReplaceStep(cur, end2, Slice.empty));
3009
+ delSteps.push(new ReplaceStep(cur, end, Slice.empty));
3010
3010
  } else {
3011
3011
  match2 = allowed;
3012
3012
  for (let j = 0; j < child.marks.length; j++)
3013
3013
  if (!parentType.allowsMarkType(child.marks[j].type))
3014
- tr.step(new RemoveMarkStep(cur, end2, child.marks[j]));
3014
+ tr.step(new RemoveMarkStep(cur, end, child.marks[j]));
3015
3015
  }
3016
- cur = end2;
3016
+ cur = end;
3017
3017
  }
3018
3018
  if (!match2.validEnd) {
3019
3019
  let fill = match2.fillBefore(Fragment.empty, true);
@@ -3022,8 +3022,8 @@ function clearIncompatible(tr, pos, parentType, match2 = parentType.contentMatch
3022
3022
  for (let i = delSteps.length - 1; i >= 0; i--)
3023
3023
  tr.step(delSteps[i]);
3024
3024
  }
3025
- function canCut(node, start2, end2) {
3026
- return (start2 == 0 || node.canReplace(start2, node.childCount)) && (end2 == node.childCount || node.canReplace(0, end2));
3025
+ function canCut(node, start, end) {
3026
+ return (start == 0 || node.canReplace(start, node.childCount)) && (end == node.childCount || node.canReplace(0, end));
3027
3027
  }
3028
3028
  function liftTarget(range) {
3029
3029
  let parent = range.parent;
@@ -3041,7 +3041,7 @@ function liftTarget(range) {
3041
3041
  function lift$2(tr, range, target) {
3042
3042
  let { $from, $to, depth } = range;
3043
3043
  let gapStart = $from.before(depth + 1), gapEnd = $to.after(depth + 1);
3044
- let start2 = gapStart, end2 = gapEnd;
3044
+ let start = gapStart, end = gapEnd;
3045
3045
  let before = Fragment.empty, openStart = 0;
3046
3046
  for (let d = depth, splitting = false; d > target; d--)
3047
3047
  if (splitting || $from.index(d) > 0) {
@@ -3049,7 +3049,7 @@ function lift$2(tr, range, target) {
3049
3049
  before = Fragment.from($from.node(d).copy(before));
3050
3050
  openStart++;
3051
3051
  } else {
3052
- start2--;
3052
+ start--;
3053
3053
  }
3054
3054
  let after = Fragment.empty, openEnd = 0;
3055
3055
  for (let d = depth, splitting = false; d > target; d--)
@@ -3058,9 +3058,9 @@ function lift$2(tr, range, target) {
3058
3058
  after = Fragment.from($to.node(d).copy(after));
3059
3059
  openEnd++;
3060
3060
  } else {
3061
- end2++;
3061
+ end++;
3062
3062
  }
3063
- tr.step(new ReplaceAroundStep(start2, end2, gapStart, gapEnd, new Slice(before.append(after), openStart, openEnd), before.size - openStart, true));
3063
+ tr.step(new ReplaceAroundStep(start, end, gapStart, gapEnd, new Slice(before.append(after), openStart, openEnd), before.size - openStart, true));
3064
3064
  }
3065
3065
  function findWrapping(range, nodeType, attrs = null, innerRange = range) {
3066
3066
  let around = findWrappingOutside(range, nodeType);
@@ -3104,8 +3104,8 @@ function wrap(tr, range, wrappers) {
3104
3104
  }
3105
3105
  content = Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content));
3106
3106
  }
3107
- let start2 = range.start, end2 = range.end;
3108
- tr.step(new ReplaceAroundStep(start2, end2, start2, end2, new Slice(content, 0, 0), wrappers.length, true));
3107
+ let start = range.start, end = range.end;
3108
+ tr.step(new ReplaceAroundStep(start, end, start, end, new Slice(content, 0, 0), wrappers.length, true));
3109
3109
  }
3110
3110
  function setBlockType$1(tr, from2, to, type, attrs) {
3111
3111
  if (!type.isTextblock)
@@ -3364,8 +3364,8 @@ class Fitter {
3364
3364
  mustMoveInline() {
3365
3365
  if (!this.$to.parent.isTextblock)
3366
3366
  return -1;
3367
- let top2 = this.frontier[this.depth], level;
3368
- if (!top2.type.isTextblock || !contentAfterFits(this.$to, this.$to.depth, top2.type, top2.match, false) || this.$to.depth == this.depth && (level = this.findCloseLevel(this.$to)) && level.depth == this.depth)
3367
+ let top = this.frontier[this.depth], level;
3368
+ if (!top.type.isTextblock || !contentAfterFits(this.$to, this.$to.depth, top.type, top.match, false) || this.$to.depth == this.depth && (level = this.findCloseLevel(this.$to)) && level.depth == this.depth)
3369
3369
  return -1;
3370
3370
  let { depth } = this.$to, after = this.$to.after(depth);
3371
3371
  while (depth > 1 && after == this.$to.end(--depth))
@@ -3405,8 +3405,8 @@ class Fitter {
3405
3405
  return $to;
3406
3406
  }
3407
3407
  openFrontierNode(type, attrs = null, content) {
3408
- let top2 = this.frontier[this.depth];
3409
- top2.match = top2.match.matchType(type);
3408
+ let top = this.frontier[this.depth];
3409
+ top.match = top.match.matchType(type);
3410
3410
  this.placed = addToFragment(this.placed, this.depth, Fragment.from(type.create(attrs, content)));
3411
3411
  this.frontier.push({ type, match: type.contentMatch });
3412
3412
  }
@@ -3452,8 +3452,8 @@ function contentAfterFits($to, depth, type, match2, open) {
3452
3452
  let fit = match2.fillBefore(node.content, true, index);
3453
3453
  return fit && !invalidMarks(type, node.content, index) ? fit : null;
3454
3454
  }
3455
- function invalidMarks(type, fragment, start2) {
3456
- for (let i = start2; i < fragment.childCount; i++)
3455
+ function invalidMarks(type, fragment, start) {
3456
+ for (let i = start; i < fragment.childCount; i++)
3457
3457
  if (!type.allowsMarks(fragment.child(i).marks))
3458
3458
  return true;
3459
3459
  return false;
@@ -3532,8 +3532,8 @@ function closeFragment(fragment, depth, oldOpen, newOpen, parent) {
3532
3532
  }
3533
3533
  if (depth > newOpen) {
3534
3534
  let match2 = parent.contentMatchAt(0);
3535
- let start2 = match2.fillBefore(fragment).append(fragment);
3536
- fragment = start2.append(match2.matchFragment(start2).fillBefore(Fragment.empty, true));
3535
+ let start = match2.fillBefore(fragment).append(fragment);
3536
+ fragment = start.append(match2.matchFragment(start).fillBefore(Fragment.empty, true));
3537
3537
  }
3538
3538
  return fragment;
3539
3539
  }
@@ -3564,10 +3564,10 @@ function deleteRange$1(tr, from2, to) {
3564
3564
  function coveredDepths($from, $to) {
3565
3565
  let result = [], minDepth = Math.min($from.depth, $to.depth);
3566
3566
  for (let d = minDepth; d >= 0; d--) {
3567
- let start2 = $from.start(d);
3568
- if (start2 < $from.pos - ($from.depth - d) || $to.end(d) > $to.pos + ($to.depth - d) || $from.node(d).type.spec.isolating || $to.node(d).type.spec.isolating)
3567
+ let start = $from.start(d);
3568
+ if (start < $from.pos - ($from.depth - d) || $to.end(d) > $to.pos + ($to.depth - d) || $from.node(d).type.spec.isolating || $to.node(d).type.spec.isolating)
3569
3569
  break;
3570
- if (start2 == $to.start(d) || d == $from.depth && d == $to.depth && $from.parent.inlineContent && $to.parent.inlineContent && d && $to.start(d - 1) == start2 - 1)
3570
+ if (start == $to.start(d) || d == $from.depth && d == $to.depth && $from.parent.inlineContent && $to.parent.inlineContent && d && $to.start(d - 1) == start - 1)
3571
3571
  result.push(d);
3572
3572
  }
3573
3573
  return result;
@@ -3987,12 +3987,12 @@ function selectionToInsertionEnd$1(tr, startLen, bias) {
3987
3987
  let step = tr.steps[last];
3988
3988
  if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep))
3989
3989
  return;
3990
- let map2 = tr.mapping.maps[last], end2;
3990
+ let map2 = tr.mapping.maps[last], end;
3991
3991
  map2.forEach((_from, _to, _newFrom, newTo) => {
3992
- if (end2 == null)
3993
- end2 = newTo;
3992
+ if (end == null)
3993
+ end = newTo;
3994
3994
  });
3995
- tr.setSelection(Selection.near(tr.doc.resolve(end2), bias));
3995
+ tr.setSelection(Selection.near(tr.doc.resolve(end), bias));
3996
3996
  }
3997
3997
  const UPDATED_SEL = 1, UPDATED_MARKS = 2, UPDATED_SCROLL = 4;
3998
3998
  class Transaction extends Transform {
@@ -4441,7 +4441,7 @@ function windowRect(doc2) {
4441
4441
  bottom: doc2.documentElement.clientHeight
4442
4442
  };
4443
4443
  }
4444
- function getSide(value, side) {
4444
+ function getSide$1(value, side) {
4445
4445
  return typeof value == "number" ? value : value[side];
4446
4446
  }
4447
4447
  function clientRect(node) {
@@ -4467,14 +4467,14 @@ function scrollRectIntoView(view, rect, startDOM) {
4467
4467
  let atTop = elt == doc2.body;
4468
4468
  let bounding = atTop ? windowRect(doc2) : clientRect(elt);
4469
4469
  let moveX = 0, moveY = 0;
4470
- if (rect.top < bounding.top + getSide(scrollThreshold, "top"))
4471
- moveY = -(bounding.top - rect.top + getSide(scrollMargin, "top"));
4472
- else if (rect.bottom > bounding.bottom - getSide(scrollThreshold, "bottom"))
4473
- moveY = rect.bottom - bounding.bottom + getSide(scrollMargin, "bottom");
4474
- if (rect.left < bounding.left + getSide(scrollThreshold, "left"))
4475
- moveX = -(bounding.left - rect.left + getSide(scrollMargin, "left"));
4476
- else if (rect.right > bounding.right - getSide(scrollThreshold, "right"))
4477
- moveX = rect.right - bounding.right + getSide(scrollMargin, "right");
4470
+ if (rect.top < bounding.top + getSide$1(scrollThreshold, "top"))
4471
+ moveY = -(bounding.top - rect.top + getSide$1(scrollMargin, "top"));
4472
+ else if (rect.bottom > bounding.bottom - getSide$1(scrollThreshold, "bottom"))
4473
+ moveY = rect.bottom - bounding.bottom + getSide$1(scrollMargin, "bottom");
4474
+ if (rect.left < bounding.left + getSide$1(scrollThreshold, "left"))
4475
+ moveX = -(bounding.left - rect.left + getSide$1(scrollMargin, "left"));
4476
+ else if (rect.right > bounding.right - getSide$1(scrollThreshold, "right"))
4477
+ moveX = rect.right - bounding.right + getSide$1(scrollMargin, "right");
4478
4478
  if (moveX || moveY) {
4479
4479
  if (atTop) {
4480
4480
  doc2.defaultView.scrollBy(moveX, moveY);
@@ -4523,11 +4523,11 @@ function resetScrollPos({ refDOM, refTop, stack }) {
4523
4523
  }
4524
4524
  function restoreScrollStack(stack, dTop) {
4525
4525
  for (let i = 0; i < stack.length; i++) {
4526
- let { dom, top: top2, left: left2 } = stack[i];
4527
- if (dom.scrollTop != top2 + dTop)
4528
- dom.scrollTop = top2 + dTop;
4529
- if (dom.scrollLeft != left2)
4530
- dom.scrollLeft = left2;
4526
+ let { dom, top, left } = stack[i];
4527
+ if (dom.scrollTop != top + dTop)
4528
+ dom.scrollTop = top + dTop;
4529
+ if (dom.scrollLeft != left)
4530
+ dom.scrollLeft = left;
4531
4531
  }
4532
4532
  }
4533
4533
  let preventScrollSupported = null;
@@ -4773,16 +4773,16 @@ function coordsAtPos(view, pos, side) {
4773
4773
  }
4774
4774
  return flattenV(singleRect(node.nodeType == 3 ? textRange(node) : node, -side), side >= 0);
4775
4775
  }
4776
- function flattenV(rect, left2) {
4776
+ function flattenV(rect, left) {
4777
4777
  if (rect.width == 0)
4778
4778
  return rect;
4779
- let x = left2 ? rect.left : rect.right;
4779
+ let x = left ? rect.left : rect.right;
4780
4780
  return { top: rect.top, bottom: rect.bottom, left: x, right: x };
4781
4781
  }
4782
- function flattenH(rect, top2) {
4782
+ function flattenH(rect, top) {
4783
4783
  if (rect.height == 0)
4784
4784
  return rect;
4785
- let y = top2 ? rect.top : rect.bottom;
4785
+ let y = top ? rect.top : rect.bottom;
4786
4786
  return { top: y, bottom: y, left: rect.left, right: rect.right };
4787
4787
  }
4788
4788
  function withFlushedState(view, state, f) {
@@ -5011,15 +5011,15 @@ class ViewDesc {
5011
5011
  }
5012
5012
  descAt(pos) {
5013
5013
  for (let i = 0, offset2 = 0; i < this.children.length; i++) {
5014
- let child = this.children[i], end2 = offset2 + child.size;
5015
- if (offset2 == pos && end2 != offset2) {
5014
+ let child = this.children[i], end = offset2 + child.size;
5015
+ if (offset2 == pos && end != offset2) {
5016
5016
  while (!child.border && child.children.length)
5017
5017
  child = child.children[0];
5018
5018
  return child;
5019
5019
  }
5020
- if (pos < end2)
5020
+ if (pos < end)
5021
5021
  return child.descAt(pos - offset2 - child.border);
5022
- offset2 = end2;
5022
+ offset2 = end;
5023
5023
  }
5024
5024
  }
5025
5025
  domFromPos(pos, side) {
@@ -5027,12 +5027,12 @@ class ViewDesc {
5027
5027
  return { node: this.dom, offset: 0 };
5028
5028
  let i = 0, offset2 = 0;
5029
5029
  for (let curPos = 0; i < this.children.length; i++) {
5030
- let child = this.children[i], end2 = curPos + child.size;
5031
- if (end2 > pos || child instanceof TrailingHackViewDesc) {
5030
+ let child = this.children[i], end = curPos + child.size;
5031
+ if (end > pos || child instanceof TrailingHackViewDesc) {
5032
5032
  offset2 = pos - curPos;
5033
5033
  break;
5034
5034
  }
5035
- curPos = end2;
5035
+ curPos = end;
5036
5036
  }
5037
5037
  if (offset2)
5038
5038
  return this.children[i].domFromPos(offset2 - this.children[i].border, side);
@@ -5065,10 +5065,10 @@ class ViewDesc {
5065
5065
  return { node: this.contentDOM, from: from2, to, fromOffset: 0, toOffset: this.contentDOM.childNodes.length };
5066
5066
  let fromOffset = -1, toOffset = -1;
5067
5067
  for (let offset2 = base2, i = 0; ; i++) {
5068
- let child = this.children[i], end2 = offset2 + child.size;
5069
- if (fromOffset == -1 && from2 <= end2) {
5068
+ let child = this.children[i], end = offset2 + child.size;
5069
+ if (fromOffset == -1 && from2 <= end) {
5070
5070
  let childBase = offset2 + child.border;
5071
- if (from2 >= childBase && to <= end2 - child.border && child.node && child.contentDOM && this.contentDOM.contains(child.contentDOM))
5071
+ if (from2 >= childBase && to <= end - child.border && child.node && child.contentDOM && this.contentDOM.contains(child.contentDOM))
5072
5072
  return child.parseRange(from2, to, childBase);
5073
5073
  from2 = offset2;
5074
5074
  for (let j = i; j > 0; j--) {
@@ -5082,8 +5082,8 @@ class ViewDesc {
5082
5082
  if (fromOffset == -1)
5083
5083
  fromOffset = 0;
5084
5084
  }
5085
- if (fromOffset > -1 && (end2 > to || i == this.children.length - 1)) {
5086
- to = end2;
5085
+ if (fromOffset > -1 && (end > to || i == this.children.length - 1)) {
5086
+ to = end;
5087
5087
  for (let j = i + 1; j < this.children.length; j++) {
5088
5088
  let next2 = this.children[j];
5089
5089
  if (next2.size && next2.dom.parentNode == this.contentDOM && !next2.emptyChildAt(-1)) {
@@ -5096,7 +5096,7 @@ class ViewDesc {
5096
5096
  toOffset = this.contentDOM.childNodes.length;
5097
5097
  break;
5098
5098
  }
5099
- offset2 = end2;
5099
+ offset2 = end;
5100
5100
  }
5101
5101
  return { node: this.contentDOM, from: from2, to, fromOffset, toOffset };
5102
5102
  }
@@ -5115,10 +5115,10 @@ class ViewDesc {
5115
5115
  setSelection(anchor, head, root2, force = false) {
5116
5116
  let from2 = Math.min(anchor, head), to = Math.max(anchor, head);
5117
5117
  for (let i = 0, offset2 = 0; i < this.children.length; i++) {
5118
- let child = this.children[i], end2 = offset2 + child.size;
5119
- if (from2 > offset2 && to < end2)
5118
+ let child = this.children[i], end = offset2 + child.size;
5119
+ if (from2 > offset2 && to < end)
5120
5120
  return child.setSelection(anchor - offset2 - child.border, head - offset2 - child.border, root2, force);
5121
- offset2 = end2;
5121
+ offset2 = end;
5122
5122
  }
5123
5123
  let anchorDOM = this.domFromPos(anchor, anchor ? -1 : 1);
5124
5124
  let headDOM = head == anchor ? anchorDOM : this.domFromPos(head, head ? -1 : 1);
@@ -5185,11 +5185,11 @@ class ViewDesc {
5185
5185
  }
5186
5186
  markDirty(from2, to) {
5187
5187
  for (let offset2 = 0, i = 0; i < this.children.length; i++) {
5188
- let child = this.children[i], end2 = offset2 + child.size;
5189
- if (offset2 == end2 ? from2 <= end2 && to >= offset2 : from2 < end2 && to > offset2) {
5190
- let startInside = offset2 + child.border, endInside = end2 - child.border;
5188
+ let child = this.children[i], end = offset2 + child.size;
5189
+ if (offset2 == end ? from2 <= end && to >= offset2 : from2 < end && to > offset2) {
5190
+ let startInside = offset2 + child.border, endInside = end - child.border;
5191
5191
  if (from2 >= startInside && to <= endInside) {
5192
- this.dirty = from2 == offset2 || to == end2 ? CONTENT_DIRTY : CHILD_DIRTY;
5192
+ this.dirty = from2 == offset2 || to == end ? CONTENT_DIRTY : CHILD_DIRTY;
5193
5193
  if (from2 == startInside && to == endInside && (child.contentLost || child.dom.parentNode != this.contentDOM))
5194
5194
  child.dirty = NODE_DIRTY;
5195
5195
  else
@@ -5199,7 +5199,7 @@ class ViewDesc {
5199
5199
  child.dirty = child.dom == child.contentDOM && child.dom.parentNode == this.contentDOM && !child.children.length ? CONTENT_DIRTY : NODE_DIRTY;
5200
5200
  }
5201
5201
  }
5202
- offset2 = end2;
5202
+ offset2 = end;
5203
5203
  }
5204
5204
  this.dirty = CONTENT_DIRTY;
5205
5205
  }
@@ -5667,25 +5667,25 @@ const noDeco = [new OuterDecoLevel()];
5667
5667
  function computeOuterDeco(outerDeco, node, needsWrap) {
5668
5668
  if (outerDeco.length == 0)
5669
5669
  return noDeco;
5670
- let top2 = needsWrap ? noDeco[0] : new OuterDecoLevel(), result = [top2];
5670
+ let top = needsWrap ? noDeco[0] : new OuterDecoLevel(), result = [top];
5671
5671
  for (let i = 0; i < outerDeco.length; i++) {
5672
5672
  let attrs = outerDeco[i].type.attrs;
5673
5673
  if (!attrs)
5674
5674
  continue;
5675
5675
  if (attrs.nodeName)
5676
- result.push(top2 = new OuterDecoLevel(attrs.nodeName));
5676
+ result.push(top = new OuterDecoLevel(attrs.nodeName));
5677
5677
  for (let name in attrs) {
5678
5678
  let val = attrs[name];
5679
5679
  if (val == null)
5680
5680
  continue;
5681
5681
  if (needsWrap && result.length == 1)
5682
- result.push(top2 = new OuterDecoLevel(node.isInline ? "span" : "div"));
5682
+ result.push(top = new OuterDecoLevel(node.isInline ? "span" : "div"));
5683
5683
  if (name == "class")
5684
- top2.class = (top2.class ? top2.class + " " : "") + val;
5684
+ top.class = (top.class ? top.class + " " : "") + val;
5685
5685
  else if (name == "style")
5686
- top2.style = (top2.style ? top2.style + ";" : "") + val;
5686
+ top.style = (top.style ? top.style + ";" : "") + val;
5687
5687
  else if (name != "nodeName")
5688
- top2[name] = val;
5688
+ top[name] = val;
5689
5689
  }
5690
5690
  }
5691
5691
  return result;
@@ -5758,20 +5758,20 @@ function rm(dom) {
5758
5758
  return next2;
5759
5759
  }
5760
5760
  class ViewTreeUpdater {
5761
- constructor(top2, lock) {
5761
+ constructor(top, lock) {
5762
5762
  this.lock = lock;
5763
5763
  this.index = 0;
5764
5764
  this.stack = [];
5765
5765
  this.changed = false;
5766
- this.top = top2;
5767
- this.preMatch = preMatch(top2.node.content, top2);
5766
+ this.top = top;
5767
+ this.preMatch = preMatch(top.node.content, top);
5768
5768
  }
5769
- destroyBetween(start2, end2) {
5770
- if (start2 == end2)
5769
+ destroyBetween(start, end) {
5770
+ if (start == end)
5771
5771
  return;
5772
- for (let i = start2; i < end2; i++)
5772
+ for (let i = start; i < end; i++)
5773
5773
  this.top.children[i].destroy();
5774
- this.top.children.splice(start2, end2 - start2);
5774
+ this.top.children.splice(start, end - start);
5775
5775
  this.changed = true;
5776
5776
  }
5777
5777
  destroyRest() {
@@ -6005,24 +6005,24 @@ function iterDeco(parent, deco, onWidget, onNode) {
6005
6005
  active.splice(i--, 1);
6006
6006
  while (decoIndex < locals.length && locals[decoIndex].from <= offset2 && locals[decoIndex].to > offset2)
6007
6007
  active.push(locals[decoIndex++]);
6008
- let end2 = offset2 + child.nodeSize;
6008
+ let end = offset2 + child.nodeSize;
6009
6009
  if (child.isText) {
6010
- let cutAt = end2;
6010
+ let cutAt = end;
6011
6011
  if (decoIndex < locals.length && locals[decoIndex].from < cutAt)
6012
6012
  cutAt = locals[decoIndex].from;
6013
6013
  for (let i = 0; i < active.length; i++)
6014
6014
  if (active[i].to < cutAt)
6015
6015
  cutAt = active[i].to;
6016
- if (cutAt < end2) {
6016
+ if (cutAt < end) {
6017
6017
  restNode = child.cut(cutAt - offset2);
6018
6018
  child = child.cut(0, cutAt - offset2);
6019
- end2 = cutAt;
6019
+ end = cutAt;
6020
6020
  index = -1;
6021
6021
  }
6022
6022
  }
6023
6023
  let outerDeco = child.isInline && !child.isLeaf ? active.filter((d) => !d.inline) : active.slice();
6024
6024
  onNode(child, outerDeco, deco.forChild(offset2, child), index);
6025
- offset2 = end2;
6025
+ offset2 = end;
6026
6026
  }
6027
6027
  }
6028
6028
  function iosHacks(dom) {
@@ -6077,18 +6077,18 @@ function findTextInFragment(frag, text2, from2, to) {
6077
6077
  function replaceNodes(nodes, from2, to, view, replacement2) {
6078
6078
  let result = [];
6079
6079
  for (let i = 0, off = 0; i < nodes.length; i++) {
6080
- let child = nodes[i], start2 = off, end2 = off += child.size;
6081
- if (start2 >= to || end2 <= from2) {
6080
+ let child = nodes[i], start = off, end = off += child.size;
6081
+ if (start >= to || end <= from2) {
6082
6082
  result.push(child);
6083
6083
  } else {
6084
- if (start2 < from2)
6085
- result.push(child.slice(0, from2 - start2, view));
6084
+ if (start < from2)
6085
+ result.push(child.slice(0, from2 - start, view));
6086
6086
  if (replacement2) {
6087
6087
  result.push(replacement2);
6088
6088
  replacement2 = void 0;
6089
6089
  }
6090
- if (end2 > to)
6091
- result.push(child.slice(to - start2, child.size, view));
6090
+ if (end > to)
6091
+ result.push(child.slice(to - start, child.size, view));
6092
6092
  }
6093
6093
  }
6094
6094
  return result;
@@ -7308,21 +7308,21 @@ editHandlers.drop = (view, _event) => {
7308
7308
  if (move)
7309
7309
  tr.deleteSelection();
7310
7310
  let pos = tr.mapping.map(insertPos);
7311
- let isNode = slice2.openStart == 0 && slice2.openEnd == 0 && slice2.content.childCount == 1;
7311
+ let isNode2 = slice2.openStart == 0 && slice2.openEnd == 0 && slice2.content.childCount == 1;
7312
7312
  let beforeInsert = tr.doc;
7313
- if (isNode)
7313
+ if (isNode2)
7314
7314
  tr.replaceRangeWith(pos, pos, slice2.content.firstChild);
7315
7315
  else
7316
7316
  tr.replaceRange(pos, pos, slice2);
7317
7317
  if (tr.doc.eq(beforeInsert))
7318
7318
  return;
7319
7319
  let $pos = tr.doc.resolve(pos);
7320
- if (isNode && NodeSelection.isSelectable(slice2.content.firstChild) && $pos.nodeAfter && $pos.nodeAfter.sameMarkup(slice2.content.firstChild)) {
7320
+ if (isNode2 && NodeSelection.isSelectable(slice2.content.firstChild) && $pos.nodeAfter && $pos.nodeAfter.sameMarkup(slice2.content.firstChild)) {
7321
7321
  tr.setSelection(new NodeSelection($pos));
7322
7322
  } else {
7323
- let end2 = tr.mapping.map(insertPos);
7324
- tr.mapping.maps[tr.mapping.maps.length - 1].forEach((_from, _to, _newFrom, newTo) => end2 = newTo);
7325
- tr.setSelection(selectionBetween(view, $pos, tr.doc.resolve(end2)));
7323
+ let end = tr.mapping.map(insertPos);
7324
+ tr.mapping.maps[tr.mapping.maps.length - 1].forEach((_from, _to, _newFrom, newTo) => end = newTo);
7325
+ tr.setSelection(selectionBetween(view, $pos, tr.doc.resolve(end)));
7326
7326
  }
7327
7327
  view.focus();
7328
7328
  view.dispatch(tr.setMeta("uiEvent", "drop"));
@@ -7488,21 +7488,21 @@ class DecorationSet {
7488
7488
  static create(doc2, decorations) {
7489
7489
  return decorations.length ? buildTree(decorations, doc2, 0, noSpec) : empty$1;
7490
7490
  }
7491
- find(start2, end2, predicate) {
7491
+ find(start, end, predicate) {
7492
7492
  let result = [];
7493
- this.findInner(start2 == null ? 0 : start2, end2 == null ? 1e9 : end2, result, 0, predicate);
7493
+ this.findInner(start == null ? 0 : start, end == null ? 1e9 : end, result, 0, predicate);
7494
7494
  return result;
7495
7495
  }
7496
- findInner(start2, end2, result, offset2, predicate) {
7496
+ findInner(start, end, result, offset2, predicate) {
7497
7497
  for (let i = 0; i < this.local.length; i++) {
7498
7498
  let span = this.local[i];
7499
- if (span.from <= end2 && span.to >= start2 && (!predicate || predicate(span.spec)))
7499
+ if (span.from <= end && span.to >= start && (!predicate || predicate(span.spec)))
7500
7500
  result.push(span.copy(span.from + offset2, span.to + offset2));
7501
7501
  }
7502
7502
  for (let i = 0; i < this.children.length; i += 3) {
7503
- if (this.children[i] < end2 && this.children[i + 1] > start2) {
7503
+ if (this.children[i] < end && this.children[i + 1] > start) {
7504
7504
  let childOff = this.children[i] + 1;
7505
- this.children[i + 2].findInner(start2 - childOff, end2 - childOff, result, offset2 + childOff, predicate);
7505
+ this.children[i + 2].findInner(start - childOff, end - childOff, result, offset2 + childOff, predicate);
7506
7506
  }
7507
7507
  }
7508
7508
  }
@@ -7610,11 +7610,11 @@ class DecorationSet {
7610
7610
  child = this.children[i + 2];
7611
7611
  break;
7612
7612
  }
7613
- let start2 = offset2 + 1, end2 = start2 + node.content.size;
7613
+ let start = offset2 + 1, end = start + node.content.size;
7614
7614
  for (let i = 0; i < this.local.length; i++) {
7615
7615
  let dec = this.local[i];
7616
- if (dec.from < end2 && dec.to > start2 && dec.type instanceof InlineType) {
7617
- let from2 = Math.max(start2, dec.from) - start2, to = Math.min(end2, dec.to) - start2;
7616
+ if (dec.from < end && dec.to > start && dec.type instanceof InlineType) {
7617
+ let from2 = Math.max(start, dec.from) - start, to = Math.min(end, dec.to) - start;
7618
7618
  if (from2 < to)
7619
7619
  (local || (local = [])).push(dec.copy(from2, to));
7620
7620
  }
@@ -7722,12 +7722,12 @@ function mapChildren(oldChildren, newLocal, mapping, node, offset2, oldOffset, o
7722
7722
  let children = oldChildren.slice();
7723
7723
  let shift2 = (oldStart, oldEnd, newStart, newEnd) => {
7724
7724
  for (let i = 0; i < children.length; i += 3) {
7725
- let end2 = children[i + 1], dSize;
7726
- if (end2 < 0 || oldStart > end2 + oldOffset)
7725
+ let end = children[i + 1], dSize;
7726
+ if (end < 0 || oldStart > end + oldOffset)
7727
7727
  continue;
7728
- let start2 = children[i] + oldOffset;
7729
- if (oldEnd >= start2) {
7730
- children[i + 1] = oldStart <= start2 ? -2 : -1;
7728
+ let start = children[i] + oldOffset;
7729
+ if (oldEnd >= start) {
7730
+ children[i + 1] = oldStart <= start ? -2 : -1;
7731
7731
  } else if (newStart >= offset2 && (dSize = newEnd - newStart - (oldEnd - oldStart))) {
7732
7732
  children[i] += dSize;
7733
7733
  children[i + 1] += dSize;
@@ -7814,9 +7814,9 @@ function mapAndGatherRemainingDecorations(children, oldChildren, decorations, ma
7814
7814
  function takeSpansForNode(spans, node, offset2) {
7815
7815
  if (node.isLeaf)
7816
7816
  return null;
7817
- let end2 = offset2 + node.nodeSize, found2 = null;
7817
+ let end = offset2 + node.nodeSize, found2 = null;
7818
7818
  for (let i = 0, span; i < spans.length; i++) {
7819
- if ((span = spans[i]) && span.from > offset2 && span.to < end2) {
7819
+ if ((span = spans[i]) && span.from > offset2 && span.to < end) {
7820
7820
  (found2 || (found2 = [])).push(span);
7821
7821
  spans[i] = null;
7822
7822
  }
@@ -8331,54 +8331,54 @@ function isMarkChange(cur, prev) {
8331
8331
  if (Fragment.from(updated).eq(cur))
8332
8332
  return { mark, type };
8333
8333
  }
8334
- function looksLikeJoin(old, start2, end2, $newStart, $newEnd) {
8335
- if (!$newStart.parent.isTextblock || end2 - start2 <= $newEnd.pos - $newStart.pos || skipClosingAndOpening($newStart, true, false) < $newEnd.pos)
8334
+ function looksLikeJoin(old, start, end, $newStart, $newEnd) {
8335
+ if (!$newStart.parent.isTextblock || end - start <= $newEnd.pos - $newStart.pos || skipClosingAndOpening($newStart, true, false) < $newEnd.pos)
8336
8336
  return false;
8337
- let $start = old.resolve(start2);
8337
+ let $start = old.resolve(start);
8338
8338
  if ($start.parentOffset < $start.parent.content.size || !$start.parent.isTextblock)
8339
8339
  return false;
8340
8340
  let $next = old.resolve(skipClosingAndOpening($start, true, true));
8341
- if (!$next.parent.isTextblock || $next.pos > end2 || skipClosingAndOpening($next, true, false) < end2)
8341
+ if (!$next.parent.isTextblock || $next.pos > end || skipClosingAndOpening($next, true, false) < end)
8342
8342
  return false;
8343
8343
  return $newStart.parent.content.cut($newStart.parentOffset).eq($next.parent.content);
8344
8344
  }
8345
8345
  function skipClosingAndOpening($pos, fromEnd, mayOpen) {
8346
- let depth = $pos.depth, end2 = fromEnd ? $pos.end() : $pos.pos;
8346
+ let depth = $pos.depth, end = fromEnd ? $pos.end() : $pos.pos;
8347
8347
  while (depth > 0 && (fromEnd || $pos.indexAfter(depth) == $pos.node(depth).childCount)) {
8348
8348
  depth--;
8349
- end2++;
8349
+ end++;
8350
8350
  fromEnd = false;
8351
8351
  }
8352
8352
  if (mayOpen) {
8353
8353
  let next2 = $pos.node(depth).maybeChild($pos.indexAfter(depth));
8354
8354
  while (next2 && !next2.isLeaf) {
8355
8355
  next2 = next2.firstChild;
8356
- end2++;
8356
+ end++;
8357
8357
  }
8358
8358
  }
8359
- return end2;
8359
+ return end;
8360
8360
  }
8361
8361
  function findDiff(a, b, pos, preferredPos, preferredSide) {
8362
- let start2 = a.findDiffStart(b, pos);
8363
- if (start2 == null)
8362
+ let start = a.findDiffStart(b, pos);
8363
+ if (start == null)
8364
8364
  return null;
8365
8365
  let { a: endA, b: endB } = a.findDiffEnd(b, pos + a.size, pos + b.size);
8366
8366
  if (preferredSide == "end") {
8367
- let adjust = Math.max(0, start2 - Math.min(endA, endB));
8368
- preferredPos -= endA + adjust - start2;
8369
- }
8370
- if (endA < start2 && a.size < b.size) {
8371
- let move = preferredPos <= start2 && preferredPos >= endA ? start2 - preferredPos : 0;
8372
- start2 -= move;
8373
- endB = start2 + (endB - endA);
8374
- endA = start2;
8375
- } else if (endB < start2) {
8376
- let move = preferredPos <= start2 && preferredPos >= endB ? start2 - preferredPos : 0;
8377
- start2 -= move;
8378
- endA = start2 + (endA - endB);
8379
- endB = start2;
8380
- }
8381
- return { start: start2, endA, endB };
8367
+ let adjust = Math.max(0, start - Math.min(endA, endB));
8368
+ preferredPos -= endA + adjust - start;
8369
+ }
8370
+ if (endA < start && a.size < b.size) {
8371
+ let move = preferredPos <= start && preferredPos >= endA ? start - preferredPos : 0;
8372
+ start -= move;
8373
+ endB = start + (endB - endA);
8374
+ endA = start;
8375
+ } else if (endB < start) {
8376
+ let move = preferredPos <= start && preferredPos >= endB ? start - preferredPos : 0;
8377
+ start -= move;
8378
+ endA = start + (endA - endB);
8379
+ endB = start;
8380
+ }
8381
+ return { start, endA, endB };
8382
8382
  }
8383
8383
  class EditorView {
8384
8384
  constructor(place, props) {
@@ -8752,7 +8752,7 @@ var base = {
8752
8752
  222: "'",
8753
8753
  229: "q"
8754
8754
  };
8755
- var shift = {
8755
+ var shift$1 = {
8756
8756
  48: ")",
8757
8757
  49: "!",
8758
8758
  50: "@",
@@ -8791,14 +8791,14 @@ for (var i = 1; i <= 24; i++)
8791
8791
  base[i + 111] = "F" + i;
8792
8792
  for (var i = 65; i <= 90; i++) {
8793
8793
  base[i] = String.fromCharCode(i + 32);
8794
- shift[i] = String.fromCharCode(i);
8794
+ shift$1[i] = String.fromCharCode(i);
8795
8795
  }
8796
8796
  for (var code in base)
8797
- if (!shift.hasOwnProperty(code))
8798
- shift[code] = base[code];
8797
+ if (!shift$1.hasOwnProperty(code))
8798
+ shift$1[code] = base[code];
8799
8799
  function keyName(event) {
8800
8800
  var ignoreKey = brokenModifierNames && (event.ctrlKey || event.altKey || event.metaKey) || (safari || ie) && event.shiftKey && event.key && event.key.length == 1;
8801
- var name = !ignoreKey && event.key || (event.shiftKey ? shift : base)[event.keyCode] || event.key || "Unidentified";
8801
+ var name = !ignoreKey && event.key || (event.shiftKey ? shift$1 : base)[event.keyCode] || event.key || "Unidentified";
8802
8802
  if (name == "Esc")
8803
8803
  name = "Escape";
8804
8804
  if (name == "Del")
@@ -9124,12 +9124,12 @@ function deleteBarrier(state, $cut, dispatch) {
9124
9124
  let canDelAfter = $cut.parent.canReplace($cut.index(), $cut.index() + 1);
9125
9125
  if (canDelAfter && (conn = (match2 = before.contentMatchAt(before.childCount)).findWrapping(after.type)) && match2.matchType(conn[0] || after.type).validEnd) {
9126
9126
  if (dispatch) {
9127
- let end2 = $cut.pos + after.nodeSize, wrap2 = Fragment.empty;
9127
+ let end = $cut.pos + after.nodeSize, wrap2 = Fragment.empty;
9128
9128
  for (let i = conn.length - 1; i >= 0; i--)
9129
9129
  wrap2 = Fragment.from(conn[i].create(null, wrap2));
9130
9130
  wrap2 = Fragment.from(before.copy(wrap2));
9131
- let tr = state.tr.step(new ReplaceAroundStep($cut.pos - 1, end2, $cut.pos, end2, new Slice(wrap2, 1, 0), conn.length, true));
9132
- let joinAt = end2 + 2 * conn.length;
9131
+ let tr = state.tr.step(new ReplaceAroundStep($cut.pos - 1, end, $cut.pos, end, new Slice(wrap2, 1, 0), conn.length, true));
9132
+ let joinAt = end + 2 * conn.length;
9133
9133
  if (canJoin(tr.doc, joinAt))
9134
9134
  tr.join(joinAt);
9135
9135
  dispatch(tr.scrollIntoView());
@@ -9156,10 +9156,10 @@ function deleteBarrier(state, $cut, dispatch) {
9156
9156
  afterDepth++;
9157
9157
  if (at.canReplace(at.childCount, at.childCount, afterText.content)) {
9158
9158
  if (dispatch) {
9159
- let end2 = Fragment.empty;
9159
+ let end = Fragment.empty;
9160
9160
  for (let i = wrap2.length - 1; i >= 0; i--)
9161
- end2 = Fragment.from(wrap2[i].copy(end2));
9162
- let tr = state.tr.step(new ReplaceAroundStep($cut.pos - wrap2.length, $cut.pos + after.nodeSize, $cut.pos + afterDepth, $cut.pos + after.nodeSize - afterDepth, new Slice(end2, wrap2.length, 0), 0, true));
9161
+ end = Fragment.from(wrap2[i].copy(end));
9162
+ let tr = state.tr.step(new ReplaceAroundStep($cut.pos - wrap2.length, $cut.pos + after.nodeSize, $cut.pos + afterDepth, $cut.pos + after.nodeSize - afterDepth, new Slice(end, wrap2.length, 0), 0, true));
9163
9163
  dispatch(tr.scrollIntoView());
9164
9164
  }
9165
9165
  return true;
@@ -9278,9 +9278,9 @@ function liftListItem$1(itemType) {
9278
9278
  };
9279
9279
  }
9280
9280
  function liftToOuterList(state, dispatch, itemType, range) {
9281
- let tr = state.tr, end2 = range.end, endOfList = range.$to.end(range.depth);
9282
- if (end2 < endOfList) {
9283
- tr.step(new ReplaceAroundStep(end2 - 1, endOfList, end2, endOfList, new Slice(Fragment.from(itemType.create(null, range.parent.copy())), 1, 0), 1, true));
9281
+ let tr = state.tr, end = range.end, endOfList = range.$to.end(range.depth);
9282
+ if (end < endOfList) {
9283
+ tr.step(new ReplaceAroundStep(end - 1, endOfList, end, endOfList, new Slice(Fragment.from(itemType.create(null, range.parent.copy())), 1, 0), 1, true));
9284
9284
  range = new NodeRange(tr.doc.resolve(range.$from.pos), tr.doc.resolve(endOfList), range.depth);
9285
9285
  }
9286
9286
  dispatch(tr.lift(range, liftTarget(range)).scrollIntoView());
@@ -9299,8 +9299,8 @@ function liftOutOfList(state, dispatch, range) {
9299
9299
  let parent = $start.node(-1), indexBefore = $start.index(-1);
9300
9300
  if (!parent.canReplace(indexBefore + (atStart ? 0 : 1), indexBefore + 1, item.content.append(atEnd ? Fragment.empty : Fragment.from(list))))
9301
9301
  return false;
9302
- let start2 = $start.pos, end2 = start2 + item.nodeSize;
9303
- tr.step(new ReplaceAroundStep(start2 - (atStart ? 1 : 0), end2 + (atEnd ? 1 : 0), start2 + 1, end2 - 1, new Slice((atStart ? Fragment.empty : Fragment.from(list.copy(Fragment.empty))).append(atEnd ? Fragment.empty : Fragment.from(list.copy(Fragment.empty))), atStart ? 0 : 1, atEnd ? 0 : 1), atStart ? 0 : 1));
9302
+ let start = $start.pos, end = start + item.nodeSize;
9303
+ tr.step(new ReplaceAroundStep(start - (atStart ? 1 : 0), end + (atEnd ? 1 : 0), start + 1, end - 1, new Slice((atStart ? Fragment.empty : Fragment.from(list.copy(Fragment.empty))).append(atEnd ? Fragment.empty : Fragment.from(list.copy(Fragment.empty))), atStart ? 0 : 1, atEnd ? 0 : 1), atStart ? 0 : 1));
9304
9304
  dispatch(tr.scrollIntoView());
9305
9305
  return true;
9306
9306
  }
@@ -9460,11 +9460,11 @@ class EventEmitter {
9460
9460
  constructor() {
9461
9461
  this.callbacks = {};
9462
9462
  }
9463
- on(event, fn2) {
9463
+ on(event, fn) {
9464
9464
  if (!this.callbacks[event]) {
9465
9465
  this.callbacks[event] = [];
9466
9466
  }
9467
- this.callbacks[event].push(fn2);
9467
+ this.callbacks[event].push(fn);
9468
9468
  return this;
9469
9469
  }
9470
9470
  emit(event, ...args) {
@@ -9474,11 +9474,11 @@ class EventEmitter {
9474
9474
  }
9475
9475
  return this;
9476
9476
  }
9477
- off(event, fn2) {
9477
+ off(event, fn) {
9478
9478
  const callbacks2 = this.callbacks[event];
9479
9479
  if (callbacks2) {
9480
- if (fn2) {
9481
- this.callbacks[event] = callbacks2.filter((callback) => callback !== fn2);
9480
+ if (fn) {
9481
+ this.callbacks[event] = callbacks2.filter((callback) => callback !== fn);
9482
9482
  } else {
9483
9483
  delete this.callbacks[event];
9484
9484
  }
@@ -10006,11 +10006,11 @@ function run$2(config) {
10006
10006
  if (match2.index === void 0) {
10007
10007
  return;
10008
10008
  }
10009
- const start2 = resolvedFrom + match2.index + 1;
10010
- const end2 = start2 + match2[0].length;
10009
+ const start = resolvedFrom + match2.index + 1;
10010
+ const end = start + match2[0].length;
10011
10011
  const range = {
10012
- from: state.tr.mapping.map(start2),
10013
- to: state.tr.mapping.map(end2)
10012
+ from: state.tr.mapping.map(start),
10013
+ to: state.tr.mapping.map(end)
10014
10014
  };
10015
10015
  const handler = rule.handler({
10016
10016
  state,
@@ -10486,8 +10486,8 @@ const clearNodes = () => ({ state, tr, dispatch }) => {
10486
10486
  });
10487
10487
  return true;
10488
10488
  };
10489
- const command = (fn2) => (props) => {
10490
- return fn2(props);
10489
+ const command = (fn) => (props) => {
10490
+ return fn(props);
10491
10491
  };
10492
10492
  const createParagraphNear = () => ({ state, dispatch }) => {
10493
10493
  return createParagraphNear$1(state, dispatch);
@@ -10551,22 +10551,22 @@ function getMarkRange($pos, type, attributes = {}) {
10551
10551
  if (!$pos || !type) {
10552
10552
  return;
10553
10553
  }
10554
- let start2 = $pos.parent.childAfter($pos.parentOffset);
10555
- if ($pos.parentOffset === start2.offset && start2.offset !== 0) {
10556
- start2 = $pos.parent.childBefore($pos.parentOffset);
10554
+ let start = $pos.parent.childAfter($pos.parentOffset);
10555
+ if ($pos.parentOffset === start.offset && start.offset !== 0) {
10556
+ start = $pos.parent.childBefore($pos.parentOffset);
10557
10557
  }
10558
- if (!start2.node) {
10558
+ if (!start.node) {
10559
10559
  return;
10560
10560
  }
10561
- const mark = findMarkInSet([...start2.node.marks], type, attributes);
10561
+ const mark = findMarkInSet([...start.node.marks], type, attributes);
10562
10562
  if (!mark) {
10563
10563
  return;
10564
10564
  }
10565
- let startIndex2 = start2.index;
10566
- let startPos = $pos.start() + start2.offset;
10565
+ let startIndex2 = start.index;
10566
+ let startPos = $pos.start() + start.offset;
10567
10567
  let endIndex2 = startIndex2 + 1;
10568
- let endPos = startPos + start2.node.nodeSize;
10569
- findMarkInSet([...start2.node.marks], type, attributes);
10568
+ let endPos = startPos + start.node.nodeSize;
10569
+ findMarkInSet([...start.node.marks], type, attributes);
10570
10570
  while (startIndex2 > 0 && mark.isInSet($pos.parent.child(startIndex2 - 1).marks)) {
10571
10571
  startIndex2 -= 1;
10572
10572
  startPos -= $pos.parent.child(startIndex2).nodeSize;
@@ -10684,8 +10684,8 @@ const focus = (position = null, options = {}) => ({ editor, view, tr, dispatch }
10684
10684
  }
10685
10685
  return true;
10686
10686
  };
10687
- const forEach$1 = (items, fn2) => (props) => {
10688
- return items.every((item, index) => fn2(item, { ...props, index }));
10687
+ const forEach$1 = (items, fn) => (props) => {
10688
+ return items.every((item, index) => fn(item, { ...props, index }));
10689
10689
  };
10690
10690
  const insertContent = (value, options) => ({ tr, commands: commands2 }) => {
10691
10691
  return commands2.insertContentAt({ from: tr.selection.from, to: tr.selection.to }, value, options);
@@ -10727,13 +10727,13 @@ function selectionToInsertionEnd(tr, startLen, bias) {
10727
10727
  return;
10728
10728
  }
10729
10729
  const map2 = tr.mapping.maps[last];
10730
- let end2 = 0;
10730
+ let end = 0;
10731
10731
  map2.forEach((_from, _to, _newFrom, newTo) => {
10732
- if (end2 === 0) {
10733
- end2 = newTo;
10732
+ if (end === 0) {
10733
+ end = newTo;
10734
10734
  }
10735
10735
  });
10736
- tr.setSelection(Selection.near(tr.doc.resolve(end2), bias));
10736
+ tr.setSelection(Selection.near(tr.doc.resolve(end), bias));
10737
10737
  }
10738
10738
  const isFragment = (nodeOrFragment) => {
10739
10739
  return nodeOrFragment.toString().startsWith("<");
@@ -11204,10 +11204,10 @@ const splitListItem = (typeOrName) => ({ tr, state, dispatch, editor }) => {
11204
11204
  const newNextTypeAttributes2 = getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs);
11205
11205
  const nextType2 = ((_a = type.contentMatch.defaultType) === null || _a === void 0 ? void 0 : _a.createAndFill(newNextTypeAttributes2)) || void 0;
11206
11206
  wrap2 = wrap2.append(Fragment.from(type.createAndFill(null, nextType2) || void 0));
11207
- const start2 = $from.before($from.depth - (depthBefore - 1));
11208
- tr.replace(start2, $from.after(-depthAfter), new Slice(wrap2, 4 - depthBefore, 0));
11207
+ const start = $from.before($from.depth - (depthBefore - 1));
11208
+ tr.replace(start, $from.after(-depthAfter), new Slice(wrap2, 4 - depthBefore, 0));
11209
11209
  let sel = -1;
11210
- tr.doc.nodesBetween(start2, tr.doc.content.size, (n, pos) => {
11210
+ tr.doc.nodesBetween(start, tr.doc.content.size, (n, pos) => {
11211
11211
  if (sel > -1) {
11212
11212
  return false;
11213
11213
  }
@@ -12028,9 +12028,9 @@ class Editor$1 extends EventEmitter {
12028
12028
  nodeViews: this.extensionManager.nodeViews
12029
12029
  });
12030
12030
  }
12031
- captureTransaction(fn2) {
12031
+ captureTransaction(fn) {
12032
12032
  this.isCapturingTransaction = true;
12033
- fn2();
12033
+ fn();
12034
12034
  this.isCapturingTransaction = false;
12035
12035
  const tr = this.capturedTransaction;
12036
12036
  this.capturedTransaction = null;
@@ -12436,1463 +12436,6 @@ function markPasteRule(config) {
12436
12436
  }
12437
12437
  });
12438
12438
  }
12439
- var top = "top";
12440
- var bottom = "bottom";
12441
- var right = "right";
12442
- var left = "left";
12443
- var auto = "auto";
12444
- var basePlacements = [top, bottom, right, left];
12445
- var start = "start";
12446
- var end = "end";
12447
- var clippingParents = "clippingParents";
12448
- var viewport = "viewport";
12449
- var popper = "popper";
12450
- var reference = "reference";
12451
- var variationPlacements = /* @__PURE__ */ basePlacements.reduce(function(acc, placement) {
12452
- return acc.concat([placement + "-" + start, placement + "-" + end]);
12453
- }, []);
12454
- var placements = /* @__PURE__ */ [].concat(basePlacements, [auto]).reduce(function(acc, placement) {
12455
- return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
12456
- }, []);
12457
- var beforeRead = "beforeRead";
12458
- var read = "read";
12459
- var afterRead = "afterRead";
12460
- var beforeMain = "beforeMain";
12461
- var main = "main";
12462
- var afterMain = "afterMain";
12463
- var beforeWrite = "beforeWrite";
12464
- var write = "write";
12465
- var afterWrite = "afterWrite";
12466
- var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
12467
- function getNodeName(element) {
12468
- return element ? (element.nodeName || "").toLowerCase() : null;
12469
- }
12470
- function getWindow(node) {
12471
- if (node == null) {
12472
- return window;
12473
- }
12474
- if (node.toString() !== "[object Window]") {
12475
- var ownerDocument = node.ownerDocument;
12476
- return ownerDocument ? ownerDocument.defaultView || window : window;
12477
- }
12478
- return node;
12479
- }
12480
- function isElement$1(node) {
12481
- var OwnElement = getWindow(node).Element;
12482
- return node instanceof OwnElement || node instanceof Element;
12483
- }
12484
- function isHTMLElement(node) {
12485
- var OwnElement = getWindow(node).HTMLElement;
12486
- return node instanceof OwnElement || node instanceof HTMLElement;
12487
- }
12488
- function isShadowRoot(node) {
12489
- if (typeof ShadowRoot === "undefined") {
12490
- return false;
12491
- }
12492
- var OwnElement = getWindow(node).ShadowRoot;
12493
- return node instanceof OwnElement || node instanceof ShadowRoot;
12494
- }
12495
- function applyStyles(_ref) {
12496
- var state = _ref.state;
12497
- Object.keys(state.elements).forEach(function(name) {
12498
- var style2 = state.styles[name] || {};
12499
- var attributes = state.attributes[name] || {};
12500
- var element = state.elements[name];
12501
- if (!isHTMLElement(element) || !getNodeName(element)) {
12502
- return;
12503
- }
12504
- Object.assign(element.style, style2);
12505
- Object.keys(attributes).forEach(function(name2) {
12506
- var value = attributes[name2];
12507
- if (value === false) {
12508
- element.removeAttribute(name2);
12509
- } else {
12510
- element.setAttribute(name2, value === true ? "" : value);
12511
- }
12512
- });
12513
- });
12514
- }
12515
- function effect$2(_ref2) {
12516
- var state = _ref2.state;
12517
- var initialStyles = {
12518
- popper: {
12519
- position: state.options.strategy,
12520
- left: "0",
12521
- top: "0",
12522
- margin: "0"
12523
- },
12524
- arrow: {
12525
- position: "absolute"
12526
- },
12527
- reference: {}
12528
- };
12529
- Object.assign(state.elements.popper.style, initialStyles.popper);
12530
- state.styles = initialStyles;
12531
- if (state.elements.arrow) {
12532
- Object.assign(state.elements.arrow.style, initialStyles.arrow);
12533
- }
12534
- return function() {
12535
- Object.keys(state.elements).forEach(function(name) {
12536
- var element = state.elements[name];
12537
- var attributes = state.attributes[name] || {};
12538
- var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);
12539
- var style2 = styleProperties.reduce(function(style3, property) {
12540
- style3[property] = "";
12541
- return style3;
12542
- }, {});
12543
- if (!isHTMLElement(element) || !getNodeName(element)) {
12544
- return;
12545
- }
12546
- Object.assign(element.style, style2);
12547
- Object.keys(attributes).forEach(function(attribute) {
12548
- element.removeAttribute(attribute);
12549
- });
12550
- });
12551
- };
12552
- }
12553
- const applyStyles$1 = {
12554
- name: "applyStyles",
12555
- enabled: true,
12556
- phase: "write",
12557
- fn: applyStyles,
12558
- effect: effect$2,
12559
- requires: ["computeStyles"]
12560
- };
12561
- function getBasePlacement(placement) {
12562
- return placement.split("-")[0];
12563
- }
12564
- var max$3 = Math.max;
12565
- var min$3 = Math.min;
12566
- var round = Math.round;
12567
- function getUAString() {
12568
- var uaData = navigator.userAgentData;
12569
- if (uaData != null && uaData.brands) {
12570
- return uaData.brands.map(function(item) {
12571
- return item.brand + "/" + item.version;
12572
- }).join(" ");
12573
- }
12574
- return navigator.userAgent;
12575
- }
12576
- function isLayoutViewport() {
12577
- return !/^((?!chrome|android).)*safari/i.test(getUAString());
12578
- }
12579
- function getBoundingClientRect(element, includeScale, isFixedStrategy) {
12580
- if (includeScale === void 0) {
12581
- includeScale = false;
12582
- }
12583
- if (isFixedStrategy === void 0) {
12584
- isFixedStrategy = false;
12585
- }
12586
- var clientRect2 = element.getBoundingClientRect();
12587
- var scaleX = 1;
12588
- var scaleY = 1;
12589
- if (includeScale && isHTMLElement(element)) {
12590
- scaleX = element.offsetWidth > 0 ? round(clientRect2.width) / element.offsetWidth || 1 : 1;
12591
- scaleY = element.offsetHeight > 0 ? round(clientRect2.height) / element.offsetHeight || 1 : 1;
12592
- }
12593
- var _ref = isElement$1(element) ? getWindow(element) : window, visualViewport = _ref.visualViewport;
12594
- var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
12595
- var x = (clientRect2.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
12596
- var y = (clientRect2.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
12597
- var width = clientRect2.width / scaleX;
12598
- var height = clientRect2.height / scaleY;
12599
- return {
12600
- width,
12601
- height,
12602
- top: y,
12603
- right: x + width,
12604
- bottom: y + height,
12605
- left: x,
12606
- x,
12607
- y
12608
- };
12609
- }
12610
- function getLayoutRect(element) {
12611
- var clientRect2 = getBoundingClientRect(element);
12612
- var width = element.offsetWidth;
12613
- var height = element.offsetHeight;
12614
- if (Math.abs(clientRect2.width - width) <= 1) {
12615
- width = clientRect2.width;
12616
- }
12617
- if (Math.abs(clientRect2.height - height) <= 1) {
12618
- height = clientRect2.height;
12619
- }
12620
- return {
12621
- x: element.offsetLeft,
12622
- y: element.offsetTop,
12623
- width,
12624
- height
12625
- };
12626
- }
12627
- function contains(parent, child) {
12628
- var rootNode = child.getRootNode && child.getRootNode();
12629
- if (parent.contains(child)) {
12630
- return true;
12631
- } else if (rootNode && isShadowRoot(rootNode)) {
12632
- var next2 = child;
12633
- do {
12634
- if (next2 && parent.isSameNode(next2)) {
12635
- return true;
12636
- }
12637
- next2 = next2.parentNode || next2.host;
12638
- } while (next2);
12639
- }
12640
- return false;
12641
- }
12642
- function getComputedStyle$1(element) {
12643
- return getWindow(element).getComputedStyle(element);
12644
- }
12645
- function isTableElement(element) {
12646
- return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0;
12647
- }
12648
- function getDocumentElement(element) {
12649
- return ((isElement$1(element) ? element.ownerDocument : element.document) || window.document).documentElement;
12650
- }
12651
- function getParentNode(element) {
12652
- if (getNodeName(element) === "html") {
12653
- return element;
12654
- }
12655
- return element.assignedSlot || element.parentNode || (isShadowRoot(element) ? element.host : null) || getDocumentElement(element);
12656
- }
12657
- function getTrueOffsetParent(element) {
12658
- if (!isHTMLElement(element) || getComputedStyle$1(element).position === "fixed") {
12659
- return null;
12660
- }
12661
- return element.offsetParent;
12662
- }
12663
- function getContainingBlock(element) {
12664
- var isFirefox = /firefox/i.test(getUAString());
12665
- var isIE = /Trident/i.test(getUAString());
12666
- if (isIE && isHTMLElement(element)) {
12667
- var elementCss = getComputedStyle$1(element);
12668
- if (elementCss.position === "fixed") {
12669
- return null;
12670
- }
12671
- }
12672
- var currentNode = getParentNode(element);
12673
- if (isShadowRoot(currentNode)) {
12674
- currentNode = currentNode.host;
12675
- }
12676
- while (isHTMLElement(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
12677
- var css = getComputedStyle$1(currentNode);
12678
- 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") {
12679
- return currentNode;
12680
- } else {
12681
- currentNode = currentNode.parentNode;
12682
- }
12683
- }
12684
- return null;
12685
- }
12686
- function getOffsetParent(element) {
12687
- var window2 = getWindow(element);
12688
- var offsetParent = getTrueOffsetParent(element);
12689
- while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === "static") {
12690
- offsetParent = getTrueOffsetParent(offsetParent);
12691
- }
12692
- if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle$1(offsetParent).position === "static")) {
12693
- return window2;
12694
- }
12695
- return offsetParent || getContainingBlock(element) || window2;
12696
- }
12697
- function getMainAxisFromPlacement(placement) {
12698
- return ["top", "bottom"].indexOf(placement) >= 0 ? "x" : "y";
12699
- }
12700
- function within(min2, value, max2) {
12701
- return max$3(min2, min$3(value, max2));
12702
- }
12703
- function withinMaxClamp(min2, value, max2) {
12704
- var v = within(min2, value, max2);
12705
- return v > max2 ? max2 : v;
12706
- }
12707
- function getFreshSideObject() {
12708
- return {
12709
- top: 0,
12710
- right: 0,
12711
- bottom: 0,
12712
- left: 0
12713
- };
12714
- }
12715
- function mergePaddingObject(paddingObject) {
12716
- return Object.assign({}, getFreshSideObject(), paddingObject);
12717
- }
12718
- function expandToHashMap(value, keys3) {
12719
- return keys3.reduce(function(hashMap, key) {
12720
- hashMap[key] = value;
12721
- return hashMap;
12722
- }, {});
12723
- }
12724
- var toPaddingObject = function toPaddingObject2(padding, state) {
12725
- padding = typeof padding === "function" ? padding(Object.assign({}, state.rects, {
12726
- placement: state.placement
12727
- })) : padding;
12728
- return mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
12729
- };
12730
- function arrow(_ref) {
12731
- var _state$modifiersData$;
12732
- var state = _ref.state, name = _ref.name, options = _ref.options;
12733
- var arrowElement = state.elements.arrow;
12734
- var popperOffsets2 = state.modifiersData.popperOffsets;
12735
- var basePlacement = getBasePlacement(state.placement);
12736
- var axis = getMainAxisFromPlacement(basePlacement);
12737
- var isVertical = [left, right].indexOf(basePlacement) >= 0;
12738
- var len = isVertical ? "height" : "width";
12739
- if (!arrowElement || !popperOffsets2) {
12740
- return;
12741
- }
12742
- var paddingObject = toPaddingObject(options.padding, state);
12743
- var arrowRect = getLayoutRect(arrowElement);
12744
- var minProp = axis === "y" ? top : left;
12745
- var maxProp = axis === "y" ? bottom : right;
12746
- var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets2[axis] - state.rects.popper[len];
12747
- var startDiff = popperOffsets2[axis] - state.rects.reference[axis];
12748
- var arrowOffsetParent = getOffsetParent(arrowElement);
12749
- var clientSize = arrowOffsetParent ? axis === "y" ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
12750
- var centerToReference = endDiff / 2 - startDiff / 2;
12751
- var min2 = paddingObject[minProp];
12752
- var max2 = clientSize - arrowRect[len] - paddingObject[maxProp];
12753
- var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
12754
- var offset2 = within(min2, center, max2);
12755
- var axisProp = axis;
12756
- state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset2, _state$modifiersData$.centerOffset = offset2 - center, _state$modifiersData$);
12757
- }
12758
- function effect$1(_ref2) {
12759
- var state = _ref2.state, options = _ref2.options;
12760
- var _options$element = options.element, arrowElement = _options$element === void 0 ? "[data-popper-arrow]" : _options$element;
12761
- if (arrowElement == null) {
12762
- return;
12763
- }
12764
- if (typeof arrowElement === "string") {
12765
- arrowElement = state.elements.popper.querySelector(arrowElement);
12766
- if (!arrowElement) {
12767
- return;
12768
- }
12769
- }
12770
- if (process.env.NODE_ENV !== "production") {
12771
- if (!isHTMLElement(arrowElement)) {
12772
- console.error(['Popper: "arrow" element must be an HTMLElement (not an SVGElement).', "To use an SVG arrow, wrap it in an HTMLElement that will be used as", "the arrow."].join(" "));
12773
- }
12774
- }
12775
- if (!contains(state.elements.popper, arrowElement)) {
12776
- if (process.env.NODE_ENV !== "production") {
12777
- console.error(['Popper: "arrow" modifier\'s `element` must be a child of the popper', "element."].join(" "));
12778
- }
12779
- return;
12780
- }
12781
- state.elements.arrow = arrowElement;
12782
- }
12783
- const arrow$1 = {
12784
- name: "arrow",
12785
- enabled: true,
12786
- phase: "main",
12787
- fn: arrow,
12788
- effect: effect$1,
12789
- requires: ["popperOffsets"],
12790
- requiresIfExists: ["preventOverflow"]
12791
- };
12792
- function getVariation(placement) {
12793
- return placement.split("-")[1];
12794
- }
12795
- var unsetSides = {
12796
- top: "auto",
12797
- right: "auto",
12798
- bottom: "auto",
12799
- left: "auto"
12800
- };
12801
- function roundOffsetsByDPR(_ref) {
12802
- var x = _ref.x, y = _ref.y;
12803
- var win = window;
12804
- var dpr = win.devicePixelRatio || 1;
12805
- return {
12806
- x: round(x * dpr) / dpr || 0,
12807
- y: round(y * dpr) / dpr || 0
12808
- };
12809
- }
12810
- function mapToStyles(_ref2) {
12811
- var _Object$assign2;
12812
- var popper2 = _ref2.popper, popperRect = _ref2.popperRect, placement = _ref2.placement, variation = _ref2.variation, offsets = _ref2.offsets, position = _ref2.position, gpuAcceleration = _ref2.gpuAcceleration, adaptive = _ref2.adaptive, roundOffsets = _ref2.roundOffsets, isFixed = _ref2.isFixed;
12813
- var _offsets$x = offsets.x, x = _offsets$x === void 0 ? 0 : _offsets$x, _offsets$y = offsets.y, y = _offsets$y === void 0 ? 0 : _offsets$y;
12814
- var _ref3 = typeof roundOffsets === "function" ? roundOffsets({
12815
- x,
12816
- y
12817
- }) : {
12818
- x,
12819
- y
12820
- };
12821
- x = _ref3.x;
12822
- y = _ref3.y;
12823
- var hasX = offsets.hasOwnProperty("x");
12824
- var hasY = offsets.hasOwnProperty("y");
12825
- var sideX = left;
12826
- var sideY = top;
12827
- var win = window;
12828
- if (adaptive) {
12829
- var offsetParent = getOffsetParent(popper2);
12830
- var heightProp = "clientHeight";
12831
- var widthProp = "clientWidth";
12832
- if (offsetParent === getWindow(popper2)) {
12833
- offsetParent = getDocumentElement(popper2);
12834
- if (getComputedStyle$1(offsetParent).position !== "static" && position === "absolute") {
12835
- heightProp = "scrollHeight";
12836
- widthProp = "scrollWidth";
12837
- }
12838
- }
12839
- offsetParent = offsetParent;
12840
- if (placement === top || (placement === left || placement === right) && variation === end) {
12841
- sideY = bottom;
12842
- var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : offsetParent[heightProp];
12843
- y -= offsetY - popperRect.height;
12844
- y *= gpuAcceleration ? 1 : -1;
12845
- }
12846
- if (placement === left || (placement === top || placement === bottom) && variation === end) {
12847
- sideX = right;
12848
- var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : offsetParent[widthProp];
12849
- x -= offsetX - popperRect.width;
12850
- x *= gpuAcceleration ? 1 : -1;
12851
- }
12852
- }
12853
- var commonStyles = Object.assign({
12854
- position
12855
- }, adaptive && unsetSides);
12856
- var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
12857
- x,
12858
- y
12859
- }) : {
12860
- x,
12861
- y
12862
- };
12863
- x = _ref4.x;
12864
- y = _ref4.y;
12865
- if (gpuAcceleration) {
12866
- var _Object$assign;
12867
- return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? "0" : "", _Object$assign[sideX] = hasX ? "0" : "", _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
12868
- }
12869
- return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "", _Object$assign2[sideX] = hasX ? x + "px" : "", _Object$assign2.transform = "", _Object$assign2));
12870
- }
12871
- function computeStyles(_ref5) {
12872
- var state = _ref5.state, options = _ref5.options;
12873
- var _options$gpuAccelerat = options.gpuAcceleration, gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, _options$adaptive = options.adaptive, adaptive = _options$adaptive === void 0 ? true : _options$adaptive, _options$roundOffsets = options.roundOffsets, roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
12874
- if (process.env.NODE_ENV !== "production") {
12875
- var transitionProperty = getComputedStyle$1(state.elements.popper).transitionProperty || "";
12876
- if (adaptive && ["transform", "top", "right", "bottom", "left"].some(function(property) {
12877
- return transitionProperty.indexOf(property) >= 0;
12878
- })) {
12879
- console.warn(["Popper: Detected CSS transitions on at least one of the following", 'CSS properties: "transform", "top", "right", "bottom", "left".', "\n\n", 'Disable the "computeStyles" modifier\'s `adaptive` option to allow', "for smooth transitions, or remove these properties from the CSS", "transition declaration on the popper element if only transitioning", "opacity or background-color for example.", "\n\n", "We recommend using the popper element as a wrapper around an inner", "element that can have any CSS property transitioned for animations."].join(" "));
12880
- }
12881
- }
12882
- var commonStyles = {
12883
- placement: getBasePlacement(state.placement),
12884
- variation: getVariation(state.placement),
12885
- popper: state.elements.popper,
12886
- popperRect: state.rects.popper,
12887
- gpuAcceleration,
12888
- isFixed: state.options.strategy === "fixed"
12889
- };
12890
- if (state.modifiersData.popperOffsets != null) {
12891
- state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
12892
- offsets: state.modifiersData.popperOffsets,
12893
- position: state.options.strategy,
12894
- adaptive,
12895
- roundOffsets
12896
- })));
12897
- }
12898
- if (state.modifiersData.arrow != null) {
12899
- state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
12900
- offsets: state.modifiersData.arrow,
12901
- position: "absolute",
12902
- adaptive: false,
12903
- roundOffsets
12904
- })));
12905
- }
12906
- state.attributes.popper = Object.assign({}, state.attributes.popper, {
12907
- "data-popper-placement": state.placement
12908
- });
12909
- }
12910
- const computeStyles$1 = {
12911
- name: "computeStyles",
12912
- enabled: true,
12913
- phase: "beforeWrite",
12914
- fn: computeStyles,
12915
- data: {}
12916
- };
12917
- var passive = {
12918
- passive: true
12919
- };
12920
- function effect(_ref) {
12921
- var state = _ref.state, instance = _ref.instance, options = _ref.options;
12922
- 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;
12923
- var window2 = getWindow(state.elements.popper);
12924
- var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
12925
- if (scroll) {
12926
- scrollParents.forEach(function(scrollParent) {
12927
- scrollParent.addEventListener("scroll", instance.update, passive);
12928
- });
12929
- }
12930
- if (resize) {
12931
- window2.addEventListener("resize", instance.update, passive);
12932
- }
12933
- return function() {
12934
- if (scroll) {
12935
- scrollParents.forEach(function(scrollParent) {
12936
- scrollParent.removeEventListener("scroll", instance.update, passive);
12937
- });
12938
- }
12939
- if (resize) {
12940
- window2.removeEventListener("resize", instance.update, passive);
12941
- }
12942
- };
12943
- }
12944
- const eventListeners = {
12945
- name: "eventListeners",
12946
- enabled: true,
12947
- phase: "write",
12948
- fn: function fn() {
12949
- },
12950
- effect,
12951
- data: {}
12952
- };
12953
- var hash$1 = {
12954
- left: "right",
12955
- right: "left",
12956
- bottom: "top",
12957
- top: "bottom"
12958
- };
12959
- function getOppositePlacement(placement) {
12960
- return placement.replace(/left|right|bottom|top/g, function(matched) {
12961
- return hash$1[matched];
12962
- });
12963
- }
12964
- var hash = {
12965
- start: "end",
12966
- end: "start"
12967
- };
12968
- function getOppositeVariationPlacement(placement) {
12969
- return placement.replace(/start|end/g, function(matched) {
12970
- return hash[matched];
12971
- });
12972
- }
12973
- function getWindowScroll(node) {
12974
- var win = getWindow(node);
12975
- var scrollLeft = win.pageXOffset;
12976
- var scrollTop = win.pageYOffset;
12977
- return {
12978
- scrollLeft,
12979
- scrollTop
12980
- };
12981
- }
12982
- function getWindowScrollBarX(element) {
12983
- return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
12984
- }
12985
- function getViewportRect(element, strategy) {
12986
- var win = getWindow(element);
12987
- var html2 = getDocumentElement(element);
12988
- var visualViewport = win.visualViewport;
12989
- var width = html2.clientWidth;
12990
- var height = html2.clientHeight;
12991
- var x = 0;
12992
- var y = 0;
12993
- if (visualViewport) {
12994
- width = visualViewport.width;
12995
- height = visualViewport.height;
12996
- var layoutViewport = isLayoutViewport();
12997
- if (layoutViewport || !layoutViewport && strategy === "fixed") {
12998
- x = visualViewport.offsetLeft;
12999
- y = visualViewport.offsetTop;
13000
- }
13001
- }
13002
- return {
13003
- width,
13004
- height,
13005
- x: x + getWindowScrollBarX(element),
13006
- y
13007
- };
13008
- }
13009
- function getDocumentRect(element) {
13010
- var _element$ownerDocumen;
13011
- var html2 = getDocumentElement(element);
13012
- var winScroll = getWindowScroll(element);
13013
- var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
13014
- var width = max$3(html2.scrollWidth, html2.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
13015
- var height = max$3(html2.scrollHeight, html2.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
13016
- var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
13017
- var y = -winScroll.scrollTop;
13018
- if (getComputedStyle$1(body || html2).direction === "rtl") {
13019
- x += max$3(html2.clientWidth, body ? body.clientWidth : 0) - width;
13020
- }
13021
- return {
13022
- width,
13023
- height,
13024
- x,
13025
- y
13026
- };
13027
- }
13028
- function isScrollParent(element) {
13029
- var _getComputedStyle = getComputedStyle$1(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
13030
- return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
13031
- }
13032
- function getScrollParent(node) {
13033
- if (["html", "body", "#document"].indexOf(getNodeName(node)) >= 0) {
13034
- return node.ownerDocument.body;
13035
- }
13036
- if (isHTMLElement(node) && isScrollParent(node)) {
13037
- return node;
13038
- }
13039
- return getScrollParent(getParentNode(node));
13040
- }
13041
- function listScrollParents(element, list) {
13042
- var _element$ownerDocumen;
13043
- if (list === void 0) {
13044
- list = [];
13045
- }
13046
- var scrollParent = getScrollParent(element);
13047
- var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
13048
- var win = getWindow(scrollParent);
13049
- var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
13050
- var updatedList = list.concat(target);
13051
- return isBody ? updatedList : updatedList.concat(listScrollParents(getParentNode(target)));
13052
- }
13053
- function rectToClientRect(rect) {
13054
- return Object.assign({}, rect, {
13055
- left: rect.x,
13056
- top: rect.y,
13057
- right: rect.x + rect.width,
13058
- bottom: rect.y + rect.height
13059
- });
13060
- }
13061
- function getInnerBoundingClientRect(element, strategy) {
13062
- var rect = getBoundingClientRect(element, false, strategy === "fixed");
13063
- rect.top = rect.top + element.clientTop;
13064
- rect.left = rect.left + element.clientLeft;
13065
- rect.bottom = rect.top + element.clientHeight;
13066
- rect.right = rect.left + element.clientWidth;
13067
- rect.width = element.clientWidth;
13068
- rect.height = element.clientHeight;
13069
- rect.x = rect.left;
13070
- rect.y = rect.top;
13071
- return rect;
13072
- }
13073
- function getClientRectFromMixedType(element, clippingParent, strategy) {
13074
- return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement$1(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
13075
- }
13076
- function getClippingParents(element) {
13077
- var clippingParents2 = listScrollParents(getParentNode(element));
13078
- var canEscapeClipping = ["absolute", "fixed"].indexOf(getComputedStyle$1(element).position) >= 0;
13079
- var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
13080
- if (!isElement$1(clipperElement)) {
13081
- return [];
13082
- }
13083
- return clippingParents2.filter(function(clippingParent) {
13084
- return isElement$1(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== "body";
13085
- });
13086
- }
13087
- function getClippingRect(element, boundary, rootBoundary, strategy) {
13088
- var mainClippingParents = boundary === "clippingParents" ? getClippingParents(element) : [].concat(boundary);
13089
- var clippingParents2 = [].concat(mainClippingParents, [rootBoundary]);
13090
- var firstClippingParent = clippingParents2[0];
13091
- var clippingRect = clippingParents2.reduce(function(accRect, clippingParent) {
13092
- var rect = getClientRectFromMixedType(element, clippingParent, strategy);
13093
- accRect.top = max$3(rect.top, accRect.top);
13094
- accRect.right = min$3(rect.right, accRect.right);
13095
- accRect.bottom = min$3(rect.bottom, accRect.bottom);
13096
- accRect.left = max$3(rect.left, accRect.left);
13097
- return accRect;
13098
- }, getClientRectFromMixedType(element, firstClippingParent, strategy));
13099
- clippingRect.width = clippingRect.right - clippingRect.left;
13100
- clippingRect.height = clippingRect.bottom - clippingRect.top;
13101
- clippingRect.x = clippingRect.left;
13102
- clippingRect.y = clippingRect.top;
13103
- return clippingRect;
13104
- }
13105
- function computeOffsets(_ref) {
13106
- var reference2 = _ref.reference, element = _ref.element, placement = _ref.placement;
13107
- var basePlacement = placement ? getBasePlacement(placement) : null;
13108
- var variation = placement ? getVariation(placement) : null;
13109
- var commonX = reference2.x + reference2.width / 2 - element.width / 2;
13110
- var commonY = reference2.y + reference2.height / 2 - element.height / 2;
13111
- var offsets;
13112
- switch (basePlacement) {
13113
- case top:
13114
- offsets = {
13115
- x: commonX,
13116
- y: reference2.y - element.height
13117
- };
13118
- break;
13119
- case bottom:
13120
- offsets = {
13121
- x: commonX,
13122
- y: reference2.y + reference2.height
13123
- };
13124
- break;
13125
- case right:
13126
- offsets = {
13127
- x: reference2.x + reference2.width,
13128
- y: commonY
13129
- };
13130
- break;
13131
- case left:
13132
- offsets = {
13133
- x: reference2.x - element.width,
13134
- y: commonY
13135
- };
13136
- break;
13137
- default:
13138
- offsets = {
13139
- x: reference2.x,
13140
- y: reference2.y
13141
- };
13142
- }
13143
- var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
13144
- if (mainAxis != null) {
13145
- var len = mainAxis === "y" ? "height" : "width";
13146
- switch (variation) {
13147
- case start:
13148
- offsets[mainAxis] = offsets[mainAxis] - (reference2[len] / 2 - element[len] / 2);
13149
- break;
13150
- case end:
13151
- offsets[mainAxis] = offsets[mainAxis] + (reference2[len] / 2 - element[len] / 2);
13152
- break;
13153
- }
13154
- }
13155
- return offsets;
13156
- }
13157
- function detectOverflow(state, options) {
13158
- if (options === void 0) {
13159
- options = {};
13160
- }
13161
- var _options = options, _options$placement = _options.placement, placement = _options$placement === void 0 ? state.placement : _options$placement, _options$strategy = _options.strategy, strategy = _options$strategy === void 0 ? state.strategy : _options$strategy, _options$boundary = _options.boundary, boundary = _options$boundary === void 0 ? clippingParents : _options$boundary, _options$rootBoundary = _options.rootBoundary, rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary, _options$elementConte = _options.elementContext, elementContext = _options$elementConte === void 0 ? popper : _options$elementConte, _options$altBoundary = _options.altBoundary, altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary, _options$padding = _options.padding, padding = _options$padding === void 0 ? 0 : _options$padding;
13162
- var paddingObject = mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
13163
- var altContext = elementContext === popper ? reference : popper;
13164
- var popperRect = state.rects.popper;
13165
- var element = state.elements[altBoundary ? altContext : elementContext];
13166
- var clippingClientRect = getClippingRect(isElement$1(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
13167
- var referenceClientRect = getBoundingClientRect(state.elements.reference);
13168
- var popperOffsets2 = computeOffsets({
13169
- reference: referenceClientRect,
13170
- element: popperRect,
13171
- strategy: "absolute",
13172
- placement
13173
- });
13174
- var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets2));
13175
- var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect;
13176
- var overflowOffsets = {
13177
- top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
13178
- bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
13179
- left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
13180
- right: elementClientRect.right - clippingClientRect.right + paddingObject.right
13181
- };
13182
- var offsetData = state.modifiersData.offset;
13183
- if (elementContext === popper && offsetData) {
13184
- var offset2 = offsetData[placement];
13185
- Object.keys(overflowOffsets).forEach(function(key) {
13186
- var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
13187
- var axis = [top, bottom].indexOf(key) >= 0 ? "y" : "x";
13188
- overflowOffsets[key] += offset2[axis] * multiply;
13189
- });
13190
- }
13191
- return overflowOffsets;
13192
- }
13193
- function computeAutoPlacement(state, options) {
13194
- if (options === void 0) {
13195
- options = {};
13196
- }
13197
- var _options = options, placement = _options.placement, boundary = _options.boundary, rootBoundary = _options.rootBoundary, padding = _options.padding, flipVariations = _options.flipVariations, _options$allowedAutoP = _options.allowedAutoPlacements, allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
13198
- var variation = getVariation(placement);
13199
- var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function(placement2) {
13200
- return getVariation(placement2) === variation;
13201
- }) : basePlacements;
13202
- var allowedPlacements = placements$1.filter(function(placement2) {
13203
- return allowedAutoPlacements.indexOf(placement2) >= 0;
13204
- });
13205
- if (allowedPlacements.length === 0) {
13206
- allowedPlacements = placements$1;
13207
- if (process.env.NODE_ENV !== "production") {
13208
- console.error(["Popper: The `allowedAutoPlacements` option did not allow any", "placements. Ensure the `placement` option matches the variation", "of the allowed placements.", 'For example, "auto" cannot be used to allow "bottom-start".', 'Use "auto-start" instead.'].join(" "));
13209
- }
13210
- }
13211
- var overflows = allowedPlacements.reduce(function(acc, placement2) {
13212
- acc[placement2] = detectOverflow(state, {
13213
- placement: placement2,
13214
- boundary,
13215
- rootBoundary,
13216
- padding
13217
- })[getBasePlacement(placement2)];
13218
- return acc;
13219
- }, {});
13220
- return Object.keys(overflows).sort(function(a, b) {
13221
- return overflows[a] - overflows[b];
13222
- });
13223
- }
13224
- function getExpandedFallbackPlacements(placement) {
13225
- if (getBasePlacement(placement) === auto) {
13226
- return [];
13227
- }
13228
- var oppositePlacement = getOppositePlacement(placement);
13229
- return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
13230
- }
13231
- function flip(_ref) {
13232
- var state = _ref.state, options = _ref.options, name = _ref.name;
13233
- if (state.modifiersData[name]._skip) {
13234
- return;
13235
- }
13236
- var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis, specifiedFallbackPlacements = options.fallbackPlacements, padding = options.padding, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, _options$flipVariatio = options.flipVariations, flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio, allowedAutoPlacements = options.allowedAutoPlacements;
13237
- var preferredPlacement = state.options.placement;
13238
- var basePlacement = getBasePlacement(preferredPlacement);
13239
- var isBasePlacement = basePlacement === preferredPlacement;
13240
- var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
13241
- var placements2 = [preferredPlacement].concat(fallbackPlacements).reduce(function(acc, placement2) {
13242
- return acc.concat(getBasePlacement(placement2) === auto ? computeAutoPlacement(state, {
13243
- placement: placement2,
13244
- boundary,
13245
- rootBoundary,
13246
- padding,
13247
- flipVariations,
13248
- allowedAutoPlacements
13249
- }) : placement2);
13250
- }, []);
13251
- var referenceRect = state.rects.reference;
13252
- var popperRect = state.rects.popper;
13253
- var checksMap = /* @__PURE__ */ new Map();
13254
- var makeFallbackChecks = true;
13255
- var firstFittingPlacement = placements2[0];
13256
- for (var i = 0; i < placements2.length; i++) {
13257
- var placement = placements2[i];
13258
- var _basePlacement = getBasePlacement(placement);
13259
- var isStartVariation = getVariation(placement) === start;
13260
- var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
13261
- var len = isVertical ? "width" : "height";
13262
- var overflow = detectOverflow(state, {
13263
- placement,
13264
- boundary,
13265
- rootBoundary,
13266
- altBoundary,
13267
- padding
13268
- });
13269
- var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
13270
- if (referenceRect[len] > popperRect[len]) {
13271
- mainVariationSide = getOppositePlacement(mainVariationSide);
13272
- }
13273
- var altVariationSide = getOppositePlacement(mainVariationSide);
13274
- var checks = [];
13275
- if (checkMainAxis) {
13276
- checks.push(overflow[_basePlacement] <= 0);
13277
- }
13278
- if (checkAltAxis) {
13279
- checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
13280
- }
13281
- if (checks.every(function(check3) {
13282
- return check3;
13283
- })) {
13284
- firstFittingPlacement = placement;
13285
- makeFallbackChecks = false;
13286
- break;
13287
- }
13288
- checksMap.set(placement, checks);
13289
- }
13290
- if (makeFallbackChecks) {
13291
- var numberOfChecks = flipVariations ? 3 : 1;
13292
- var _loop = function _loop2(_i2) {
13293
- var fittingPlacement = placements2.find(function(placement2) {
13294
- var checks2 = checksMap.get(placement2);
13295
- if (checks2) {
13296
- return checks2.slice(0, _i2).every(function(check3) {
13297
- return check3;
13298
- });
13299
- }
13300
- });
13301
- if (fittingPlacement) {
13302
- firstFittingPlacement = fittingPlacement;
13303
- return "break";
13304
- }
13305
- };
13306
- for (var _i = numberOfChecks; _i > 0; _i--) {
13307
- var _ret = _loop(_i);
13308
- if (_ret === "break")
13309
- break;
13310
- }
13311
- }
13312
- if (state.placement !== firstFittingPlacement) {
13313
- state.modifiersData[name]._skip = true;
13314
- state.placement = firstFittingPlacement;
13315
- state.reset = true;
13316
- }
13317
- }
13318
- const flip$1 = {
13319
- name: "flip",
13320
- enabled: true,
13321
- phase: "main",
13322
- fn: flip,
13323
- requiresIfExists: ["offset"],
13324
- data: {
13325
- _skip: false
13326
- }
13327
- };
13328
- function getSideOffsets(overflow, rect, preventedOffsets) {
13329
- if (preventedOffsets === void 0) {
13330
- preventedOffsets = {
13331
- x: 0,
13332
- y: 0
13333
- };
13334
- }
13335
- return {
13336
- top: overflow.top - rect.height - preventedOffsets.y,
13337
- right: overflow.right - rect.width + preventedOffsets.x,
13338
- bottom: overflow.bottom - rect.height + preventedOffsets.y,
13339
- left: overflow.left - rect.width - preventedOffsets.x
13340
- };
13341
- }
13342
- function isAnySideFullyClipped(overflow) {
13343
- return [top, right, bottom, left].some(function(side) {
13344
- return overflow[side] >= 0;
13345
- });
13346
- }
13347
- function hide(_ref) {
13348
- var state = _ref.state, name = _ref.name;
13349
- var referenceRect = state.rects.reference;
13350
- var popperRect = state.rects.popper;
13351
- var preventedOffsets = state.modifiersData.preventOverflow;
13352
- var referenceOverflow = detectOverflow(state, {
13353
- elementContext: "reference"
13354
- });
13355
- var popperAltOverflow = detectOverflow(state, {
13356
- altBoundary: true
13357
- });
13358
- var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
13359
- var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
13360
- var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
13361
- var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
13362
- state.modifiersData[name] = {
13363
- referenceClippingOffsets,
13364
- popperEscapeOffsets,
13365
- isReferenceHidden,
13366
- hasPopperEscaped
13367
- };
13368
- state.attributes.popper = Object.assign({}, state.attributes.popper, {
13369
- "data-popper-reference-hidden": isReferenceHidden,
13370
- "data-popper-escaped": hasPopperEscaped
13371
- });
13372
- }
13373
- const hide$1 = {
13374
- name: "hide",
13375
- enabled: true,
13376
- phase: "main",
13377
- requiresIfExists: ["preventOverflow"],
13378
- fn: hide
13379
- };
13380
- function distanceAndSkiddingToXY(placement, rects, offset2) {
13381
- var basePlacement = getBasePlacement(placement);
13382
- var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
13383
- var _ref = typeof offset2 === "function" ? offset2(Object.assign({}, rects, {
13384
- placement
13385
- })) : offset2, skidding = _ref[0], distance = _ref[1];
13386
- skidding = skidding || 0;
13387
- distance = (distance || 0) * invertDistance;
13388
- return [left, right].indexOf(basePlacement) >= 0 ? {
13389
- x: distance,
13390
- y: skidding
13391
- } : {
13392
- x: skidding,
13393
- y: distance
13394
- };
13395
- }
13396
- function offset(_ref2) {
13397
- var state = _ref2.state, options = _ref2.options, name = _ref2.name;
13398
- var _options$offset = options.offset, offset2 = _options$offset === void 0 ? [0, 0] : _options$offset;
13399
- var data2 = placements.reduce(function(acc, placement) {
13400
- acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset2);
13401
- return acc;
13402
- }, {});
13403
- var _data$state$placement = data2[state.placement], x = _data$state$placement.x, y = _data$state$placement.y;
13404
- if (state.modifiersData.popperOffsets != null) {
13405
- state.modifiersData.popperOffsets.x += x;
13406
- state.modifiersData.popperOffsets.y += y;
13407
- }
13408
- state.modifiersData[name] = data2;
13409
- }
13410
- const offset$1 = {
13411
- name: "offset",
13412
- enabled: true,
13413
- phase: "main",
13414
- requires: ["popperOffsets"],
13415
- fn: offset
13416
- };
13417
- function popperOffsets(_ref) {
13418
- var state = _ref.state, name = _ref.name;
13419
- state.modifiersData[name] = computeOffsets({
13420
- reference: state.rects.reference,
13421
- element: state.rects.popper,
13422
- strategy: "absolute",
13423
- placement: state.placement
13424
- });
13425
- }
13426
- const popperOffsets$1 = {
13427
- name: "popperOffsets",
13428
- enabled: true,
13429
- phase: "read",
13430
- fn: popperOffsets,
13431
- data: {}
13432
- };
13433
- function getAltAxis(axis) {
13434
- return axis === "x" ? "y" : "x";
13435
- }
13436
- function preventOverflow(_ref) {
13437
- var state = _ref.state, options = _ref.options, name = _ref.name;
13438
- 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;
13439
- var overflow = detectOverflow(state, {
13440
- boundary,
13441
- rootBoundary,
13442
- padding,
13443
- altBoundary
13444
- });
13445
- var basePlacement = getBasePlacement(state.placement);
13446
- var variation = getVariation(state.placement);
13447
- var isBasePlacement = !variation;
13448
- var mainAxis = getMainAxisFromPlacement(basePlacement);
13449
- var altAxis = getAltAxis(mainAxis);
13450
- var popperOffsets2 = state.modifiersData.popperOffsets;
13451
- var referenceRect = state.rects.reference;
13452
- var popperRect = state.rects.popper;
13453
- var tetherOffsetValue = typeof tetherOffset === "function" ? tetherOffset(Object.assign({}, state.rects, {
13454
- placement: state.placement
13455
- })) : tetherOffset;
13456
- var normalizedTetherOffsetValue = typeof tetherOffsetValue === "number" ? {
13457
- mainAxis: tetherOffsetValue,
13458
- altAxis: tetherOffsetValue
13459
- } : Object.assign({
13460
- mainAxis: 0,
13461
- altAxis: 0
13462
- }, tetherOffsetValue);
13463
- var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
13464
- var data2 = {
13465
- x: 0,
13466
- y: 0
13467
- };
13468
- if (!popperOffsets2) {
13469
- return;
13470
- }
13471
- if (checkMainAxis) {
13472
- var _offsetModifierState$;
13473
- var mainSide = mainAxis === "y" ? top : left;
13474
- var altSide = mainAxis === "y" ? bottom : right;
13475
- var len = mainAxis === "y" ? "height" : "width";
13476
- var offset2 = popperOffsets2[mainAxis];
13477
- var min2 = offset2 + overflow[mainSide];
13478
- var max2 = offset2 - overflow[altSide];
13479
- var additive = tether ? -popperRect[len] / 2 : 0;
13480
- var minLen = variation === start ? referenceRect[len] : popperRect[len];
13481
- var maxLen = variation === start ? -popperRect[len] : -referenceRect[len];
13482
- var arrowElement = state.elements.arrow;
13483
- var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
13484
- width: 0,
13485
- height: 0
13486
- };
13487
- var arrowPaddingObject = state.modifiersData["arrow#persistent"] ? state.modifiersData["arrow#persistent"].padding : getFreshSideObject();
13488
- var arrowPaddingMin = arrowPaddingObject[mainSide];
13489
- var arrowPaddingMax = arrowPaddingObject[altSide];
13490
- var arrowLen = within(0, referenceRect[len], arrowRect[len]);
13491
- var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
13492
- var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
13493
- var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
13494
- var clientOffset = arrowOffsetParent ? mainAxis === "y" ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
13495
- var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
13496
- var tetherMin = offset2 + minOffset - offsetModifierValue - clientOffset;
13497
- var tetherMax = offset2 + maxOffset - offsetModifierValue;
13498
- var preventedOffset = within(tether ? min$3(min2, tetherMin) : min2, offset2, tether ? max$3(max2, tetherMax) : max2);
13499
- popperOffsets2[mainAxis] = preventedOffset;
13500
- data2[mainAxis] = preventedOffset - offset2;
13501
- }
13502
- if (checkAltAxis) {
13503
- var _offsetModifierState$2;
13504
- var _mainSide = mainAxis === "x" ? top : left;
13505
- var _altSide = mainAxis === "x" ? bottom : right;
13506
- var _offset = popperOffsets2[altAxis];
13507
- var _len = altAxis === "y" ? "height" : "width";
13508
- var _min = _offset + overflow[_mainSide];
13509
- var _max = _offset - overflow[_altSide];
13510
- var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
13511
- var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
13512
- var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
13513
- var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
13514
- var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
13515
- popperOffsets2[altAxis] = _preventedOffset;
13516
- data2[altAxis] = _preventedOffset - _offset;
13517
- }
13518
- state.modifiersData[name] = data2;
13519
- }
13520
- const preventOverflow$1 = {
13521
- name: "preventOverflow",
13522
- enabled: true,
13523
- phase: "main",
13524
- fn: preventOverflow,
13525
- requiresIfExists: ["offset"]
13526
- };
13527
- function getHTMLElementScroll(element) {
13528
- return {
13529
- scrollLeft: element.scrollLeft,
13530
- scrollTop: element.scrollTop
13531
- };
13532
- }
13533
- function getNodeScroll(node) {
13534
- if (node === getWindow(node) || !isHTMLElement(node)) {
13535
- return getWindowScroll(node);
13536
- } else {
13537
- return getHTMLElementScroll(node);
13538
- }
13539
- }
13540
- function isElementScaled(element) {
13541
- var rect = element.getBoundingClientRect();
13542
- var scaleX = round(rect.width) / element.offsetWidth || 1;
13543
- var scaleY = round(rect.height) / element.offsetHeight || 1;
13544
- return scaleX !== 1 || scaleY !== 1;
13545
- }
13546
- function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
13547
- if (isFixed === void 0) {
13548
- isFixed = false;
13549
- }
13550
- var isOffsetParentAnElement = isHTMLElement(offsetParent);
13551
- var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
13552
- var documentElement = getDocumentElement(offsetParent);
13553
- var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
13554
- var scroll = {
13555
- scrollLeft: 0,
13556
- scrollTop: 0
13557
- };
13558
- var offsets = {
13559
- x: 0,
13560
- y: 0
13561
- };
13562
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
13563
- if (getNodeName(offsetParent) !== "body" || isScrollParent(documentElement)) {
13564
- scroll = getNodeScroll(offsetParent);
13565
- }
13566
- if (isHTMLElement(offsetParent)) {
13567
- offsets = getBoundingClientRect(offsetParent, true);
13568
- offsets.x += offsetParent.clientLeft;
13569
- offsets.y += offsetParent.clientTop;
13570
- } else if (documentElement) {
13571
- offsets.x = getWindowScrollBarX(documentElement);
13572
- }
13573
- }
13574
- return {
13575
- x: rect.left + scroll.scrollLeft - offsets.x,
13576
- y: rect.top + scroll.scrollTop - offsets.y,
13577
- width: rect.width,
13578
- height: rect.height
13579
- };
13580
- }
13581
- function order(modifiers2) {
13582
- var map2 = /* @__PURE__ */ new Map();
13583
- var visited = /* @__PURE__ */ new Set();
13584
- var result = [];
13585
- modifiers2.forEach(function(modifier) {
13586
- map2.set(modifier.name, modifier);
13587
- });
13588
- function sort(modifier) {
13589
- visited.add(modifier.name);
13590
- var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
13591
- requires.forEach(function(dep) {
13592
- if (!visited.has(dep)) {
13593
- var depModifier = map2.get(dep);
13594
- if (depModifier) {
13595
- sort(depModifier);
13596
- }
13597
- }
13598
- });
13599
- result.push(modifier);
13600
- }
13601
- modifiers2.forEach(function(modifier) {
13602
- if (!visited.has(modifier.name)) {
13603
- sort(modifier);
13604
- }
13605
- });
13606
- return result;
13607
- }
13608
- function orderModifiers(modifiers2) {
13609
- var orderedModifiers = order(modifiers2);
13610
- return modifierPhases.reduce(function(acc, phase) {
13611
- return acc.concat(orderedModifiers.filter(function(modifier) {
13612
- return modifier.phase === phase;
13613
- }));
13614
- }, []);
13615
- }
13616
- function debounce$2(fn2) {
13617
- var pending;
13618
- return function() {
13619
- if (!pending) {
13620
- pending = new Promise(function(resolve2) {
13621
- Promise.resolve().then(function() {
13622
- pending = void 0;
13623
- resolve2(fn2());
13624
- });
13625
- });
13626
- }
13627
- return pending;
13628
- };
13629
- }
13630
- function format(str) {
13631
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
13632
- args[_key - 1] = arguments[_key];
13633
- }
13634
- return [].concat(args).reduce(function(p, c) {
13635
- return p.replace(/%s/, c);
13636
- }, str);
13637
- }
13638
- var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
13639
- var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available';
13640
- var VALID_PROPERTIES = ["name", "enabled", "phase", "fn", "effect", "requires", "options"];
13641
- function validateModifiers(modifiers2) {
13642
- modifiers2.forEach(function(modifier) {
13643
- [].concat(Object.keys(modifier), VALID_PROPERTIES).filter(function(value, index, self2) {
13644
- return self2.indexOf(value) === index;
13645
- }).forEach(function(key) {
13646
- switch (key) {
13647
- case "name":
13648
- if (typeof modifier.name !== "string") {
13649
- console.error(format(INVALID_MODIFIER_ERROR, String(modifier.name), '"name"', '"string"', '"' + String(modifier.name) + '"'));
13650
- }
13651
- break;
13652
- case "enabled":
13653
- if (typeof modifier.enabled !== "boolean") {
13654
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', '"' + String(modifier.enabled) + '"'));
13655
- }
13656
- break;
13657
- case "phase":
13658
- if (modifierPhases.indexOf(modifier.phase) < 0) {
13659
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases.join(", "), '"' + String(modifier.phase) + '"'));
13660
- }
13661
- break;
13662
- case "fn":
13663
- if (typeof modifier.fn !== "function") {
13664
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', '"' + String(modifier.fn) + '"'));
13665
- }
13666
- break;
13667
- case "effect":
13668
- if (modifier.effect != null && typeof modifier.effect !== "function") {
13669
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', '"' + String(modifier.fn) + '"'));
13670
- }
13671
- break;
13672
- case "requires":
13673
- if (modifier.requires != null && !Array.isArray(modifier.requires)) {
13674
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', '"' + String(modifier.requires) + '"'));
13675
- }
13676
- break;
13677
- case "requiresIfExists":
13678
- if (!Array.isArray(modifier.requiresIfExists)) {
13679
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', '"' + String(modifier.requiresIfExists) + '"'));
13680
- }
13681
- break;
13682
- case "options":
13683
- case "data":
13684
- break;
13685
- default:
13686
- console.error('PopperJS: an invalid property has been provided to the "' + modifier.name + '" modifier, valid properties are ' + VALID_PROPERTIES.map(function(s) {
13687
- return '"' + s + '"';
13688
- }).join(", ") + '; but "' + key + '" was provided.');
13689
- }
13690
- modifier.requires && modifier.requires.forEach(function(requirement) {
13691
- if (modifiers2.find(function(mod) {
13692
- return mod.name === requirement;
13693
- }) == null) {
13694
- console.error(format(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement));
13695
- }
13696
- });
13697
- });
13698
- });
13699
- }
13700
- function uniqueBy(arr, fn2) {
13701
- var identifiers = /* @__PURE__ */ new Set();
13702
- return arr.filter(function(item) {
13703
- var identifier = fn2(item);
13704
- if (!identifiers.has(identifier)) {
13705
- identifiers.add(identifier);
13706
- return true;
13707
- }
13708
- });
13709
- }
13710
- function mergeByName(modifiers2) {
13711
- var merged = modifiers2.reduce(function(merged2, current) {
13712
- var existing = merged2[current.name];
13713
- merged2[current.name] = existing ? Object.assign({}, existing, current, {
13714
- options: Object.assign({}, existing.options, current.options),
13715
- data: Object.assign({}, existing.data, current.data)
13716
- }) : current;
13717
- return merged2;
13718
- }, {});
13719
- return Object.keys(merged).map(function(key) {
13720
- return merged[key];
13721
- });
13722
- }
13723
- var INVALID_ELEMENT_ERROR = "Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.";
13724
- var INFINITE_LOOP_ERROR = "Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.";
13725
- var DEFAULT_OPTIONS = {
13726
- placement: "bottom",
13727
- modifiers: [],
13728
- strategy: "absolute"
13729
- };
13730
- function areValidElements() {
13731
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
13732
- args[_key] = arguments[_key];
13733
- }
13734
- return !args.some(function(element) {
13735
- return !(element && typeof element.getBoundingClientRect === "function");
13736
- });
13737
- }
13738
- function popperGenerator(generatorOptions) {
13739
- if (generatorOptions === void 0) {
13740
- generatorOptions = {};
13741
- }
13742
- var _generatorOptions = generatorOptions, _generatorOptions$def = _generatorOptions.defaultModifiers, defaultModifiers2 = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, _generatorOptions$def2 = _generatorOptions.defaultOptions, defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
13743
- return function createPopper2(reference2, popper2, options) {
13744
- if (options === void 0) {
13745
- options = defaultOptions;
13746
- }
13747
- var state = {
13748
- placement: "bottom",
13749
- orderedModifiers: [],
13750
- options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
13751
- modifiersData: {},
13752
- elements: {
13753
- reference: reference2,
13754
- popper: popper2
13755
- },
13756
- attributes: {},
13757
- styles: {}
13758
- };
13759
- var effectCleanupFns = [];
13760
- var isDestroyed = false;
13761
- var instance = {
13762
- state,
13763
- setOptions: function setOptions(setOptionsAction) {
13764
- var options2 = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction;
13765
- cleanupModifierEffects();
13766
- state.options = Object.assign({}, defaultOptions, state.options, options2);
13767
- state.scrollParents = {
13768
- reference: isElement$1(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
13769
- popper: listScrollParents(popper2)
13770
- };
13771
- var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state.options.modifiers)));
13772
- state.orderedModifiers = orderedModifiers.filter(function(m) {
13773
- return m.enabled;
13774
- });
13775
- if (process.env.NODE_ENV !== "production") {
13776
- var modifiers2 = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function(_ref) {
13777
- var name = _ref.name;
13778
- return name;
13779
- });
13780
- validateModifiers(modifiers2);
13781
- if (getBasePlacement(state.options.placement) === auto) {
13782
- var flipModifier = state.orderedModifiers.find(function(_ref2) {
13783
- var name = _ref2.name;
13784
- return name === "flip";
13785
- });
13786
- if (!flipModifier) {
13787
- console.error(['Popper: "auto" placements require the "flip" modifier be', "present and enabled to work."].join(" "));
13788
- }
13789
- }
13790
- var _getComputedStyle = getComputedStyle$1(popper2), marginTop = _getComputedStyle.marginTop, marginRight = _getComputedStyle.marginRight, marginBottom = _getComputedStyle.marginBottom, marginLeft = _getComputedStyle.marginLeft;
13791
- if ([marginTop, marginRight, marginBottom, marginLeft].some(function(margin) {
13792
- return parseFloat(margin);
13793
- })) {
13794
- console.warn(['Popper: CSS "margin" styles cannot be used to apply padding', "between the popper and its reference element or boundary.", "To replicate margin, use the `offset` modifier, as well as", "the `padding` option in the `preventOverflow` and `flip`", "modifiers."].join(" "));
13795
- }
13796
- }
13797
- runModifierEffects();
13798
- return instance.update();
13799
- },
13800
- forceUpdate: function forceUpdate() {
13801
- if (isDestroyed) {
13802
- return;
13803
- }
13804
- var _state$elements = state.elements, reference3 = _state$elements.reference, popper3 = _state$elements.popper;
13805
- if (!areValidElements(reference3, popper3)) {
13806
- if (process.env.NODE_ENV !== "production") {
13807
- console.error(INVALID_ELEMENT_ERROR);
13808
- }
13809
- return;
13810
- }
13811
- state.rects = {
13812
- reference: getCompositeRect(reference3, getOffsetParent(popper3), state.options.strategy === "fixed"),
13813
- popper: getLayoutRect(popper3)
13814
- };
13815
- state.reset = false;
13816
- state.placement = state.options.placement;
13817
- state.orderedModifiers.forEach(function(modifier) {
13818
- return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
13819
- });
13820
- var __debug_loops__ = 0;
13821
- for (var index = 0; index < state.orderedModifiers.length; index++) {
13822
- if (process.env.NODE_ENV !== "production") {
13823
- __debug_loops__ += 1;
13824
- if (__debug_loops__ > 100) {
13825
- console.error(INFINITE_LOOP_ERROR);
13826
- break;
13827
- }
13828
- }
13829
- if (state.reset === true) {
13830
- state.reset = false;
13831
- index = -1;
13832
- continue;
13833
- }
13834
- var _state$orderedModifie = state.orderedModifiers[index], fn2 = _state$orderedModifie.fn, _state$orderedModifie2 = _state$orderedModifie.options, _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2, name = _state$orderedModifie.name;
13835
- if (typeof fn2 === "function") {
13836
- state = fn2({
13837
- state,
13838
- options: _options,
13839
- name,
13840
- instance
13841
- }) || state;
13842
- }
13843
- }
13844
- },
13845
- update: debounce$2(function() {
13846
- return new Promise(function(resolve2) {
13847
- instance.forceUpdate();
13848
- resolve2(state);
13849
- });
13850
- }),
13851
- destroy: function destroy() {
13852
- cleanupModifierEffects();
13853
- isDestroyed = true;
13854
- }
13855
- };
13856
- if (!areValidElements(reference2, popper2)) {
13857
- if (process.env.NODE_ENV !== "production") {
13858
- console.error(INVALID_ELEMENT_ERROR);
13859
- }
13860
- return instance;
13861
- }
13862
- instance.setOptions(options).then(function(state2) {
13863
- if (!isDestroyed && options.onFirstUpdate) {
13864
- options.onFirstUpdate(state2);
13865
- }
13866
- });
13867
- function runModifierEffects() {
13868
- state.orderedModifiers.forEach(function(_ref3) {
13869
- var name = _ref3.name, _ref3$options = _ref3.options, options2 = _ref3$options === void 0 ? {} : _ref3$options, effect2 = _ref3.effect;
13870
- if (typeof effect2 === "function") {
13871
- var cleanupFn = effect2({
13872
- state,
13873
- name,
13874
- instance,
13875
- options: options2
13876
- });
13877
- var noopFn = function noopFn2() {
13878
- };
13879
- effectCleanupFns.push(cleanupFn || noopFn);
13880
- }
13881
- });
13882
- }
13883
- function cleanupModifierEffects() {
13884
- effectCleanupFns.forEach(function(fn2) {
13885
- return fn2();
13886
- });
13887
- effectCleanupFns = [];
13888
- }
13889
- return instance;
13890
- };
13891
- }
13892
- var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
13893
- var createPopper = /* @__PURE__ */ popperGenerator({
13894
- defaultModifiers
13895
- });
13896
12439
  class Editor extends Editor$1 {
13897
12440
  constructor() {
13898
12441
  super(...arguments);
@@ -14497,16 +13040,16 @@ var Leaf = /* @__PURE__ */ function(RopeSequence3) {
14497
13040
  Leaf2.prototype.getInner = function getInner(i) {
14498
13041
  return this.values[i];
14499
13042
  };
14500
- Leaf2.prototype.forEachInner = function forEachInner(f, from2, to, start2) {
13043
+ Leaf2.prototype.forEachInner = function forEachInner(f, from2, to, start) {
14501
13044
  for (var i = from2; i < to; i++) {
14502
- if (f(this.values[i], start2 + i) === false) {
13045
+ if (f(this.values[i], start + i) === false) {
14503
13046
  return false;
14504
13047
  }
14505
13048
  }
14506
13049
  };
14507
- Leaf2.prototype.forEachInvertedInner = function forEachInvertedInner(f, from2, to, start2) {
13050
+ Leaf2.prototype.forEachInvertedInner = function forEachInvertedInner(f, from2, to, start) {
14508
13051
  for (var i = from2 - 1; i >= to; i--) {
14509
- if (f(this.values[i], start2 + i) === false) {
13052
+ if (f(this.values[i], start + i) === false) {
14510
13053
  return false;
14511
13054
  }
14512
13055
  }
@@ -14532,12 +13075,12 @@ var Leaf = /* @__PURE__ */ function(RopeSequence3) {
14532
13075
  }(RopeSequence);
14533
13076
  RopeSequence.empty = new Leaf([]);
14534
13077
  var Append = /* @__PURE__ */ function(RopeSequence3) {
14535
- function Append2(left2, right2) {
13078
+ function Append2(left, right) {
14536
13079
  RopeSequence3.call(this);
14537
- this.left = left2;
14538
- this.right = right2;
14539
- this.length = left2.length + right2.length;
14540
- this.depth = Math.max(left2.depth, right2.depth) + 1;
13080
+ this.left = left;
13081
+ this.right = right;
13082
+ this.length = left.length + right.length;
13083
+ this.depth = Math.max(left.depth, right.depth) + 1;
14541
13084
  }
14542
13085
  if (RopeSequence3)
14543
13086
  Append2.__proto__ = RopeSequence3;
@@ -14549,21 +13092,21 @@ var Append = /* @__PURE__ */ function(RopeSequence3) {
14549
13092
  Append2.prototype.getInner = function getInner(i) {
14550
13093
  return i < this.left.length ? this.left.get(i) : this.right.get(i - this.left.length);
14551
13094
  };
14552
- Append2.prototype.forEachInner = function forEachInner(f, from2, to, start2) {
13095
+ Append2.prototype.forEachInner = function forEachInner(f, from2, to, start) {
14553
13096
  var leftLen = this.left.length;
14554
- if (from2 < leftLen && this.left.forEachInner(f, from2, Math.min(to, leftLen), start2) === false) {
13097
+ if (from2 < leftLen && this.left.forEachInner(f, from2, Math.min(to, leftLen), start) === false) {
14555
13098
  return false;
14556
13099
  }
14557
- if (to > leftLen && this.right.forEachInner(f, Math.max(from2 - leftLen, 0), Math.min(this.length, to) - leftLen, start2 + leftLen) === false) {
13100
+ if (to > leftLen && this.right.forEachInner(f, Math.max(from2 - leftLen, 0), Math.min(this.length, to) - leftLen, start + leftLen) === false) {
14558
13101
  return false;
14559
13102
  }
14560
13103
  };
14561
- Append2.prototype.forEachInvertedInner = function forEachInvertedInner(f, from2, to, start2) {
13104
+ Append2.prototype.forEachInvertedInner = function forEachInvertedInner(f, from2, to, start) {
14562
13105
  var leftLen = this.left.length;
14563
- if (from2 > leftLen && this.right.forEachInvertedInner(f, from2 - leftLen, Math.max(to, leftLen) - leftLen, start2 + leftLen) === false) {
13106
+ if (from2 > leftLen && this.right.forEachInvertedInner(f, from2 - leftLen, Math.max(to, leftLen) - leftLen, start + leftLen) === false) {
14564
13107
  return false;
14565
13108
  }
14566
- if (to < leftLen && this.left.forEachInvertedInner(f, Math.min(from2, leftLen), to, start2) === false) {
13109
+ if (to < leftLen && this.left.forEachInvertedInner(f, Math.min(from2, leftLen), to, start) === false) {
14567
13110
  return false;
14568
13111
  }
14569
13112
  };
@@ -14610,17 +13153,17 @@ class Branch {
14610
13153
  popEvent(state, preserveItems) {
14611
13154
  if (this.eventCount == 0)
14612
13155
  return null;
14613
- let end2 = this.items.length;
14614
- for (; ; end2--) {
14615
- let next2 = this.items.get(end2 - 1);
13156
+ let end = this.items.length;
13157
+ for (; ; end--) {
13158
+ let next2 = this.items.get(end - 1);
14616
13159
  if (next2.selection) {
14617
- --end2;
13160
+ --end;
14618
13161
  break;
14619
13162
  }
14620
13163
  }
14621
13164
  let remap, mapFrom;
14622
13165
  if (preserveItems) {
14623
- remap = this.remapping(end2, this.items.length);
13166
+ remap = this.remapping(end, this.items.length);
14624
13167
  mapFrom = remap.maps.length;
14625
13168
  }
14626
13169
  let transform = state.tr;
@@ -14629,7 +13172,7 @@ class Branch {
14629
13172
  this.items.forEach((item, i) => {
14630
13173
  if (!item.step) {
14631
13174
  if (!remap) {
14632
- remap = this.remapping(end2, i + 1);
13175
+ remap = this.remapping(end, i + 1);
14633
13176
  mapFrom = remap.maps.length;
14634
13177
  }
14635
13178
  mapFrom--;
@@ -14651,7 +13194,7 @@ class Branch {
14651
13194
  }
14652
13195
  if (item.selection) {
14653
13196
  selection = remap ? item.selection.map(remap.slice(mapFrom)) : item.selection;
14654
- remaining = new Branch(this.items.slice(0, end2).append(addBefore.reverse().concat(addAfter)), this.eventCount - 1);
13197
+ remaining = new Branch(this.items.slice(0, end).append(addBefore.reverse().concat(addAfter)), this.eventCount - 1);
14655
13198
  return false;
14656
13199
  }
14657
13200
  }, this.items.length, 0);
@@ -14701,14 +13244,14 @@ class Branch {
14701
13244
  rebased(rebasedTransform, rebasedCount) {
14702
13245
  if (!this.eventCount)
14703
13246
  return this;
14704
- let rebasedItems = [], start2 = Math.max(0, this.items.length - rebasedCount);
13247
+ let rebasedItems = [], start = Math.max(0, this.items.length - rebasedCount);
14705
13248
  let mapping = rebasedTransform.mapping;
14706
13249
  let newUntil = rebasedTransform.steps.length;
14707
13250
  let eventCount = this.eventCount;
14708
13251
  this.items.forEach((item) => {
14709
13252
  if (item.selection)
14710
13253
  eventCount--;
14711
- }, start2);
13254
+ }, start);
14712
13255
  let iRebased = rebasedCount;
14713
13256
  this.items.forEach((item) => {
14714
13257
  let pos = mapping.getMirror(--iRebased);
@@ -14725,11 +13268,11 @@ class Branch {
14725
13268
  } else {
14726
13269
  rebasedItems.push(new Item(map2));
14727
13270
  }
14728
- }, start2);
13271
+ }, start);
14729
13272
  let newMaps = [];
14730
13273
  for (let i = rebasedCount; i < newUntil; i++)
14731
13274
  newMaps.push(new Item(mapping.maps[i]));
14732
- let items = this.items.slice(0, start2).append(newMaps).append(rebasedItems);
13275
+ let items = this.items.slice(0, start).append(newMaps).append(rebasedItems);
14733
13276
  let branch = new Branch(items, eventCount);
14734
13277
  if (branch.emptyItemCount() > max_empty_items)
14735
13278
  branch = branch.compress(this.items.length - rebasedItems.length);
@@ -14838,9 +13381,9 @@ function isAdjacentTo(transform, prevRanges) {
14838
13381
  if (!transform.docChanged)
14839
13382
  return true;
14840
13383
  let adjacent = false;
14841
- transform.mapping.maps[0].forEach((start2, end2) => {
13384
+ transform.mapping.maps[0].forEach((start, end) => {
14842
13385
  for (let i = 0; i < prevRanges.length; i += 2)
14843
- if (start2 <= prevRanges[i + 1] && end2 >= prevRanges[i])
13386
+ if (start <= prevRanges[i + 1] && end >= prevRanges[i])
14844
13387
  adjacent = true;
14845
13388
  });
14846
13389
  return adjacent;
@@ -16797,7 +15340,7 @@ function init$2() {
16797
15340
  S_START.jd = makeAcceptingState(SYM);
16798
15341
  return S_START;
16799
15342
  }
16800
- function run$1(start2, str) {
15343
+ function run$1(start, str) {
16801
15344
  var iterable = stringToArray(str.replace(/[A-Z]/g, function(c) {
16802
15345
  return c.toLowerCase();
16803
15346
  }));
@@ -16806,7 +15349,7 @@ function run$1(start2, str) {
16806
15349
  var cursor = 0;
16807
15350
  var charCursor = 0;
16808
15351
  while (charCursor < charCount) {
16809
- var state = start2;
15352
+ var state = start;
16810
15353
  var nextState = null;
16811
15354
  var tokenLength = 0;
16812
15355
  var latestAccepting = null;
@@ -17183,13 +15726,13 @@ function init$1() {
17183
15726
  makeT(S_LOCALPART_AT, LOCALHOST, S_EMAIL);
17184
15727
  return S_START;
17185
15728
  }
17186
- function run(start2, input, tokens) {
15729
+ function run(start, input, tokens) {
17187
15730
  var len = tokens.length;
17188
15731
  var cursor = 0;
17189
15732
  var multis = [];
17190
15733
  var textTokens = [];
17191
15734
  while (cursor < len) {
17192
- var state = start2;
15735
+ var state = start;
17193
15736
  var secondState = null;
17194
15737
  var nextState = null;
17195
15738
  var multiLength = 0;
@@ -19776,11 +18319,11 @@ var FunctionPrototype$3 = Function.prototype;
19776
18319
  var bind$3 = FunctionPrototype$3.bind;
19777
18320
  var call$e = FunctionPrototype$3.call;
19778
18321
  var uncurryThis$q = NATIVE_BIND$3 && bind$3.bind(call$e, call$e);
19779
- var functionUncurryThis = NATIVE_BIND$3 ? function(fn2) {
19780
- return fn2 && uncurryThis$q(fn2);
19781
- } : function(fn2) {
19782
- return fn2 && function() {
19783
- return call$e.apply(fn2, arguments);
18322
+ var functionUncurryThis = NATIVE_BIND$3 ? function(fn) {
18323
+ return fn && uncurryThis$q(fn);
18324
+ } : function(fn) {
18325
+ return fn && function() {
18326
+ return call$e.apply(fn, arguments);
19784
18327
  };
19785
18328
  };
19786
18329
  var $TypeError$b = TypeError;
@@ -19965,12 +18508,12 @@ var isCallable$f = isCallable$k;
19965
18508
  var isObject$c = isObject$f;
19966
18509
  var $TypeError$8 = TypeError;
19967
18510
  var ordinaryToPrimitive$1 = function(input, pref) {
19968
- var fn2, val;
19969
- if (pref === "string" && isCallable$f(fn2 = input.toString) && !isObject$c(val = call$c(fn2, input)))
18511
+ var fn, val;
18512
+ if (pref === "string" && isCallable$f(fn = input.toString) && !isObject$c(val = call$c(fn, input)))
19970
18513
  return val;
19971
- if (isCallable$f(fn2 = input.valueOf) && !isObject$c(val = call$c(fn2, input)))
18514
+ if (isCallable$f(fn = input.valueOf) && !isObject$c(val = call$c(fn, input)))
19972
18515
  return val;
19973
- if (pref !== "string" && isCallable$f(fn2 = input.toString) && !isObject$c(val = call$c(fn2, input)))
18516
+ if (pref !== "string" && isCallable$f(fn = input.toString) && !isObject$c(val = call$c(fn, input)))
19974
18517
  return val;
19975
18518
  throw $TypeError$8("Can't convert object to primitive value");
19976
18519
  };
@@ -20329,10 +18872,10 @@ var uncurryThis$j = functionUncurryThis;
20329
18872
  var aCallable$2 = aCallable$4;
20330
18873
  var NATIVE_BIND$1 = functionBindNative;
20331
18874
  var bind$2 = uncurryThis$j(uncurryThis$j.bind);
20332
- var functionBindContext = function(fn2, that) {
20333
- aCallable$2(fn2);
20334
- return that === void 0 ? fn2 : NATIVE_BIND$1 ? bind$2(fn2, that) : function() {
20335
- return fn2.apply(that, arguments);
18875
+ var functionBindContext = function(fn, that) {
18876
+ aCallable$2(fn);
18877
+ return that === void 0 ? fn : NATIVE_BIND$1 ? bind$2(fn, that) : function() {
18878
+ return fn.apply(that, arguments);
20336
18879
  };
20337
18880
  };
20338
18881
  var uncurryThis$i = functionUncurryThis;
@@ -20357,9 +18900,9 @@ var toIntegerOrInfinity$4 = function(argument) {
20357
18900
  return number !== number || number === 0 ? 0 : trunc2(number);
20358
18901
  };
20359
18902
  var toIntegerOrInfinity$3 = toIntegerOrInfinity$4;
20360
- var min$2 = Math.min;
18903
+ var min$4 = Math.min;
20361
18904
  var toLength$3 = function(argument) {
20362
- return argument > 0 ? min$2(toIntegerOrInfinity$3(argument), 9007199254740991) : 0;
18905
+ return argument > 0 ? min$4(toIntegerOrInfinity$3(argument), 9007199254740991) : 0;
20363
18906
  };
20364
18907
  var toLength$2 = toLength$3;
20365
18908
  var lengthOfArrayLike$5 = function(obj) {
@@ -20574,11 +19117,11 @@ objectGetOwnPropertyDescriptor.f = DESCRIPTORS$4 ? $getOwnPropertyDescriptor : f
20574
19117
  };
20575
19118
  var objectGetOwnPropertyNames = {};
20576
19119
  var toIntegerOrInfinity$2 = toIntegerOrInfinity$4;
20577
- var max$2 = Math.max;
20578
- var min$1 = Math.min;
19120
+ var max$4 = Math.max;
19121
+ var min$3 = Math.min;
20579
19122
  var toAbsoluteIndex$2 = function(index, length) {
20580
19123
  var integer = toIntegerOrInfinity$2(index);
20581
- return integer < 0 ? max$2(integer + length, 0) : min$1(integer, length);
19124
+ return integer < 0 ? max$4(integer + length, 0) : min$3(integer, length);
20582
19125
  };
20583
19126
  var toIndexedObject$4 = toIndexedObject$6;
20584
19127
  var toAbsoluteIndex$1 = toAbsoluteIndex$2;
@@ -21282,12 +19825,12 @@ var toAbsoluteIndex = toAbsoluteIndex$2;
21282
19825
  var lengthOfArrayLike$2 = lengthOfArrayLike$5;
21283
19826
  var createProperty = createProperty$1;
21284
19827
  var $Array = Array;
21285
- var max$1 = Math.max;
21286
- var arraySliceSimple = function(O, start2, end2) {
19828
+ var max$3 = Math.max;
19829
+ var arraySliceSimple = function(O, start, end) {
21287
19830
  var length = lengthOfArrayLike$2(O);
21288
- var k = toAbsoluteIndex(start2, length);
21289
- var fin = toAbsoluteIndex(end2 === void 0 ? length : end2, length);
21290
- var result = $Array(max$1(fin - k, 0));
19831
+ var k = toAbsoluteIndex(start, length);
19832
+ var fin = toAbsoluteIndex(end === void 0 ? length : end, length);
19833
+ var result = $Array(max$3(fin - k, 0));
21291
19834
  for (var n = 0; k < fin; k++, n++)
21292
19835
  createProperty(result, n, O[k]);
21293
19836
  result.length = n;
@@ -21487,7 +20030,7 @@ var iterate$2 = function(iterable, unboundFunction, options) {
21487
20030
  var AS_ENTRIES = !!(options && options.AS_ENTRIES);
21488
20031
  var IS_ITERATOR = !!(options && options.IS_ITERATOR);
21489
20032
  var INTERRUPTED = !!(options && options.INTERRUPTED);
21490
- var fn2 = bind(unboundFunction, that);
20033
+ var fn = bind(unboundFunction, that);
21491
20034
  var iterator, iterFn, index, length, result, next2, step;
21492
20035
  var stop = function(condition) {
21493
20036
  if (iterator)
@@ -21497,9 +20040,9 @@ var iterate$2 = function(iterable, unboundFunction, options) {
21497
20040
  var callFn = function(value) {
21498
20041
  if (AS_ENTRIES) {
21499
20042
  anObject$5(value);
21500
- return INTERRUPTED ? fn2(value[0], value[1], stop) : fn2(value[0], value[1]);
20043
+ return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
21501
20044
  }
21502
- return INTERRUPTED ? fn2(value, stop) : fn2(value);
20045
+ return INTERRUPTED ? fn(value, stop) : fn(value);
21503
20046
  };
21504
20047
  if (IS_ITERATOR) {
21505
20048
  iterator = iterable;
@@ -22440,8 +20983,8 @@ var DOMRectReadOnly = function() {
22440
20983
  return freeze(this);
22441
20984
  }
22442
20985
  DOMRectReadOnly2.prototype.toJSON = function() {
22443
- var _a = this, x = _a.x, y = _a.y, top2 = _a.top, right2 = _a.right, bottom2 = _a.bottom, left2 = _a.left, width = _a.width, height = _a.height;
22444
- return { x, y, top: top2, right: right2, bottom: bottom2, left: left2, width, height };
20986
+ var _a = this, x = _a.x, y = _a.y, top = _a.top, right = _a.right, bottom = _a.bottom, left = _a.left, width = _a.width, height = _a.height;
20987
+ return { x, y, top, right, bottom, left, width, height };
22445
20988
  };
22446
20989
  DOMRectReadOnly2.fromRect = function(rectangle) {
22447
20990
  return new DOMRectReadOnly2(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
@@ -22459,7 +21002,7 @@ var isHidden = function(target) {
22459
21002
  var _b = target, offsetWidth = _b.offsetWidth, offsetHeight = _b.offsetHeight;
22460
21003
  return !(offsetWidth || offsetHeight || target.getClientRects().length);
22461
21004
  };
22462
- var isElement = function(obj) {
21005
+ var isElement$1 = function(obj) {
22463
21006
  var _a, _b;
22464
21007
  if (obj instanceof Element) {
22465
21008
  return true;
@@ -22859,7 +21402,7 @@ var ResizeObserverController = function() {
22859
21402
  };
22860
21403
  return ResizeObserverController2;
22861
21404
  }();
22862
- var ResizeObserver = function() {
21405
+ var ResizeObserver$1 = function() {
22863
21406
  function ResizeObserver2(callback) {
22864
21407
  if (arguments.length === 0) {
22865
21408
  throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");
@@ -22873,7 +21416,7 @@ var ResizeObserver = function() {
22873
21416
  if (arguments.length === 0) {
22874
21417
  throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");
22875
21418
  }
22876
- if (!isElement(target)) {
21419
+ if (!isElement$1(target)) {
22877
21420
  throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");
22878
21421
  }
22879
21422
  ResizeObserverController.observe(this, target, options);
@@ -22882,7 +21425,7 @@ var ResizeObserver = function() {
22882
21425
  if (arguments.length === 0) {
22883
21426
  throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");
22884
21427
  }
22885
- if (!isElement(target)) {
21428
+ if (!isElement$1(target)) {
22886
21429
  throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");
22887
21430
  }
22888
21431
  ResizeObserverController.unobserve(this, target);
@@ -23313,8 +21856,8 @@ var getSubstitution = getSubstitution$1;
23313
21856
  var regExpExec = regexpExecAbstract;
23314
21857
  var wellKnownSymbol = wellKnownSymbol$f;
23315
21858
  var REPLACE = wellKnownSymbol("replace");
23316
- var max = Math.max;
23317
- var min = Math.min;
21859
+ var max$2 = Math.max;
21860
+ var min$2 = Math.min;
23318
21861
  var concat = uncurryThis([].concat);
23319
21862
  var push = uncurryThis([].push);
23320
21863
  var stringIndexOf = uncurryThis("".indexOf);
@@ -23381,7 +21924,7 @@ fixRegExpWellKnownSymbolLogic("replace", function(_, nativeReplace2, maybeCallNa
23381
21924
  for (var i = 0; i < results.length; i++) {
23382
21925
  result = results[i];
23383
21926
  var matched = toString4(result[0]);
23384
- var position = max(min(toIntegerOrInfinity(result.index), S.length), 0);
21927
+ var position = max$2(min$2(toIntegerOrInfinity(result.index), S.length), 0);
23385
21928
  var captures = [];
23386
21929
  for (var j = 1; j < result.length; j++)
23387
21930
  push(captures, maybeToString(result[j]));
@@ -23784,7 +22327,7 @@ var SimpleBar = /* @__PURE__ */ function() {
23784
22327
  this.contentWrapperEl.addEventListener("scroll", this.onScroll);
23785
22328
  elWindow.addEventListener("resize", this.onWindowResize);
23786
22329
  var resizeObserverStarted = false;
23787
- var resizeObserver = elWindow.ResizeObserver || ResizeObserver;
22330
+ var resizeObserver = elWindow.ResizeObserver || ResizeObserver$1;
23788
22331
  this.resizeObserver = new resizeObserver(function() {
23789
22332
  if (!resizeObserverStarted)
23790
22333
  return;
@@ -24135,127 +22678,1031 @@ SimpleBar.handleMutations = function(mutations) {
24135
22678
  });
24136
22679
  }
24137
22680
  }
24138
- });
24139
- });
22681
+ });
22682
+ });
22683
+ };
22684
+ SimpleBar.getOptions = getOptions;
22685
+ if (canUseDom) {
22686
+ SimpleBar.initHtmlApi();
22687
+ }
22688
+ function useValidator({ validations }) {
22689
+ const error = ref(null);
22690
+ function validate() {
22691
+ for (const validate2 of validations) {
22692
+ const validationError = validate2();
22693
+ if (validationError) {
22694
+ return error.value = validationError;
22695
+ }
22696
+ error.value = null;
22697
+ }
22698
+ }
22699
+ function reset() {
22700
+ error.value = null;
22701
+ }
22702
+ return { error, validate, reset };
22703
+ }
22704
+ const noFormatter = (value) => value;
22705
+ function useTempValue({ valueRef, format = noFormatter }) {
22706
+ const tempValue = ref(format(valueRef.value));
22707
+ watch(valueRef, () => tempValue.value = format(valueRef.value));
22708
+ return tempValue;
22709
+ }
22710
+ function useElementRef(ref2) {
22711
+ return computed(() => {
22712
+ var _a;
22713
+ return ((_a = ref2.value) == null ? void 0 : _a.$el) || ref2.value;
22714
+ });
22715
+ }
22716
+ function useNumberValue({ valueRef, digits, min: min2, max: max2, onChange }) {
22717
+ function format(number) {
22718
+ return Number(parseFloat(number).toFixed(digits));
22719
+ }
22720
+ const temp = useTempValue({ valueRef, format });
22721
+ function validateNumber(number) {
22722
+ if (min2 !== null && number < min2)
22723
+ return min2;
22724
+ if (max2 !== null && number > max2)
22725
+ return max2;
22726
+ return number;
22727
+ }
22728
+ function change(value) {
22729
+ temp.value = value;
22730
+ if (temp.value === "") {
22731
+ temp.value = min2 != null ? min2 : 1;
22732
+ }
22733
+ const numericValue = Number.parseFloat(temp.value);
22734
+ const validatedNumber = validateNumber(numericValue);
22735
+ temp.value = format(validatedNumber);
22736
+ onChange(temp.value);
22737
+ }
22738
+ function increment(step) {
22739
+ const newValue = temp.value + Number(step);
22740
+ const validatedNumber = validateNumber(newValue);
22741
+ temp.value = format(validatedNumber);
22742
+ onChange(temp.value);
22743
+ }
22744
+ function decrement(step) {
22745
+ const newValue = temp.value - Number(step);
22746
+ const validatedNumber = validateNumber(newValue);
22747
+ temp.value = format(validatedNumber);
22748
+ onChange(temp.value);
22749
+ }
22750
+ return {
22751
+ temp,
22752
+ change,
22753
+ increment,
22754
+ decrement
22755
+ };
22756
+ }
22757
+ function getSide(placement) {
22758
+ return placement.split("-")[0];
22759
+ }
22760
+ function getAlignment(placement) {
22761
+ return placement.split("-")[1];
22762
+ }
22763
+ function getMainAxisFromPlacement(placement) {
22764
+ return ["top", "bottom"].includes(getSide(placement)) ? "x" : "y";
22765
+ }
22766
+ function getLengthFromAxis(axis) {
22767
+ return axis === "y" ? "height" : "width";
22768
+ }
22769
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
22770
+ let {
22771
+ reference,
22772
+ floating
22773
+ } = _ref;
22774
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
22775
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
22776
+ const mainAxis = getMainAxisFromPlacement(placement);
22777
+ const length = getLengthFromAxis(mainAxis);
22778
+ const commonAlign = reference[length] / 2 - floating[length] / 2;
22779
+ const side = getSide(placement);
22780
+ const isVertical = mainAxis === "x";
22781
+ let coords;
22782
+ switch (side) {
22783
+ case "top":
22784
+ coords = {
22785
+ x: commonX,
22786
+ y: reference.y - floating.height
22787
+ };
22788
+ break;
22789
+ case "bottom":
22790
+ coords = {
22791
+ x: commonX,
22792
+ y: reference.y + reference.height
22793
+ };
22794
+ break;
22795
+ case "right":
22796
+ coords = {
22797
+ x: reference.x + reference.width,
22798
+ y: commonY
22799
+ };
22800
+ break;
22801
+ case "left":
22802
+ coords = {
22803
+ x: reference.x - floating.width,
22804
+ y: commonY
22805
+ };
22806
+ break;
22807
+ default:
22808
+ coords = {
22809
+ x: reference.x,
22810
+ y: reference.y
22811
+ };
22812
+ }
22813
+ switch (getAlignment(placement)) {
22814
+ case "start":
22815
+ coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
22816
+ break;
22817
+ case "end":
22818
+ coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
22819
+ break;
22820
+ }
22821
+ return coords;
22822
+ }
22823
+ const computePosition$1 = async (reference, floating, config) => {
22824
+ const {
22825
+ placement = "bottom",
22826
+ strategy = "absolute",
22827
+ middleware = [],
22828
+ platform: platform2
22829
+ } = config;
22830
+ const validMiddleware = middleware.filter(Boolean);
22831
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
22832
+ if (process.env.NODE_ENV !== "production") {
22833
+ if (platform2 == null) {
22834
+ console.error(["Floating UI: `platform` property was not passed to config. If you", "want to use Floating UI on the web, install @floating-ui/dom", "instead of the /core package. Otherwise, you can create your own", "`platform`: https://floating-ui.com/docs/platform"].join(" "));
22835
+ }
22836
+ if (validMiddleware.filter((_ref) => {
22837
+ let {
22838
+ name
22839
+ } = _ref;
22840
+ return name === "autoPlacement" || name === "flip";
22841
+ }).length > 1) {
22842
+ throw new Error(["Floating UI: duplicate `flip` and/or `autoPlacement` middleware", "detected. This will lead to an infinite loop. Ensure only one of", "either has been passed to the `middleware` array."].join(" "));
22843
+ }
22844
+ if (!reference || !floating) {
22845
+ console.error(["Floating UI: The reference and/or floating element was not defined", "when `computePosition()` was called. Ensure that both elements have", "been created and can be measured."].join(" "));
22846
+ }
22847
+ }
22848
+ let rects = await platform2.getElementRects({
22849
+ reference,
22850
+ floating,
22851
+ strategy
22852
+ });
22853
+ let {
22854
+ x,
22855
+ y
22856
+ } = computeCoordsFromPlacement(rects, placement, rtl);
22857
+ let statefulPlacement = placement;
22858
+ let middlewareData = {};
22859
+ let resetCount = 0;
22860
+ for (let i = 0; i < validMiddleware.length; i++) {
22861
+ const {
22862
+ name,
22863
+ fn
22864
+ } = validMiddleware[i];
22865
+ const {
22866
+ x: nextX,
22867
+ y: nextY,
22868
+ data: data2,
22869
+ reset
22870
+ } = await fn({
22871
+ x,
22872
+ y,
22873
+ initialPlacement: placement,
22874
+ placement: statefulPlacement,
22875
+ strategy,
22876
+ middlewareData,
22877
+ rects,
22878
+ platform: platform2,
22879
+ elements: {
22880
+ reference,
22881
+ floating
22882
+ }
22883
+ });
22884
+ x = nextX != null ? nextX : x;
22885
+ y = nextY != null ? nextY : y;
22886
+ middlewareData = {
22887
+ ...middlewareData,
22888
+ [name]: {
22889
+ ...middlewareData[name],
22890
+ ...data2
22891
+ }
22892
+ };
22893
+ if (process.env.NODE_ENV !== "production") {
22894
+ if (resetCount > 50) {
22895
+ console.warn(["Floating UI: The middleware lifecycle appears to be running in an", "infinite loop. This is usually caused by a `reset` continually", "being returned without a break condition."].join(" "));
22896
+ }
22897
+ }
22898
+ if (reset && resetCount <= 50) {
22899
+ resetCount++;
22900
+ if (typeof reset === "object") {
22901
+ if (reset.placement) {
22902
+ statefulPlacement = reset.placement;
22903
+ }
22904
+ if (reset.rects) {
22905
+ rects = reset.rects === true ? await platform2.getElementRects({
22906
+ reference,
22907
+ floating,
22908
+ strategy
22909
+ }) : reset.rects;
22910
+ }
22911
+ ({
22912
+ x,
22913
+ y
22914
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
22915
+ }
22916
+ i = -1;
22917
+ continue;
22918
+ }
22919
+ }
22920
+ return {
22921
+ x,
22922
+ y,
22923
+ placement: statefulPlacement,
22924
+ strategy,
22925
+ middlewareData
22926
+ };
22927
+ };
22928
+ function expandPaddingObject(padding) {
22929
+ return {
22930
+ top: 0,
22931
+ right: 0,
22932
+ bottom: 0,
22933
+ left: 0,
22934
+ ...padding
22935
+ };
22936
+ }
22937
+ function getSideObjectFromPadding(padding) {
22938
+ return typeof padding !== "number" ? expandPaddingObject(padding) : {
22939
+ top: padding,
22940
+ right: padding,
22941
+ bottom: padding,
22942
+ left: padding
22943
+ };
22944
+ }
22945
+ function rectToClientRect(rect) {
22946
+ return {
22947
+ ...rect,
22948
+ top: rect.y,
22949
+ left: rect.x,
22950
+ right: rect.x + rect.width,
22951
+ bottom: rect.y + rect.height
22952
+ };
22953
+ }
22954
+ async function detectOverflow(middlewareArguments, options) {
22955
+ var _await$platform$isEle;
22956
+ if (options === void 0) {
22957
+ options = {};
22958
+ }
22959
+ const {
22960
+ x,
22961
+ y,
22962
+ platform: platform2,
22963
+ rects,
22964
+ elements,
22965
+ strategy
22966
+ } = middlewareArguments;
22967
+ const {
22968
+ boundary = "clippingAncestors",
22969
+ rootBoundary = "viewport",
22970
+ elementContext = "floating",
22971
+ altBoundary = false,
22972
+ padding = 0
22973
+ } = options;
22974
+ const paddingObject = getSideObjectFromPadding(padding);
22975
+ const altContext = elementContext === "floating" ? "reference" : "floating";
22976
+ const element = elements[altBoundary ? altContext : elementContext];
22977
+ const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
22978
+ 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)),
22979
+ boundary,
22980
+ rootBoundary,
22981
+ strategy
22982
+ }));
22983
+ const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
22984
+ rect: elementContext === "floating" ? {
22985
+ ...rects.floating,
22986
+ x,
22987
+ y
22988
+ } : rects.reference,
22989
+ offsetParent: await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating)),
22990
+ strategy
22991
+ }) : rects[elementContext]);
22992
+ return {
22993
+ top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
22994
+ bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
22995
+ left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
22996
+ right: elementClientRect.right - clippingClientRect.right + paddingObject.right
22997
+ };
22998
+ }
22999
+ const min$1 = Math.min;
23000
+ const max$1 = Math.max;
23001
+ function within(min$1$1, value, max$1$1) {
23002
+ return max$1(min$1$1, min$1(value, max$1$1));
23003
+ }
23004
+ async function convertValueToCoords(middlewareArguments, value) {
23005
+ const {
23006
+ placement,
23007
+ platform: platform2,
23008
+ elements
23009
+ } = middlewareArguments;
23010
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
23011
+ const side = getSide(placement);
23012
+ const alignment = getAlignment(placement);
23013
+ const isVertical = getMainAxisFromPlacement(placement) === "x";
23014
+ const mainAxisMulti = ["left", "top"].includes(side) ? -1 : 1;
23015
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
23016
+ const rawValue = typeof value === "function" ? value(middlewareArguments) : value;
23017
+ let {
23018
+ mainAxis,
23019
+ crossAxis,
23020
+ alignmentAxis
23021
+ } = typeof rawValue === "number" ? {
23022
+ mainAxis: rawValue,
23023
+ crossAxis: 0,
23024
+ alignmentAxis: null
23025
+ } : {
23026
+ mainAxis: 0,
23027
+ crossAxis: 0,
23028
+ alignmentAxis: null,
23029
+ ...rawValue
23030
+ };
23031
+ if (alignment && typeof alignmentAxis === "number") {
23032
+ crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
23033
+ }
23034
+ return isVertical ? {
23035
+ x: crossAxis * crossAxisMulti,
23036
+ y: mainAxis * mainAxisMulti
23037
+ } : {
23038
+ x: mainAxis * mainAxisMulti,
23039
+ y: crossAxis * crossAxisMulti
23040
+ };
23041
+ }
23042
+ const offset = function(value) {
23043
+ if (value === void 0) {
23044
+ value = 0;
23045
+ }
23046
+ return {
23047
+ name: "offset",
23048
+ options: value,
23049
+ async fn(middlewareArguments) {
23050
+ const {
23051
+ x,
23052
+ y
23053
+ } = middlewareArguments;
23054
+ const diffCoords = await convertValueToCoords(middlewareArguments, value);
23055
+ return {
23056
+ x: x + diffCoords.x,
23057
+ y: y + diffCoords.y,
23058
+ data: diffCoords
23059
+ };
23060
+ }
23061
+ };
23062
+ };
23063
+ function getCrossAxis(axis) {
23064
+ return axis === "x" ? "y" : "x";
23065
+ }
23066
+ const shift = function(options) {
23067
+ if (options === void 0) {
23068
+ options = {};
23069
+ }
23070
+ return {
23071
+ name: "shift",
23072
+ options,
23073
+ async fn(middlewareArguments) {
23074
+ const {
23075
+ x,
23076
+ y,
23077
+ placement
23078
+ } = middlewareArguments;
23079
+ const {
23080
+ mainAxis: checkMainAxis = true,
23081
+ crossAxis: checkCrossAxis = false,
23082
+ limiter = {
23083
+ fn: (_ref) => {
23084
+ let {
23085
+ x: x2,
23086
+ y: y2
23087
+ } = _ref;
23088
+ return {
23089
+ x: x2,
23090
+ y: y2
23091
+ };
23092
+ }
23093
+ },
23094
+ ...detectOverflowOptions
23095
+ } = options;
23096
+ const coords = {
23097
+ x,
23098
+ y
23099
+ };
23100
+ const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
23101
+ const mainAxis = getMainAxisFromPlacement(getSide(placement));
23102
+ const crossAxis = getCrossAxis(mainAxis);
23103
+ let mainAxisCoord = coords[mainAxis];
23104
+ let crossAxisCoord = coords[crossAxis];
23105
+ if (checkMainAxis) {
23106
+ const minSide = mainAxis === "y" ? "top" : "left";
23107
+ const maxSide = mainAxis === "y" ? "bottom" : "right";
23108
+ const min2 = mainAxisCoord + overflow[minSide];
23109
+ const max2 = mainAxisCoord - overflow[maxSide];
23110
+ mainAxisCoord = within(min2, mainAxisCoord, max2);
23111
+ }
23112
+ if (checkCrossAxis) {
23113
+ const minSide = crossAxis === "y" ? "top" : "left";
23114
+ const maxSide = crossAxis === "y" ? "bottom" : "right";
23115
+ const min2 = crossAxisCoord + overflow[minSide];
23116
+ const max2 = crossAxisCoord - overflow[maxSide];
23117
+ crossAxisCoord = within(min2, crossAxisCoord, max2);
23118
+ }
23119
+ const limitedCoords = limiter.fn({
23120
+ ...middlewareArguments,
23121
+ [mainAxis]: mainAxisCoord,
23122
+ [crossAxis]: crossAxisCoord
23123
+ });
23124
+ return {
23125
+ ...limitedCoords,
23126
+ data: {
23127
+ x: limitedCoords.x - x,
23128
+ y: limitedCoords.y - y
23129
+ }
23130
+ };
23131
+ }
23132
+ };
23133
+ };
23134
+ const limitShift = function(options) {
23135
+ if (options === void 0) {
23136
+ options = {};
23137
+ }
23138
+ return {
23139
+ options,
23140
+ fn(middlewareArguments) {
23141
+ const {
23142
+ x,
23143
+ y,
23144
+ placement,
23145
+ rects,
23146
+ middlewareData
23147
+ } = middlewareArguments;
23148
+ const {
23149
+ offset: offset2 = 0,
23150
+ mainAxis: checkMainAxis = true,
23151
+ crossAxis: checkCrossAxis = true
23152
+ } = options;
23153
+ const coords = {
23154
+ x,
23155
+ y
23156
+ };
23157
+ const mainAxis = getMainAxisFromPlacement(placement);
23158
+ const crossAxis = getCrossAxis(mainAxis);
23159
+ let mainAxisCoord = coords[mainAxis];
23160
+ let crossAxisCoord = coords[crossAxis];
23161
+ const rawOffset = typeof offset2 === "function" ? offset2(middlewareArguments) : offset2;
23162
+ const computedOffset = typeof rawOffset === "number" ? {
23163
+ mainAxis: rawOffset,
23164
+ crossAxis: 0
23165
+ } : {
23166
+ mainAxis: 0,
23167
+ crossAxis: 0,
23168
+ ...rawOffset
23169
+ };
23170
+ if (checkMainAxis) {
23171
+ const len = mainAxis === "y" ? "height" : "width";
23172
+ const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
23173
+ const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
23174
+ if (mainAxisCoord < limitMin) {
23175
+ mainAxisCoord = limitMin;
23176
+ } else if (mainAxisCoord > limitMax) {
23177
+ mainAxisCoord = limitMax;
23178
+ }
23179
+ }
23180
+ if (checkCrossAxis) {
23181
+ var _middlewareData$offse, _middlewareData$offse2, _middlewareData$offse3, _middlewareData$offse4;
23182
+ const len = mainAxis === "y" ? "width" : "height";
23183
+ const isOriginSide = ["top", "left"].includes(getSide(placement));
23184
+ const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? (_middlewareData$offse = (_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) != null ? _middlewareData$offse : 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
23185
+ const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : (_middlewareData$offse3 = (_middlewareData$offse4 = middlewareData.offset) == null ? void 0 : _middlewareData$offse4[crossAxis]) != null ? _middlewareData$offse3 : 0) - (isOriginSide ? computedOffset.crossAxis : 0);
23186
+ if (crossAxisCoord < limitMin) {
23187
+ crossAxisCoord = limitMin;
23188
+ } else if (crossAxisCoord > limitMax) {
23189
+ crossAxisCoord = limitMax;
23190
+ }
23191
+ }
23192
+ return {
23193
+ [mainAxis]: mainAxisCoord,
23194
+ [crossAxis]: crossAxisCoord
23195
+ };
23196
+ }
23197
+ };
24140
23198
  };
24141
- SimpleBar.getOptions = getOptions;
24142
- if (canUseDom) {
24143
- SimpleBar.initHtmlApi();
23199
+ function isWindow(value) {
23200
+ return value && value.document && value.location && value.alert && value.setInterval;
24144
23201
  }
24145
- function useValidator({ validations }) {
24146
- const error = ref(null);
24147
- function validate() {
24148
- for (const validate2 of validations) {
24149
- const validationError = validate2();
24150
- if (validationError) {
24151
- return error.value = validationError;
24152
- }
24153
- error.value = null;
23202
+ function getWindow(node) {
23203
+ if (node == null) {
23204
+ return window;
23205
+ }
23206
+ if (!isWindow(node)) {
23207
+ const ownerDocument = node.ownerDocument;
23208
+ return ownerDocument ? ownerDocument.defaultView || window : window;
23209
+ }
23210
+ return node;
23211
+ }
23212
+ function getComputedStyle$1(element) {
23213
+ return getWindow(element).getComputedStyle(element);
23214
+ }
23215
+ function getNodeName(node) {
23216
+ return isWindow(node) ? "" : node ? (node.nodeName || "").toLowerCase() : "";
23217
+ }
23218
+ function getUAString() {
23219
+ const uaData = navigator.userAgentData;
23220
+ if (uaData && Array.isArray(uaData.brands)) {
23221
+ return uaData.brands.map((item) => item.brand + "/" + item.version).join(" ");
23222
+ }
23223
+ return navigator.userAgent;
23224
+ }
23225
+ function isHTMLElement(value) {
23226
+ return value instanceof getWindow(value).HTMLElement;
23227
+ }
23228
+ function isElement(value) {
23229
+ return value instanceof getWindow(value).Element;
23230
+ }
23231
+ function isNode(value) {
23232
+ return value instanceof getWindow(value).Node;
23233
+ }
23234
+ function isShadowRoot(node) {
23235
+ if (typeof ShadowRoot === "undefined") {
23236
+ return false;
23237
+ }
23238
+ const OwnElement = getWindow(node).ShadowRoot;
23239
+ return node instanceof OwnElement || node instanceof ShadowRoot;
23240
+ }
23241
+ function isOverflowElement(element) {
23242
+ const {
23243
+ overflow,
23244
+ overflowX,
23245
+ overflowY,
23246
+ display
23247
+ } = getComputedStyle$1(element);
23248
+ return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
23249
+ }
23250
+ function isTableElement(element) {
23251
+ return ["table", "td", "th"].includes(getNodeName(element));
23252
+ }
23253
+ function isContainingBlock(element) {
23254
+ const isFirefox = /firefox/i.test(getUAString());
23255
+ const css = getComputedStyle$1(element);
23256
+ const backdropFilter = css.backdropFilter || css.WebkitBackdropFilter;
23257
+ return css.transform !== "none" || css.perspective !== "none" || (backdropFilter ? backdropFilter !== "none" : false) || isFirefox && css.willChange === "filter" || isFirefox && (css.filter ? css.filter !== "none" : false) || ["transform", "perspective"].some((value) => css.willChange.includes(value)) || ["paint", "layout", "strict", "content"].some(
23258
+ (value) => {
23259
+ const contain = css.contain;
23260
+ return contain != null ? contain.includes(value) : false;
24154
23261
  }
23262
+ );
23263
+ }
23264
+ function isLayoutViewport() {
23265
+ return !/^((?!chrome|android).)*safari/i.test(getUAString());
23266
+ }
23267
+ function isLastTraversableNode(node) {
23268
+ return ["html", "body", "#document"].includes(getNodeName(node));
23269
+ }
23270
+ const min = Math.min;
23271
+ const max = Math.max;
23272
+ const round = Math.round;
23273
+ function getBoundingClientRect(element, includeScale, isFixedStrategy) {
23274
+ var _win$visualViewport$o, _win$visualViewport, _win$visualViewport$o2, _win$visualViewport2;
23275
+ if (includeScale === void 0) {
23276
+ includeScale = false;
24155
23277
  }
24156
- function reset() {
24157
- error.value = null;
23278
+ if (isFixedStrategy === void 0) {
23279
+ isFixedStrategy = false;
24158
23280
  }
24159
- return { error, validate, reset };
23281
+ const clientRect2 = element.getBoundingClientRect();
23282
+ let scaleX = 1;
23283
+ let scaleY = 1;
23284
+ if (includeScale && isHTMLElement(element)) {
23285
+ scaleX = element.offsetWidth > 0 ? round(clientRect2.width) / element.offsetWidth || 1 : 1;
23286
+ scaleY = element.offsetHeight > 0 ? round(clientRect2.height) / element.offsetHeight || 1 : 1;
23287
+ }
23288
+ const win = isElement(element) ? getWindow(element) : window;
23289
+ const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
23290
+ const x = (clientRect2.left + (addVisualOffsets ? (_win$visualViewport$o = (_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) != null ? _win$visualViewport$o : 0 : 0)) / scaleX;
23291
+ const y = (clientRect2.top + (addVisualOffsets ? (_win$visualViewport$o2 = (_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) != null ? _win$visualViewport$o2 : 0 : 0)) / scaleY;
23292
+ const width = clientRect2.width / scaleX;
23293
+ const height = clientRect2.height / scaleY;
23294
+ return {
23295
+ width,
23296
+ height,
23297
+ top: y,
23298
+ right: x + width,
23299
+ bottom: y + height,
23300
+ left: x,
23301
+ x,
23302
+ y
23303
+ };
24160
23304
  }
24161
- const noFormatter = (value) => value;
24162
- function useTempValue({ valueRef, format: format2 = noFormatter }) {
24163
- const tempValue = ref(format2(valueRef.value));
24164
- watch(valueRef, () => tempValue.value = format2(valueRef.value));
24165
- return tempValue;
23305
+ function getDocumentElement(node) {
23306
+ return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
24166
23307
  }
24167
- function useElementRef(ref2) {
24168
- return computed(() => {
24169
- var _a;
24170
- return ((_a = ref2.value) == null ? void 0 : _a.$el) || ref2.value;
24171
- });
23308
+ function getNodeScroll(element) {
23309
+ if (isElement(element)) {
23310
+ return {
23311
+ scrollLeft: element.scrollLeft,
23312
+ scrollTop: element.scrollTop
23313
+ };
23314
+ }
23315
+ return {
23316
+ scrollLeft: element.pageXOffset,
23317
+ scrollTop: element.pageYOffset
23318
+ };
24172
23319
  }
24173
- function useNumberValue({ valueRef, digits, min: min2, max: max2, onChange }) {
24174
- function format2(number) {
24175
- return Number(parseFloat(number).toFixed(digits));
23320
+ function getWindowScrollBarX(element) {
23321
+ return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
23322
+ }
23323
+ function isScaled(element) {
23324
+ const rect = getBoundingClientRect(element);
23325
+ return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
23326
+ }
23327
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
23328
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
23329
+ const documentElement = getDocumentElement(offsetParent);
23330
+ const rect = getBoundingClientRect(
23331
+ element,
23332
+ isOffsetParentAnElement && isScaled(offsetParent),
23333
+ strategy === "fixed"
23334
+ );
23335
+ let scroll = {
23336
+ scrollLeft: 0,
23337
+ scrollTop: 0
23338
+ };
23339
+ const offsets = {
23340
+ x: 0,
23341
+ y: 0
23342
+ };
23343
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== "fixed") {
23344
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
23345
+ scroll = getNodeScroll(offsetParent);
23346
+ }
23347
+ if (isHTMLElement(offsetParent)) {
23348
+ const offsetRect = getBoundingClientRect(offsetParent, true);
23349
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
23350
+ offsets.y = offsetRect.y + offsetParent.clientTop;
23351
+ } else if (documentElement) {
23352
+ offsets.x = getWindowScrollBarX(documentElement);
23353
+ }
24176
23354
  }
24177
- const temp = useTempValue({ valueRef, format: format2 });
24178
- function validateNumber(number) {
24179
- if (min2 !== null && number < min2)
24180
- return min2;
24181
- if (max2 !== null && number > max2)
24182
- return max2;
24183
- return number;
23355
+ return {
23356
+ x: rect.left + scroll.scrollLeft - offsets.x,
23357
+ y: rect.top + scroll.scrollTop - offsets.y,
23358
+ width: rect.width,
23359
+ height: rect.height
23360
+ };
23361
+ }
23362
+ function getParentNode(node) {
23363
+ if (getNodeName(node) === "html") {
23364
+ return node;
24184
23365
  }
24185
- function change(value) {
24186
- temp.value = value;
24187
- if (temp.value === "") {
24188
- temp.value = min2 != null ? min2 : 1;
23366
+ const result = node.assignedSlot || node.parentNode || (isShadowRoot(node) ? node.host : null) || getDocumentElement(node);
23367
+ return isShadowRoot(result) ? result.host : result;
23368
+ }
23369
+ function getTrueOffsetParent(element) {
23370
+ if (!isHTMLElement(element) || getComputedStyle$1(element).position === "fixed") {
23371
+ return null;
23372
+ }
23373
+ return element.offsetParent;
23374
+ }
23375
+ function getContainingBlock(element) {
23376
+ let currentNode = getParentNode(element);
23377
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
23378
+ if (isContainingBlock(currentNode)) {
23379
+ return currentNode;
23380
+ } else {
23381
+ currentNode = getParentNode(currentNode);
24189
23382
  }
24190
- const numericValue = Number.parseFloat(temp.value);
24191
- const validatedNumber = validateNumber(numericValue);
24192
- temp.value = format2(validatedNumber);
24193
- onChange(temp.value);
24194
23383
  }
24195
- function increment(step) {
24196
- const newValue = temp.value + Number(step);
24197
- const validatedNumber = validateNumber(newValue);
24198
- temp.value = format2(validatedNumber);
24199
- onChange(temp.value);
23384
+ return null;
23385
+ }
23386
+ function getOffsetParent(element) {
23387
+ const window2 = getWindow(element);
23388
+ let offsetParent = getTrueOffsetParent(element);
23389
+ while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === "static") {
23390
+ offsetParent = getTrueOffsetParent(offsetParent);
24200
23391
  }
24201
- function decrement(step) {
24202
- const newValue = temp.value - Number(step);
24203
- const validatedNumber = validateNumber(newValue);
24204
- temp.value = format2(validatedNumber);
24205
- onChange(temp.value);
23392
+ if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle$1(offsetParent).position === "static" && !isContainingBlock(offsetParent))) {
23393
+ return window2;
23394
+ }
23395
+ return offsetParent || getContainingBlock(element) || window2;
23396
+ }
23397
+ function getDimensions(element) {
23398
+ if (isHTMLElement(element)) {
23399
+ return {
23400
+ width: element.offsetWidth,
23401
+ height: element.offsetHeight
23402
+ };
24206
23403
  }
23404
+ const rect = getBoundingClientRect(element);
24207
23405
  return {
24208
- temp,
24209
- change,
24210
- increment,
24211
- decrement
23406
+ width: rect.width,
23407
+ height: rect.height
23408
+ };
23409
+ }
23410
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
23411
+ let {
23412
+ rect,
23413
+ offsetParent,
23414
+ strategy
23415
+ } = _ref;
23416
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
23417
+ const documentElement = getDocumentElement(offsetParent);
23418
+ if (offsetParent === documentElement) {
23419
+ return rect;
23420
+ }
23421
+ let scroll = {
23422
+ scrollLeft: 0,
23423
+ scrollTop: 0
23424
+ };
23425
+ const offsets = {
23426
+ x: 0,
23427
+ y: 0
23428
+ };
23429
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== "fixed") {
23430
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
23431
+ scroll = getNodeScroll(offsetParent);
23432
+ }
23433
+ if (isHTMLElement(offsetParent)) {
23434
+ const offsetRect = getBoundingClientRect(offsetParent, true);
23435
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
23436
+ offsets.y = offsetRect.y + offsetParent.clientTop;
23437
+ }
23438
+ }
23439
+ return {
23440
+ ...rect,
23441
+ x: rect.x - scroll.scrollLeft + offsets.x,
23442
+ y: rect.y - scroll.scrollTop + offsets.y
23443
+ };
23444
+ }
23445
+ function getViewportRect(element, strategy) {
23446
+ const win = getWindow(element);
23447
+ const html2 = getDocumentElement(element);
23448
+ const visualViewport = win.visualViewport;
23449
+ let width = html2.clientWidth;
23450
+ let height = html2.clientHeight;
23451
+ let x = 0;
23452
+ let y = 0;
23453
+ if (visualViewport) {
23454
+ width = visualViewport.width;
23455
+ height = visualViewport.height;
23456
+ const layoutViewport = isLayoutViewport();
23457
+ if (layoutViewport || !layoutViewport && strategy === "fixed") {
23458
+ x = visualViewport.offsetLeft;
23459
+ y = visualViewport.offsetTop;
23460
+ }
23461
+ }
23462
+ return {
23463
+ width,
23464
+ height,
23465
+ x,
23466
+ y
23467
+ };
23468
+ }
23469
+ function getDocumentRect(element) {
23470
+ var _element$ownerDocumen;
23471
+ const html2 = getDocumentElement(element);
23472
+ const scroll = getNodeScroll(element);
23473
+ const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
23474
+ const width = max(html2.scrollWidth, html2.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
23475
+ const height = max(html2.scrollHeight, html2.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
23476
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
23477
+ const y = -scroll.scrollTop;
23478
+ if (getComputedStyle$1(body || html2).direction === "rtl") {
23479
+ x += max(html2.clientWidth, body ? body.clientWidth : 0) - width;
23480
+ }
23481
+ return {
23482
+ width,
23483
+ height,
23484
+ x,
23485
+ y
23486
+ };
23487
+ }
23488
+ function getNearestOverflowAncestor(node) {
23489
+ const parentNode2 = getParentNode(node);
23490
+ if (isLastTraversableNode(parentNode2)) {
23491
+ return node.ownerDocument.body;
23492
+ }
23493
+ if (isHTMLElement(parentNode2) && isOverflowElement(parentNode2)) {
23494
+ return parentNode2;
23495
+ }
23496
+ return getNearestOverflowAncestor(parentNode2);
23497
+ }
23498
+ function getOverflowAncestors(node, list) {
23499
+ var _node$ownerDocument;
23500
+ if (list === void 0) {
23501
+ list = [];
23502
+ }
23503
+ const scrollableAncestor = getNearestOverflowAncestor(node);
23504
+ const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
23505
+ const win = getWindow(scrollableAncestor);
23506
+ const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
23507
+ const updatedList = list.concat(target);
23508
+ return isBody ? updatedList : updatedList.concat(getOverflowAncestors(target));
23509
+ }
23510
+ function getInnerBoundingClientRect(element, strategy) {
23511
+ const clientRect2 = getBoundingClientRect(element, false, strategy === "fixed");
23512
+ const top = clientRect2.top + element.clientTop;
23513
+ const left = clientRect2.left + element.clientLeft;
23514
+ return {
23515
+ top,
23516
+ left,
23517
+ x: left,
23518
+ y: top,
23519
+ right: left + element.clientWidth,
23520
+ bottom: top + element.clientHeight,
23521
+ width: element.clientWidth,
23522
+ height: element.clientHeight
23523
+ };
23524
+ }
23525
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
23526
+ if (clippingAncestor === "viewport") {
23527
+ return rectToClientRect(getViewportRect(element, strategy));
23528
+ }
23529
+ if (isElement(clippingAncestor)) {
23530
+ return getInnerBoundingClientRect(clippingAncestor, strategy);
23531
+ }
23532
+ return rectToClientRect(getDocumentRect(getDocumentElement(element)));
23533
+ }
23534
+ function getClippingElementAncestors(element) {
23535
+ let result = getOverflowAncestors(element).filter((el) => isElement(el) && getNodeName(el) !== "body");
23536
+ let currentContainingBlockComputedStyle = null;
23537
+ const elementIsFixed = getComputedStyle$1(element).position === "fixed";
23538
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
23539
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
23540
+ const computedStyle = getComputedStyle$1(currentNode);
23541
+ const containingBlock = isContainingBlock(currentNode);
23542
+ const shouldDropCurrentNode = elementIsFixed ? !containingBlock && !currentContainingBlockComputedStyle : !containingBlock && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position);
23543
+ if (shouldDropCurrentNode) {
23544
+ result = result.filter((ancestor) => ancestor !== currentNode);
23545
+ } else {
23546
+ currentContainingBlockComputedStyle = computedStyle;
23547
+ }
23548
+ currentNode = getParentNode(currentNode);
23549
+ }
23550
+ return result;
23551
+ }
23552
+ function getClippingRect(_ref) {
23553
+ let {
23554
+ element,
23555
+ boundary,
23556
+ rootBoundary,
23557
+ strategy
23558
+ } = _ref;
23559
+ const elementClippingAncestors = boundary === "clippingAncestors" ? getClippingElementAncestors(element) : [].concat(boundary);
23560
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
23561
+ const firstClippingAncestor = clippingAncestors[0];
23562
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
23563
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
23564
+ accRect.top = max(rect.top, accRect.top);
23565
+ accRect.right = min(rect.right, accRect.right);
23566
+ accRect.bottom = min(rect.bottom, accRect.bottom);
23567
+ accRect.left = max(rect.left, accRect.left);
23568
+ return accRect;
23569
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
23570
+ return {
23571
+ width: clippingRect.right - clippingRect.left,
23572
+ height: clippingRect.bottom - clippingRect.top,
23573
+ x: clippingRect.left,
23574
+ y: clippingRect.top
24212
23575
  };
24213
23576
  }
23577
+ const platform = {
23578
+ getClippingRect,
23579
+ convertOffsetParentRelativeRectToViewportRelativeRect,
23580
+ isElement,
23581
+ getDimensions,
23582
+ getOffsetParent,
23583
+ getDocumentElement,
23584
+ async getElementRects(_ref) {
23585
+ let {
23586
+ reference,
23587
+ floating,
23588
+ strategy
23589
+ } = _ref;
23590
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
23591
+ const getDimensionsFn = this.getDimensions;
23592
+ return {
23593
+ reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy),
23594
+ floating: {
23595
+ x: 0,
23596
+ y: 0,
23597
+ ...await getDimensionsFn(floating)
23598
+ }
23599
+ };
23600
+ },
23601
+ getClientRects: (element) => Array.from(element.getClientRects()),
23602
+ isRTL: (element) => getComputedStyle$1(element).direction === "rtl"
23603
+ };
23604
+ function autoUpdate(reference, floating, update, options) {
23605
+ if (options === void 0) {
23606
+ options = {};
23607
+ }
23608
+ const {
23609
+ ancestorScroll: _ancestorScroll = true,
23610
+ ancestorResize = true,
23611
+ elementResize = true,
23612
+ animationFrame = false
23613
+ } = options;
23614
+ const ancestorScroll = _ancestorScroll && !animationFrame;
23615
+ const ancestors = ancestorScroll || ancestorResize ? [...isElement(reference) ? getOverflowAncestors(reference) : reference.contextElement ? getOverflowAncestors(reference.contextElement) : [], ...getOverflowAncestors(floating)] : [];
23616
+ ancestors.forEach((ancestor) => {
23617
+ ancestorScroll && ancestor.addEventListener("scroll", update, {
23618
+ passive: true
23619
+ });
23620
+ ancestorResize && ancestor.addEventListener("resize", update);
23621
+ });
23622
+ let observer = null;
23623
+ if (elementResize) {
23624
+ let initialUpdate = true;
23625
+ observer = new ResizeObserver(() => {
23626
+ if (!initialUpdate) {
23627
+ update();
23628
+ }
23629
+ initialUpdate = false;
23630
+ });
23631
+ isElement(reference) && !animationFrame && observer.observe(reference);
23632
+ if (!isElement(reference) && reference.contextElement && !animationFrame) {
23633
+ observer.observe(reference.contextElement);
23634
+ }
23635
+ observer.observe(floating);
23636
+ }
23637
+ let frameId;
23638
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
23639
+ if (animationFrame) {
23640
+ frameLoop();
23641
+ }
23642
+ function frameLoop() {
23643
+ const nextRefRect = getBoundingClientRect(reference);
23644
+ if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
23645
+ update();
23646
+ }
23647
+ prevRefRect = nextRefRect;
23648
+ frameId = requestAnimationFrame(frameLoop);
23649
+ }
23650
+ update();
23651
+ return () => {
23652
+ var _observer;
23653
+ ancestors.forEach((ancestor) => {
23654
+ ancestorScroll && ancestor.removeEventListener("scroll", update);
23655
+ ancestorResize && ancestor.removeEventListener("resize", update);
23656
+ });
23657
+ (_observer = observer) == null ? void 0 : _observer.disconnect();
23658
+ observer = null;
23659
+ if (animationFrame) {
23660
+ cancelAnimationFrame(frameId);
23661
+ }
23662
+ };
23663
+ }
23664
+ const computePosition = (reference, floating, options) => computePosition$1(reference, floating, {
23665
+ platform,
23666
+ ...options
23667
+ });
24214
23668
  function useModalToggler({ onBeforeOpened, onClosed, wrapperRef, modalRef } = {}) {
24215
23669
  const editor = inject(InjectionTokens$1.EDITOR);
24216
23670
  const isOpened = ref(false);
24217
- let popper2;
24218
- function initPopper() {
23671
+ let floatingInstance;
23672
+ function initModal() {
24219
23673
  const wrapperEl = useElementRef(wrapperRef);
24220
23674
  const modalEl = useElementRef(modalRef);
24221
- popper2 = createPopper(wrapperEl.value, modalEl.value, {
24222
- placement: "bottom",
24223
- strategy: "fixed",
24224
- modifiers: [
24225
- {
24226
- name: "offset",
24227
- options: {
24228
- offset: [0, 4]
24229
- }
24230
- },
24231
- {
24232
- name: "preventOverflow",
24233
- options: {
24234
- padding: 16
24235
- }
24236
- },
24237
- {
24238
- name: "flip",
24239
- enabled: false
24240
- }
24241
- ]
23675
+ floatingInstance = autoUpdate(wrapperEl.value, modalEl.value, async () => {
23676
+ const positioning = await computePosition(wrapperEl.value, modalEl.value, {
23677
+ placement: "bottom",
23678
+ strategy: "fixed",
23679
+ middleware: [
23680
+ shift({ padding: 16, crossAxis: true, limiter: limitShift() }),
23681
+ offset({ mainAxis: 4 })
23682
+ ]
23683
+ });
23684
+ const { x, y } = positioning;
23685
+ Object.assign(modalEl.value, {
23686
+ left: `${x}px`,
23687
+ top: `${y}px`
23688
+ });
24242
23689
  });
24243
23690
  }
24244
23691
  async function open() {
23692
+ if (isOpened.value)
23693
+ return;
24245
23694
  onBeforeOpened == null ? void 0 : onBeforeOpened();
24246
23695
  editor.commands.storeSelection();
24247
23696
  isOpened.value = true;
24248
23697
  await nextTick();
24249
- initPopper();
23698
+ initModal();
24250
23699
  }
24251
23700
  function close2() {
24252
23701
  isOpened.value = false;
23702
+ floatingInstance == null ? void 0 : floatingInstance();
24253
23703
  editor.commands.restoreSelection();
24254
23704
  onClosed == null ? void 0 : onClosed();
24255
23705
  }
24256
- onUnmounted(() => {
24257
- popper2 == null ? void 0 : popper2.destroy();
24258
- });
24259
23706
  const toggle = (toOpen) => toOpen ? open() : close2();
24260
23707
  return { isOpened, open, close: close2, toggle };
24261
23708
  }
@@ -25240,7 +24687,7 @@ var render$r = function __render__18() {
25240
24687
  },
25241
24688
  scopedSlots: _vm._u([{
25242
24689
  key: "option",
25243
- fn: function fn2(attrs) {
24690
+ fn: function fn(attrs) {
25244
24691
  return [_vm._t("option", null, null, attrs)];
25245
24692
  }
25246
24693
  }], null, true)
@@ -25309,7 +24756,7 @@ var render$q = function __render__19() {
25309
24756
  },
25310
24757
  scopedSlots: _vm._u([{
25311
24758
  key: "default",
25312
- fn: function fn2(attrs) {
24759
+ fn: function fn(attrs) {
25313
24760
  return [_vm._t("activator", null, null, attrs)];
25314
24761
  }
25315
24762
  }], null, true)
@@ -25326,7 +24773,7 @@ var render$q = function __render__19() {
25326
24773
  },
25327
24774
  scopedSlots: _vm._u([{
25328
24775
  key: "option",
25329
- fn: function fn2(attrs) {
24776
+ fn: function fn(attrs) {
25330
24777
  return [_vm._t("option", null, null, attrs)];
25331
24778
  }
25332
24779
  }], null, true)
@@ -25498,7 +24945,7 @@ var render$p = function __render__20() {
25498
24945
  },
25499
24946
  scopedSlots: _vm._u([{
25500
24947
  key: "activator",
25501
- fn: function fn2() {
24948
+ fn: function fn() {
25502
24949
  return [_vm._t("activator", null, {
25503
24950
  "isOpened": _vm.api.isOpened,
25504
24951
  "open": _vm.api.open,
@@ -25719,7 +25166,7 @@ var render$n = function __render__22() {
25719
25166
  },
25720
25167
  scopedSlots: _vm._u([{
25721
25168
  key: "option",
25722
- fn: function fn2(_ref) {
25169
+ fn: function fn(_ref) {
25723
25170
  var option = _ref.option;
25724
25171
  return [_c("DropdownOption", {
25725
25172
  directives: [{
@@ -25951,7 +25398,7 @@ var render$k = function __render__25() {
25951
25398
  },
25952
25399
  scopedSlots: _vm._u([{
25953
25400
  key: "activator",
25954
- fn: function fn2(_ref) {
25401
+ fn: function fn(_ref) {
25955
25402
  var toggle = _ref.toggle, isOpened = _ref.isOpened;
25956
25403
  return [_c("Button", {
25957
25404
  directives: [{
@@ -26032,7 +25479,7 @@ var render$j = function __render__26() {
26032
25479
  },
26033
25480
  scopedSlots: _vm._u([{
26034
25481
  key: "activator",
26035
- fn: function fn2(_ref) {
25482
+ fn: function fn(_ref) {
26036
25483
  var toggle = _ref.toggle, isOpened = _ref.isOpened;
26037
25484
  return [_c("Button", {
26038
25485
  directives: [{
@@ -26386,7 +25833,7 @@ var render$e = function __render__31() {
26386
25833
  },
26387
25834
  scopedSlots: _vm._u([{
26388
25835
  key: "activator",
26389
- fn: function fn2(_ref) {
25836
+ fn: function fn(_ref) {
26390
25837
  var open = _ref.open, isOpened = _ref.isOpened;
26391
25838
  return [_c("Button", {
26392
25839
  directives: [{
@@ -26469,7 +25916,7 @@ var render$d = function __render__32() {
26469
25916
  },
26470
25917
  scopedSlots: _vm._u([{
26471
25918
  key: "option",
26472
- fn: function fn2(_ref) {
25919
+ fn: function fn(_ref) {
26473
25920
  var isActive2 = _ref.isActive, option = _ref.option, activate = _ref.activate;
26474
25921
  return [_c("Button", {
26475
25922
  directives: [{
@@ -26717,7 +26164,7 @@ var render$b = function __render__34() {
26717
26164
  },
26718
26165
  scopedSlots: _vm._u([{
26719
26166
  key: "activator",
26720
- fn: function fn2(_ref) {
26167
+ fn: function fn(_ref) {
26721
26168
  var open = _ref.open, isOpened = _ref.isOpened;
26722
26169
  return [_c("Button", {
26723
26170
  directives: [{
@@ -26745,7 +26192,7 @@ var render$b = function __render__34() {
26745
26192
  }
26746
26193
  }, {
26747
26194
  key: "option",
26748
- fn: function fn2(_ref2) {
26195
+ fn: function fn(_ref2) {
26749
26196
  var option = _ref2.option;
26750
26197
  return [_c("DropdownOption", {
26751
26198
  staticClass: "zw-list-control__option",
@@ -27034,7 +26481,7 @@ var render$8 = function __render__37() {
27034
26481
  },
27035
26482
  scopedSlots: _vm._u([{
27036
26483
  key: "option",
27037
- fn: function fn2(_ref) {
26484
+ fn: function fn(_ref) {
27038
26485
  var option = _ref.option;
27039
26486
  return [_c("DropdownOption", {
27040
26487
  staticClass: "zw-link-modal-dropdown__option",
@@ -27171,7 +26618,7 @@ var render$6 = function __render__39() {
27171
26618
  },
27172
26619
  scopedSlots: _vm._u([{
27173
26620
  key: "option",
27174
- fn: function fn2(_ref) {
26621
+ fn: function fn(_ref) {
27175
26622
  var option = _ref.option;
27176
26623
  return [_c("DropdownOption", {
27177
26624
  staticClass: "zw-link-modal-dropdown__option",
@@ -27784,7 +27231,7 @@ var __component__$1 = /* @__PURE__ */ normalizeComponent(
27784
27231
  staticRenderFns$1,
27785
27232
  false,
27786
27233
  __vue2_injectStyles$1,
27787
- "3ceb232a",
27234
+ "def9f25e",
27788
27235
  null,
27789
27236
  null
27790
27237
  );
@@ -27818,33 +27265,26 @@ function useEditor({ content, onChange, extensions: extensions2, isReadonlyRef }
27818
27265
  }
27819
27266
  function useToolbar({ wrapperRef, offsets, isActiveRef, placementRef }) {
27820
27267
  const wrapperEl = useElementRef(wrapperRef);
27821
- let popper2;
27268
+ let floatingInstance;
27822
27269
  function mount(element) {
27823
- popper2 = createPopper(wrapperEl.value, element, {
27824
- placement: placementRef.value,
27825
- strategy: "fixed",
27826
- modifiers: [
27827
- {
27828
- name: "offset",
27829
- options: { offset: offsets }
27830
- },
27831
- {
27832
- name: "preventOverflow",
27833
- options: {
27834
- altAxis: true,
27835
- padding: 2
27836
- }
27837
- },
27838
- {
27839
- name: "flip",
27840
- enabled: false
27841
- }
27842
- ]
27270
+ floatingInstance = autoUpdate(wrapperEl.value, element, async () => {
27271
+ const positioning = await computePosition(wrapperEl.value, element, {
27272
+ placement: placementRef.value,
27273
+ strategy: "fixed",
27274
+ middleware: [
27275
+ shift({ padding: 16, crossAxis: true, limiter: limitShift() }),
27276
+ offset({ crossAxis: offsets[0], mainAxis: offsets[1] })
27277
+ ]
27278
+ });
27279
+ const { x, y } = positioning;
27280
+ Object.assign(element.style, {
27281
+ left: `${x}px`,
27282
+ top: `${y}px`
27283
+ });
27843
27284
  });
27844
27285
  }
27845
- const update = () => popper2 == null ? void 0 : popper2.update();
27286
+ onUnmounted(() => floatingInstance == null ? void 0 : floatingInstance());
27846
27287
  return {
27847
- update,
27848
27288
  mount,
27849
27289
  isActiveRef,
27850
27290
  offsets
@@ -28016,10 +27456,8 @@ const __vue2_script = {
28016
27456
  isActiveRef: isToolbarActiveRef,
28017
27457
  offsets: props.toolbarOffsets
28018
27458
  });
28019
- const updateToolbar = () => toolbar.update();
28020
27459
  function onChange(content) {
28021
27460
  emit("input", content);
28022
- updateToolbar();
28023
27461
  }
28024
27462
  const pageBlocks = toRef(props, "pageBlocks");
28025
27463
  const { editor, getContent } = useEditor({
@@ -28058,7 +27496,6 @@ const __vue2_script = {
28058
27496
  toolbarRef,
28059
27497
  wysiwygRef,
28060
27498
  toolbar,
28061
- updateToolbar,
28062
27499
  getContent,
28063
27500
  getContentCustomization
28064
27501
  };