cherrypy-foundation 1.0.0__py3-none-any.whl

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