@mgdis/mg-components 3.1.0 → 3.2.0

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 (225) hide show
  1. package/dist/cjs/css-shim-629916b0.js +6 -0
  2. package/dist/cjs/index-369388eb.js +146 -0
  3. package/dist/cjs/{index-85a4a0b6.js → index-bead7dbd.js} +78 -2
  4. package/dist/cjs/loader.cjs.js +4 -4
  5. package/dist/cjs/mg-badge_21.cjs.entry.js +3313 -0
  6. package/dist/cjs/mg-components.cjs.js +3 -3
  7. package/dist/cjs/mg-modal.cjs.entry.js +111 -0
  8. package/dist/cjs/mg-popover.cjs.entry.js +165 -0
  9. package/dist/cjs/popper-0c3964e7.js +1786 -0
  10. package/dist/cjs/{shadow-css-8940f82d.js → shadow-css-546083ef.js} +1 -1
  11. package/dist/collection/collection-manifest.json +4 -1
  12. package/dist/collection/components/atoms/mg-badge/mg-badge.conf.js +1 -1
  13. package/dist/collection/components/atoms/mg-badge/mg-badge.js +11 -7
  14. package/dist/collection/components/atoms/mg-badge/mg-badge.stories.js +3 -0
  15. package/dist/collection/components/atoms/mg-button/mg-button.css +26 -17
  16. package/dist/collection/components/atoms/mg-button/mg-button.js +71 -2
  17. package/dist/collection/components/atoms/mg-button/mg-button.stories.js +5 -0
  18. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +12 -1
  19. package/dist/collection/components/atoms/mg-character-left/mg-character-left.stories.js +8 -0
  20. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +8 -0
  21. package/dist/collection/components/atoms/mg-icon/mg-icon.css +5 -7
  22. package/dist/collection/components/atoms/mg-icon/mg-icon.js +11 -1
  23. package/dist/collection/components/atoms/mg-input-title/mg-input-title.css +4 -4
  24. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +14 -3
  25. package/dist/collection/components/atoms/mg-tag/mg-tag.js +10 -3
  26. package/dist/collection/components/atoms/mg-tag/mg-tag.stories.js +3 -0
  27. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +9 -0
  28. package/dist/collection/components/molecules/inputs/MgInput.js +20 -14
  29. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +9 -1
  30. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +103 -40
  31. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.stories.js +6 -1
  32. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +27 -0
  33. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +125 -56
  34. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.stories.js +6 -1
  35. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +27 -0
  36. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +144 -68
  37. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.stories.js +6 -1
  38. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +27 -0
  39. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +101 -35
  40. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.stories.js +6 -1
  41. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +9 -1
  42. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +115 -37
  43. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.stories.js +6 -1
  44. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +28 -1
  45. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +132 -51
  46. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.stories.js +14 -1
  47. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +27 -0
  48. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +155 -53
  49. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.stories.js +7 -2
  50. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +27 -0
  51. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +108 -42
  52. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.stories.js +7 -2
  53. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +4 -1
  54. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +60 -31
  55. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.stories.js +6 -1
  56. package/dist/collection/components/molecules/mg-form/mg-form.css +15 -0
  57. package/dist/collection/components/molecules/mg-form/mg-form.js +269 -0
  58. package/dist/collection/components/molecules/mg-form/mg-form.stories.js +58 -0
  59. package/dist/collection/components/molecules/mg-message/mg-message.css +1 -1
  60. package/dist/collection/components/molecules/mg-message/mg-message.js +11 -4
  61. package/dist/collection/components/molecules/mg-message/mg-message.stories.js +5 -1
  62. package/dist/collection/components/molecules/mg-modal/mg-modal.css +54 -0
  63. package/dist/collection/components/molecules/mg-modal/mg-modal.js +233 -0
  64. package/dist/collection/components/molecules/mg-modal/mg-modal.stories.js +51 -0
  65. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +32 -12
  66. package/dist/collection/components/molecules/mg-pagination/mg-pagination.stories.js +1 -0
  67. package/dist/collection/components/molecules/mg-panel/mg-panel.css +42 -0
  68. package/dist/collection/components/molecules/mg-panel/mg-panel.js +255 -0
  69. package/dist/collection/components/molecules/mg-panel/mg-panel.stories.js +31 -0
  70. package/dist/collection/components/molecules/mg-popover/mg-popover.css +2 -2
  71. package/dist/collection/components/molecules/mg-popover/mg-popover.js +19 -4
  72. package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js +4 -1
  73. package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +14 -3
  74. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +68 -20
  75. package/dist/collection/components/molecules/mg-tabs/mg-tabs.stories.js +10 -1
  76. package/dist/collection/stories/messages.stories.js +1 -1
  77. package/dist/collection/utils/components.utils.js +16 -9
  78. package/dist/collection/utils/locale.utils.js +6 -3
  79. package/dist/collection/utils/test.utils.js +27 -15
  80. package/dist/collection/variables.css +30 -1
  81. package/dist/collection/variables.scss +30 -1
  82. package/dist/components/MgInput.js +20 -14
  83. package/dist/components/components.utils.js +16 -9
  84. package/dist/components/index.d.ts +1 -1
  85. package/dist/components/index2.js +22 -12
  86. package/dist/components/locale.utils.js +6 -3
  87. package/dist/components/mg-badge2.js +9 -5
  88. package/dist/components/mg-button2.js +21 -2
  89. package/dist/components/mg-character-left2.js +12 -1
  90. package/dist/components/mg-form.d.ts +11 -0
  91. package/dist/components/mg-form.js +146 -0
  92. package/dist/components/mg-icon2.js +20 -2
  93. package/dist/components/mg-input-checkbox.js +65 -36
  94. package/dist/components/mg-input-date.js +87 -52
  95. package/dist/components/mg-input-numeric.js +105 -63
  96. package/dist/components/mg-input-password.js +60 -29
  97. package/dist/components/mg-input-radio.js +74 -34
  98. package/dist/components/mg-input-select2.js +89 -46
  99. package/dist/components/mg-input-text.js +1 -237
  100. package/dist/components/mg-input-text2.js +288 -0
  101. package/dist/components/mg-input-textarea.js +67 -36
  102. package/dist/components/mg-input-title2.js +13 -4
  103. package/dist/components/mg-input-toggle.js +30 -22
  104. package/dist/components/mg-message.js +10 -3
  105. package/dist/components/mg-modal.d.ts +11 -0
  106. package/dist/components/mg-modal.js +147 -0
  107. package/dist/components/mg-pagination.js +31 -11
  108. package/dist/components/mg-panel.d.ts +11 -0
  109. package/dist/components/mg-panel.js +210 -0
  110. package/dist/components/mg-popover.js +20 -5
  111. package/dist/components/mg-tabs.js +43 -11
  112. package/dist/components/mg-tag.js +8 -1
  113. package/dist/components/mg-tooltip2.js +9 -0
  114. package/dist/esm/css-shim-0993aa3b.js +4 -0
  115. package/dist/esm/{index-e3e84606.js → index-9e877561.js} +78 -2
  116. package/dist/esm/index-c346f52d.js +139 -0
  117. package/dist/esm/loader.js +4 -4
  118. package/dist/esm/mg-badge_21.entry.js +3289 -0
  119. package/dist/esm/mg-components.js +3 -3
  120. package/dist/esm/mg-modal.entry.js +107 -0
  121. package/dist/esm/mg-popover.entry.js +161 -0
  122. package/dist/esm/polyfills/css-shim.js +1 -1
  123. package/dist/esm/popper-8874fd6c.js +1784 -0
  124. package/dist/esm/{shadow-css-5d2d01ce.js → shadow-css-dfa0587f.js} +1 -1
  125. package/dist/esm-es5/css-shim-0993aa3b.js +1 -0
  126. package/dist/esm-es5/index-9e877561.js +1 -0
  127. package/dist/esm-es5/index-c346f52d.js +1 -0
  128. package/dist/esm-es5/loader.js +1 -1
  129. package/dist/esm-es5/mg-badge_21.entry.js +2 -0
  130. package/dist/esm-es5/mg-components.js +1 -1
  131. package/dist/esm-es5/mg-modal.entry.js +1 -0
  132. package/dist/esm-es5/mg-popover.entry.js +1 -0
  133. package/dist/esm-es5/popper-8874fd6c.js +1 -0
  134. package/dist/esm-es5/{shadow-css-5d2d01ce.js → shadow-css-dfa0587f.js} +0 -0
  135. package/dist/mg-components/mg-components.css +1 -1
  136. package/dist/mg-components/mg-components.esm.js +1 -1
  137. package/dist/mg-components/mg-components.js +2 -2
  138. package/dist/mg-components/p-3633e9e1.system.entry.js +2 -0
  139. package/dist/mg-components/p-3c14153d.js +1 -0
  140. package/dist/mg-components/p-55a22b35.system.js +1 -0
  141. package/dist/mg-components/{p-f6455ab3.js → p-5e796581.js} +0 -0
  142. package/dist/mg-components/p-656b5efb.system.js +1 -0
  143. package/dist/mg-components/p-68d6f104.js +1 -0
  144. package/dist/mg-components/{p-366a224e.js → p-6d49ed95.js} +1 -1
  145. package/dist/mg-components/p-70177194.entry.js +1 -0
  146. package/dist/mg-components/{p-71d57b8b.system.js → p-8b2d8a2a.system.js} +0 -0
  147. package/dist/mg-components/p-8cb61c3f.system.js +1 -0
  148. package/dist/mg-components/p-ace173b1.js +1 -0
  149. package/dist/mg-components/p-c46fbd54.entry.js +1 -0
  150. package/dist/mg-components/p-c90cc4bf.system.js +1 -0
  151. package/dist/mg-components/p-cd2a4acc.system.entry.js +1 -0
  152. package/dist/mg-components/p-de1164fa.system.entry.js +1 -0
  153. package/dist/mg-components/p-dfe25da3.entry.js +1 -0
  154. package/dist/mg-components/p-e4a502b5.system.js +1 -0
  155. package/dist/mg-components/variables.css +30 -1
  156. package/dist/mg-components/variables.scss +30 -1
  157. package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +8 -4
  158. package/dist/types/components/atoms/mg-badge/mg-badge.stories.d.ts +5 -0
  159. package/dist/types/components/atoms/mg-button/mg-button.d.ts +22 -2
  160. package/dist/types/components/atoms/mg-button/mg-button.stories.d.ts +5 -0
  161. package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +13 -2
  162. package/dist/types/components/atoms/mg-character-left/mg-character-left.stories.d.ts +9 -0
  163. package/dist/types/components/atoms/mg-icon/mg-icon.conf.d.ts +1 -1
  164. package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +11 -1
  165. package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +11 -1
  166. package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +10 -3
  167. package/dist/types/components/atoms/mg-tag/mg-tag.stories.d.ts +5 -0
  168. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +11 -2
  169. package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +8 -0
  170. package/dist/types/components/molecules/inputs/MgInput.d.ts +5 -4
  171. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +31 -11
  172. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.stories.d.ts +5 -0
  173. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +39 -14
  174. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.stories.d.ts +5 -0
  175. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +53 -14
  176. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.stories.d.ts +5 -0
  177. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +28 -9
  178. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.stories.d.ts +5 -0
  179. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.conf.d.ts +1 -1
  180. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +37 -8
  181. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.stories.d.ts +5 -0
  182. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.conf.d.ts +1 -1
  183. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +30 -7
  184. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.stories.d.ts +14 -0
  185. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +46 -10
  186. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.stories.d.ts +5 -0
  187. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +30 -10
  188. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.stories.d.ts +5 -0
  189. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.conf.d.ts +1 -1
  190. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +27 -12
  191. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.stories.d.ts +5 -0
  192. package/dist/types/components/molecules/mg-form/mg-form.d.ts +82 -0
  193. package/dist/types/components/molecules/mg-form/mg-form.stories.d.ts +11 -0
  194. package/dist/types/components/molecules/mg-message/mg-message.d.ts +11 -4
  195. package/dist/types/components/molecules/mg-message/mg-message.stories.d.ts +10 -0
  196. package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +83 -0
  197. package/dist/types/components/molecules/mg-modal/mg-modal.stories.d.ts +13 -0
  198. package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +23 -7
  199. package/dist/types/components/molecules/mg-pagination/mg-pagination.stories.d.ts +5 -0
  200. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +110 -0
  201. package/dist/types/components/molecules/mg-panel/mg-panel.stories.d.ts +6 -0
  202. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +18 -3
  203. package/dist/types/components/molecules/mg-tabs/mg-tabs.conf.d.ts +5 -0
  204. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +21 -6
  205. package/dist/types/components/molecules/mg-tabs/mg-tabs.stories.d.ts +8 -0
  206. package/dist/types/components.d.ts +365 -78
  207. package/dist/types/locales/index.d.ts +15 -8
  208. package/dist/types/utils/components.utils.d.ts +16 -9
  209. package/dist/types/utils/locale.utils.d.ts +6 -3
  210. package/dist/types/utils/test.utils.d.ts +13 -1
  211. package/package.json +13 -9
  212. package/readme.md +3 -0
  213. package/dist/cjs/css-shim-a22512c4.js +0 -6
  214. package/dist/cjs/mg-badge_20.cjs.entry.js +0 -4661
  215. package/dist/esm/css-shim-7c240feb.js +0 -4
  216. package/dist/esm/mg-badge_20.entry.js +0 -4638
  217. package/dist/esm-es5/css-shim-7c240feb.js +0 -1
  218. package/dist/esm-es5/index-e3e84606.js +0 -1
  219. package/dist/esm-es5/mg-badge_20.entry.js +0 -2
  220. package/dist/mg-components/p-1cd24462.system.js +0 -1
  221. package/dist/mg-components/p-2e2f6b27.system.entry.js +0 -2
  222. package/dist/mg-components/p-422c429b.system.js +0 -1
  223. package/dist/mg-components/p-62fa3797.js +0 -1
  224. package/dist/mg-components/p-9a215712.system.js +0 -1
  225. package/dist/mg-components/p-cbf0464b.entry.js +0 -1
