@limetech/lime-elements 34.1.0-next.8 → 34.1.0-next.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/dist/cjs/{_arrayIncludesWith-d69e30af.js → _arrayIncludesWith-36a6fafb.js} +7 -6
  2. package/dist/cjs/{_assignValue-493aac17.js → _assignValue-c9fc3712.js} +2 -2
  3. package/dist/cjs/{_defineProperty-c081d04c.js → _defineProperty-8351e789.js} +4 -3
  4. package/dist/cjs/eq-9a943b00.js +75 -0
  5. package/dist/cjs/{isArrayLike-2bebb99c.js → isArrayLike-ac53bdac.js} +1 -30
  6. package/dist/cjs/{isEqual-1ce0c121.js → isEqual-e3b9c27c.js} +21 -19
  7. package/dist/cjs/{eq-3b43a5ca.js → isObject-e28b7997.js} +0 -71
  8. package/dist/cjs/isObjectLike-3e3f0cba.js +31 -0
  9. package/dist/cjs/{isSymbol-4666002c.js → isSymbol-d22b2798.js} +3 -3
  10. package/dist/cjs/lime-elements.cjs.js +1 -1
  11. package/dist/cjs/limel-color-picker-palette_2.cjs.entry.js +188 -0
  12. package/dist/cjs/limel-color-picker.cjs.entry.js +51 -0
  13. package/dist/cjs/{limel-flatpickr-adapter_2.cjs.entry.js → limel-flatpickr-adapter.cjs.entry.js} +8 -801
  14. package/dist/cjs/limel-form.cjs.entry.js +14 -12
  15. package/dist/cjs/limel-input-field.cjs.entry.js +713 -0
  16. package/dist/cjs/{limel-list_2.cjs.entry.js → limel-list_3.cjs.entry.js} +1929 -0
  17. package/dist/cjs/limel-menu.cjs.entry.js +5 -4
  18. package/dist/cjs/limel-tab-bar.cjs.entry.js +7 -5
  19. package/dist/cjs/limel-table.cjs.entry.js +9 -7
  20. package/dist/cjs/{limel-tooltip.cjs.entry.js → limel-tooltip_2.cjs.entry.js} +16 -0
  21. package/dist/cjs/loader.cjs.js +1 -1
  22. package/dist/cjs/{pickBy-64252559.js → pickBy-88b0430a.js} +10 -10
  23. package/dist/cjs/toNumber-062ea29c.js +99 -0
  24. package/dist/cjs/{zipObject-2f430e94.js → zipObject-4050a45f.js} +1 -1
  25. package/dist/collection/collection-manifest.json +2 -0
  26. package/dist/collection/components/color-picker/color-picker-palette.css +1202 -0
  27. package/dist/collection/components/color-picker/color-picker-palette.js +135 -0
  28. package/dist/collection/components/color-picker/color-picker.css +71 -0
  29. package/dist/collection/components/color-picker/color-picker.js +189 -0
  30. package/dist/collection/components/color-picker/swatches.js +29 -0
  31. package/dist/esm/{_arrayIncludesWith-3f5ce249.js → _arrayIncludesWith-b5d3fd9e.js} +5 -4
  32. package/dist/esm/{_assignValue-94fb6adc.js → _assignValue-08fe10bc.js} +2 -2
  33. package/dist/esm/{_defineProperty-cbf98a2a.js → _defineProperty-8c869077.js} +2 -1
  34. package/dist/esm/eq-c1c7f528.js +72 -0
  35. package/dist/esm/{isArrayLike-14db8f02.js → isArrayLike-dd37ba9a.js} +2 -30
  36. package/dist/esm/{isEqual-4d982635.js → isEqual-4f22635f.js} +5 -3
  37. package/dist/esm/{eq-f40dd1d6.js → isObject-c74e273c.js} +1 -70
  38. package/dist/esm/isObjectLike-38996507.js +29 -0
  39. package/dist/esm/{isSymbol-84252d8e.js → isSymbol-5bf20921.js} +2 -2
  40. package/dist/esm/lime-elements.js +1 -1
  41. package/dist/esm/limel-color-picker-palette_2.entry.js +183 -0
  42. package/dist/esm/limel-color-picker.entry.js +47 -0
  43. package/dist/esm/{limel-flatpickr-adapter_2.entry.js → limel-flatpickr-adapter.entry.js} +8 -800
  44. package/dist/esm/limel-form.entry.js +10 -8
  45. package/dist/esm/limel-input-field.entry.js +709 -0
  46. package/dist/esm/{limel-list_2.entry.js → limel-list_3.entry.js} +1929 -1
  47. package/dist/esm/limel-menu.entry.js +5 -4
  48. package/dist/esm/limel-tab-bar.entry.js +7 -5
  49. package/dist/esm/limel-table.entry.js +9 -7
  50. package/dist/esm/{limel-tooltip.entry.js → limel-tooltip_2.entry.js} +16 -1
  51. package/dist/esm/loader.js +1 -1
  52. package/dist/esm/{pickBy-c485c1b5.js → pickBy-8a849e46.js} +5 -5
  53. package/dist/esm/toNumber-a6ed64f0.js +97 -0
  54. package/dist/esm/{zipObject-53fcafb3.js → zipObject-22e88ce9.js} +1 -1
  55. package/dist/lime-elements/lime-elements.esm.js +1 -1
  56. package/dist/lime-elements/p-090bc949.js +1 -0
  57. package/dist/lime-elements/p-13f0e4f4.entry.js +1 -0
  58. package/dist/lime-elements/p-18fe2eb1.entry.js +1 -0
  59. package/dist/lime-elements/{p-425a0596.js → p-1a64b531.js} +1 -1
  60. package/dist/lime-elements/p-365098fe.js +1 -0
  61. package/dist/lime-elements/p-379955f4.js +1 -0
  62. package/dist/lime-elements/p-426d11b4.js +1 -0
  63. package/dist/lime-elements/p-440084ea.js +1 -0
  64. package/dist/lime-elements/p-468e940e.entry.js +16 -0
  65. package/dist/lime-elements/p-4bc5d3fc.entry.js +1 -0
  66. package/dist/lime-elements/p-511d71e0.entry.js +1 -0
  67. package/dist/lime-elements/p-7f43b0c4.js +1 -0
  68. package/dist/lime-elements/p-81258617.entry.js +1 -0
  69. package/dist/lime-elements/p-858c6b82.js +1 -0
  70. package/dist/lime-elements/{p-fc691234.entry.js → p-bcafdb7a.entry.js} +2 -2
  71. package/dist/lime-elements/p-c93050d6.js +1 -0
  72. package/dist/lime-elements/p-cc154284.entry.js +1 -0
  73. package/dist/lime-elements/p-d529bb7d.js +1 -0
  74. package/dist/lime-elements/p-eda23c05.js +1 -0
  75. package/dist/lime-elements/{p-ff0217b3.entry.js → p-f2c706b8.entry.js} +1 -1
  76. package/dist/lime-elements/{p-facf936d.entry.js → p-f5a3e526.entry.js} +1 -1
  77. package/dist/lime-elements/p-f83213b8.js +1 -0
  78. package/dist/types/components/color-picker/color-picker-palette.d.ts +32 -0
  79. package/dist/types/components/color-picker/color-picker.d.ts +54 -0
  80. package/dist/types/components/color-picker/swatches.d.ts +4 -0
  81. package/dist/types/components.d.ts +114 -0
  82. package/package.json +1 -1
  83. package/dist/cjs/limel-popover.cjs.entry.js +0 -116
  84. package/dist/cjs/limel-portal.cjs.entry.js +0 -1935
  85. package/dist/cjs/limel-tooltip-content.cjs.entry.js +0 -22
  86. package/dist/esm/limel-popover.entry.js +0 -112
  87. package/dist/esm/limel-portal.entry.js +0 -1931
  88. package/dist/esm/limel-tooltip-content.entry.js +0 -18
  89. package/dist/lime-elements/p-227d2c5a.entry.js +0 -1
  90. package/dist/lime-elements/p-3ce2d46a.js +0 -1
  91. package/dist/lime-elements/p-77afe6dd.entry.js +0 -1
  92. package/dist/lime-elements/p-7c4d91f5.js +0 -1
  93. package/dist/lime-elements/p-845e645a.entry.js +0 -1
  94. package/dist/lime-elements/p-8bbe3720.js +0 -1
  95. package/dist/lime-elements/p-8e4ff107.js +0 -1
  96. package/dist/lime-elements/p-acfbf7ac.js +0 -1
  97. package/dist/lime-elements/p-bbc1bb01.entry.js +0 -1
  98. package/dist/lime-elements/p-c0765c9b.js +0 -1
  99. package/dist/lime-elements/p-e28a4246.entry.js +0 -1
  100. package/dist/lime-elements/p-ee7355e7.js +0 -1
  101. package/dist/lime-elements/p-f4495f59.entry.js +0 -1
  102. package/dist/lime-elements/p-fbe32287.entry.js +0 -16
  103. package/dist/lime-elements/p-fc610f15.js +0 -1
@@ -481,5 +481,1934 @@ let MenuSurface = class {
481
481
  };
482
482
  MenuSurface.style = menuSurfaceCss;
483
483
 