@@ -0,0 +1,1784 @@
1
+ var top = 'top';
2
+ var bottom = 'bottom';
3
+ var right = 'right';
4
+ var left = 'left';
5
+ var auto = 'auto';
6
+ var basePlacements = [top, bottom, right, left];
7
+ var start = 'start';
8
+ var end = 'end';
9
+ var clippingParents = 'clippingParents';
10
+ var viewport = 'viewport';
11
+ var popper = 'popper';
12
+ var reference = 'reference';
13
+ var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
14
+ return acc.concat([placement + "-" + start, placement + "-" + end]);
15
+ }, []);
16
+ var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
17
+ return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
18
+ }, []); // modifiers that need to read the DOM
19
+
20
+ var beforeRead = 'beforeRead';
21
+ var read = 'read';
22
+ var afterRead = 'afterRead'; // pure-logic modifiers
23
+
24
+ var beforeMain = 'beforeMain';
25
+ var main = 'main';
26
+ var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
27
+
28
+ var beforeWrite = 'beforeWrite';
29
+ var write = 'write';
30
+ var afterWrite = 'afterWrite';
31
+ var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
32
+
33
+ function getNodeName(element) {
34
+ return element ? (element.nodeName || '').toLowerCase() : null;
35
+ }
36
+
37
+ function getWindow(node) {
38
+ if (node == null) {
39
+ return window;
40
+ }
41
+
42
+ if (node.toString() !== '[object Window]') {
43
+ var ownerDocument = node.ownerDocument;
44
+ return ownerDocument ? ownerDocument.defaultView || window : window;
45
+ }
46
+
47
+ return node;
48
+ }
49
+
50
+ function isElement(node) {
51
+ var OwnElement = getWindow(node).Element;
52
+ return node instanceof OwnElement || node instanceof Element;
53
+ }
54
+
55
+ function isHTMLElement(node) {
56
+ var OwnElement = getWindow(node).HTMLElement;
57
+ return node instanceof OwnElement || node instanceof HTMLElement;
58
+ }
59
+
60
+ function isShadowRoot(node) {
61
+ // IE 11 has no ShadowRoot
62
+ if (typeof ShadowRoot === 'undefined') {
63
+ return false;
64
+ }
65
+
66
+ var OwnElement = getWindow(node).ShadowRoot;
67
+ return node instanceof OwnElement || node instanceof ShadowRoot;
68
+ }
69
+
70
+ // and applies them to the HTMLElements such as popper and arrow
71
+
72
+ function applyStyles(_ref) {
73
+ var state = _ref.state;
74
+ Object.keys(state.elements).forEach(function (name) {
75
+ var style = state.styles[name] || {};
76
+ var attributes = state.attributes[name] || {};
77
+ var element = state.elements[name]; // arrow is optional + virtual elements
78
+
79
+ if (!isHTMLElement(element) || !getNodeName(element)) {
80
+ return;
81
+ } // Flow doesn't support to extend this property, but it's the most
82
+ // effective way to apply styles to an HTMLElement
83
+ // $FlowFixMe[cannot-write]
84
+
85
+
86
+ Object.assign(element.style, style);
87
+ Object.keys(attributes).forEach(function (name) {
88
+ var value = attributes[name];
89
+
90
+ if (value === false) {
91
+ element.removeAttribute(name);
92
+ } else {
93
+ element.setAttribute(name, value === true ? '' : value);
94
+ }
95
+ });
96
+ });
97
+ }
98
+
99
+ function effect$2(_ref2) {
100
+ var state = _ref2.state;
101
+ var initialStyles = {
102
+ popper: {
103
+ position: state.options.strategy,
104
+ left: '0',
105
+ top: '0',
106
+ margin: '0'
107
+ },
108
+ arrow: {
109
+ position: 'absolute'
110
+ },
111
+ reference: {}
112
+ };
113
+ Object.assign(state.elements.popper.style, initialStyles.popper);
114
+ state.styles = initialStyles;
115
+
116
+ if (state.elements.arrow) {
117
+ Object.assign(state.elements.arrow.style, initialStyles.arrow);
118
+ }
119
+
120
+ return function () {
121
+ Object.keys(state.elements).forEach(function (name) {
122
+ var element = state.elements[name];
123
+ var attributes = state.attributes[name] || {};
124
+ var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
125
+
126
+ var style = styleProperties.reduce(function (style, property) {
127
+ style[property] = '';
128
+ return style;
129
+ }, {}); // arrow is optional + virtual elements
130
+
131
+ if (!isHTMLElement(element) || !getNodeName(element)) {
132
+ return;
133
+ }
134
+
135
+ Object.assign(element.style, style);
136
+ Object.keys(attributes).forEach(function (attribute) {
137
+ element.removeAttribute(attribute);
138
+ });
139
+ });
140
+ };
141
+ } // eslint-disable-next-line import/no-unused-modules
142
+
143
+
144
+ const applyStyles$1 = {
145
+ name: 'applyStyles',
146
+ enabled: true,
147
+ phase: 'write',
148
+ fn: applyStyles,
149
+ effect: effect$2,
150
+ requires: ['computeStyles']
151
+ };
152
+
153
+ function getBasePlacement(placement) {
154
+ return placement.split('-')[0];
155
+ }
156
+
157
+ var max = Math.max;
158
+ var min = Math.min;
159
+ var round = Math.round;
160
+
161
+ function getBoundingClientRect(element, includeScale) {
162
+ if (includeScale === void 0) {
163
+ includeScale = false;
164
+ }
165
+
166
+ var rect = element.getBoundingClientRect();
167
+ var scaleX = 1;
168
+ var scaleY = 1;
169
+
170
+ if (isHTMLElement(element) && includeScale) {
171
+ var offsetHeight = element.offsetHeight;
172
+ var offsetWidth = element.offsetWidth; // Do not attempt to divide by 0, otherwise we get `Infinity` as scale
173
+ // Fallback to 1 in case both values are `0`
174
+
175
+ if (offsetWidth > 0) {
176
+ scaleX = round(rect.width) / offsetWidth || 1;
177
+ }
178
+
179
+ if (offsetHeight > 0) {
180
+ scaleY = round(rect.height) / offsetHeight || 1;
181
+ }
182
+ }
183
+
184
+ return {
185
+ width: rect.width / scaleX,
186
+ height: rect.height / scaleY,
187
+ top: rect.top / scaleY,
188
+ right: rect.right / scaleX,
189
+ bottom: rect.bottom / scaleY,
190
+ left: rect.left / scaleX,
191
+ x: rect.left / scaleX,
192
+ y: rect.top / scaleY
193
+ };
194
+ }
195
+
196
+ // means it doesn't take into account transforms.
197
+
198
+ function getLayoutRect(element) {
199
+ var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
200
+ // Fixes https://github.com/popperjs/popper-core/issues/1223
201
+
202
+ var width = element.offsetWidth;
203
+ var height = element.offsetHeight;
204
+
205
+ if (Math.abs(clientRect.width - width) <= 1) {
206
+ width = clientRect.width;
207
+ }
208
+
209
+ if (Math.abs(clientRect.height - height) <= 1) {
210
+ height = clientRect.height;
211
+ }
212
+
213
+ return {
214
+ x: element.offsetLeft,
215
+ y: element.offsetTop,
216
+ width: width,
217
+ height: height
218
+ };
219
+ }
220
+
221
+ function contains(parent, child) {
222
+ var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
223
+
224
+ if (parent.contains(child)) {
225
+ return true;
226
+ } // then fallback to custom implementation with Shadow DOM support
227
+ else if (rootNode && isShadowRoot(rootNode)) {
228
+ var next = child;
229
+
230
+ do {
231
+ if (next && parent.isSameNode(next)) {
232
+ return true;
233
+ } // $FlowFixMe[prop-missing]: need a better way to handle this...
234
+
235
+
236
+ next = next.parentNode || next.host;
237
+ } while (next);
238
+ } // Give up, the result is false
239
+
240
+
241
+ return false;
242
+ }
243
+
244
+ function getComputedStyle(element) {
245
+ return getWindow(element).getComputedStyle(element);
246
+ }
247
+
248
+ function isTableElement(element) {
249
+ return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
250
+ }
251
+
252
+ function getDocumentElement(element) {
253
+ // $FlowFixMe[incompatible-return]: assume body is always available
254
+ return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
255
+ element.document) || window.document).documentElement;
256
+ }
257
+
258
+ function getParentNode(element) {
259
+ if (getNodeName(element) === 'html') {
260
+ return element;
261
+ }
262
+
263
+ return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
264
+ // $FlowFixMe[incompatible-return]
265
+ // $FlowFixMe[prop-missing]
266
+ element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
267
+ element.parentNode || ( // DOM Element detected
268
+ isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
269
+ // $FlowFixMe[incompatible-call]: HTMLElement is a Node
270
+ getDocumentElement(element) // fallback
271
+
272
+ );
273
+ }
274
+
275
+ function getTrueOffsetParent(element) {
276
+ if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
277
+ getComputedStyle(element).position === 'fixed') {
278
+ return null;
279
+ }
280
+
281
+ return element.offsetParent;
282
+ } // `.offsetParent` reports `null` for fixed elements, while absolute elements
283
+ // return the containing block
284
+
285
+
286
+ function getContainingBlock(element) {
287
+ var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;
288
+ var isIE = navigator.userAgent.indexOf('Trident') !== -1;
289
+
290
+ if (isIE && isHTMLElement(element)) {
291
+ // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
292
+ var elementCss = getComputedStyle(element);
293
+
294
+ if (elementCss.position === 'fixed') {
295
+ return null;
296
+ }
297
+ }
298
+
299
+ var currentNode = getParentNode(element);
300
+
301
+ while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
302
+ var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
303
+ // create a containing block.
304
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
305
+
306
+ 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') {
307
+ return currentNode;
308
+ } else {
309
+ currentNode = currentNode.parentNode;
310
+ }
311
+ }
312
+
313
+ return null;
314
+ } // Gets the closest ancestor positioned element. Handles some edge cases,
315
+ // such as table ancestors and cross browser bugs.
316
+
317
+
318
+ function getOffsetParent(element) {
319
+ var window = getWindow(element);
320
+ var offsetParent = getTrueOffsetParent(element);
321
+
322
+ while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
323
+ offsetParent = getTrueOffsetParent(offsetParent);
324
+ }
325
+
326
+ if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
327
+ return window;
328
+ }
329
+
330
+ return offsetParent || getContainingBlock(element) || window;
331
+ }
332
+
333
+ function getMainAxisFromPlacement(placement) {
334
+ return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
335
+ }
336
+
337
+ function within(min$1, value, max$1) {
338
+ return max(min$1, min(value, max$1));
339
+ }
340
+ function withinMaxClamp(min, value, max) {
341
+ var v = within(min, value, max);
342
+ return v > max ? max : v;
343
+ }
344
+
345
+ function getFreshSideObject() {
346
+ return {
347
+ top: 0,
348
+ right: 0,
349
+ bottom: 0,
350
+ left: 0
351
+ };
352
+ }
353
+
354
+ function mergePaddingObject(paddingObject) {
355
+ return Object.assign({}, getFreshSideObject(), paddingObject);
356
+ }
357
+
358
+ function expandToHashMap(value, keys) {
359
+ return keys.reduce(function (hashMap, key) {
360
+ hashMap[key] = value;
361
+ return hashMap;
362
+ }, {});
363
+ }
364
+
365
+ var toPaddingObject = function toPaddingObject(padding, state) {
366
+ padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
367
+ placement: state.placement
368
+ })) : padding;
369
+ return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
370
+ };
371
+
372
+ function arrow(_ref) {
373
+ var _state$modifiersData$;
374
+
375
+ var state = _ref.state,
376
+ name = _ref.name,
377
+ options = _ref.options;
378
+ var arrowElement = state.elements.arrow;
379
+ var popperOffsets = state.modifiersData.popperOffsets;
380
+ var basePlacement = getBasePlacement(state.placement);
381
+ var axis = getMainAxisFromPlacement(basePlacement);
382
+ var isVertical = [left, right].indexOf(basePlacement) >= 0;
383
+ var len = isVertical ? 'height' : 'width';
384
+
385
+ if (!arrowElement || !popperOffsets) {
386
+ return;
387
+ }
388
+
389
+ var paddingObject = toPaddingObject(options.padding, state);
390
+ var arrowRect = getLayoutRect(arrowElement);
391
+ var minProp = axis === 'y' ? top : left;
392
+ var maxProp = axis === 'y' ? bottom : right;
393
+ var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
394
+ var startDiff = popperOffsets[axis] - state.rects.reference[axis];
395
+ var arrowOffsetParent = getOffsetParent(arrowElement);
396
+ var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
397
+ var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is
398
+ // outside of the popper bounds
399
+
400
+ var min = paddingObject[minProp];
401
+ var max = clientSize - arrowRect[len] - paddingObject[maxProp];
402
+ var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
403
+ var offset = within(min, center, max); // Prevents breaking syntax highlighting...
404
+
405
+ var axisProp = axis;
406
+ state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
407
+ }
408
+
409
+ function effect$1(_ref2) {
410
+ var state = _ref2.state,
411
+ options = _ref2.options;
412
+ var _options$element = options.element,
413
+ arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
414
+
415
+ if (arrowElement == null) {
416
+ return;
417
+ } // CSS selector
418
+
419
+
420
+ if (typeof arrowElement === 'string') {
421
+ arrowElement = state.elements.popper.querySelector(arrowElement);
422
+
423
+ if (!arrowElement) {
424
+ return;
425
+ }
426
+ }
427
+
428
+ if (!contains(state.elements.popper, arrowElement)) {
429
+
430
+ return;
431
+ }
432
+
433
+ state.elements.arrow = arrowElement;
434
+ } // eslint-disable-next-line import/no-unused-modules
435
+
436
+
437
+ const arrow$1 = {
438
+ name: 'arrow',
439
+ enabled: true,
440
+ phase: 'main',
441
+ fn: arrow,
442
+ effect: effect$1,
443
+ requires: ['popperOffsets'],
444
+ requiresIfExists: ['preventOverflow']
445
+ };
446
+
447
+ function getVariation(placement) {
448
+ return placement.split('-')[1];
449
+ }
450
+
451
+ var unsetSides = {
452
+ top: 'auto',
453
+ right: 'auto',
454
+ bottom: 'auto',
455
+ left: 'auto'
456
+ }; // Round the offsets to the nearest suitable subpixel based on the DPR.
457
+ // Zooming can change the DPR, but it seems to report a value that will
458
+ // cleanly divide the values into the appropriate subpixels.
459
+
460
+ function roundOffsetsByDPR(_ref) {
461
+ var x = _ref.x,
462
+ y = _ref.y;
463
+ var win = window;
464
+ var dpr = win.devicePixelRatio || 1;
465
+ return {
466
+ x: round(x * dpr) / dpr || 0,
467
+ y: round(y * dpr) / dpr || 0
468
+ };
469
+ }
470
+
471
+ function mapToStyles(_ref2) {
472
+ var _Object$assign2;
473
+
474
+ var popper = _ref2.popper,
475
+ popperRect = _ref2.popperRect,
476
+ placement = _ref2.placement,
477
+ variation = _ref2.variation,
478
+ offsets = _ref2.offsets,
479
+ position = _ref2.position,
480
+ gpuAcceleration = _ref2.gpuAcceleration,
481
+ adaptive = _ref2.adaptive,
482
+ roundOffsets = _ref2.roundOffsets,
483
+ isFixed = _ref2.isFixed;
484
+ var _offsets$x = offsets.x,
485
+ x = _offsets$x === void 0 ? 0 : _offsets$x,
486
+ _offsets$y = offsets.y,
487
+ y = _offsets$y === void 0 ? 0 : _offsets$y;
488
+
489
+ var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
490
+ x: x,
491
+ y: y
492
+ }) : {
493
+ x: x,
494
+ y: y
495
+ };
496
+
497
+ x = _ref3.x;
498
+ y = _ref3.y;
499
+ var hasX = offsets.hasOwnProperty('x');
500
+ var hasY = offsets.hasOwnProperty('y');
501
+ var sideX = left;
502
+ var sideY = top;
503
+ var win = window;
504
+
505
+ if (adaptive) {
506
+ var offsetParent = getOffsetParent(popper);
507
+ var heightProp = 'clientHeight';
508
+ var widthProp = 'clientWidth';
509
+
510
+ if (offsetParent === getWindow(popper)) {
511
+ offsetParent = getDocumentElement(popper);
512
+
513
+ if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {
514
+ heightProp = 'scrollHeight';
515
+ widthProp = 'scrollWidth';
516
+ }
517
+ } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
518
+
519
+
520
+ offsetParent = offsetParent;
521
+
522
+ if (placement === top || (placement === left || placement === right) && variation === end) {
523
+ sideY = bottom;
524
+ var offsetY = isFixed && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
525
+ offsetParent[heightProp];
526
+ y -= offsetY - popperRect.height;
527
+ y *= gpuAcceleration ? 1 : -1;
528
+ }
529
+
530
+ if (placement === left || (placement === top || placement === bottom) && variation === end) {
531
+ sideX = right;
532
+ var offsetX = isFixed && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
533
+ offsetParent[widthProp];
534
+ x -= offsetX - popperRect.width;
535
+ x *= gpuAcceleration ? 1 : -1;
536
+ }
537
+ }
538
+
539
+ var commonStyles = Object.assign({
540
+ position: position
541
+ }, adaptive && unsetSides);
542
+
543
+ var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
544
+ x: x,
545
+ y: y
546
+ }) : {
547
+ x: x,
548
+ y: y
549
+ };
550
+
551
+ x = _ref4.x;
552
+ y = _ref4.y;
553
+
554
+ if (gpuAcceleration) {
555
+ var _Object$assign;
556
+
557
+ 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));
558
+ }
559
+
560
+ return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
561
+ }
562
+
563
+ function computeStyles(_ref5) {
564
+ var state = _ref5.state,
565
+ options = _ref5.options;
566
+ var _options$gpuAccelerat = options.gpuAcceleration,
567
+ gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
568
+ _options$adaptive = options.adaptive,
569
+ adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
570
+ _options$roundOffsets = options.roundOffsets,
571
+ roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
572
+
573
+ var commonStyles = {
574
+ placement: getBasePlacement(state.placement),
575
+ variation: getVariation(state.placement),
576
+ popper: state.elements.popper,
577
+ popperRect: state.rects.popper,
578
+ gpuAcceleration: gpuAcceleration,
579
+ isFixed: state.options.strategy === 'fixed'
580
+ };
581
+
582
+ if (state.modifiersData.popperOffsets != null) {
583
+ state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
584
+ offsets: state.modifiersData.popperOffsets,
585
+ position: state.options.strategy,
586
+ adaptive: adaptive,
587
+ roundOffsets: roundOffsets
588
+ })));
589
+ }
590
+
591
+ if (state.modifiersData.arrow != null) {
592
+ state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
593
+ offsets: state.modifiersData.arrow,
594
+ position: 'absolute',
595
+ adaptive: false,
596
+ roundOffsets: roundOffsets
597
+ })));
598
+ }
599
+
600
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
601
+ 'data-popper-placement': state.placement
602
+ });
603
+ } // eslint-disable-next-line import/no-unused-modules
604
+
605
+
606
+ const computeStyles$1 = {
607
+ name: 'computeStyles',
608
+ enabled: true,
609
+ phase: 'beforeWrite',
610
+ fn: computeStyles,
611
+ data: {}
612
+ };
613
+
614
+ var passive = {
615
+ passive: true
616
+ };
617
+
618
+ function effect(_ref) {
619
+ var state = _ref.state,
620
+ instance = _ref.instance,
621
+ options = _ref.options;
622
+ var _options$scroll = options.scroll,
623
+ scroll = _options$scroll === void 0 ? true : _options$scroll,
624
+ _options$resize = options.resize,
625
+ resize = _options$resize === void 0 ? true : _options$resize;
626
+ var window = getWindow(state.elements.popper);
627
+ var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
628
+
629
+ if (scroll) {
630
+ scrollParents.forEach(function (scrollParent) {
631
+ scrollParent.addEventListener('scroll', instance.update, passive);
632
+ });
633
+ }
634
+
635
+ if (resize) {
636
+ window.addEventListener('resize', instance.update, passive);
637
+ }
638
+
639
+ return function () {
640
+ if (scroll) {
641
+ scrollParents.forEach(function (scrollParent) {
642
+ scrollParent.removeEventListener('scroll', instance.update, passive);
643
+ });
644
+ }
645
+
646
+ if (resize) {
647
+ window.removeEventListener('resize', instance.update, passive);
648
+ }
649
+ };
650
+ } // eslint-disable-next-line import/no-unused-modules
651
+
652
+
653
+ const eventListeners = {
654
+ name: 'eventListeners',
655
+ enabled: true,
656
+ phase: 'write',
657
+ fn: function fn() {},
658
+ effect: effect,
659
+ data: {}
660
+ };
661
+
662
+ var hash$1 = {
663
+ left: 'right',
664
+ right: 'left',
665
+ bottom: 'top',
666
+ top: 'bottom'
667
+ };
668
+ function getOppositePlacement(placement) {
669
+ return placement.replace(/left|right|bottom|top/g, function (matched) {
670
+ return hash$1[matched];
671
+ });
672
+ }
673
+
674
+ var hash = {
675
+ start: 'end',
676
+ end: 'start'
677
+ };
678
+ function getOppositeVariationPlacement(placement) {
679
+ return placement.replace(/start|end/g, function (matched) {
680
+ return hash[matched];
681
+ });
682
+ }
683
+
684
+ function getWindowScroll(node) {
685
+ var win = getWindow(node);
686
+ var scrollLeft = win.pageXOffset;
687
+ var scrollTop = win.pageYOffset;
688
+ return {
689
+ scrollLeft: scrollLeft,
690
+ scrollTop: scrollTop
691
+ };
692
+ }
693
+
694
+ function getWindowScrollBarX(element) {
695
+ // If <html> has a CSS width greater than the viewport, then this will be
696
+ // incorrect for RTL.
697
+ // Popper 1 is broken in this case and never had a bug report so let's assume
698
+ // it's not an issue. I don't think anyone ever specifies width on <html>
699
+ // anyway.
700
+ // Browsers where the left scrollbar doesn't cause an issue report `0` for
701
+ // this (e.g. Edge 2019, IE11, Safari)
702
+ return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
703
+ }
704
+
705
+ function getViewportRect(element) {
706
+ var win = getWindow(element);
707
+ var html = getDocumentElement(element);
708
+ var visualViewport = win.visualViewport;
709
+ var width = html.clientWidth;
710
+ var height = html.clientHeight;
711
+ var x = 0;
712
+ var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper
713
+ // can be obscured underneath it.
714
+ // Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even
715
+ // if it isn't open, so if this isn't available, the popper will be detected
716
+ // to overflow the bottom of the screen too early.
717
+
718
+ if (visualViewport) {
719
+ width = visualViewport.width;
720
+ height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently)
721
+ // In Chrome, it returns a value very close to 0 (+/-) but contains rounding
722
+ // errors due to floating point numbers, so we need to check precision.
723
+ // Safari returns a number <= 0, usually < -1 when pinch-zoomed
724
+ // Feature detection fails in mobile emulation mode in Chrome.
725
+ // Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) <
726
+ // 0.001
727
+ // Fallback here: "Not Safari" userAgent
728
+
729
+ if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
730
+ x = visualViewport.offsetLeft;
731
+ y = visualViewport.offsetTop;
732
+ }
733
+ }
734
+
735
+ return {
736
+ width: width,
737
+ height: height,
738
+ x: x + getWindowScrollBarX(element),
739
+ y: y
740
+ };
741
+ }
742
+
743
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable
744
+
745
+ function getDocumentRect(element) {
746
+ var _element$ownerDocumen;
747
+
748
+ var html = getDocumentElement(element);
749
+ var winScroll = getWindowScroll(element);
750
+ var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
751
+ var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
752
+ var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
753
+ var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
754
+ var y = -winScroll.scrollTop;
755
+
756
+ if (getComputedStyle(body || html).direction === 'rtl') {
757
+ x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
758
+ }
759
+
760
+ return {
761
+ width: width,
762
+ height: height,
763
+ x: x,
764
+ y: y
765
+ };
766
+ }
767
+
768
+ function isScrollParent(element) {
769
+ // Firefox wants us to check `-x` and `-y` variations as well
770
+ var _getComputedStyle = getComputedStyle(element),
771
+ overflow = _getComputedStyle.overflow,
772
+ overflowX = _getComputedStyle.overflowX,
773
+ overflowY = _getComputedStyle.overflowY;
774
+
775
+ return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
776
+ }
777
+
778
+ function getScrollParent(node) {
779
+ if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
780
+ // $FlowFixMe[incompatible-return]: assume body is always available
781
+ return node.ownerDocument.body;
782
+ }
783
+
784
+ if (isHTMLElement(node) && isScrollParent(node)) {
785
+ return node;
786
+ }
787
+
788
+ return getScrollParent(getParentNode(node));
789
+ }
790
+
791
+ /*
792
+ given a DOM element, return the list of all scroll parents, up the list of ancesors
793
+ until we get to the top window object. This list is what we attach scroll listeners
794
+ to, because if any of these parent elements scroll, we'll need to re-calculate the
795
+ reference element's position.
796
+ */
797
+
798
+ function listScrollParents(element, list) {
799
+ var _element$ownerDocumen;
800
+
801
+ if (list === void 0) {
802
+ list = [];
803
+ }
804
+
805
+ var scrollParent = getScrollParent(element);
806
+ var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
807
+ var win = getWindow(scrollParent);
808
+ var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
809
+ var updatedList = list.concat(target);
810
+ return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
811
+ updatedList.concat(listScrollParents(getParentNode(target)));
812
+ }
813
+
814
+ function rectToClientRect(rect) {
815
+ return Object.assign({}, rect, {
816
+ left: rect.x,
817
+ top: rect.y,
818
+ right: rect.x + rect.width,
819
+ bottom: rect.y + rect.height
820
+ });
821
+ }
822
+
823
+ function getInnerBoundingClientRect(element) {
824
+ var rect = getBoundingClientRect(element);
825
+ rect.top = rect.top + element.clientTop;
826
+ rect.left = rect.left + element.clientLeft;
827
+ rect.bottom = rect.top + element.clientHeight;
828
+ rect.right = rect.left + element.clientWidth;
829
+ rect.width = element.clientWidth;
830
+ rect.height = element.clientHeight;
831
+ rect.x = rect.left;
832
+ rect.y = rect.top;
833
+ return rect;
834
+ }
835
+
836
+ function getClientRectFromMixedType(element, clippingParent) {
837
+ return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
838
+ } // A "clipping parent" is an overflowable container with the characteristic of
839
+ // clipping (or hiding) overflowing elements with a position different from
840
+ // `initial`
841
+
842
+
843
+ function getClippingParents(element) {
844
+ var clippingParents = listScrollParents(getParentNode(element));
845
+ var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;
846
+ var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
847
+
848
+ if (!isElement(clipperElement)) {
849
+ return [];
850
+ } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
851
+
852
+
853
+ return clippingParents.filter(function (clippingParent) {
854
+ return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
855
+ });
856
+ } // Gets the maximum area that the element is visible in due to any number of
857
+ // clipping parents
858
+
859
+
860
+ function getClippingRect(element, boundary, rootBoundary) {
861
+ var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
862
+ var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
863
+ var firstClippingParent = clippingParents[0];
864
+ var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
865
+ var rect = getClientRectFromMixedType(element, clippingParent);
866
+ accRect.top = max(rect.top, accRect.top);
867
+ accRect.right = min(rect.right, accRect.right);
868
+ accRect.bottom = min(rect.bottom, accRect.bottom);
869
+ accRect.left = max(rect.left, accRect.left);
870
+ return accRect;
871
+ }, getClientRectFromMixedType(element, firstClippingParent));
872
+ clippingRect.width = clippingRect.right - clippingRect.left;
873
+ clippingRect.height = clippingRect.bottom - clippingRect.top;
874
+ clippingRect.x = clippingRect.left;
875
+ clippingRect.y = clippingRect.top;
876
+ return clippingRect;
877
+ }
878
+
879
+ function computeOffsets(_ref) {
880
+ var reference = _ref.reference,
881
+ element = _ref.element,
882
+ placement = _ref.placement;
883
+ var basePlacement = placement ? getBasePlacement(placement) : null;
884
+ var variation = placement ? getVariation(placement) : null;
885
+ var commonX = reference.x + reference.width / 2 - element.width / 2;
886
+ var commonY = reference.y + reference.height / 2 - element.height / 2;
887
+ var offsets;
888
+
889
+ switch (basePlacement) {
890
+ case top:
891
+ offsets = {
892
+ x: commonX,
893
+ y: reference.y - element.height
894
+ };
895
+ break;
896
+
897
+ case bottom:
898
+ offsets = {
899
+ x: commonX,
900
+ y: reference.y + reference.height
901
+ };
902
+ break;
903
+
904
+ case right:
905
+ offsets = {
906
+ x: reference.x + reference.width,
907
+ y: commonY
908
+ };
909
+ break;
910
+
911
+ case left:
912
+ offsets = {
913
+ x: reference.x - element.width,
914
+ y: commonY
915
+ };
916
+ break;
917
+
918
+ default:
919
+ offsets = {
920
+ x: reference.x,
921
+ y: reference.y
922
+ };
923
+ }
924
+
925
+ var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
926
+
927
+ if (mainAxis != null) {
928
+ var len = mainAxis === 'y' ? 'height' : 'width';
929
+
930
+ switch (variation) {
931
+ case start:
932
+ offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
933
+ break;
934
+
935
+ case end:
936
+ offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
937
+ break;
938
+ }
939
+ }
940
+
941
+ return offsets;
942
+ }
943
+
944
+ function detectOverflow(state, options) {
945
+ if (options === void 0) {
946
+ options = {};
947
+ }
948
+
949
+ var _options = options,
950
+ _options$placement = _options.placement,
951
+ placement = _options$placement === void 0 ? state.placement : _options$placement,
952
+ _options$boundary = _options.boundary,
953
+ boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
954
+ _options$rootBoundary = _options.rootBoundary,
955
+ rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
956
+ _options$elementConte = _options.elementContext,
957
+ elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
958
+ _options$altBoundary = _options.altBoundary,
959
+ altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
960
+ _options$padding = _options.padding,
961
+ padding = _options$padding === void 0 ? 0 : _options$padding;
962
+ var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
963
+ var altContext = elementContext === popper ? reference : popper;
964
+ var popperRect = state.rects.popper;
965
+ var element = state.elements[altBoundary ? altContext : elementContext];
966
+ var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
967
+ var referenceClientRect = getBoundingClientRect(state.elements.reference);
968
+ var popperOffsets = computeOffsets({
969
+ reference: referenceClientRect,
970
+ element: popperRect,
971
+ strategy: 'absolute',
972
+ placement: placement
973
+ });
974
+ var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
975
+ var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
976
+ // 0 or negative = within the clipping rect
977
+
978
+ var overflowOffsets = {
979
+ top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
980
+ bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
981
+ left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
982
+ right: elementClientRect.right - clippingClientRect.right + paddingObject.right
983
+ };
984
+ var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element
985
+
986
+ if (elementContext === popper && offsetData) {
987
+ var offset = offsetData[placement];
988
+ Object.keys(overflowOffsets).forEach(function (key) {
989
+ var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
990
+ var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
991
+ overflowOffsets[key] += offset[axis] * multiply;
992
+ });
993
+ }
994
+
995
+ return overflowOffsets;
996
+ }
997
+
998
+ function computeAutoPlacement(state, options) {
999
+ if (options === void 0) {
1000
+ options = {};
1001
+ }
1002
+
1003
+ var _options = options,
1004
+ placement = _options.placement,
1005
+ boundary = _options.boundary,
1006
+ rootBoundary = _options.rootBoundary,
1007
+ padding = _options.padding,
1008
+ flipVariations = _options.flipVariations,
1009
+ _options$allowedAutoP = _options.allowedAutoPlacements,
1010
+ allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
1011
+ var variation = getVariation(placement);
1012
+ var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
1013
+ return getVariation(placement) === variation;
1014
+ }) : basePlacements;
1015
+ var allowedPlacements = placements$1.filter(function (placement) {
1016
+ return allowedAutoPlacements.indexOf(placement) >= 0;
1017
+ });
1018
+
1019
+ if (allowedPlacements.length === 0) {
1020
+ allowedPlacements = placements$1;
1021
+ } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
1022
+
1023
+
1024
+ var overflows = allowedPlacements.reduce(function (acc, placement) {
1025
+ acc[placement] = detectOverflow(state, {
1026
+ placement: placement,
1027
+ boundary: boundary,
1028
+ rootBoundary: rootBoundary,
1029
+ padding: padding
1030
+ })[getBasePlacement(placement)];
1031
+ return acc;
1032
+ }, {});
1033
+ return Object.keys(overflows).sort(function (a, b) {
1034
+ return overflows[a] - overflows[b];
1035
+ });
1036
+ }
1037
+
1038
+ function getExpandedFallbackPlacements(placement) {
1039
+ if (getBasePlacement(placement) === auto) {
1040
+ return [];
1041
+ }
1042
+
1043
+ var oppositePlacement = getOppositePlacement(placement);
1044
+ return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
1045
+ }
1046
+
1047
+ function flip(_ref) {
1048
+ var state = _ref.state,
1049
+ options = _ref.options,
1050
+ name = _ref.name;
1051
+
1052
+ if (state.modifiersData[name]._skip) {
1053
+ return;
1054
+ }
1055
+
1056
+ var _options$mainAxis = options.mainAxis,
1057
+ checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
1058
+ _options$altAxis = options.altAxis,
1059
+ checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,
1060
+ specifiedFallbackPlacements = options.fallbackPlacements,
1061
+ padding = options.padding,
1062
+ boundary = options.boundary,
1063
+ rootBoundary = options.rootBoundary,
1064
+ altBoundary = options.altBoundary,
1065
+ _options$flipVariatio = options.flipVariations,
1066
+ flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,
1067
+ allowedAutoPlacements = options.allowedAutoPlacements;
1068
+ var preferredPlacement = state.options.placement;
1069
+ var basePlacement = getBasePlacement(preferredPlacement);
1070
+ var isBasePlacement = basePlacement === preferredPlacement;
1071
+ var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
1072
+ var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {
1073
+ return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {
1074
+ placement: placement,
1075
+ boundary: boundary,
1076
+ rootBoundary: rootBoundary,
1077
+ padding: padding,
1078
+ flipVariations: flipVariations,
1079
+ allowedAutoPlacements: allowedAutoPlacements
1080
+ }) : placement);
1081
+ }, []);
1082
+ var referenceRect = state.rects.reference;
1083
+ var popperRect = state.rects.popper;
1084
+ var checksMap = new Map();
1085
+ var makeFallbackChecks = true;
1086
+ var firstFittingPlacement = placements[0];
1087
+
1088
+ for (var i = 0; i < placements.length; i++) {
1089
+ var placement = placements[i];
1090
+
1091
+ var _basePlacement = getBasePlacement(placement);
1092
+
1093
+ var isStartVariation = getVariation(placement) === start;
1094
+ var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
1095
+ var len = isVertical ? 'width' : 'height';
1096
+ var overflow = detectOverflow(state, {
1097
+ placement: placement,
1098
+ boundary: boundary,
1099
+ rootBoundary: rootBoundary,
1100
+ altBoundary: altBoundary,
1101
+ padding: padding
1102
+ });
1103
+ var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
1104
+
1105
+ if (referenceRect[len] > popperRect[len]) {
1106
+ mainVariationSide = getOppositePlacement(mainVariationSide);
1107
+ }
1108
+
1109
+ var altVariationSide = getOppositePlacement(mainVariationSide);
1110
+ var checks = [];
1111
+
1112
+ if (checkMainAxis) {
1113
+ checks.push(overflow[_basePlacement] <= 0);
1114
+ }
1115
+
1116
+ if (checkAltAxis) {
1117
+ checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
1118
+ }
1119
+
1120
+ if (checks.every(function (check) {
1121
+ return check;
1122
+ })) {
1123
+ firstFittingPlacement = placement;
1124
+ makeFallbackChecks = false;
1125
+ break;
1126
+ }
1127
+
1128
+ checksMap.set(placement, checks);
1129
+ }
1130
+
1131
+ if (makeFallbackChecks) {
1132
+ // `2` may be desired in some cases – research later
1133
+ var numberOfChecks = flipVariations ? 3 : 1;
1134
+
1135
+ var _loop = function _loop(_i) {
1136
+ var fittingPlacement = placements.find(function (placement) {
1137
+ var checks = checksMap.get(placement);
1138
+
1139
+ if (checks) {
1140
+ return checks.slice(0, _i).every(function (check) {
1141
+ return check;
1142
+ });
1143
+ }
1144
+ });
1145
+
1146
+ if (fittingPlacement) {
1147
+ firstFittingPlacement = fittingPlacement;
1148
+ return "break";
1149
+ }
1150
+ };
1151
+
1152
+ for (var _i = numberOfChecks; _i > 0; _i--) {
1153
+ var _ret = _loop(_i);
1154
+
1155
+ if (_ret === "break") break;
1156
+ }
1157
+ }
1158
+
1159
+ if (state.placement !== firstFittingPlacement) {
1160
+ state.modifiersData[name]._skip = true;
1161
+ state.placement = firstFittingPlacement;
1162
+ state.reset = true;
1163
+ }
1164
+ } // eslint-disable-next-line import/no-unused-modules
1165
+
1166
+
1167
+ const flip$1 = {
1168
+ name: 'flip',
1169
+ enabled: true,
1170
+ phase: 'main',
1171
+ fn: flip,
1172
+ requiresIfExists: ['offset'],
1173
+ data: {
1174
+ _skip: false
1175
+ }
1176
+ };
1177
+
1178
+ function getSideOffsets(overflow, rect, preventedOffsets) {
1179
+ if (preventedOffsets === void 0) {
1180
+ preventedOffsets = {
1181
+ x: 0,
1182
+ y: 0
1183
+ };
1184
+ }
1185
+
1186
+ return {
1187
+ top: overflow.top - rect.height - preventedOffsets.y,
1188
+ right: overflow.right - rect.width + preventedOffsets.x,
1189
+ bottom: overflow.bottom - rect.height + preventedOffsets.y,
1190
+ left: overflow.left - rect.width - preventedOffsets.x
1191
+ };
1192
+ }
1193
+
1194
+ function isAnySideFullyClipped(overflow) {
1195
+ return [top, right, bottom, left].some(function (side) {
1196
+ return overflow[side] >= 0;
1197
+ });
1198
+ }
1199
+
1200
+ function hide(_ref) {
1201
+ var state = _ref.state,
1202
+ name = _ref.name;
1203
+ var referenceRect = state.rects.reference;
1204
+ var popperRect = state.rects.popper;
1205
+ var preventedOffsets = state.modifiersData.preventOverflow;
1206
+ var referenceOverflow = detectOverflow(state, {
1207
+ elementContext: 'reference'
1208
+ });
1209
+ var popperAltOverflow = detectOverflow(state, {
1210
+ altBoundary: true
1211
+ });
1212
+ var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
1213
+ var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
1214
+ var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
1215
+ var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
1216
+ state.modifiersData[name] = {
1217
+ referenceClippingOffsets: referenceClippingOffsets,
1218
+ popperEscapeOffsets: popperEscapeOffsets,
1219
+ isReferenceHidden: isReferenceHidden,
1220
+ hasPopperEscaped: hasPopperEscaped
1221
+ };
1222
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
1223
+ 'data-popper-reference-hidden': isReferenceHidden,
1224
+ 'data-popper-escaped': hasPopperEscaped
1225
+ });
1226
+ } // eslint-disable-next-line import/no-unused-modules
1227
+
1228
+
1229
+ const hide$1 = {
1230
+ name: 'hide',
1231
+ enabled: true,
1232
+ phase: 'main',
1233
+ requiresIfExists: ['preventOverflow'],
1234
+ fn: hide
1235
+ };
1236
+
1237
+ function distanceAndSkiddingToXY(placement, rects, offset) {
1238
+ var basePlacement = getBasePlacement(placement);
1239
+ var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
1240
+
1241
+ var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
1242
+ placement: placement
1243
+ })) : offset,
1244
+ skidding = _ref[0],
1245
+ distance = _ref[1];
1246
+
1247
+ skidding = skidding || 0;
1248
+ distance = (distance || 0) * invertDistance;
1249
+ return [left, right].indexOf(basePlacement) >= 0 ? {
1250
+ x: distance,
1251
+ y: skidding
1252
+ } : {
1253
+ x: skidding,
1254
+ y: distance
1255
+ };
1256
+ }
1257
+
1258
+ function offset(_ref2) {
1259
+ var state = _ref2.state,
1260
+ options = _ref2.options,
1261
+ name = _ref2.name;
1262
+ var _options$offset = options.offset,
1263
+ offset = _options$offset === void 0 ? [0, 0] : _options$offset;
1264
+ var data = placements.reduce(function (acc, placement) {
1265
+ acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
1266
+ return acc;
1267
+ }, {});
1268
+ var _data$state$placement = data[state.placement],
1269
+ x = _data$state$placement.x,
1270
+ y = _data$state$placement.y;
1271
+
1272
+ if (state.modifiersData.popperOffsets != null) {
1273
+ state.modifiersData.popperOffsets.x += x;
1274
+ state.modifiersData.popperOffsets.y += y;
1275
+ }
1276
+
1277
+ state.modifiersData[name] = data;
1278
+ } // eslint-disable-next-line import/no-unused-modules
1279
+
1280
+
1281
+ const offset$1 = {
1282
+ name: 'offset',
1283
+ enabled: true,
1284
+ phase: 'main',
1285
+ requires: ['popperOffsets'],
1286
+ fn: offset
1287
+ };
1288
+
1289
+ function popperOffsets(_ref) {
1290
+ var state = _ref.state,
1291
+ name = _ref.name;
1292
+ // Offsets are the actual position the popper needs to have to be
1293
+ // properly positioned near its reference element
1294
+ // This is the most basic placement, and will be adjusted by
1295
+ // the modifiers in the next step
1296
+ state.modifiersData[name] = computeOffsets({
1297
+ reference: state.rects.reference,
1298
+ element: state.rects.popper,
1299
+ strategy: 'absolute',
1300
+ placement: state.placement
1301
+ });
1302
+ } // eslint-disable-next-line import/no-unused-modules
1303
+
1304
+
1305
+ const popperOffsets$1 = {
1306
+ name: 'popperOffsets',
1307
+ enabled: true,
1308
+ phase: 'read',
1309
+ fn: popperOffsets,
1310
+ data: {}
1311
+ };
1312
+
1313
+ function getAltAxis(axis) {
1314
+ return axis === 'x' ? 'y' : 'x';
1315
+ }
1316
+
1317
+ function preventOverflow(_ref) {
1318
+ var state = _ref.state,
1319
+ options = _ref.options,
1320
+ name = _ref.name;
1321
+ var _options$mainAxis = options.mainAxis,
1322
+ checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
1323
+ _options$altAxis = options.altAxis,
1324
+ checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
1325
+ boundary = options.boundary,
1326
+ rootBoundary = options.rootBoundary,
1327
+ altBoundary = options.altBoundary,
1328
+ padding = options.padding,
1329
+ _options$tether = options.tether,
1330
+ tether = _options$tether === void 0 ? true : _options$tether,
1331
+ _options$tetherOffset = options.tetherOffset,
1332
+ tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
1333
+ var overflow = detectOverflow(state, {
1334
+ boundary: boundary,
1335
+ rootBoundary: rootBoundary,
1336
+ padding: padding,
1337
+ altBoundary: altBoundary
1338
+ });
1339
+ var basePlacement = getBasePlacement(state.placement);
1340
+ var variation = getVariation(state.placement);
1341
+ var isBasePlacement = !variation;
1342
+ var mainAxis = getMainAxisFromPlacement(basePlacement);
1343
+ var altAxis = getAltAxis(mainAxis);
1344
+ var popperOffsets = state.modifiersData.popperOffsets;
1345
+ var referenceRect = state.rects.reference;
1346
+ var popperRect = state.rects.popper;
1347
+ var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
1348
+ placement: state.placement
1349
+ })) : tetherOffset;
1350
+ var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
1351
+ mainAxis: tetherOffsetValue,
1352
+ altAxis: tetherOffsetValue
1353
+ } : Object.assign({
1354
+ mainAxis: 0,
1355
+ altAxis: 0
1356
+ }, tetherOffsetValue);
1357
+ var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
1358
+ var data = {
1359
+ x: 0,
1360
+ y: 0
1361
+ };
1362
+
1363
+ if (!popperOffsets) {
1364
+ return;
1365
+ }
1366
+
1367
+ if (checkMainAxis) {
1368
+ var _offsetModifierState$;
1369
+
1370
+ var mainSide = mainAxis === 'y' ? top : left;
1371
+ var altSide = mainAxis === 'y' ? bottom : right;
1372
+ var len = mainAxis === 'y' ? 'height' : 'width';
1373
+ var offset = popperOffsets[mainAxis];
1374
+ var min$1 = offset + overflow[mainSide];
1375
+ var max$1 = offset - overflow[altSide];
1376
+ var additive = tether ? -popperRect[len] / 2 : 0;
1377
+ var minLen = variation === start ? referenceRect[len] : popperRect[len];
1378
+ var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
1379
+ // outside the reference bounds
1380
+
1381
+ var arrowElement = state.elements.arrow;
1382
+ var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
1383
+ width: 0,
1384
+ height: 0
1385
+ };
1386
+ var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();
1387
+ var arrowPaddingMin = arrowPaddingObject[mainSide];
1388
+ var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want
1389
+ // to include its full size in the calculation. If the reference is small
1390
+ // and near the edge of a boundary, the popper can overflow even if the
1391
+ // reference is not overflowing as well (e.g. virtual elements with no
1392
+ // width or height)
1393
+
1394
+ var arrowLen = within(0, referenceRect[len], arrowRect[len]);
1395
+ var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
1396
+ var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
1397
+ var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
1398
+ var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
1399
+ var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
1400
+ var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
1401
+ var tetherMax = offset + maxOffset - offsetModifierValue;
1402
+ var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
1403
+ popperOffsets[mainAxis] = preventedOffset;
1404
+ data[mainAxis] = preventedOffset - offset;
1405
+ }
1406
+
1407
+ if (checkAltAxis) {
1408
+ var _offsetModifierState$2;
1409
+
1410
+ var _mainSide = mainAxis === 'x' ? top : left;
1411
+
1412
+ var _altSide = mainAxis === 'x' ? bottom : right;
1413
+
1414
+ var _offset = popperOffsets[altAxis];
1415
+
1416
+ var _len = altAxis === 'y' ? 'height' : 'width';
1417
+
1418
+ var _min = _offset + overflow[_mainSide];
1419
+
1420
+ var _max = _offset - overflow[_altSide];
1421
+
1422
+ var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
1423
+
1424
+ var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
1425
+
1426
+ var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
1427
+
1428
+ var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
1429
+
1430
+ var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
1431
+
1432
+ popperOffsets[altAxis] = _preventedOffset;
1433
+ data[altAxis] = _preventedOffset - _offset;
1434
+ }
1435
+
1436
+ state.modifiersData[name] = data;
1437
+ } // eslint-disable-next-line import/no-unused-modules
1438
+
1439
+
1440
+ const preventOverflow$1 = {
1441
+ name: 'preventOverflow',
1442
+ enabled: true,
1443
+ phase: 'main',
1444
+ fn: preventOverflow,
1445
+ requiresIfExists: ['offset']
1446
+ };
1447
+
1448
+ function getHTMLElementScroll(element) {
1449
+ return {
1450
+ scrollLeft: element.scrollLeft,
1451
+ scrollTop: element.scrollTop
1452
+ };
1453
+ }
1454
+
1455
+ function getNodeScroll(node) {
1456
+ if (node === getWindow(node) || !isHTMLElement(node)) {
1457
+ return getWindowScroll(node);
1458
+ } else {
1459
+ return getHTMLElementScroll(node);
1460
+ }
1461
+ }
1462
+
1463
+ function isElementScaled(element) {
1464
+ var rect = element.getBoundingClientRect();
1465
+ var scaleX = round(rect.width) / element.offsetWidth || 1;
1466
+ var scaleY = round(rect.height) / element.offsetHeight || 1;
1467
+ return scaleX !== 1 || scaleY !== 1;
1468
+ } // Returns the composite rect of an element relative to its offsetParent.
1469
+ // Composite means it takes into account transforms as well as layout.
1470
+
1471
+
1472
+ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
1473
+ if (isFixed === void 0) {
1474
+ isFixed = false;
1475
+ }
1476
+
1477
+ var isOffsetParentAnElement = isHTMLElement(offsetParent);
1478
+ var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
1479
+ var documentElement = getDocumentElement(offsetParent);
1480
+ var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
1481
+ var scroll = {
1482
+ scrollLeft: 0,
1483
+ scrollTop: 0
1484
+ };
1485
+ var offsets = {
1486
+ x: 0,
1487
+ y: 0
1488
+ };
1489
+
1490
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1491
+ if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
1492
+ isScrollParent(documentElement)) {
1493
+ scroll = getNodeScroll(offsetParent);
1494
+ }
1495
+
1496
+ if (isHTMLElement(offsetParent)) {
1497
+ offsets = getBoundingClientRect(offsetParent, true);
1498
+ offsets.x += offsetParent.clientLeft;
1499
+ offsets.y += offsetParent.clientTop;
1500
+ } else if (documentElement) {
1501
+ offsets.x = getWindowScrollBarX(documentElement);
1502
+ }
1503
+ }
1504
+
1505
+ return {
1506
+ x: rect.left + scroll.scrollLeft - offsets.x,
1507
+ y: rect.top + scroll.scrollTop - offsets.y,
1508
+ width: rect.width,
1509
+ height: rect.height
1510
+ };
1511
+ }
1512
+
1513
+ function order(modifiers) {
1514
+ var map = new Map();
1515
+ var visited = new Set();
1516
+ var result = [];
1517
+ modifiers.forEach(function (modifier) {
1518
+ map.set(modifier.name, modifier);
1519
+ }); // On visiting object, check for its dependencies and visit them recursively
1520
+
1521
+ function sort(modifier) {
1522
+ visited.add(modifier.name);
1523
+ var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
1524
+ requires.forEach(function (dep) {
1525
+ if (!visited.has(dep)) {
1526
+ var depModifier = map.get(dep);
1527
+
1528
+ if (depModifier) {
1529
+ sort(depModifier);
1530
+ }
1531
+ }
1532
+ });
1533
+ result.push(modifier);
1534
+ }
1535
+
1536
+ modifiers.forEach(function (modifier) {
1537
+ if (!visited.has(modifier.name)) {
1538
+ // check for visited object
1539
+ sort(modifier);
1540
+ }
1541
+ });
1542
+ return result;
1543
+ }
1544
+
1545
+ function orderModifiers(modifiers) {
1546
+ // order based on dependencies
1547
+ var orderedModifiers = order(modifiers); // order based on phase
1548
+
1549
+ return modifierPhases.reduce(function (acc, phase) {
1550
+ return acc.concat(orderedModifiers.filter(function (modifier) {
1551
+ return modifier.phase === phase;
1552
+ }));
1553
+ }, []);
1554
+ }
1555
+
1556
+ function debounce(fn) {
1557
+ var pending;
1558
+ return function () {
1559
+ if (!pending) {
1560
+ pending = new Promise(function (resolve) {
1561
+ Promise.resolve().then(function () {
1562
+ pending = undefined;
1563
+ resolve(fn());
1564
+ });
1565
+ });
1566
+ }
1567
+
1568
+ return pending;
1569
+ };
1570
+ }
1571
+
1572
+ function mergeByName(modifiers) {
1573
+ var merged = modifiers.reduce(function (merged, current) {
1574
+ var existing = merged[current.name];
1575
+ merged[current.name] = existing ? Object.assign({}, existing, current, {
1576
+ options: Object.assign({}, existing.options, current.options),
1577
+ data: Object.assign({}, existing.data, current.data)
1578
+ }) : current;
1579
+ return merged;
1580
+ }, {}); // IE11 does not support Object.values
1581
+
1582
+ return Object.keys(merged).map(function (key) {
1583
+ return merged[key];
1584
+ });
1585
+ }
1586
+
1587
+ var DEFAULT_OPTIONS = {
1588
+ placement: 'bottom',
1589
+ modifiers: [],
1590
+ strategy: 'absolute'
1591
+ };
1592
+
1593
+ function areValidElements() {
1594
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1595
+ args[_key] = arguments[_key];
1596
+ }
1597
+
1598
+ return !args.some(function (element) {
1599
+ return !(element && typeof element.getBoundingClientRect === 'function');
1600
+ });
1601
+ }
1602
+
1603
+ function popperGenerator(generatorOptions) {
1604
+ if (generatorOptions === void 0) {
1605
+ generatorOptions = {};
1606
+ }
1607
+
1608
+ var _generatorOptions = generatorOptions,
1609
+ _generatorOptions$def = _generatorOptions.defaultModifiers,
1610
+ defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
1611
+ _generatorOptions$def2 = _generatorOptions.defaultOptions,
1612
+ defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
1613
+ return function createPopper(reference, popper, options) {
1614
+ if (options === void 0) {
1615
+ options = defaultOptions;
1616
+ }
1617
+
1618
+ var state = {
1619
+ placement: 'bottom',
1620
+ orderedModifiers: [],
1621
+ options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
1622
+ modifiersData: {},
1623
+ elements: {
1624
+ reference: reference,
1625
+ popper: popper
1626
+ },
1627
+ attributes: {},
1628
+ styles: {}
1629
+ };
1630
+ var effectCleanupFns = [];
1631
+ var isDestroyed = false;
1632
+ var instance = {
1633
+ state: state,
1634
+ setOptions: function setOptions(setOptionsAction) {
1635
+ var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
1636
+ cleanupModifierEffects();
1637
+ state.options = Object.assign({}, defaultOptions, state.options, options);
1638
+ state.scrollParents = {
1639
+ reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
1640
+ popper: listScrollParents(popper)
1641
+ }; // Orders the modifiers based on their dependencies and `phase`
1642
+ // properties
1643
+
1644
+ var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
1645
+
1646
+ state.orderedModifiers = orderedModifiers.filter(function (m) {
1647
+ return m.enabled;
1648
+ }); // Validate the provided modifiers so that the consumer will get warned
1649
+
1650
+ runModifierEffects();
1651
+ return instance.update();
1652
+ },
1653
+ // Sync update – it will always be executed, even if not necessary. This
1654
+ // is useful for low frequency updates where sync behavior simplifies the
1655
+ // logic.
1656
+ // For high frequency updates (e.g. `resize` and `scroll` events), always
1657
+ // prefer the async Popper#update method
1658
+ forceUpdate: function forceUpdate() {
1659
+ if (isDestroyed) {
1660
+ return;
1661
+ }
1662
+
1663
+ var _state$elements = state.elements,
1664
+ reference = _state$elements.reference,
1665
+ popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
1666
+ // anymore
1667
+
1668
+ if (!areValidElements(reference, popper)) {
1669
+
1670
+ return;
1671
+ } // Store the reference and popper rects to be read by modifiers
1672
+
1673
+
1674
+ state.rects = {
1675
+ reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
1676
+ popper: getLayoutRect(popper)
1677
+ }; // Modifiers have the ability to reset the current update cycle. The
1678
+ // most common use case for this is the `flip` modifier changing the
1679
+ // placement, which then needs to re-run all the modifiers, because the
1680
+ // logic was previously ran for the previous placement and is therefore
1681
+ // stale/incorrect
1682
+
1683
+ state.reset = false;
1684
+ state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
1685
+ // is filled with the initial data specified by the modifier. This means
1686
+ // it doesn't persist and is fresh on each update.
1687
+ // To ensure persistent data, use `${name}#persistent`
1688
+
1689
+ state.orderedModifiers.forEach(function (modifier) {
1690
+ return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
1691
+ });
1692
+
1693
+ for (var index = 0; index < state.orderedModifiers.length; index++) {
1694
+
1695
+ if (state.reset === true) {
1696
+ state.reset = false;
1697
+ index = -1;
1698
+ continue;
1699
+ }
1700
+
1701
+ var _state$orderedModifie = state.orderedModifiers[index],
1702
+ fn = _state$orderedModifie.fn,
1703
+ _state$orderedModifie2 = _state$orderedModifie.options,
1704
+ _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
1705
+ name = _state$orderedModifie.name;
1706
+
1707
+ if (typeof fn === 'function') {
1708
+ state = fn({
1709
+ state: state,
1710
+ options: _options,
1711
+ name: name,
1712
+ instance: instance
1713
+ }) || state;
1714
+ }
1715
+ }
1716
+ },
1717
+ // Async and optimistically optimized update – it will not be executed if
1718
+ // not necessary (debounced to run at most once-per-tick)
1719
+ update: debounce(function () {
1720
+ return new Promise(function (resolve) {
1721
+ instance.forceUpdate();
1722
+ resolve(state);
1723
+ });
1724
+ }),
1725
+ destroy: function destroy() {
1726
+ cleanupModifierEffects();
1727
+ isDestroyed = true;
1728
+ }
1729
+ };
1730
+
1731
+ if (!areValidElements(reference, popper)) {
1732
+
1733
+ return instance;
1734
+ }
1735
+
1736
+ instance.setOptions(options).then(function (state) {
1737
+ if (!isDestroyed && options.onFirstUpdate) {
1738
+ options.onFirstUpdate(state);
1739
+ }
1740
+ }); // Modifiers have the ability to execute arbitrary code before the first
1741
+ // update cycle runs. They will be executed in the same order as the update
1742
+ // cycle. This is useful when a modifier adds some persistent data that
1743
+ // other modifiers need to use, but the modifier is run after the dependent
1744
+ // one.
1745
+
1746
+ function runModifierEffects() {
1747
+ state.orderedModifiers.forEach(function (_ref3) {
1748
+ var name = _ref3.name,
1749
+ _ref3$options = _ref3.options,
1750
+ options = _ref3$options === void 0 ? {} : _ref3$options,
1751
+ effect = _ref3.effect;
1752
+
1753
+ if (typeof effect === 'function') {
1754
+ var cleanupFn = effect({
1755
+ state: state,
1756
+ name: name,
1757
+ instance: instance,
1758
+ options: options
1759
+ });
1760
+
1761
+ var noopFn = function noopFn() {};
1762
+
1763
+ effectCleanupFns.push(cleanupFn || noopFn);
1764
+ }
1765
+ });
1766
+ }
1767
+
1768
+ function cleanupModifierEffects() {
1769
+ effectCleanupFns.forEach(function (fn) {
1770
+ return fn();
1771
+ });
1772
+ effectCleanupFns = [];
1773
+ }
1774
+
1775
+ return instance;
1776
+ };
1777
+ }
1778
+
1779
+ var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
1780
+ var createPopper = /*#__PURE__*/popperGenerator({
1781
+ defaultModifiers: defaultModifiers
1782
+ }); // eslint-disable-next-line import/no-unused-modules
1783
+
1784
+ export { createPopper as c };