484
+ var top = 'top';
485
+ var bottom = 'bottom';
486
+ var right = 'right';
487
+ var left = 'left';
488
+ var auto = 'auto';
489
+ var basePlacements = [top, bottom, right, left];
490
+ var start = 'start';
491
+ var end = 'end';
492
+ var clippingParents = 'clippingParents';
493
+ var viewport = 'viewport';
494
+ var popper = 'popper';
495
+ var reference = 'reference';
496
+ var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
497
+ return acc.concat([placement + "-" + start, placement + "-" + end]);
498
+ }, []);
499
+ var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
500
+ return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
501
+ }, []); // modifiers that need to read the DOM
502
+
503
+ var beforeRead = 'beforeRead';
504
+ var read = 'read';
505
+ var afterRead = 'afterRead'; // pure-logic modifiers
506
+
507
+ var beforeMain = 'beforeMain';
508
+ var main = 'main';
509
+ var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
510
+
511
+ var beforeWrite = 'beforeWrite';
512
+ var write = 'write';
513
+ var afterWrite = 'afterWrite';
514
+ var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
515
+
516
+ function getNodeName(element) {
517
+ return element ? (element.nodeName || '').toLowerCase() : null;
518
+ }
519
+
520
+ function getWindow(node) {
521
+ if (node == null) {
522
+ return window;
523
+ }
524
+
525
+ if (node.toString() !== '[object Window]') {
526
+ var ownerDocument = node.ownerDocument;
527
+ return ownerDocument ? ownerDocument.defaultView || window : window;
528
+ }
529
+
530
+ return node;
531
+ }
532
+
533
+ function isElement(node) {
534
+ var OwnElement = getWindow(node).Element;
535
+ return node instanceof OwnElement || node instanceof Element;
536
+ }
537
+
538
+ function isHTMLElement(node) {
539
+ var OwnElement = getWindow(node).HTMLElement;
540
+ return node instanceof OwnElement || node instanceof HTMLElement;
541
+ }
542
+
543
+ function isShadowRoot(node) {
544
+ // IE 11 has no ShadowRoot
545
+ if (typeof ShadowRoot === 'undefined') {
546
+ return false;
547
+ }
548
+
549
+ var OwnElement = getWindow(node).ShadowRoot;
550
+ return node instanceof OwnElement || node instanceof ShadowRoot;
551
+ }
552
+
553
+ // and applies them to the HTMLElements such as popper and arrow
554
+
555
+ function applyStyles(_ref) {
556
+ var state = _ref.state;
557
+ Object.keys(state.elements).forEach(function (name) {
558
+ var style = state.styles[name] || {};
559
+ var attributes = state.attributes[name] || {};
560
+ var element = state.elements[name]; // arrow is optional + virtual elements
561
+
562
+ if (!isHTMLElement(element) || !getNodeName(element)) {
563
+ return;
564
+ } // Flow doesn't support to extend this property, but it's the most
565
+ // effective way to apply styles to an HTMLElement
566
+ // $FlowFixMe[cannot-write]
567
+
568
+
569
+ Object.assign(element.style, style);
570
+ Object.keys(attributes).forEach(function (name) {
571
+ var value = attributes[name];
572
+
573
+ if (value === false) {
574
+ element.removeAttribute(name);
575
+ } else {
576
+ element.setAttribute(name, value === true ? '' : value);
577
+ }
578
+ });
579
+ });
580
+ }
581
+
582
+ function effect$2(_ref2) {
583
+ var state = _ref2.state;
584
+ var initialStyles = {
585
+ popper: {
586
+ position: state.options.strategy,
587
+ left: '0',
588
+ top: '0',
589
+ margin: '0'
590
+ },
591
+ arrow: {
592
+ position: 'absolute'
593
+ },
594
+ reference: {}
595
+ };
596
+ Object.assign(state.elements.popper.style, initialStyles.popper);
597
+ state.styles = initialStyles;
598
+
599
+ if (state.elements.arrow) {
600
+ Object.assign(state.elements.arrow.style, initialStyles.arrow);
601
+ }
602
+
603
+ return function () {
604
+ Object.keys(state.elements).forEach(function (name) {
605
+ var element = state.elements[name];
606
+ var attributes = state.attributes[name] || {};
607
+ var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
608
+
609
+ var style = styleProperties.reduce(function (style, property) {
610
+ style[property] = '';
611
+ return style;
612
+ }, {}); // arrow is optional + virtual elements
613
+
614
+ if (!isHTMLElement(element) || !getNodeName(element)) {
615
+ return;
616
+ }
617
+
618
+ Object.assign(element.style, style);
619
+ Object.keys(attributes).forEach(function (attribute) {
620
+ element.removeAttribute(attribute);
621
+ });
622
+ });
623
+ };
624
+ } // eslint-disable-next-line import/no-unused-modules
625
+
626
+
627
+ const applyStyles$1 = {
628
+ name: 'applyStyles',
629
+ enabled: true,
630
+ phase: 'write',
631
+ fn: applyStyles,
632
+ effect: effect$2,
633
+ requires: ['computeStyles']
634
+ };
635
+
636
+ function getBasePlacement(placement) {
637
+ return placement.split('-')[0];
638
+ }
639
+
640
+ var round$1 = Math.round;
641
+ function getBoundingClientRect(element, includeScale) {
642
+ if (includeScale === void 0) {
643
+ includeScale = false;
644
+ }
645
+
646
+ var rect = element.getBoundingClientRect();
647
+ var scaleX = 1;
648
+ var scaleY = 1;
649
+
650
+ if (isHTMLElement(element) && includeScale) {
651
+ // Fallback to 1 in case both values are `0`
652
+ scaleX = rect.width / element.offsetWidth || 1;
653
+ scaleY = rect.height / element.offsetHeight || 1;
654
+ }
655
+
656
+ return {
657
+ width: round$1(rect.width / scaleX),
658
+ height: round$1(rect.height / scaleY),
659
+ top: round$1(rect.top / scaleY),
660
+ right: round$1(rect.right / scaleX),
661
+ bottom: round$1(rect.bottom / scaleY),
662
+ left: round$1(rect.left / scaleX),
663
+ x: round$1(rect.left / scaleX),
664
+ y: round$1(rect.top / scaleY)
665
+ };
666
+ }
667
+
668
+ // means it doesn't take into account transforms.
669
+
670
+ function getLayoutRect(element) {
671
+ var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
672
+ // Fixes https://github.com/popperjs/popper-core/issues/1223
673
+
674
+ var width = element.offsetWidth;
675
+ var height = element.offsetHeight;
676
+
677
+ if (Math.abs(clientRect.width - width) <= 1) {
678
+ width = clientRect.width;
679
+ }
680
+
681
+ if (Math.abs(clientRect.height - height) <= 1) {
682
+ height = clientRect.height;
683
+ }
684
+
685
+ return {
686
+ x: element.offsetLeft,
687
+ y: element.offsetTop,
688
+ width: width,
689
+ height: height
690
+ };
691
+ }
692
+
693
+ function contains(parent, child) {
694
+ var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
695
+
696
+ if (parent.contains(child)) {
697
+ return true;
698
+ } // then fallback to custom implementation with Shadow DOM support
699
+ else if (rootNode && isShadowRoot(rootNode)) {
700
+ var next = child;
701
+
702
+ do {
703
+ if (next && parent.isSameNode(next)) {
704
+ return true;
705
+ } // $FlowFixMe[prop-missing]: need a better way to handle this...
706
+
707
+
708
+ next = next.parentNode || next.host;
709
+ } while (next);
710
+ } // Give up, the result is false
711
+
712
+
713
+ return false;
714
+ }
715
+
716
+ function getComputedStyle(element) {
717
+ return getWindow(element).getComputedStyle(element);
718
+ }
719
+
720
+ function isTableElement(element) {
721
+ return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
722
+ }
723
+
724
+ function getDocumentElement(element) {
725
+ // $FlowFixMe[incompatible-return]: assume body is always available
726
+ return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
727
+ element.document) || window.document).documentElement;
728
+ }
729
+
730
+ function getParentNode(element) {
731
+ if (getNodeName(element) === 'html') {
732
+ return element;
733
+ }
734
+
735
+ return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
736
+ // $FlowFixMe[incompatible-return]
737
+ // $FlowFixMe[prop-missing]
738
+ element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
739
+ element.parentNode || ( // DOM Element detected
740
+ isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
741
+ // $FlowFixMe[incompatible-call]: HTMLElement is a Node
742
+ getDocumentElement(element) // fallback
743
+
744
+ );
745
+ }
746
+
747
+ function getTrueOffsetParent(element) {
748
+ if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
749
+ getComputedStyle(element).position === 'fixed') {
750
+ return null;
751
+ }
752
+
753
+ return element.offsetParent;
754
+ } // `.offsetParent` reports `null` for fixed elements, while absolute elements
755
+ // return the containing block
756
+
757
+
758
+ function getContainingBlock(element) {
759
+ var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;
760
+ var isIE = navigator.userAgent.indexOf('Trident') !== -1;
761
+
762
+ if (isIE && isHTMLElement(element)) {
763
+ // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
764
+ var elementCss = getComputedStyle(element);
765
+
766
+ if (elementCss.position === 'fixed') {
767
+ return null;
768
+ }
769
+ }
770
+
771
+ var currentNode = getParentNode(element);
772
+
773
+ while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
774
+ var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
775
+ // create a containing block.
776
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
777
+
778
+ 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') {
779
+ return currentNode;
780
+ } else {
781
+ currentNode = currentNode.parentNode;
782
+ }
783
+ }
784
+
785
+ return null;
786
+ } // Gets the closest ancestor positioned element. Handles some edge cases,
787
+ // such as table ancestors and cross browser bugs.
788
+
789
+
790
+ function getOffsetParent(element) {
791
+ var window = getWindow(element);
792
+ var offsetParent = getTrueOffsetParent(element);
793
+
794
+ while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
795
+ offsetParent = getTrueOffsetParent(offsetParent);
796
+ }
797
+
798
+ if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
799
+ return window;
800
+ }
801
+
802
+ return offsetParent || getContainingBlock(element) || window;
803
+ }
804
+
805
+ function getMainAxisFromPlacement(placement) {
806
+ return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
807
+ }
808
+
809
+ var max = Math.max;
810
+ var min = Math.min;
811
+ var round = Math.round;
812
+
813
+ function within(min$1, value, max$1) {
814
+ return max(min$1, min(value, max$1));
815
+ }
816
+
817
+ function getFreshSideObject() {
818
+ return {
819
+ top: 0,
820
+ right: 0,
821
+ bottom: 0,
822
+ left: 0
823
+ };
824
+ }
825
+
826
+ function mergePaddingObject(paddingObject) {
827
+ return Object.assign({}, getFreshSideObject(), paddingObject);
828
+ }
829
+
830
+ function expandToHashMap(value, keys) {
831
+ return keys.reduce(function (hashMap, key) {
832
+ hashMap[key] = value;
833
+ return hashMap;
834
+ }, {});
835
+ }
836
+
837
+ var toPaddingObject = function toPaddingObject(padding, state) {
838
+ padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
839
+ placement: state.placement
840
+ })) : padding;
841
+ return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
842
+ };
843
+
844
+ function arrow(_ref) {
845
+ var _state$modifiersData$;
846
+
847
+ var state = _ref.state,
848
+ name = _ref.name,
849
+ options = _ref.options;
850
+ var arrowElement = state.elements.arrow;
851
+ var popperOffsets = state.modifiersData.popperOffsets;
852
+ var basePlacement = getBasePlacement(state.placement);
853
+ var axis = getMainAxisFromPlacement(basePlacement);
854
+ var isVertical = [left, right].indexOf(basePlacement) >= 0;
855
+ var len = isVertical ? 'height' : 'width';
856
+
857
+ if (!arrowElement || !popperOffsets) {
858
+ return;
859
+ }
860
+
861
+ var paddingObject = toPaddingObject(options.padding, state);
862
+ var arrowRect = getLayoutRect(arrowElement);
863
+ var minProp = axis === 'y' ? top : left;
864
+ var maxProp = axis === 'y' ? bottom : right;
865
+ var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
866
+ var startDiff = popperOffsets[axis] - state.rects.reference[axis];
867
+ var arrowOffsetParent = getOffsetParent(arrowElement);
868
+ var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
869
+ var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is
870
+ // outside of the popper bounds
871
+
872
+ var min = paddingObject[minProp];
873
+ var max = clientSize - arrowRect[len] - paddingObject[maxProp];
874
+ var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
875
+ var offset = within(min, center, max); // Prevents breaking syntax highlighting...
876
+
877
+ var axisProp = axis;
878
+ state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
879
+ }
880
+
881
+ function effect$1(_ref2) {
882
+ var state = _ref2.state,
883
+ options = _ref2.options;
884
+ var _options$element = options.element,
885
+ arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
886
+
887
+ if (arrowElement == null) {
888
+ return;
889
+ } // CSS selector
890
+
891
+
892
+ if (typeof arrowElement === 'string') {
893
+ arrowElement = state.elements.popper.querySelector(arrowElement);
894
+
895
+ if (!arrowElement) {
896
+ return;
897
+ }
898
+ }
899
+
900
+ if (!contains(state.elements.popper, arrowElement)) {
901
+
902
+ return;
903
+ }
904
+
905
+ state.elements.arrow = arrowElement;
906
+ } // eslint-disable-next-line import/no-unused-modules
907
+
908
+
909
+ const arrow$1 = {
910
+ name: 'arrow',
911
+ enabled: true,
912
+ phase: 'main',
913
+ fn: arrow,
914
+ effect: effect$1,
915
+ requires: ['popperOffsets'],
916
+ requiresIfExists: ['preventOverflow']
917
+ };
918
+
919
+ var unsetSides = {
920
+ top: 'auto',
921
+ right: 'auto',
922
+ bottom: 'auto',
923
+ left: 'auto'
924
+ }; // Round the offsets to the nearest suitable subpixel based on the DPR.
925
+ // Zooming can change the DPR, but it seems to report a value that will
926
+ // cleanly divide the values into the appropriate subpixels.
927
+
928
+ function roundOffsetsByDPR(_ref) {
929
+ var x = _ref.x,
930
+ y = _ref.y;
931
+ var win = window;
932
+ var dpr = win.devicePixelRatio || 1;
933
+ return {
934
+ x: round(round(x * dpr) / dpr) || 0,
935
+ y: round(round(y * dpr) / dpr) || 0
936
+ };
937
+ }
938
+
939
+ function mapToStyles(_ref2) {
940
+ var _Object$assign2;
941
+
942
+ var popper = _ref2.popper,
943
+ popperRect = _ref2.popperRect,
944
+ placement = _ref2.placement,
945
+ offsets = _ref2.offsets,
946
+ position = _ref2.position,
947
+ gpuAcceleration = _ref2.gpuAcceleration,
948
+ adaptive = _ref2.adaptive,
949
+ roundOffsets = _ref2.roundOffsets;
950
+
951
+ var _ref3 = roundOffsets === true ? roundOffsetsByDPR(offsets) : typeof roundOffsets === 'function' ? roundOffsets(offsets) : offsets,
952
+ _ref3$x = _ref3.x,
953
+ x = _ref3$x === void 0 ? 0 : _ref3$x,
954
+ _ref3$y = _ref3.y,
955
+ y = _ref3$y === void 0 ? 0 : _ref3$y;
956
+
957
+ var hasX = offsets.hasOwnProperty('x');
958
+ var hasY = offsets.hasOwnProperty('y');
959
+ var sideX = left;
960
+ var sideY = top;
961
+ var win = window;
962
+
963
+ if (adaptive) {
964
+ var offsetParent = getOffsetParent(popper);
965
+ var heightProp = 'clientHeight';
966
+ var widthProp = 'clientWidth';
967
+
968
+ if (offsetParent === getWindow(popper)) {
969
+ offsetParent = getDocumentElement(popper);
970
+
971
+ if (getComputedStyle(offsetParent).position !== 'static') {
972
+ heightProp = 'scrollHeight';
973
+ widthProp = 'scrollWidth';
974
+ }
975
+ } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
976
+
977
+
978
+ offsetParent = offsetParent;
979
+
980
+ if (placement === top) {
981
+ sideY = bottom; // $FlowFixMe[prop-missing]
982
+
983
+ y -= offsetParent[heightProp] - popperRect.height;
984
+ y *= gpuAcceleration ? 1 : -1;
985
+ }
986
+
987
+ if (placement === left) {
988
+ sideX = right; // $FlowFixMe[prop-missing]
989
+
990
+ x -= offsetParent[widthProp] - popperRect.width;
991
+ x *= gpuAcceleration ? 1 : -1;
992
+ }
993
+ }
994
+
995
+ var commonStyles = Object.assign({
996
+ position: position
997
+ }, adaptive && unsetSides);
998
+
999
+ if (gpuAcceleration) {
1000
+ var _Object$assign;
1001
+
1002
+ return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) < 2 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
1003
+ }
1004
+
1005
+ return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
1006
+ }
1007
+
1008
+ function computeStyles(_ref4) {
1009
+ var state = _ref4.state,
1010
+ options = _ref4.options;
1011
+ var _options$gpuAccelerat = options.gpuAcceleration,
1012
+ gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
1013
+ _options$adaptive = options.adaptive,
1014
+ adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
1015
+ _options$roundOffsets = options.roundOffsets,
1016
+ roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
1017
+
1018
+ var commonStyles = {
1019
+ placement: getBasePlacement(state.placement),
1020
+ popper: state.elements.popper,
1021
+ popperRect: state.rects.popper,
1022
+ gpuAcceleration: gpuAcceleration
1023
+ };
1024
+
1025
+ if (state.modifiersData.popperOffsets != null) {
1026
+ state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
1027
+ offsets: state.modifiersData.popperOffsets,
1028
+ position: state.options.strategy,
1029
+ adaptive: adaptive,
1030
+ roundOffsets: roundOffsets
1031
+ })));
1032
+ }
1033
+
1034
+ if (state.modifiersData.arrow != null) {
1035
+ state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
1036
+ offsets: state.modifiersData.arrow,
1037
+ position: 'absolute',
1038
+ adaptive: false,
1039
+ roundOffsets: roundOffsets
1040
+ })));
1041
+ }
1042
+
1043
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
1044
+ 'data-popper-placement': state.placement
1045
+ });
1046
+ } // eslint-disable-next-line import/no-unused-modules
1047
+
1048
+
1049
+ const computeStyles$1 = {
1050
+ name: 'computeStyles',
1051
+ enabled: true,
1052
+ phase: 'beforeWrite',
1053
+ fn: computeStyles,
1054
+ data: {}
1055
+ };
1056
+
1057
+ var passive = {
1058
+ passive: true
1059
+ };
1060
+
1061
+ function effect(_ref) {
1062
+ var state = _ref.state,
1063
+ instance = _ref.instance,
1064
+ options = _ref.options;
1065
+ var _options$scroll = options.scroll,
1066
+ scroll = _options$scroll === void 0 ? true : _options$scroll,
1067
+ _options$resize = options.resize,
1068
+ resize = _options$resize === void 0 ? true : _options$resize;
1069
+ var window = getWindow(state.elements.popper);
1070
+ var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
1071
+
1072
+ if (scroll) {
1073
+ scrollParents.forEach(function (scrollParent) {
1074
+ scrollParent.addEventListener('scroll', instance.update, passive);
1075
+ });
1076
+ }
1077
+
1078
+ if (resize) {
1079
+ window.addEventListener('resize', instance.update, passive);
1080
+ }
1081
+
1082
+ return function () {
1083
+ if (scroll) {
1084
+ scrollParents.forEach(function (scrollParent) {
1085
+ scrollParent.removeEventListener('scroll', instance.update, passive);
1086
+ });
1087
+ }
1088
+
1089
+ if (resize) {
1090
+ window.removeEventListener('resize', instance.update, passive);
1091
+ }
1092
+ };
1093
+ } // eslint-disable-next-line import/no-unused-modules
1094
+
1095
+
1096
+ const eventListeners = {
1097
+ name: 'eventListeners',
1098
+ enabled: true,
1099
+ phase: 'write',
1100
+ fn: function fn() {},
1101
+ effect: effect,
1102
+ data: {}
1103
+ };
1104
+
1105
+ var hash$1 = {
1106
+ left: 'right',
1107
+ right: 'left',
1108
+ bottom: 'top',
1109
+ top: 'bottom'
1110
+ };
1111
+ function getOppositePlacement(placement) {
1112
+ return placement.replace(/left|right|bottom|top/g, function (matched) {
1113
+ return hash$1[matched];
1114
+ });
1115
+ }
1116
+
1117
+ var hash = {
1118
+ start: 'end',
1119
+ end: 'start'
1120
+ };
1121
+ function getOppositeVariationPlacement(placement) {
1122
+ return placement.replace(/start|end/g, function (matched) {
1123
+ return hash[matched];
1124
+ });
1125
+ }
1126
+
1127
+ function getWindowScroll(node) {
1128
+ var win = getWindow(node);
1129
+ var scrollLeft = win.pageXOffset;
1130
+ var scrollTop = win.pageYOffset;
1131
+ return {
1132
+ scrollLeft: scrollLeft,
1133
+ scrollTop: scrollTop
1134
+ };
1135
+ }
1136
+
1137
+ function getWindowScrollBarX(element) {
1138
+ // If <html> has a CSS width greater than the viewport, then this will be
1139
+ // incorrect for RTL.
1140
+ // Popper 1 is broken in this case and never had a bug report so let's assume
1141
+ // it's not an issue. I don't think anyone ever specifies width on <html>
1142
+ // anyway.
1143
+ // Browsers where the left scrollbar doesn't cause an issue report `0` for
1144
+ // this (e.g. Edge 2019, IE11, Safari)
1145
+ return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
1146
+ }
1147
+
1148
+ function getViewportRect(element) {
1149
+ var win = getWindow(element);
1150
+ var html = getDocumentElement(element);
1151
+ var visualViewport = win.visualViewport;
1152
+ var width = html.clientWidth;
1153
+ var height = html.clientHeight;
1154
+ var x = 0;
1155
+ var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper
1156
+ // can be obscured underneath it.
1157
+ // Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even
1158
+ // if it isn't open, so if this isn't available, the popper will be detected
1159
+ // to overflow the bottom of the screen too early.
1160
+
1161
+ if (visualViewport) {
1162
+ width = visualViewport.width;
1163
+ height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently)
1164
+ // In Chrome, it returns a value very close to 0 (+/-) but contains rounding
1165
+ // errors due to floating point numbers, so we need to check precision.
1166
+ // Safari returns a number <= 0, usually < -1 when pinch-zoomed
1167
+ // Feature detection fails in mobile emulation mode in Chrome.
1168
+ // Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) <
1169
+ // 0.001
1170
+ // Fallback here: "Not Safari" userAgent
1171
+
1172
+ if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
1173
+ x = visualViewport.offsetLeft;
1174
+ y = visualViewport.offsetTop;
1175
+ }
1176
+ }
1177
+
1178
+ return {
1179
+ width: width,
1180
+ height: height,
1181
+ x: x + getWindowScrollBarX(element),
1182
+ y: y
1183
+ };
1184
+ }
1185
+
1186
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable
1187
+
1188
+ function getDocumentRect(element) {
1189
+ var _element$ownerDocumen;
1190
+
1191
+ var html = getDocumentElement(element);
1192
+ var winScroll = getWindowScroll(element);
1193
+ var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
1194
+ var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
1195
+ var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
1196
+ var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
1197
+ var y = -winScroll.scrollTop;
1198
+
1199
+ if (getComputedStyle(body || html).direction === 'rtl') {
1200
+ x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
1201
+ }
1202
+
1203
+ return {
1204
+ width: width,
1205
+ height: height,
1206
+ x: x,
1207
+ y: y
1208
+ };
1209
+ }
1210
+
1211
+ function isScrollParent(element) {
1212
+ // Firefox wants us to check `-x` and `-y` variations as well
1213
+ var _getComputedStyle = getComputedStyle(element),
1214
+ overflow = _getComputedStyle.overflow,
1215
+ overflowX = _getComputedStyle.overflowX,
1216
+ overflowY = _getComputedStyle.overflowY;
1217
+
1218
+ return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
1219
+ }
1220
+
1221
+ function getScrollParent(node) {
1222
+ if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
1223
+ // $FlowFixMe[incompatible-return]: assume body is always available
1224
+ return node.ownerDocument.body;
1225
+ }
1226
+
1227
+ if (isHTMLElement(node) && isScrollParent(node)) {
1228
+ return node;
1229
+ }
1230
+
1231
+ return getScrollParent(getParentNode(node));
1232
+ }
1233
+
1234
+ /*
1235
+ given a DOM element, return the list of all scroll parents, up the list of ancesors
1236
+ until we get to the top window object. This list is what we attach scroll listeners
1237
+ to, because if any of these parent elements scroll, we'll need to re-calculate the
1238
+ reference element's position.
1239
+ */
1240
+
1241
+ function listScrollParents(element, list) {
1242
+ var _element$ownerDocumen;
1243
+
1244
+ if (list === void 0) {
1245
+ list = [];
1246
+ }
1247
+
1248
+ var scrollParent = getScrollParent(element);
1249
+ var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
1250
+ var win = getWindow(scrollParent);
1251
+ var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
1252
+ var updatedList = list.concat(target);
1253
+ return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
1254
+ updatedList.concat(listScrollParents(getParentNode(target)));
1255
+ }
1256
+
1257
+ function rectToClientRect(rect) {
1258
+ return Object.assign({}, rect, {
1259
+ left: rect.x,
1260
+ top: rect.y,
1261
+ right: rect.x + rect.width,
1262
+ bottom: rect.y + rect.height
1263
+ });
1264
+ }
1265
+
1266
+ function getInnerBoundingClientRect(element) {
1267
+ var rect = getBoundingClientRect(element);
1268
+ rect.top = rect.top + element.clientTop;
1269
+ rect.left = rect.left + element.clientLeft;
1270
+ rect.bottom = rect.top + element.clientHeight;
1271
+ rect.right = rect.left + element.clientWidth;
1272
+ rect.width = element.clientWidth;
1273
+ rect.height = element.clientHeight;
1274
+ rect.x = rect.left;
1275
+ rect.y = rect.top;
1276
+ return rect;
1277
+ }
1278
+
1279
+ function getClientRectFromMixedType(element, clippingParent) {
1280
+ return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isHTMLElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
1281
+ } // A "clipping parent" is an overflowable container with the characteristic of
1282
+ // clipping (or hiding) overflowing elements with a position different from
1283
+ // `initial`
1284
+
1285
+
1286
+ function getClippingParents(element) {
1287
+ var clippingParents = listScrollParents(getParentNode(element));
1288
+ var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;
1289
+ var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
1290
+
1291
+ if (!isElement(clipperElement)) {
1292
+ return [];
1293
+ } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
1294
+
1295
+
1296
+ return clippingParents.filter(function (clippingParent) {
1297
+ return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
1298
+ });
1299
+ } // Gets the maximum area that the element is visible in due to any number of
1300
+ // clipping parents
1301
+
1302
+
1303
+ function getClippingRect(element, boundary, rootBoundary) {
1304
+ var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
1305
+ var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
1306
+ var firstClippingParent = clippingParents[0];
1307
+ var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
1308
+ var rect = getClientRectFromMixedType(element, clippingParent);
1309
+ accRect.top = max(rect.top, accRect.top);
1310
+ accRect.right = min(rect.right, accRect.right);
1311
+ accRect.bottom = min(rect.bottom, accRect.bottom);
1312
+ accRect.left = max(rect.left, accRect.left);
1313
+ return accRect;
1314
+ }, getClientRectFromMixedType(element, firstClippingParent));
1315
+ clippingRect.width = clippingRect.right - clippingRect.left;
1316
+ clippingRect.height = clippingRect.bottom - clippingRect.top;
1317
+ clippingRect.x = clippingRect.left;
1318
+ clippingRect.y = clippingRect.top;
1319
+ return clippingRect;
1320
+ }
1321
+
1322
+ function getVariation(placement) {
1323
+ return placement.split('-')[1];
1324
+ }
1325
+
1326
+ function computeOffsets(_ref) {
1327
+ var reference = _ref.reference,
1328
+ element = _ref.element,
1329
+ placement = _ref.placement;
1330
+ var basePlacement = placement ? getBasePlacement(placement) : null;
1331
+ var variation = placement ? getVariation(placement) : null;
1332
+ var commonX = reference.x + reference.width / 2 - element.width / 2;
1333
+ var commonY = reference.y + reference.height / 2 - element.height / 2;
1334
+ var offsets;
1335
+
1336
+ switch (basePlacement) {
1337
+ case top:
1338
+ offsets = {
1339
+ x: commonX,
1340
+ y: reference.y - element.height
1341
+ };
1342
+ break;
1343
+
1344
+ case bottom:
1345
+ offsets = {
1346
+ x: commonX,
1347
+ y: reference.y + reference.height
1348
+ };
1349
+ break;
1350
+
1351
+ case right:
1352
+ offsets = {
1353
+ x: reference.x + reference.width,
1354
+ y: commonY
1355
+ };
1356
+ break;
1357
+
1358
+ case left:
1359
+ offsets = {
1360
+ x: reference.x - element.width,
1361
+ y: commonY
1362
+ };
1363
+ break;
1364
+
1365
+ default:
1366
+ offsets = {
1367
+ x: reference.x,
1368
+ y: reference.y
1369
+ };
1370
+ }
1371
+
1372
+ var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
1373
+
1374
+ if (mainAxis != null) {
1375
+ var len = mainAxis === 'y' ? 'height' : 'width';
1376
+
1377
+ switch (variation) {
1378
+ case start:
1379
+ offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
1380
+ break;
1381
+
1382
+ case end:
1383
+ offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
1384
+ break;
1385
+ }
1386
+ }
1387
+
1388
+ return offsets;
1389
+ }
1390
+
1391
+ function detectOverflow(state, options) {
1392
+ if (options === void 0) {
1393
+ options = {};
1394
+ }
1395
+
1396
+ var _options = options,
1397
+ _options$placement = _options.placement,
1398
+ placement = _options$placement === void 0 ? state.placement : _options$placement,
1399
+ _options$boundary = _options.boundary,
1400
+ boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
1401
+ _options$rootBoundary = _options.rootBoundary,
1402
+ rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
1403
+ _options$elementConte = _options.elementContext,
1404
+ elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
1405
+ _options$altBoundary = _options.altBoundary,
1406
+ altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
1407
+ _options$padding = _options.padding,
1408
+ padding = _options$padding === void 0 ? 0 : _options$padding;
1409
+ var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
1410
+ var altContext = elementContext === popper ? reference : popper;
1411
+ var referenceElement = state.elements.reference;
1412
+ var popperRect = state.rects.popper;
1413
+ var element = state.elements[altBoundary ? altContext : elementContext];
1414
+ var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
1415
+ var referenceClientRect = getBoundingClientRect(referenceElement);
1416
+ var popperOffsets = computeOffsets({
1417
+ reference: referenceClientRect,
1418
+ element: popperRect,
1419
+ strategy: 'absolute',
1420
+ placement: placement
1421
+ });
1422
+ var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
1423
+ var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
1424
+ // 0 or negative = within the clipping rect
1425
+
1426
+ var overflowOffsets = {
1427
+ top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
1428
+ bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
1429
+ left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
1430
+ right: elementClientRect.right - clippingClientRect.right + paddingObject.right
1431
+ };
1432
+ var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element
1433
+
1434
+ if (elementContext === popper && offsetData) {
1435
+ var offset = offsetData[placement];
1436
+ Object.keys(overflowOffsets).forEach(function (key) {
1437
+ var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
1438
+ var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
1439
+ overflowOffsets[key] += offset[axis] * multiply;
1440
+ });
1441
+ }
1442
+
1443
+ return overflowOffsets;
1444
+ }
1445
+
1446
+ function computeAutoPlacement(state, options) {
1447
+ if (options === void 0) {
1448
+ options = {};
1449
+ }
1450
+
1451
+ var _options = options,
1452
+ placement = _options.placement,
1453
+ boundary = _options.boundary,
1454
+ rootBoundary = _options.rootBoundary,
1455
+ padding = _options.padding,
1456
+ flipVariations = _options.flipVariations,
1457
+ _options$allowedAutoP = _options.allowedAutoPlacements,
1458
+ allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
1459
+ var variation = getVariation(placement);
1460
+ var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
1461
+ return getVariation(placement) === variation;
1462
+ }) : basePlacements;
1463
+ var allowedPlacements = placements$1.filter(function (placement) {
1464
+ return allowedAutoPlacements.indexOf(placement) >= 0;
1465
+ });
1466
+
1467
+ if (allowedPlacements.length === 0) {
1468
+ allowedPlacements = placements$1;
1469
+ } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
1470
+
1471
+
1472
+ var overflows = allowedPlacements.reduce(function (acc, placement) {
1473
+ acc[placement] = detectOverflow(state, {
1474
+ placement: placement,
1475
+ boundary: boundary,
1476
+ rootBoundary: rootBoundary,
1477
+ padding: padding
1478
+ })[getBasePlacement(placement)];
1479
+ return acc;
1480
+ }, {});
1481
+ return Object.keys(overflows).sort(function (a, b) {
1482
+ return overflows[a] - overflows[b];
1483
+ });
1484
+ }
1485
+
1486
+ function getExpandedFallbackPlacements(placement) {
1487
+ if (getBasePlacement(placement) === auto) {
1488
+ return [];
1489
+ }
1490
+
1491
+ var oppositePlacement = getOppositePlacement(placement);
1492
+ return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
1493
+ }
1494
+
1495
+ function flip(_ref) {
1496
+ var state = _ref.state,
1497
+ options = _ref.options,
1498
+ name = _ref.name;
1499
+
1500
+ if (state.modifiersData[name]._skip) {
1501
+ return;
1502
+ }
1503
+
1504
+ var _options$mainAxis = options.mainAxis,
1505
+ checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
1506
+ _options$altAxis = options.altAxis,
1507
+ checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,
1508
+ specifiedFallbackPlacements = options.fallbackPlacements,
1509
+ padding = options.padding,
1510
+ boundary = options.boundary,
1511
+ rootBoundary = options.rootBoundary,
1512
+ altBoundary = options.altBoundary,
1513
+ _options$flipVariatio = options.flipVariations,
1514
+ flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,
1515
+ allowedAutoPlacements = options.allowedAutoPlacements;
1516
+ var preferredPlacement = state.options.placement;
1517
+ var basePlacement = getBasePlacement(preferredPlacement);
1518
+ var isBasePlacement = basePlacement === preferredPlacement;
1519
+ var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
1520
+ var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {
1521
+ return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {
1522
+ placement: placement,
1523
+ boundary: boundary,
1524
+ rootBoundary: rootBoundary,
1525
+ padding: padding,
1526
+ flipVariations: flipVariations,
1527
+ allowedAutoPlacements: allowedAutoPlacements
1528
+ }) : placement);
1529
+ }, []);
1530
+ var referenceRect = state.rects.reference;
1531
+ var popperRect = state.rects.popper;
1532
+ var checksMap = new Map();
1533
+ var makeFallbackChecks = true;
1534
+ var firstFittingPlacement = placements[0];
1535
+
1536
+ for (var i = 0; i < placements.length; i++) {
1537
+ var placement = placements[i];
1538
+
1539
+ var _basePlacement = getBasePlacement(placement);
1540
+
1541
+ var isStartVariation = getVariation(placement) === start;
1542
+ var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
1543
+ var len = isVertical ? 'width' : 'height';
1544
+ var overflow = detectOverflow(state, {
1545
+ placement: placement,
1546
+ boundary: boundary,
1547
+ rootBoundary: rootBoundary,
1548
+ altBoundary: altBoundary,
1549
+ padding: padding
1550
+ });
1551
+ var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
1552
+
1553
+ if (referenceRect[len] > popperRect[len]) {
1554
+ mainVariationSide = getOppositePlacement(mainVariationSide);
1555
+ }
1556
+
1557
+ var altVariationSide = getOppositePlacement(mainVariationSide);
1558
+ var checks = [];
1559
+
1560
+ if (checkMainAxis) {
1561
+ checks.push(overflow[_basePlacement] <= 0);
1562
+ }
1563
+
1564
+ if (checkAltAxis) {
1565
+ checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
1566
+ }
1567
+
1568
+ if (checks.every(function (check) {
1569
+ return check;
1570
+ })) {
1571
+ firstFittingPlacement = placement;
1572
+ makeFallbackChecks = false;
1573
+ break;
1574
+ }
1575
+
1576
+ checksMap.set(placement, checks);
1577
+ }
1578
+
1579
+ if (makeFallbackChecks) {
1580
+ // `2` may be desired in some cases – research later
1581
+ var numberOfChecks = flipVariations ? 3 : 1;
1582
+
1583
+ var _loop = function _loop(_i) {
1584
+ var fittingPlacement = placements.find(function (placement) {
1585
+ var checks = checksMap.get(placement);
1586
+
1587
+ if (checks) {
1588
+ return checks.slice(0, _i).every(function (check) {
1589
+ return check;
1590
+ });
1591
+ }
1592
+ });
1593
+
1594
+ if (fittingPlacement) {
1595
+ firstFittingPlacement = fittingPlacement;
1596
+ return "break";
1597
+ }
1598
+ };
1599
+
1600
+ for (var _i = numberOfChecks; _i > 0; _i--) {
1601
+ var _ret = _loop(_i);
1602
+
1603
+ if (_ret === "break") break;
1604
+ }
1605
+ }
1606
+
1607
+ if (state.placement !== firstFittingPlacement) {
1608
+ state.modifiersData[name]._skip = true;
1609
+ state.placement = firstFittingPlacement;
1610
+ state.reset = true;
1611
+ }
1612
+ } // eslint-disable-next-line import/no-unused-modules
1613
+
1614
+
1615
+ const flip$1 = {
1616
+ name: 'flip',
1617
+ enabled: true,
1618
+ phase: 'main',
1619
+ fn: flip,
1620
+ requiresIfExists: ['offset'],
1621
+ data: {
1622
+ _skip: false
1623
+ }
1624
+ };
1625
+
1626
+ function getSideOffsets(overflow, rect, preventedOffsets) {
1627
+ if (preventedOffsets === void 0) {
1628
+ preventedOffsets = {
1629
+ x: 0,
1630
+ y: 0
1631
+ };
1632
+ }
1633
+
1634
+ return {
1635
+ top: overflow.top - rect.height - preventedOffsets.y,
1636
+ right: overflow.right - rect.width + preventedOffsets.x,
1637
+ bottom: overflow.bottom - rect.height + preventedOffsets.y,
1638
+ left: overflow.left - rect.width - preventedOffsets.x
1639
+ };
1640
+ }
1641
+
1642
+ function isAnySideFullyClipped(overflow) {
1643
+ return [top, right, bottom, left].some(function (side) {
1644
+ return overflow[side] >= 0;
1645
+ });
1646
+ }
1647
+
1648
+ function hide(_ref) {
1649
+ var state = _ref.state,
1650
+ name = _ref.name;
1651
+ var referenceRect = state.rects.reference;
1652
+ var popperRect = state.rects.popper;
1653
+ var preventedOffsets = state.modifiersData.preventOverflow;
1654
+ var referenceOverflow = detectOverflow(state, {
1655
+ elementContext: 'reference'
1656
+ });
1657
+ var popperAltOverflow = detectOverflow(state, {
1658
+ altBoundary: true
1659
+ });
1660
+ var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
1661
+ var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
1662
+ var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
1663
+ var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
1664
+ state.modifiersData[name] = {
1665
+ referenceClippingOffsets: referenceClippingOffsets,
1666
+ popperEscapeOffsets: popperEscapeOffsets,
1667
+ isReferenceHidden: isReferenceHidden,
1668
+ hasPopperEscaped: hasPopperEscaped
1669
+ };
1670
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
1671
+ 'data-popper-reference-hidden': isReferenceHidden,
1672
+ 'data-popper-escaped': hasPopperEscaped
1673
+ });
1674
+ } // eslint-disable-next-line import/no-unused-modules
1675
+
1676
+
1677
+ const hide$1 = {
1678
+ name: 'hide',
1679
+ enabled: true,
1680
+ phase: 'main',
1681
+ requiresIfExists: ['preventOverflow'],
1682
+ fn: hide
1683
+ };
1684
+
1685
+ function distanceAndSkiddingToXY(placement, rects, offset) {
1686
+ var basePlacement = getBasePlacement(placement);
1687
+ var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
1688
+
1689
+ var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
1690
+ placement: placement
1691
+ })) : offset,
1692
+ skidding = _ref[0],
1693
+ distance = _ref[1];
1694
+
1695
+ skidding = skidding || 0;
1696
+ distance = (distance || 0) * invertDistance;
1697
+ return [left, right].indexOf(basePlacement) >= 0 ? {
1698
+ x: distance,
1699
+ y: skidding
1700
+ } : {
1701
+ x: skidding,
1702
+ y: distance
1703
+ };
1704
+ }
1705
+
1706
+ function offset(_ref2) {
1707
+ var state = _ref2.state,
1708
+ options = _ref2.options,
1709
+ name = _ref2.name;
1710
+ var _options$offset = options.offset,
1711
+ offset = _options$offset === void 0 ? [0, 0] : _options$offset;
1712
+ var data = placements.reduce(function (acc, placement) {
1713
+ acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
1714
+ return acc;
1715
+ }, {});
1716
+ var _data$state$placement = data[state.placement],
1717
+ x = _data$state$placement.x,
1718
+ y = _data$state$placement.y;
1719
+
1720
+ if (state.modifiersData.popperOffsets != null) {
1721
+ state.modifiersData.popperOffsets.x += x;
1722
+ state.modifiersData.popperOffsets.y += y;
1723
+ }
1724
+
1725
+ state.modifiersData[name] = data;
1726
+ } // eslint-disable-next-line import/no-unused-modules
1727
+
1728
+
1729
+ const offset$1 = {
1730
+ name: 'offset',
1731
+ enabled: true,
1732
+ phase: 'main',
1733
+ requires: ['popperOffsets'],
1734
+ fn: offset
1735
+ };
1736
+
1737
+ function popperOffsets(_ref) {
1738
+ var state = _ref.state,
1739
+ name = _ref.name;
1740
+ // Offsets are the actual position the popper needs to have to be
1741
+ // properly positioned near its reference element
1742
+ // This is the most basic placement, and will be adjusted by
1743
+ // the modifiers in the next step
1744
+ state.modifiersData[name] = computeOffsets({
1745
+ reference: state.rects.reference,
1746
+ element: state.rects.popper,
1747
+ strategy: 'absolute',
1748
+ placement: state.placement
1749
+ });
1750
+ } // eslint-disable-next-line import/no-unused-modules
1751
+
1752
+
1753
+ const popperOffsets$1 = {
1754
+ name: 'popperOffsets',
1755
+ enabled: true,
1756
+ phase: 'read',
1757
+ fn: popperOffsets,
1758
+ data: {}
1759
+ };
1760
+
1761
+ function getAltAxis(axis) {
1762
+ return axis === 'x' ? 'y' : 'x';
1763
+ }
1764
+
1765
+ function preventOverflow(_ref) {
1766
+ var state = _ref.state,
1767
+ options = _ref.options,
1768
+ name = _ref.name;
1769
+ var _options$mainAxis = options.mainAxis,
1770
+ checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
1771
+ _options$altAxis = options.altAxis,
1772
+ checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
1773
+ boundary = options.boundary,
1774
+ rootBoundary = options.rootBoundary,
1775
+ altBoundary = options.altBoundary,
1776
+ padding = options.padding,
1777
+ _options$tether = options.tether,
1778
+ tether = _options$tether === void 0 ? true : _options$tether,
1779
+ _options$tetherOffset = options.tetherOffset,
1780
+ tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
1781
+ var overflow = detectOverflow(state, {
1782
+ boundary: boundary,
1783
+ rootBoundary: rootBoundary,
1784
+ padding: padding,
1785
+ altBoundary: altBoundary
1786
+ });
1787
+ var basePlacement = getBasePlacement(state.placement);
1788
+ var variation = getVariation(state.placement);
1789
+ var isBasePlacement = !variation;
1790
+ var mainAxis = getMainAxisFromPlacement(basePlacement);
1791
+ var altAxis = getAltAxis(mainAxis);
1792
+ var popperOffsets = state.modifiersData.popperOffsets;
1793
+ var referenceRect = state.rects.reference;
1794
+ var popperRect = state.rects.popper;
1795
+ var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
1796
+ placement: state.placement
1797
+ })) : tetherOffset;
1798
+ var data = {
1799
+ x: 0,
1800
+ y: 0
1801
+ };
1802
+
1803
+ if (!popperOffsets) {
1804
+ return;
1805
+ }
1806
+
1807
+ if (checkMainAxis || checkAltAxis) {
1808
+ var mainSide = mainAxis === 'y' ? top : left;
1809
+ var altSide = mainAxis === 'y' ? bottom : right;
1810
+ var len = mainAxis === 'y' ? 'height' : 'width';
1811
+ var offset = popperOffsets[mainAxis];
1812
+ var min$1 = popperOffsets[mainAxis] + overflow[mainSide];
1813
+ var max$1 = popperOffsets[mainAxis] - overflow[altSide];
1814
+ var additive = tether ? -popperRect[len] / 2 : 0;
1815
+ var minLen = variation === start ? referenceRect[len] : popperRect[len];
1816
+ var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
1817
+ // outside the reference bounds
1818
+
1819
+ var arrowElement = state.elements.arrow;
1820
+ var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
1821
+ width: 0,
1822
+ height: 0
1823
+ };
1824
+ var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();
1825
+ var arrowPaddingMin = arrowPaddingObject[mainSide];
1826
+ var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want
1827
+ // to include its full size in the calculation. If the reference is small
1828
+ // and near the edge of a boundary, the popper can overflow even if the
1829
+ // reference is not overflowing as well (e.g. virtual elements with no
1830
+ // width or height)
1831
+
1832
+ var arrowLen = within(0, referenceRect[len], arrowRect[len]);
1833
+ var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - tetherOffsetValue : minLen - arrowLen - arrowPaddingMin - tetherOffsetValue;
1834
+ var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + tetherOffsetValue : maxLen + arrowLen + arrowPaddingMax + tetherOffsetValue;
1835
+ var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
1836
+ var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
1837
+ var offsetModifierValue = state.modifiersData.offset ? state.modifiersData.offset[state.placement][mainAxis] : 0;
1838
+ var tetherMin = popperOffsets[mainAxis] + minOffset - offsetModifierValue - clientOffset;
1839
+ var tetherMax = popperOffsets[mainAxis] + maxOffset - offsetModifierValue;
1840
+
1841
+ if (checkMainAxis) {
1842
+ var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
1843
+ popperOffsets[mainAxis] = preventedOffset;
1844
+ data[mainAxis] = preventedOffset - offset;
1845
+ }
1846
+
1847
+ if (checkAltAxis) {
1848
+ var _mainSide = mainAxis === 'x' ? top : left;
1849
+
1850
+ var _altSide = mainAxis === 'x' ? bottom : right;
1851
+
1852
+ var _offset = popperOffsets[altAxis];
1853
+
1854
+ var _min = _offset + overflow[_mainSide];
1855
+
1856
+ var _max = _offset - overflow[_altSide];
1857
+
1858
+ var _preventedOffset = within(tether ? min(_min, tetherMin) : _min, _offset, tether ? max(_max, tetherMax) : _max);
1859
+
1860
+ popperOffsets[altAxis] = _preventedOffset;
1861
+ data[altAxis] = _preventedOffset - _offset;
1862
+ }
1863
+ }
1864
+
1865
+ state.modifiersData[name] = data;
1866
+ } // eslint-disable-next-line import/no-unused-modules
1867
+
1868
+
1869
+ const preventOverflow$1 = {
1870
+ name: 'preventOverflow',
1871
+ enabled: true,
1872
+ phase: 'main',
1873
+ fn: preventOverflow,
1874
+ requiresIfExists: ['offset']
1875
+ };
1876
+
1877
+ function getHTMLElementScroll(element) {
1878
+ return {
1879
+ scrollLeft: element.scrollLeft,
1880
+ scrollTop: element.scrollTop
1881
+ };
1882
+ }
1883
+
1884
+ function getNodeScroll(node) {
1885
+ if (node === getWindow(node) || !isHTMLElement(node)) {
1886
+ return getWindowScroll(node);
1887
+ } else {
1888
+ return getHTMLElementScroll(node);
1889
+ }
1890
+ }
1891
+
1892
+ function isElementScaled(element) {
1893
+ var rect = element.getBoundingClientRect();
1894
+ var scaleX = rect.width / element.offsetWidth || 1;
1895
+ var scaleY = rect.height / element.offsetHeight || 1;
1896
+ return scaleX !== 1 || scaleY !== 1;
1897
+ } // Returns the composite rect of an element relative to its offsetParent.
1898
+ // Composite means it takes into account transforms as well as layout.
1899
+
1900
+
1901
+ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
1902
+ if (isFixed === void 0) {
1903
+ isFixed = false;
1904
+ }
1905
+
1906
+ var isOffsetParentAnElement = isHTMLElement(offsetParent);
1907
+ var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
1908
+ var documentElement = getDocumentElement(offsetParent);
1909
+ var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
1910
+ var scroll = {
1911
+ scrollLeft: 0,
1912
+ scrollTop: 0
1913
+ };
1914
+ var offsets = {
1915
+ x: 0,
1916
+ y: 0
1917
+ };
1918
+
1919
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1920
+ if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
1921
+ isScrollParent(documentElement)) {
1922
+ scroll = getNodeScroll(offsetParent);
1923
+ }
1924
+
1925
+ if (isHTMLElement(offsetParent)) {
1926
+ offsets = getBoundingClientRect(offsetParent, true);
1927
+ offsets.x += offsetParent.clientLeft;
1928
+ offsets.y += offsetParent.clientTop;
1929
+ } else if (documentElement) {
1930
+ offsets.x = getWindowScrollBarX(documentElement);
1931
+ }
1932
+ }
1933
+
1934
+ return {
1935
+ x: rect.left + scroll.scrollLeft - offsets.x,
1936
+ y: rect.top + scroll.scrollTop - offsets.y,
1937
+ width: rect.width,
1938
+ height: rect.height
1939
+ };
1940
+ }
1941
+
1942
+ function order(modifiers) {
1943
+ var map = new Map();
1944
+ var visited = new Set();
1945
+ var result = [];
1946
+ modifiers.forEach(function (modifier) {
1947
+ map.set(modifier.name, modifier);
1948
+ }); // On visiting object, check for its dependencies and visit them recursively
1949
+
1950
+ function sort(modifier) {
1951
+ visited.add(modifier.name);
1952
+ var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
1953
+ requires.forEach(function (dep) {
1954
+ if (!visited.has(dep)) {
1955
+ var depModifier = map.get(dep);
1956
+
1957
+ if (depModifier) {
1958
+ sort(depModifier);
1959
+ }
1960
+ }
1961
+ });
1962
+ result.push(modifier);
1963
+ }
1964
+
1965
+ modifiers.forEach(function (modifier) {
1966
+ if (!visited.has(modifier.name)) {
1967
+ // check for visited object
1968
+ sort(modifier);
1969
+ }
1970
+ });
1971
+ return result;
1972
+ }
1973
+
1974
+ function orderModifiers(modifiers) {
1975
+ // order based on dependencies
1976
+ var orderedModifiers = order(modifiers); // order based on phase
1977
+
1978
+ return modifierPhases.reduce(function (acc, phase) {
1979
+ return acc.concat(orderedModifiers.filter(function (modifier) {
1980
+ return modifier.phase === phase;
1981
+ }));
1982
+ }, []);
1983
+ }
1984
+
1985
+ function debounce(fn) {
1986
+ var pending;
1987
+ return function () {
1988
+ if (!pending) {
1989
+ pending = new Promise(function (resolve) {
1990
+ Promise.resolve().then(function () {
1991
+ pending = undefined;
1992
+ resolve(fn());
1993
+ });
1994
+ });
1995
+ }
1996
+
1997
+ return pending;
1998
+ };
1999
+ }
2000
+
2001
+ function mergeByName(modifiers) {
2002
+ var merged = modifiers.reduce(function (merged, current) {
2003
+ var existing = merged[current.name];
2004
+ merged[current.name] = existing ? Object.assign({}, existing, current, {
2005
+ options: Object.assign({}, existing.options, current.options),
2006
+ data: Object.assign({}, existing.data, current.data)
2007
+ }) : current;
2008
+ return merged;
2009
+ }, {}); // IE11 does not support Object.values
2010
+
2011
+ return Object.keys(merged).map(function (key) {
2012
+ return merged[key];
2013
+ });
2014
+ }
2015
+
2016
+ var DEFAULT_OPTIONS = {
2017
+ placement: 'bottom',
2018
+ modifiers: [],
2019
+ strategy: 'absolute'
2020
+ };
2021
+
2022
+ function areValidElements() {
2023
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2024
+ args[_key] = arguments[_key];
2025
+ }
2026
+
2027
+ return !args.some(function (element) {
2028
+ return !(element && typeof element.getBoundingClientRect === 'function');
2029
+ });
2030
+ }
2031
+
2032
+ function popperGenerator(generatorOptions) {
2033
+ if (generatorOptions === void 0) {
2034
+ generatorOptions = {};
2035
+ }
2036
+
2037
+ var _generatorOptions = generatorOptions,
2038
+ _generatorOptions$def = _generatorOptions.defaultModifiers,
2039
+ defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
2040
+ _generatorOptions$def2 = _generatorOptions.defaultOptions,
2041
+ defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
2042
+ return function createPopper(reference, popper, options) {
2043
+ if (options === void 0) {
2044
+ options = defaultOptions;
2045
+ }
2046
+
2047
+ var state = {
2048
+ placement: 'bottom',
2049
+ orderedModifiers: [],
2050
+ options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
2051
+ modifiersData: {},
2052
+ elements: {
2053
+ reference: reference,
2054
+ popper: popper
2055
+ },
2056
+ attributes: {},
2057
+ styles: {}
2058
+ };
2059
+ var effectCleanupFns = [];
2060
+ var isDestroyed = false;
2061
+ var instance = {
2062
+ state: state,
2063
+ setOptions: function setOptions(options) {
2064
+ cleanupModifierEffects();
2065
+ state.options = Object.assign({}, defaultOptions, state.options, options);
2066
+ state.scrollParents = {
2067
+ reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
2068
+ popper: listScrollParents(popper)
2069
+ }; // Orders the modifiers based on their dependencies and `phase`
2070
+ // properties
2071
+
2072
+ var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
2073
+
2074
+ state.orderedModifiers = orderedModifiers.filter(function (m) {
2075
+ return m.enabled;
2076
+ }); // Validate the provided modifiers so that the consumer will get warned
2077
+
2078
+ runModifierEffects();
2079
+ return instance.update();
2080
+ },
2081
+ // Sync update – it will always be executed, even if not necessary. This
2082
+ // is useful for low frequency updates where sync behavior simplifies the
2083
+ // logic.
2084
+ // For high frequency updates (e.g. `resize` and `scroll` events), always
2085
+ // prefer the async Popper#update method
2086
+ forceUpdate: function forceUpdate() {
2087
+ if (isDestroyed) {
2088
+ return;
2089
+ }
2090
+
2091
+ var _state$elements = state.elements,
2092
+ reference = _state$elements.reference,
2093
+ popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
2094
+ // anymore
2095
+
2096
+ if (!areValidElements(reference, popper)) {
2097
+
2098
+ return;
2099
+ } // Store the reference and popper rects to be read by modifiers
2100
+
2101
+
2102
+ state.rects = {
2103
+ reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
2104
+ popper: getLayoutRect(popper)
2105
+ }; // Modifiers have the ability to reset the current update cycle. The
2106
+ // most common use case for this is the `flip` modifier changing the
2107
+ // placement, which then needs to re-run all the modifiers, because the
2108
+ // logic was previously ran for the previous placement and is therefore
2109
+ // stale/incorrect
2110
+
2111
+ state.reset = false;
2112
+ state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
2113
+ // is filled with the initial data specified by the modifier. This means
2114
+ // it doesn't persist and is fresh on each update.
2115
+ // To ensure persistent data, use `${name}#persistent`
2116
+
2117
+ state.orderedModifiers.forEach(function (modifier) {
2118
+ return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
2119
+ });
2120
+
2121
+ for (var index = 0; index < state.orderedModifiers.length; index++) {
2122
+
2123
+ if (state.reset === true) {
2124
+ state.reset = false;
2125
+ index = -1;
2126
+ continue;
2127
+ }
2128
+
2129
+ var _state$orderedModifie = state.orderedModifiers[index],
2130
+ fn = _state$orderedModifie.fn,
2131
+ _state$orderedModifie2 = _state$orderedModifie.options,
2132
+ _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
2133
+ name = _state$orderedModifie.name;
2134
+
2135
+ if (typeof fn === 'function') {
2136
+ state = fn({
2137
+ state: state,
2138
+ options: _options,
2139
+ name: name,
2140
+ instance: instance
2141
+ }) || state;
2142
+ }
2143
+ }
2144
+ },
2145
+ // Async and optimistically optimized update – it will not be executed if
2146
+ // not necessary (debounced to run at most once-per-tick)
2147
+ update: debounce(function () {
2148
+ return new Promise(function (resolve) {
2149
+ instance.forceUpdate();
2150
+ resolve(state);
2151
+ });
2152
+ }),
2153
+ destroy: function destroy() {
2154
+ cleanupModifierEffects();
2155
+ isDestroyed = true;
2156
+ }
2157
+ };
2158
+
2159
+ if (!areValidElements(reference, popper)) {
2160
+
2161
+ return instance;
2162
+ }
2163
+
2164
+ instance.setOptions(options).then(function (state) {
2165
+ if (!isDestroyed && options.onFirstUpdate) {
2166
+ options.onFirstUpdate(state);
2167
+ }
2168
+ }); // Modifiers have the ability to execute arbitrary code before the first
2169
+ // update cycle runs. They will be executed in the same order as the update
2170
+ // cycle. This is useful when a modifier adds some persistent data that
2171
+ // other modifiers need to use, but the modifier is run after the dependent
2172
+ // one.
2173
+
2174
+ function runModifierEffects() {
2175
+ state.orderedModifiers.forEach(function (_ref3) {
2176
+ var name = _ref3.name,
2177
+ _ref3$options = _ref3.options,
2178
+ options = _ref3$options === void 0 ? {} : _ref3$options,
2179
+ effect = _ref3.effect;
2180
+
2181
+ if (typeof effect === 'function') {
2182
+ var cleanupFn = effect({
2183
+ state: state,
2184
+ name: name,
2185
+ instance: instance,
2186
+ options: options
2187
+ });
2188
+
2189
+ var noopFn = function noopFn() {};
2190
+
2191
+ effectCleanupFns.push(cleanupFn || noopFn);
2192
+ }
2193
+ });
2194
+ }
2195
+
2196
+ function cleanupModifierEffects() {
2197
+ effectCleanupFns.forEach(function (fn) {
2198
+ return fn();
2199
+ });
2200
+ effectCleanupFns = [];
2201
+ }
2202
+
2203
+ return instance;
2204
+ };
2205
+ }
2206
+
2207
+ var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
2208
+ var createPopper = /*#__PURE__*/popperGenerator({
2209
+ defaultModifiers: defaultModifiers
2210
+ }); // eslint-disable-next-line import/no-unused-modules
2211
+
2212
+ const portalCss = ":host(limel-portal){display:block;position:absolute;top:0;bottom:0;width:100%;pointer-events:none}:host([hidden]){display:none}";
2213
+
2214
+ let Portal = class {
2215
+ constructor(hostRef) {
2216
+ index.registerInstance(this, hostRef);
2217
+ /**
2218
+ * Decides which direction the portal content should open.
2219
+ */
2220
+ this.openDirection = 'right';
2221
+ /**
2222
+ * Position of the content.
2223
+ */
2224
+ this.position = 'absolute';
2225
+ /**
2226
+ * Dynamic styling that can be applied to the container holding the content.
2227
+ */
2228
+ this.containerStyle = {};
2229
+ /**
2230
+ * Parent element to move the content to.
2231
+ */
2232
+ this.parent = document.body;
2233
+ /**
2234
+ * Used to make a dropdown have the same width as the trigger, for example
2235
+ * in `limel-picker`.
2236
+ */
2237
+ this.inheritParentWidth = false;
2238
+ /**
2239
+ * True if the content within the portal should be visible.
2240
+ *
2241
+ * If the content is from within a dialog for instance, this can be set to
2242
+ * true from false when the dialog opens to position the content properly.
2243
+ */
2244
+ this.visible = false;
2245
+ this.loaded = false;
2246
+ this.parents = new WeakMap();
2247
+ }
2248
+ onVisible() {
2249
+ if (!this.visible) {
2250
+ this.hideContainer();
2251
+ this.styleContainer();
2252
+ this.destroyPopper();
2253
+ return;
2254
+ }
2255
+ this.styleContainer();
2256
+ this.createPopper();
2257
+ requestAnimationFrame(() => {
2258
+ this.showContainer();
2259
+ });
2260
+ }
2261
+ disconnectedCallback() {
2262
+ this.removeContainer();
2263
+ this.destroyPopper();
2264
+ if (this.observer) {
2265
+ this.observer.unobserve(this.container);
2266
+ }
2267
+ }
2268
+ connectedCallback() {
2269
+ if (!this.loaded) {
2270
+ return;
2271
+ }
2272
+ this.createContainer();
2273
+ this.hideContainer();
2274
+ this.attachContainer();
2275
+ this.styleContainer();
2276
+ if (this.visible) {
2277
+ this.createPopper();
2278
+ this.showContainer();
2279
+ }
2280
+ if ('ResizeObserver' in window) {
2281
+ const observer = new ResizeObserver(() => {
2282
+ if (this.popperInstance) {
2283
+ this.styleContainer();
2284
+ this.popperInstance.update();
2285
+ }
2286
+ });
2287
+ observer.observe(this.container);
2288
+ }
2289
+ }
2290
+ componentDidLoad() {
2291
+ this.loaded = true;
2292
+ this.connectedCallback();
2293
+ }
2294
+ render() {
2295
+ return index.h("slot", null);
2296
+ }
2297
+ createContainer() {
2298
+ const slot = this.host.shadowRoot.querySelector('slot');
2299
+ const content = (slot.assignedElements && slot.assignedElements()) || [];
2300
+ this.container = document.createElement('div');
2301
+ this.container.setAttribute('id', this.containerId);
2302
+ this.container.setAttribute('class', 'limel-portal--container');
2303
+ Object.assign(this.container, {
2304
+ portalSource: this.host,
2305
+ });
2306
+ content.forEach((element) => {
2307
+ this.parents.set(element, element.parentElement);
2308
+ this.container.appendChild(element);
2309
+ });
2310
+ }
2311
+ attachContainer() {
2312
+ this.parent.appendChild(this.container);
2313
+ }
2314
+ removeContainer() {
2315
+ if (!this.container) {
2316
+ return;
2317
+ }
2318
+ Array.from(this.container.children).forEach((element) => {
2319
+ const parent = this.parents.get(element);
2320
+ if (!parent) {
2321
+ return;
2322
+ }
2323
+ parent.appendChild(element);
2324
+ });
2325
+ this.hideContainer();
2326
+ this.container.parentElement.removeChild(this.container);
2327
+ }
2328
+ hideContainer() {
2329
+ this.container.style.opacity = '0';
2330
+ }
2331
+ showContainer() {
2332
+ this.container.style.opacity = '1';
2333
+ }
2334
+ styleContainer() {
2335
+ const hostWidth = this.host.getBoundingClientRect().width;
2336
+ if (this.visible) {
2337
+ this.container.style.display = 'block';
2338
+ }
2339
+ else {
2340
+ this.container.style.display = 'none';
2341
+ }
2342
+ if (this.inheritParentWidth) {
2343
+ const containerWidth = this.getContentWidth(this.container);
2344
+ let width = containerWidth;
2345
+ if (hostWidth > 0) {
2346
+ width = hostWidth;
2347
+ }
2348
+ this.container.style.width = `${width}px`;
2349
+ }
2350
+ this.ensureContainerFitsInViewPort();
2351
+ Object.keys(this.containerStyle).forEach((property) => {
2352
+ this.container.style[property] = this.containerStyle[property];
2353
+ });
2354
+ }
2355
+ getContentWidth(element) {
2356
+ if (!element) {
2357
+ return null;
2358
+ }
2359
+ const width = element.getBoundingClientRect().width;
2360
+ if (width !== 0) {
2361
+ return width;
2362
+ }
2363
+ const elementContent = element.querySelector('*');
2364
+ return this.getContentWidth(elementContent);
2365
+ }
2366
+ createPopper() {
2367
+ const config = this.createPopperConfig();
2368
+ this.popperInstance = createPopper(this.host, this.container, config);
2369
+ }
2370
+ destroyPopper() {
2371
+ var _a;
2372
+ (_a = this.popperInstance) === null || _a === void 0 ? void 0 : _a.destroy();
2373
+ this.popperInstance = null;
2374
+ }
2375
+ createPopperConfig() {
2376
+ let placement = 'bottom-start';
2377
+ let flipPlacement = 'top-start';
2378
+ if (this.openDirection === 'left') {
2379
+ placement = 'bottom-end';
2380
+ flipPlacement = 'top-end';
2381
+ }
2382
+ return {
2383
+ strategy: this.position,
2384
+ placement: placement,
2385
+ modifiers: [
2386
+ {
2387
+ name: 'flip',
2388
+ options: {
2389
+ fallbackPlacements: [flipPlacement],
2390
+ },
2391
+ },
2392
+ ],
2393
+ };
2394
+ }
2395
+ ensureContainerFitsInViewPort() {
2396
+ const viewHeight = Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0);
2397
+ const { top, bottom } = this.host.getBoundingClientRect();
2398
+ const spaceAboveTopOfSurface = Math.max(top, 0);
2399
+ const spaceBelowTopOfSurface = Math.max(viewHeight - bottom, 0);
2400
+ const extraCosmeticSpace = 16;
2401
+ const maxHeight = Math.max(spaceAboveTopOfSurface, spaceBelowTopOfSurface) -
2402
+ extraCosmeticSpace;
2403
+ this.container.style.maxHeight = `${maxHeight}px`;
2404
+ }
2405
+ get host() { return index.getElement(this); }
2406
+ static get watchers() { return {
2407
+ "visible": ["onVisible"]
2408
+ }; }
2409
+ };
2410
+ Portal.style = portalCss;
2411
+
484
2412
  exports.limel_list = List;
485
2413
  exports.limel_menu_surface = MenuSurface;
2414
+ exports.limel_portal = Portal;