sillytavern 1.4.1

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 (259) hide show
  1. package/.dockerignore +4 -0
  2. package/.github/ISSUE_TEMPLATE/bug_report.md +35 -0
  3. package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  4. package/.github/workflows/npm-publish.yml +32 -0
  5. package/Dockerfile +49 -0
  6. package/Start.bat +3 -0
  7. package/colab/GPU.ipynb +339 -0
  8. package/colab/extras_server.py +40 -0
  9. package/colab/globals.py +2 -0
  10. package/colab/models.py +77 -0
  11. package/docker/docker-compose.yml +12 -0
  12. package/docker/docker-entrypoint.sh +28 -0
  13. package/faq.md +208 -0
  14. package/package.json +49 -0
  15. package/poe-client.js +638 -0
  16. package/poe-test.js +21 -0
  17. package/poe_graphql/AddHumanMessageMutation.graphql +52 -0
  18. package/poe_graphql/AddMessageBreakMutation.graphql +17 -0
  19. package/poe_graphql/AutoSubscriptionMutation.graphql +7 -0
  20. package/poe_graphql/BioFragment.graphql +8 -0
  21. package/poe_graphql/ChatAddedSubscription.graphql +5 -0
  22. package/poe_graphql/ChatFragment.graphql +6 -0
  23. package/poe_graphql/ChatListPaginationQuery.graphql +316 -0
  24. package/poe_graphql/ChatPaginationQuery.graphql +26 -0
  25. package/poe_graphql/ChatViewQuery.graphql +8 -0
  26. package/poe_graphql/DeleteHumanMessagesMutation.graphql +7 -0
  27. package/poe_graphql/DeleteMessageMutation.graphql +7 -0
  28. package/poe_graphql/HandleFragment.graphql +8 -0
  29. package/poe_graphql/LoginWithVerificationCodeMutation.graphql +13 -0
  30. package/poe_graphql/MessageAddedSubscription.graphql +115 -0
  31. package/poe_graphql/MessageDeletedSubscription.graphql +8 -0
  32. package/poe_graphql/MessageFragment.graphql +13 -0
  33. package/poe_graphql/MessageRemoveVoteMutation.graphql +7 -0
  34. package/poe_graphql/MessageSetVoteMutation.graphql +7 -0
  35. package/poe_graphql/SendVerificationCodeForLoginMutation.graphql +12 -0
  36. package/poe_graphql/ShareMessagesMutation.graphql +9 -0
  37. package/poe_graphql/SignupWithVerificationCodeMutation.graphql +13 -0
  38. package/poe_graphql/StaleChatUpdateMutation.graphql +7 -0
  39. package/poe_graphql/SubscriptionsMutation.graphql +9 -0
  40. package/poe_graphql/SummarizePlainPostQuery.graphql +3 -0
  41. package/poe_graphql/SummarizeQuotePostQuery.graphql +3 -0
  42. package/poe_graphql/SummarizeSharePostQuery.graphql +3 -0
  43. package/poe_graphql/UserSnippetFragment.graphql +14 -0
  44. package/poe_graphql/ViewerInfoQuery.graphql +21 -0
  45. package/poe_graphql/ViewerMessageLimitUpdatedSubscription.graphql +81 -0
  46. package/poe_graphql/ViewerStateFragment.graphql +30 -0
  47. package/poe_graphql/ViewerStateUpdatedSubscription.graphql +63 -0
  48. package/public/KoboldAI Settings/Ace of Spades 13B.settings +22 -0
  49. package/public/KoboldAI Settings/Adventurer-NeoX-20B-Erebus.settings +54 -0
  50. package/public/KoboldAI Settings/Basic Coherence 13B.settings +22 -0
  51. package/public/KoboldAI Settings/Best Guess 6B.settings +22 -0
  52. package/public/KoboldAI Settings/Calibrated-Pygmalion-6b.settings +47 -0
  53. package/public/KoboldAI Settings/Classic-Pygmalion-2.7b.settings +46 -0
  54. package/public/KoboldAI Settings/Classic-Pygmalion-6b.settings +47 -0
  55. package/public/KoboldAI Settings/Coherent Creativity 6B.settings +22 -0
  56. package/public/KoboldAI Settings/Default-TavernAI.settings +22 -0
  57. package/public/KoboldAI Settings/DragonSlayer-Pygmalion-6b.settings +47 -0
  58. package/public/KoboldAI Settings/GPU-Pygmalion-6b.settings +47 -0
  59. package/public/KoboldAI Settings/Genesis 13B.settings +22 -0
  60. package/public/KoboldAI Settings/Godlike.settings +22 -0
  61. package/public/KoboldAI Settings/Good Winds.settings +22 -0
  62. package/public/KoboldAI Settings/Lancer-OPT-2.7B-Erebus.settings +54 -0
  63. package/public/KoboldAI Settings/Liminal Drift.settings +22 -0
  64. package/public/KoboldAI Settings/Low Rider 13B.settings +22 -0
  65. package/public/KoboldAI Settings/Luna Moth 6B.settings +22 -0
  66. package/public/KoboldAI Settings/Mayday.settings +22 -0
  67. package/public/KoboldAI Settings/Ouroboros.settings +22 -0
  68. package/public/KoboldAI Settings/Pleasing Results 6B.settings +22 -0
  69. package/public/KoboldAI Settings/Pro Writer 13B.settings +22 -0
  70. package/public/KoboldAI Settings/RA - Pygmalion-1.3b.settings +46 -0
  71. package/public/KoboldAI Settings/Storywriter 6B.settings +22 -0
  72. package/public/NovelAI Settings/Classic-Euterpe.settings +14 -0
  73. package/public/NovelAI Settings/Classic-Krake.settings +14 -0
  74. package/public/OpenAI Settings/Default.settings +15 -0
  75. package/public/TextGen Settings/Beam Search.settings +15 -0
  76. package/public/TextGen Settings/Contrastive Search.settings +15 -0
  77. package/public/TextGen Settings/Default.settings +15 -0
  78. package/public/TextGen Settings/Deterministic.settings +15 -0
  79. package/public/TextGen Settings/Kobold (Godlike).settings +15 -0
  80. package/public/TextGen Settings/Kobold (Liminal Drift).settings +15 -0
  81. package/public/TextGen Settings/Naive.settings +15 -0
  82. package/public/TextGen Settings/NovelAI (Best Guess).settings +15 -0
  83. package/public/TextGen Settings/NovelAI (Decadence).settings +15 -0
  84. package/public/TextGen Settings/NovelAI (Genesis).settings +15 -0
  85. package/public/TextGen Settings/NovelAI (Lycaenidae).settings +15 -0
  86. package/public/TextGen Settings/NovelAI (Ouroboros).settings +15 -0
  87. package/public/TextGen Settings/NovelAI (Pleasing Results).settings +15 -0
  88. package/public/TextGen Settings/NovelAI (Sphinx Moth).settings +15 -0
  89. package/public/TextGen Settings/NovelAI (Storywriter).settings +15 -0
  90. package/public/TextGen Settings/Pygmalion.settings +15 -0
  91. package/public/css/fontawesome.css +8488 -0
  92. package/public/css/notes.css +46 -0
  93. package/public/css/solid.css +24 -0
  94. package/public/favicon.ico +0 -0
  95. package/public/img/No-Image-Placeholder.svg +309 -0
  96. package/public/img/addbg3.png +0 -0
  97. package/public/img/ai4.png +0 -0
  98. package/public/img/apple-icon-114x114.png +0 -0
  99. package/public/img/apple-icon-144x144.png +0 -0
  100. package/public/img/apple-icon-57x57.png +0 -0
  101. package/public/img/apple-icon-72x72.png +0 -0
  102. package/public/img/book2.png +0 -0
  103. package/public/img/default-expressions/admiration.png +0 -0
  104. package/public/img/default-expressions/amusement.png +0 -0
  105. package/public/img/default-expressions/anger.png +0 -0
  106. package/public/img/default-expressions/annoyance.png +0 -0
  107. package/public/img/default-expressions/approval.png +0 -0
  108. package/public/img/default-expressions/caring.png +0 -0
  109. package/public/img/default-expressions/confusion.png +0 -0
  110. package/public/img/default-expressions/curiosity.png +0 -0
  111. package/public/img/default-expressions/desire.png +0 -0
  112. package/public/img/default-expressions/desire1.png +0 -0
  113. package/public/img/default-expressions/desire2.png +0 -0
  114. package/public/img/default-expressions/disappointment.png +0 -0
  115. package/public/img/default-expressions/disapproval.png +0 -0
  116. package/public/img/default-expressions/disgust.png +0 -0
  117. package/public/img/default-expressions/embarrassment.png +0 -0
  118. package/public/img/default-expressions/excitement.png +0 -0
  119. package/public/img/default-expressions/fear.png +0 -0
  120. package/public/img/default-expressions/gratitude.png +0 -0
  121. package/public/img/default-expressions/grief.png +0 -0
  122. package/public/img/default-expressions/joy.png +0 -0
  123. package/public/img/default-expressions/love.png +0 -0
  124. package/public/img/default-expressions/nervousness.png +0 -0
  125. package/public/img/default-expressions/neutral.png +0 -0
  126. package/public/img/default-expressions/optimism.png +0 -0
  127. package/public/img/default-expressions/pride.png +0 -0
  128. package/public/img/default-expressions/realization.png +0 -0
  129. package/public/img/default-expressions/relief.png +0 -0
  130. package/public/img/default-expressions/remorse.png +0 -0
  131. package/public/img/default-expressions/sadness.png +0 -0
  132. package/public/img/default-expressions/surprise.png +0 -0
  133. package/public/img/five.png +0 -0
  134. package/public/img/times-circle.svg +1 -0
  135. package/public/img/you.png +0 -0
  136. package/public/index.html +1899 -0
  137. package/public/notes/1.html +44 -0
  138. package/public/notes/1.png +0 -0
  139. package/public/notes/10.html +20 -0
  140. package/public/notes/11.html +33 -0
  141. package/public/notes/12.html +27 -0
  142. package/public/notes/13.html +29 -0
  143. package/public/notes/13_1.html +24 -0
  144. package/public/notes/13_2.html +25 -0
  145. package/public/notes/13_3.html +89 -0
  146. package/public/notes/14.html +30 -0
  147. package/public/notes/2.html +37 -0
  148. package/public/notes/2.png +0 -0
  149. package/public/notes/3.html +37 -0
  150. package/public/notes/4.html +105 -0
  151. package/public/notes/6.html +33 -0
  152. package/public/notes/7.html +40 -0
  153. package/public/notes/8.html +19 -0
  154. package/public/notes/9.html +46 -0
  155. package/public/notes/advanced_formatting.html +91 -0
  156. package/public/notes/group_reply_strategy.html +63 -0
  157. package/public/notes/message_sound.html +33 -0
  158. package/public/notes/multigen.html +36 -0
  159. package/public/notes/oai_api_key.html +37 -0
  160. package/public/notes/textgen_streaming.html +29 -0
  161. package/public/notes/token-limits.html +68 -0
  162. package/public/script.js +5131 -0
  163. package/public/scripts/RossAscends-mods.js +750 -0
  164. package/public/scripts/bookmarks.js +130 -0
  165. package/public/scripts/extensions/backgrounds/index.js +129 -0
  166. package/public/scripts/extensions/backgrounds/manifest.json +11 -0
  167. package/public/scripts/extensions/backgrounds/style.css +45 -0
  168. package/public/scripts/extensions/caption/index.js +117 -0
  169. package/public/scripts/extensions/caption/manifest.json +13 -0
  170. package/public/scripts/extensions/caption/style.css +23 -0
  171. package/public/scripts/extensions/dice/droll.js +108 -0
  172. package/public/scripts/extensions/dice/index.js +96 -0
  173. package/public/scripts/extensions/dice/manifest.json +11 -0
  174. package/public/scripts/extensions/dice/style.css +26 -0
  175. package/public/scripts/extensions/expressions/index.js +387 -0
  176. package/public/scripts/extensions/expressions/manifest.json +13 -0
  177. package/public/scripts/extensions/expressions/style.css +115 -0
  178. package/public/scripts/extensions/floating-prompt/index.js +151 -0
  179. package/public/scripts/extensions/floating-prompt/manifest.json +11 -0
  180. package/public/scripts/extensions/floating-prompt/style.css +19 -0
  181. package/public/scripts/extensions/memory/index.js +358 -0
  182. package/public/scripts/extensions/memory/manifest.json +13 -0
  183. package/public/scripts/extensions/memory/style.css +34 -0
  184. package/public/scripts/extensions.js +288 -0
  185. package/public/scripts/f-localStorage.js +27 -0
  186. package/public/scripts/gpt-2-3-tokenizer/README.md +28 -0
  187. package/public/scripts/gpt-2-3-tokenizer/encoder.js +1 -0
  188. package/public/scripts/gpt-2-3-tokenizer/mod.js +169 -0
  189. package/public/scripts/gpt-2-3-tokenizer/vocab.bpe.js +1 -0
  190. package/public/scripts/gpt-3-tokenizer/array-keyed-map.js +210 -0
  191. package/public/scripts/gpt-3-tokenizer/gpt3-tokenizer.js +271 -0
  192. package/public/scripts/gpt-3-tokenizer/gpt3-tokenizer.js.map +1 -0
  193. package/public/scripts/group-chats.js +899 -0
  194. package/public/scripts/horde.js +214 -0
  195. package/public/scripts/jquery-3.5.1.min.js +2 -0
  196. package/public/scripts/jquery-cookie-1.4.1.min.js +2 -0
  197. package/public/scripts/jquery.transit.min.js +1 -0
  198. package/public/scripts/kai-settings.js +179 -0
  199. package/public/scripts/nai-settings.js +108 -0
  200. package/public/scripts/openai.js +973 -0
  201. package/public/scripts/poe.js +360 -0
  202. package/public/scripts/popper.js +2008 -0
  203. package/public/scripts/popper.js.map +1 -0
  204. package/public/scripts/power-user.js +571 -0
  205. package/public/scripts/purify.min.js +3 -0
  206. package/public/scripts/purify.min.js.map +1 -0
  207. package/public/scripts/showdown.min.js +3 -0
  208. package/public/scripts/showdown.min.js.map +1 -0
  209. package/public/scripts/swiped-events.js +165 -0
  210. package/public/scripts/textgen-settings.js +194 -0
  211. package/public/scripts/toolcool-color-picker.js +87 -0
  212. package/public/scripts/utils.js +109 -0
  213. package/public/scripts/world-info.js +661 -0
  214. package/public/sounds/message.mp3 +0 -0
  215. package/public/style.css +3633 -0
  216. package/public/webfonts/NotoSans/NotoSans-Black.woff +0 -0
  217. package/public/webfonts/NotoSans/NotoSans-Black.woff2 +0 -0
  218. package/public/webfonts/NotoSans/NotoSans-BlackItalic.woff +0 -0
  219. package/public/webfonts/NotoSans/NotoSans-BlackItalic.woff2 +0 -0
  220. package/public/webfonts/NotoSans/NotoSans-Bold.woff +0 -0
  221. package/public/webfonts/NotoSans/NotoSans-Bold.woff2 +0 -0
  222. package/public/webfonts/NotoSans/NotoSans-BoldItalic.woff +0 -0
  223. package/public/webfonts/NotoSans/NotoSans-BoldItalic.woff2 +0 -0
  224. package/public/webfonts/NotoSans/NotoSans-ExtraBold.woff +0 -0
  225. package/public/webfonts/NotoSans/NotoSans-ExtraBold.woff2 +0 -0
  226. package/public/webfonts/NotoSans/NotoSans-ExtraBoldItalic.woff +0 -0
  227. package/public/webfonts/NotoSans/NotoSans-ExtraBoldItalic.woff2 +0 -0
  228. package/public/webfonts/NotoSans/NotoSans-ExtraLight.woff +0 -0
  229. package/public/webfonts/NotoSans/NotoSans-ExtraLight.woff2 +0 -0
  230. package/public/webfonts/NotoSans/NotoSans-ExtraLightItalic.woff +0 -0
  231. package/public/webfonts/NotoSans/NotoSans-ExtraLightItalic.woff2 +0 -0
  232. package/public/webfonts/NotoSans/NotoSans-Italic.woff +0 -0
  233. package/public/webfonts/NotoSans/NotoSans-Italic.woff2 +0 -0
  234. package/public/webfonts/NotoSans/NotoSans-Light.woff +0 -0
  235. package/public/webfonts/NotoSans/NotoSans-Light.woff2 +0 -0
  236. package/public/webfonts/NotoSans/NotoSans-LightItalic.woff +0 -0
  237. package/public/webfonts/NotoSans/NotoSans-LightItalic.woff2 +0 -0
  238. package/public/webfonts/NotoSans/NotoSans-Medium.woff +0 -0
  239. package/public/webfonts/NotoSans/NotoSans-Medium.woff2 +0 -0
  240. package/public/webfonts/NotoSans/NotoSans-MediumItalic.woff +0 -0
  241. package/public/webfonts/NotoSans/NotoSans-MediumItalic.woff2 +0 -0
  242. package/public/webfonts/NotoSans/NotoSans-Regular.woff +0 -0
  243. package/public/webfonts/NotoSans/NotoSans-Regular.woff2 +0 -0
  244. package/public/webfonts/NotoSans/NotoSans-SemiBold.woff +0 -0
  245. package/public/webfonts/NotoSans/NotoSans-SemiBold.woff2 +0 -0
  246. package/public/webfonts/NotoSans/NotoSans-SemiBoldItalic.woff +0 -0
  247. package/public/webfonts/NotoSans/NotoSans-SemiBoldItalic.woff2 +0 -0
  248. package/public/webfonts/NotoSans/NotoSans-Thin.woff +0 -0
  249. package/public/webfonts/NotoSans/NotoSans-Thin.woff2 +0 -0
  250. package/public/webfonts/NotoSans/NotoSans-ThinItalic.woff +0 -0
  251. package/public/webfonts/NotoSans/NotoSans-ThinItalic.woff2 +0 -0
  252. package/public/webfonts/NotoSans/stylesheet.css +162 -0
  253. package/public/webfonts/fa-solid-900.ttf +0 -0
  254. package/public/webfonts/fa-solid-900.woff2 +0 -0
  255. package/readme.md +187 -0
  256. package/server.js +2593 -0
  257. package/start.sh +24 -0
  258. package/tools/charaverter/main.mjs +110 -0
  259. package/tools/charaverter/package.json +10 -0
@@ -0,0 +1,2008 @@
1
+ /**
2
+ * @popperjs/core v2.11.6 - 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) {
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 format(str) {
448
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
449
+ args[_key - 1] = arguments[_key];
450
+ }
451
+
452
+ return [].concat(args).reduce(function (p, c) {
453
+ return p.replace(/%s/, c);
454
+ }, str);
455
+ }
456
+
457
+ var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
458
+ var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available';
459
+ var VALID_PROPERTIES = ['name', 'enabled', 'phase', 'fn', 'effect', 'requires', 'options'];
460
+ function validateModifiers(modifiers) {
461
+ modifiers.forEach(function (modifier) {
462
+ [].concat(Object.keys(modifier), VALID_PROPERTIES) // IE11-compatible replacement for `new Set(iterable)`
463
+ .filter(function (value, index, self) {
464
+ return self.indexOf(value) === index;
465
+ }).forEach(function (key) {
466
+ switch (key) {
467
+ case 'name':
468
+ if (typeof modifier.name !== 'string') {
469
+ console.error(format(INVALID_MODIFIER_ERROR, String(modifier.name), '"name"', '"string"', "\"" + String(modifier.name) + "\""));
470
+ }
471
+
472
+ break;
473
+
474
+ case 'enabled':
475
+ if (typeof modifier.enabled !== 'boolean') {
476
+ console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', "\"" + String(modifier.enabled) + "\""));
477
+ }
478
+
479
+ break;
480
+
481
+ case 'phase':
482
+ if (modifierPhases.indexOf(modifier.phase) < 0) {
483
+ console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases.join(', '), "\"" + String(modifier.phase) + "\""));
484
+ }
485
+
486
+ break;
487
+
488
+ case 'fn':
489
+ if (typeof modifier.fn !== 'function') {
490
+ console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', "\"" + String(modifier.fn) + "\""));
491
+ }
492
+
493
+ break;
494
+
495
+ case 'effect':
496
+ if (modifier.effect != null && typeof modifier.effect !== 'function') {
497
+ console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', "\"" + String(modifier.fn) + "\""));
498
+ }
499
+
500
+ break;
501
+
502
+ case 'requires':
503
+ if (modifier.requires != null && !Array.isArray(modifier.requires)) {
504
+ console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', "\"" + String(modifier.requires) + "\""));
505
+ }
506
+
507
+ break;
508
+
509
+ case 'requiresIfExists':
510
+ if (!Array.isArray(modifier.requiresIfExists)) {
511
+ console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', "\"" + String(modifier.requiresIfExists) + "\""));
512
+ }
513
+
514
+ break;
515
+
516
+ case 'options':
517
+ case 'data':
518
+ break;
519
+
520
+ default:
521
+ console.error("PopperJS: an invalid property has been provided to the \"" + modifier.name + "\" modifier, valid properties are " + VALID_PROPERTIES.map(function (s) {
522
+ return "\"" + s + "\"";
523
+ }).join(', ') + "; but \"" + key + "\" was provided.");
524
+ }
525
+
526
+ modifier.requires && modifier.requires.forEach(function (requirement) {
527
+ if (modifiers.find(function (mod) {
528
+ return mod.name === requirement;
529
+ }) == null) {
530
+ console.error(format(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement));
531
+ }
532
+ });
533
+ });
534
+ });
535
+ }
536
+
537
+ function uniqueBy(arr, fn) {
538
+ var identifiers = new Set();
539
+ return arr.filter(function (item) {
540
+ var identifier = fn(item);
541
+
542
+ if (!identifiers.has(identifier)) {
543
+ identifiers.add(identifier);
544
+ return true;
545
+ }
546
+ });
547
+ }
548
+
549
+ function getBasePlacement(placement) {
550
+ return placement.split('-')[0];
551
+ }
552
+
553
+ function mergeByName(modifiers) {
554
+ var merged = modifiers.reduce(function (merged, current) {
555
+ var existing = merged[current.name];
556
+ merged[current.name] = existing ? Object.assign({}, existing, current, {
557
+ options: Object.assign({}, existing.options, current.options),
558
+ data: Object.assign({}, existing.data, current.data)
559
+ }) : current;
560
+ return merged;
561
+ }, {}); // IE11 does not support Object.values
562
+
563
+ return Object.keys(merged).map(function (key) {
564
+ return merged[key];
565
+ });
566
+ }
567
+
568
+ function getViewportRect(element, strategy) {
569
+ var win = getWindow(element);
570
+ var html = getDocumentElement(element);
571
+ var visualViewport = win.visualViewport;
572
+ var width = html.clientWidth;
573
+ var height = html.clientHeight;
574
+ var x = 0;
575
+ var y = 0;
576
+
577
+ if (visualViewport) {
578
+ width = visualViewport.width;
579
+ height = visualViewport.height;
580
+ var layoutViewport = isLayoutViewport();
581
+
582
+ if (layoutViewport || !layoutViewport && strategy === 'fixed') {
583
+ x = visualViewport.offsetLeft;
584
+ y = visualViewport.offsetTop;
585
+ }
586
+ }
587
+
588
+ return {
589
+ width: width,
590
+ height: height,
591
+ x: x + getWindowScrollBarX(element),
592
+ y: y
593
+ };
594
+ }
595
+
596
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable
597
+
598
+ function getDocumentRect(element) {
599
+ var _element$ownerDocumen;
600
+
601
+ var html = getDocumentElement(element);
602
+ var winScroll = getWindowScroll(element);
603
+ var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
604
+ var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
605
+ var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
606
+ var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
607
+ var y = -winScroll.scrollTop;
608
+
609
+ if (getComputedStyle(body || html).direction === 'rtl') {
610
+ x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
611
+ }
612
+
613
+ return {
614
+ width: width,
615
+ height: height,
616
+ x: x,
617
+ y: y
618
+ };
619
+ }
620
+
621
+ function contains(parent, child) {
622
+ var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
623
+
624
+ if (parent.contains(child)) {
625
+ return true;
626
+ } // then fallback to custom implementation with Shadow DOM support
627
+ else if (rootNode && isShadowRoot(rootNode)) {
628
+ var next = child;
629
+
630
+ do {
631
+ if (next && parent.isSameNode(next)) {
632
+ return true;
633
+ } // $FlowFixMe[prop-missing]: need a better way to handle this...
634
+
635
+
636
+ next = next.parentNode || next.host;
637
+ } while (next);
638
+ } // Give up, the result is false
639
+
640
+
641
+ return false;
642
+ }
643
+
644
+ function rectToClientRect(rect) {
645
+ return Object.assign({}, rect, {
646
+ left: rect.x,
647
+ top: rect.y,
648
+ right: rect.x + rect.width,
649
+ bottom: rect.y + rect.height
650
+ });
651
+ }
652
+
653
+ function getInnerBoundingClientRect(element, strategy) {
654
+ var rect = getBoundingClientRect(element, false, strategy === 'fixed');
655
+ rect.top = rect.top + element.clientTop;
656
+ rect.left = rect.left + element.clientLeft;
657
+ rect.bottom = rect.top + element.clientHeight;
658
+ rect.right = rect.left + element.clientWidth;
659
+ rect.width = element.clientWidth;
660
+ rect.height = element.clientHeight;
661
+ rect.x = rect.left;
662
+ rect.y = rect.top;
663
+ return rect;
664
+ }
665
+
666
+ function getClientRectFromMixedType(element, clippingParent, strategy) {
667
+ return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
668
+ } // A "clipping parent" is an overflowable container with the characteristic of
669
+ // clipping (or hiding) overflowing elements with a position different from
670
+ // `initial`
671
+
672
+
673
+ function getClippingParents(element) {
674
+ var clippingParents = listScrollParents(getParentNode(element));
675
+ var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;
676
+ var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
677
+
678
+ if (!isElement(clipperElement)) {
679
+ return [];
680
+ } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
681
+
682
+
683
+ return clippingParents.filter(function (clippingParent) {
684
+ return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
685
+ });
686
+ } // Gets the maximum area that the element is visible in due to any number of
687
+ // clipping parents
688
+
689
+
690
+ function getClippingRect(element, boundary, rootBoundary, strategy) {
691
+ var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
692
+ var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
693
+ var firstClippingParent = clippingParents[0];
694
+ var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
695
+ var rect = getClientRectFromMixedType(element, clippingParent, strategy);
696
+ accRect.top = max(rect.top, accRect.top);
697
+ accRect.right = min(rect.right, accRect.right);
698
+ accRect.bottom = min(rect.bottom, accRect.bottom);
699
+ accRect.left = max(rect.left, accRect.left);
700
+ return accRect;
701
+ }, getClientRectFromMixedType(element, firstClippingParent, strategy));
702
+ clippingRect.width = clippingRect.right - clippingRect.left;
703
+ clippingRect.height = clippingRect.bottom - clippingRect.top;
704
+ clippingRect.x = clippingRect.left;
705
+ clippingRect.y = clippingRect.top;
706
+ return clippingRect;
707
+ }
708
+
709
+ function getVariation(placement) {
710
+ return placement.split('-')[1];
711
+ }
712
+
713
+ function getMainAxisFromPlacement(placement) {
714
+ return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
715
+ }
716
+
717
+ function computeOffsets(_ref) {
718
+ var reference = _ref.reference,
719
+ element = _ref.element,
720
+ placement = _ref.placement;
721
+ var basePlacement = placement ? getBasePlacement(placement) : null;
722
+ var variation = placement ? getVariation(placement) : null;
723
+ var commonX = reference.x + reference.width / 2 - element.width / 2;
724
+ var commonY = reference.y + reference.height / 2 - element.height / 2;
725
+ var offsets;
726
+
727
+ switch (basePlacement) {
728
+ case top:
729
+ offsets = {
730
+ x: commonX,
731
+ y: reference.y - element.height
732
+ };
733
+ break;
734
+
735
+ case bottom:
736
+ offsets = {
737
+ x: commonX,
738
+ y: reference.y + reference.height
739
+ };
740
+ break;
741
+
742
+ case right:
743
+ offsets = {
744
+ x: reference.x + reference.width,
745
+ y: commonY
746
+ };
747
+ break;
748
+
749
+ case left:
750
+ offsets = {
751
+ x: reference.x - element.width,
752
+ y: commonY
753
+ };
754
+ break;
755
+
756
+ default:
757
+ offsets = {
758
+ x: reference.x,
759
+ y: reference.y
760
+ };
761
+ }
762
+
763
+ var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
764
+
765
+ if (mainAxis != null) {
766
+ var len = mainAxis === 'y' ? 'height' : 'width';
767
+
768
+ switch (variation) {
769
+ case start:
770
+ offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
771
+ break;
772
+
773
+ case end:
774
+ offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
775
+ break;
776
+ }
777
+ }
778
+
779
+ return offsets;
780
+ }
781
+
782
+ function getFreshSideObject() {
783
+ return {
784
+ top: 0,
785
+ right: 0,
786
+ bottom: 0,
787
+ left: 0
788
+ };
789
+ }
790
+
791
+ function mergePaddingObject(paddingObject) {
792
+ return Object.assign({}, getFreshSideObject(), paddingObject);
793
+ }
794
+
795
+ function expandToHashMap(value, keys) {
796
+ return keys.reduce(function (hashMap, key) {
797
+ hashMap[key] = value;
798
+ return hashMap;
799
+ }, {});
800
+ }
801
+
802
+ function detectOverflow(state, options) {
803
+ if (options === void 0) {
804
+ options = {};
805
+ }
806
+
807
+ var _options = options,
808
+ _options$placement = _options.placement,
809
+ placement = _options$placement === void 0 ? state.placement : _options$placement,
810
+ _options$strategy = _options.strategy,
811
+ strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,
812
+ _options$boundary = _options.boundary,
813
+ boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
814
+ _options$rootBoundary = _options.rootBoundary,
815
+ rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
816
+ _options$elementConte = _options.elementContext,
817
+ elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
818
+ _options$altBoundary = _options.altBoundary,
819
+ altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
820
+ _options$padding = _options.padding,
821
+ padding = _options$padding === void 0 ? 0 : _options$padding;
822
+ var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
823
+ var altContext = elementContext === popper ? reference : popper;
824
+ var popperRect = state.rects.popper;
825
+ var element = state.elements[altBoundary ? altContext : elementContext];
826
+ var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
827
+ var referenceClientRect = getBoundingClientRect(state.elements.reference);
828
+ var popperOffsets = computeOffsets({
829
+ reference: referenceClientRect,
830
+ element: popperRect,
831
+ strategy: 'absolute',
832
+ placement: placement
833
+ });
834
+ var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
835
+ var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
836
+ // 0 or negative = within the clipping rect
837
+
838
+ var overflowOffsets = {
839
+ top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
840
+ bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
841
+ left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
842
+ right: elementClientRect.right - clippingClientRect.right + paddingObject.right
843
+ };
844
+ var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element
845
+
846
+ if (elementContext === popper && offsetData) {
847
+ var offset = offsetData[placement];
848
+ Object.keys(overflowOffsets).forEach(function (key) {
849
+ var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
850
+ var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
851
+ overflowOffsets[key] += offset[axis] * multiply;
852
+ });
853
+ }
854
+
855
+ return overflowOffsets;
856
+ }
857
+
858
+ var INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.';
859
+ var INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.';
860
+ var DEFAULT_OPTIONS = {
861
+ placement: 'bottom',
862
+ modifiers: [],
863
+ strategy: 'absolute'
864
+ };
865
+
866
+ function areValidElements() {
867
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
868
+ args[_key] = arguments[_key];
869
+ }
870
+
871
+ return !args.some(function (element) {
872
+ return !(element && typeof element.getBoundingClientRect === 'function');
873
+ });
874
+ }
875
+
876
+ function popperGenerator(generatorOptions) {
877
+ if (generatorOptions === void 0) {
878
+ generatorOptions = {};
879
+ }
880
+
881
+ var _generatorOptions = generatorOptions,
882
+ _generatorOptions$def = _generatorOptions.defaultModifiers,
883
+ defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
884
+ _generatorOptions$def2 = _generatorOptions.defaultOptions,
885
+ defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
886
+ return function createPopper(reference, popper, options) {
887
+ if (options === void 0) {
888
+ options = defaultOptions;
889
+ }
890
+
891
+ var state = {
892
+ placement: 'bottom',
893
+ orderedModifiers: [],
894
+ options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
895
+ modifiersData: {},
896
+ elements: {
897
+ reference: reference,
898
+ popper: popper
899
+ },
900
+ attributes: {},
901
+ styles: {}
902
+ };
903
+ var effectCleanupFns = [];
904
+ var isDestroyed = false;
905
+ var instance = {
906
+ state: state,
907
+ setOptions: function setOptions(setOptionsAction) {
908
+ var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
909
+ cleanupModifierEffects();
910
+ state.options = Object.assign({}, defaultOptions, state.options, options);
911
+ state.scrollParents = {
912
+ reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
913
+ popper: listScrollParents(popper)
914
+ }; // Orders the modifiers based on their dependencies and `phase`
915
+ // properties
916
+
917
+ var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
918
+
919
+ state.orderedModifiers = orderedModifiers.filter(function (m) {
920
+ return m.enabled;
921
+ }); // Validate the provided modifiers so that the consumer will get warned
922
+ // if one of the modifiers is invalid for any reason
923
+
924
+ {
925
+ var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function (_ref) {
926
+ var name = _ref.name;
927
+ return name;
928
+ });
929
+ validateModifiers(modifiers);
930
+
931
+ if (getBasePlacement(state.options.placement) === auto) {
932
+ var flipModifier = state.orderedModifiers.find(function (_ref2) {
933
+ var name = _ref2.name;
934
+ return name === 'flip';
935
+ });
936
+
937
+ if (!flipModifier) {
938
+ console.error(['Popper: "auto" placements require the "flip" modifier be', 'present and enabled to work.'].join(' '));
939
+ }
940
+ }
941
+
942
+ var _getComputedStyle = getComputedStyle(popper),
943
+ marginTop = _getComputedStyle.marginTop,
944
+ marginRight = _getComputedStyle.marginRight,
945
+ marginBottom = _getComputedStyle.marginBottom,
946
+ marginLeft = _getComputedStyle.marginLeft; // We no longer take into account `margins` on the popper, and it can
947
+ // cause bugs with positioning, so we'll warn the consumer
948
+
949
+
950
+ if ([marginTop, marginRight, marginBottom, marginLeft].some(function (margin) {
951
+ return parseFloat(margin);
952
+ })) {
953
+ console.warn(['Popper: CSS "margin" styles cannot be used to apply padding', 'between the popper and its reference element or boundary.', 'To replicate margin, use the `offset` modifier, as well as', 'the `padding` option in the `preventOverflow` and `flip`', 'modifiers.'].join(' '));
954
+ }
955
+ }
956
+
957
+ runModifierEffects();
958
+ return instance.update();
959
+ },
960
+ // Sync update – it will always be executed, even if not necessary. This
961
+ // is useful for low frequency updates where sync behavior simplifies the
962
+ // logic.
963
+ // For high frequency updates (e.g. `resize` and `scroll` events), always
964
+ // prefer the async Popper#update method
965
+ forceUpdate: function forceUpdate() {
966
+ if (isDestroyed) {
967
+ return;
968
+ }
969
+
970
+ var _state$elements = state.elements,
971
+ reference = _state$elements.reference,
972
+ popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
973
+ // anymore
974
+
975
+ if (!areValidElements(reference, popper)) {
976
+ {
977
+ console.error(INVALID_ELEMENT_ERROR);
978
+ }
979
+
980
+ return;
981
+ } // Store the reference and popper rects to be read by modifiers
982
+
983
+
984
+ state.rects = {
985
+ reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
986
+ popper: getLayoutRect(popper)
987
+ }; // Modifiers have the ability to reset the current update cycle. The
988
+ // most common use case for this is the `flip` modifier changing the
989
+ // placement, which then needs to re-run all the modifiers, because the
990
+ // logic was previously ran for the previous placement and is therefore
991
+ // stale/incorrect
992
+
993
+ state.reset = false;
994
+ state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
995
+ // is filled with the initial data specified by the modifier. This means
996
+ // it doesn't persist and is fresh on each update.
997
+ // To ensure persistent data, use `${name}#persistent`
998
+
999
+ state.orderedModifiers.forEach(function (modifier) {
1000
+ return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
1001
+ });
1002
+ var __debug_loops__ = 0;
1003
+
1004
+ for (var index = 0; index < state.orderedModifiers.length; index++) {
1005
+ {
1006
+ __debug_loops__ += 1;
1007
+
1008
+ if (__debug_loops__ > 100) {
1009
+ console.error(INFINITE_LOOP_ERROR);
1010
+ break;
1011
+ }
1012
+ }
1013
+
1014
+ if (state.reset === true) {
1015
+ state.reset = false;
1016
+ index = -1;
1017
+ continue;
1018
+ }
1019
+
1020
+ var _state$orderedModifie = state.orderedModifiers[index],
1021
+ fn = _state$orderedModifie.fn,
1022
+ _state$orderedModifie2 = _state$orderedModifie.options,
1023
+ _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
1024
+ name = _state$orderedModifie.name;
1025
+
1026
+ if (typeof fn === 'function') {
1027
+ state = fn({
1028
+ state: state,
1029
+ options: _options,
1030
+ name: name,
1031
+ instance: instance
1032
+ }) || state;
1033
+ }
1034
+ }
1035
+ },
1036
+ // Async and optimistically optimized update – it will not be executed if
1037
+ // not necessary (debounced to run at most once-per-tick)
1038
+ update: debounce(function () {
1039
+ return new Promise(function (resolve) {
1040
+ instance.forceUpdate();
1041
+ resolve(state);
1042
+ });
1043
+ }),
1044
+ destroy: function destroy() {
1045
+ cleanupModifierEffects();
1046
+ isDestroyed = true;
1047
+ }
1048
+ };
1049
+
1050
+ if (!areValidElements(reference, popper)) {
1051
+ {
1052
+ console.error(INVALID_ELEMENT_ERROR);
1053
+ }
1054
+
1055
+ return instance;
1056
+ }
1057
+
1058
+ instance.setOptions(options).then(function (state) {
1059
+ if (!isDestroyed && options.onFirstUpdate) {
1060
+ options.onFirstUpdate(state);
1061
+ }
1062
+ }); // Modifiers have the ability to execute arbitrary code before the first
1063
+ // update cycle runs. They will be executed in the same order as the update
1064
+ // cycle. This is useful when a modifier adds some persistent data that
1065
+ // other modifiers need to use, but the modifier is run after the dependent
1066
+ // one.
1067
+
1068
+ function runModifierEffects() {
1069
+ state.orderedModifiers.forEach(function (_ref3) {
1070
+ var name = _ref3.name,
1071
+ _ref3$options = _ref3.options,
1072
+ options = _ref3$options === void 0 ? {} : _ref3$options,
1073
+ effect = _ref3.effect;
1074
+
1075
+ if (typeof effect === 'function') {
1076
+ var cleanupFn = effect({
1077
+ state: state,
1078
+ name: name,
1079
+ instance: instance,
1080
+ options: options
1081
+ });
1082
+
1083
+ var noopFn = function noopFn() {};
1084
+
1085
+ effectCleanupFns.push(cleanupFn || noopFn);
1086
+ }
1087
+ });
1088
+ }
1089
+
1090
+ function cleanupModifierEffects() {
1091
+ effectCleanupFns.forEach(function (fn) {
1092
+ return fn();
1093
+ });
1094
+ effectCleanupFns = [];
1095
+ }
1096
+
1097
+ return instance;
1098
+ };
1099
+ }
1100
+
1101
+ var passive = {
1102
+ passive: true
1103
+ };
1104
+
1105
+ function effect$2(_ref) {
1106
+ var state = _ref.state,
1107
+ instance = _ref.instance,
1108
+ options = _ref.options;
1109
+ var _options$scroll = options.scroll,
1110
+ scroll = _options$scroll === void 0 ? true : _options$scroll,
1111
+ _options$resize = options.resize,
1112
+ resize = _options$resize === void 0 ? true : _options$resize;
1113
+ var window = getWindow(state.elements.popper);
1114
+ var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
1115
+
1116
+ if (scroll) {
1117
+ scrollParents.forEach(function (scrollParent) {
1118
+ scrollParent.addEventListener('scroll', instance.update, passive);
1119
+ });
1120
+ }
1121
+
1122
+ if (resize) {
1123
+ window.addEventListener('resize', instance.update, passive);
1124
+ }
1125
+
1126
+ return function () {
1127
+ if (scroll) {
1128
+ scrollParents.forEach(function (scrollParent) {
1129
+ scrollParent.removeEventListener('scroll', instance.update, passive);
1130
+ });
1131
+ }
1132
+
1133
+ if (resize) {
1134
+ window.removeEventListener('resize', instance.update, passive);
1135
+ }
1136
+ };
1137
+ } // eslint-disable-next-line import/no-unused-modules
1138
+
1139
+
1140
+ var eventListeners = {
1141
+ name: 'eventListeners',
1142
+ enabled: true,
1143
+ phase: 'write',
1144
+ fn: function fn() {},
1145
+ effect: effect$2,
1146
+ data: {}
1147
+ };
1148
+
1149
+ function popperOffsets(_ref) {
1150
+ var state = _ref.state,
1151
+ name = _ref.name;
1152
+ // Offsets are the actual position the popper needs to have to be
1153
+ // properly positioned near its reference element
1154
+ // This is the most basic placement, and will be adjusted by
1155
+ // the modifiers in the next step
1156
+ state.modifiersData[name] = computeOffsets({
1157
+ reference: state.rects.reference,
1158
+ element: state.rects.popper,
1159
+ strategy: 'absolute',
1160
+ placement: state.placement
1161
+ });
1162
+ } // eslint-disable-next-line import/no-unused-modules
1163
+
1164
+
1165
+ var popperOffsets$1 = {
1166
+ name: 'popperOffsets',
1167
+ enabled: true,
1168
+ phase: 'read',
1169
+ fn: popperOffsets,
1170
+ data: {}
1171
+ };
1172
+
1173
+ var unsetSides = {
1174
+ top: 'auto',
1175
+ right: 'auto',
1176
+ bottom: 'auto',
1177
+ left: 'auto'
1178
+ }; // Round the offsets to the nearest suitable subpixel based on the DPR.
1179
+ // Zooming can change the DPR, but it seems to report a value that will
1180
+ // cleanly divide the values into the appropriate subpixels.
1181
+
1182
+ function roundOffsetsByDPR(_ref) {
1183
+ var x = _ref.x,
1184
+ y = _ref.y;
1185
+ var win = window;
1186
+ var dpr = win.devicePixelRatio || 1;
1187
+ return {
1188
+ x: round(x * dpr) / dpr || 0,
1189
+ y: round(y * dpr) / dpr || 0
1190
+ };
1191
+ }
1192
+
1193
+ function mapToStyles(_ref2) {
1194
+ var _Object$assign2;
1195
+
1196
+ var popper = _ref2.popper,
1197
+ popperRect = _ref2.popperRect,
1198
+ placement = _ref2.placement,
1199
+ variation = _ref2.variation,
1200
+ offsets = _ref2.offsets,
1201
+ position = _ref2.position,
1202
+ gpuAcceleration = _ref2.gpuAcceleration,
1203
+ adaptive = _ref2.adaptive,
1204
+ roundOffsets = _ref2.roundOffsets,
1205
+ isFixed = _ref2.isFixed;
1206
+ var _offsets$x = offsets.x,
1207
+ x = _offsets$x === void 0 ? 0 : _offsets$x,
1208
+ _offsets$y = offsets.y,
1209
+ y = _offsets$y === void 0 ? 0 : _offsets$y;
1210
+
1211
+ var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
1212
+ x: x,
1213
+ y: y
1214
+ }) : {
1215
+ x: x,
1216
+ y: y
1217
+ };
1218
+
1219
+ x = _ref3.x;
1220
+ y = _ref3.y;
1221
+ var hasX = offsets.hasOwnProperty('x');
1222
+ var hasY = offsets.hasOwnProperty('y');
1223
+ var sideX = left;
1224
+ var sideY = top;
1225
+ var win = window;
1226
+
1227
+ if (adaptive) {
1228
+ var offsetParent = getOffsetParent(popper);
1229
+ var heightProp = 'clientHeight';
1230
+ var widthProp = 'clientWidth';
1231
+
1232
+ if (offsetParent === getWindow(popper)) {
1233
+ offsetParent = getDocumentElement(popper);
1234
+
1235
+ if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {
1236
+ heightProp = 'scrollHeight';
1237
+ widthProp = 'scrollWidth';
1238
+ }
1239
+ } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
1240
+
1241
+
1242
+ offsetParent = offsetParent;
1243
+
1244
+ if (placement === top || (placement === left || placement === right) && variation === end) {
1245
+ sideY = bottom;
1246
+ var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
1247
+ offsetParent[heightProp];
1248
+ y -= offsetY - popperRect.height;
1249
+ y *= gpuAcceleration ? 1 : -1;
1250
+ }
1251
+
1252
+ if (placement === left || (placement === top || placement === bottom) && variation === end) {
1253
+ sideX = right;
1254
+ var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
1255
+ offsetParent[widthProp];
1256
+ x -= offsetX - popperRect.width;
1257
+ x *= gpuAcceleration ? 1 : -1;
1258
+ }
1259
+ }
1260
+
1261
+ var commonStyles = Object.assign({
1262
+ position: position
1263
+ }, adaptive && unsetSides);
1264
+
1265
+ var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
1266
+ x: x,
1267
+ y: y
1268
+ }) : {
1269
+ x: x,
1270
+ y: y
1271
+ };
1272
+
1273
+ x = _ref4.x;
1274
+ y = _ref4.y;
1275
+
1276
+ if (gpuAcceleration) {
1277
+ var _Object$assign;
1278
+
1279
+ 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));
1280
+ }
1281
+
1282
+ return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
1283
+ }
1284
+
1285
+ function computeStyles(_ref5) {
1286
+ var state = _ref5.state,
1287
+ options = _ref5.options;
1288
+ var _options$gpuAccelerat = options.gpuAcceleration,
1289
+ gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
1290
+ _options$adaptive = options.adaptive,
1291
+ adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
1292
+ _options$roundOffsets = options.roundOffsets,
1293
+ roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
1294
+
1295
+ {
1296
+ var transitionProperty = getComputedStyle(state.elements.popper).transitionProperty || '';
1297
+
1298
+ if (adaptive && ['transform', 'top', 'right', 'bottom', 'left'].some(function (property) {
1299
+ return transitionProperty.indexOf(property) >= 0;
1300
+ })) {
1301
+ console.warn(['Popper: Detected CSS transitions on at least one of the following', 'CSS properties: "transform", "top", "right", "bottom", "left".', '\n\n', 'Disable the "computeStyles" modifier\'s `adaptive` option to allow', 'for smooth transitions, or remove these properties from the CSS', 'transition declaration on the popper element if only transitioning', 'opacity or background-color for example.', '\n\n', 'We recommend using the popper element as a wrapper around an inner', 'element that can have any CSS property transitioned for animations.'].join(' '));
1302
+ }
1303
+ }
1304
+
1305
+ var commonStyles = {
1306
+ placement: getBasePlacement(state.placement),
1307
+ variation: getVariation(state.placement),
1308
+ popper: state.elements.popper,
1309
+ popperRect: state.rects.popper,
1310
+ gpuAcceleration: gpuAcceleration,
1311
+ isFixed: state.options.strategy === 'fixed'
1312
+ };
1313
+
1314
+ if (state.modifiersData.popperOffsets != null) {
1315
+ state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
1316
+ offsets: state.modifiersData.popperOffsets,
1317
+ position: state.options.strategy,
1318
+ adaptive: adaptive,
1319
+ roundOffsets: roundOffsets
1320
+ })));
1321
+ }
1322
+
1323
+ if (state.modifiersData.arrow != null) {
1324
+ state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
1325
+ offsets: state.modifiersData.arrow,
1326
+ position: 'absolute',
1327
+ adaptive: false,
1328
+ roundOffsets: roundOffsets
1329
+ })));
1330
+ }
1331
+
1332
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
1333
+ 'data-popper-placement': state.placement
1334
+ });
1335
+ } // eslint-disable-next-line import/no-unused-modules
1336
+
1337
+
1338
+ var computeStyles$1 = {
1339
+ name: 'computeStyles',
1340
+ enabled: true,
1341
+ phase: 'beforeWrite',
1342
+ fn: computeStyles,
1343
+ data: {}
1344
+ };
1345
+
1346
+ // and applies them to the HTMLElements such as popper and arrow
1347
+
1348
+ function applyStyles(_ref) {
1349
+ var state = _ref.state;
1350
+ Object.keys(state.elements).forEach(function (name) {
1351
+ var style = state.styles[name] || {};
1352
+ var attributes = state.attributes[name] || {};
1353
+ var element = state.elements[name]; // arrow is optional + virtual elements
1354
+
1355
+ if (!isHTMLElement(element) || !getNodeName(element)) {
1356
+ return;
1357
+ } // Flow doesn't support to extend this property, but it's the most
1358
+ // effective way to apply styles to an HTMLElement
1359
+ // $FlowFixMe[cannot-write]
1360
+
1361
+
1362
+ Object.assign(element.style, style);
1363
+ Object.keys(attributes).forEach(function (name) {
1364
+ var value = attributes[name];
1365
+
1366
+ if (value === false) {
1367
+ element.removeAttribute(name);
1368
+ } else {
1369
+ element.setAttribute(name, value === true ? '' : value);
1370
+ }
1371
+ });
1372
+ });
1373
+ }
1374
+
1375
+ function effect$1(_ref2) {
1376
+ var state = _ref2.state;
1377
+ var initialStyles = {
1378
+ popper: {
1379
+ position: state.options.strategy,
1380
+ left: '0',
1381
+ top: '0',
1382
+ margin: '0'
1383
+ },
1384
+ arrow: {
1385
+ position: 'absolute'
1386
+ },
1387
+ reference: {}
1388
+ };
1389
+ Object.assign(state.elements.popper.style, initialStyles.popper);
1390
+ state.styles = initialStyles;
1391
+
1392
+ if (state.elements.arrow) {
1393
+ Object.assign(state.elements.arrow.style, initialStyles.arrow);
1394
+ }
1395
+
1396
+ return function () {
1397
+ Object.keys(state.elements).forEach(function (name) {
1398
+ var element = state.elements[name];
1399
+ var attributes = state.attributes[name] || {};
1400
+ var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
1401
+
1402
+ var style = styleProperties.reduce(function (style, property) {
1403
+ style[property] = '';
1404
+ return style;
1405
+ }, {}); // arrow is optional + virtual elements
1406
+
1407
+ if (!isHTMLElement(element) || !getNodeName(element)) {
1408
+ return;
1409
+ }
1410
+
1411
+ Object.assign(element.style, style);
1412
+ Object.keys(attributes).forEach(function (attribute) {
1413
+ element.removeAttribute(attribute);
1414
+ });
1415
+ });
1416
+ };
1417
+ } // eslint-disable-next-line import/no-unused-modules
1418
+
1419
+
1420
+ var applyStyles$1 = {
1421
+ name: 'applyStyles',
1422
+ enabled: true,
1423
+ phase: 'write',
1424
+ fn: applyStyles,
1425
+ effect: effect$1,
1426
+ requires: ['computeStyles']
1427
+ };
1428
+
1429
+ function distanceAndSkiddingToXY(placement, rects, offset) {
1430
+ var basePlacement = getBasePlacement(placement);
1431
+ var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
1432
+
1433
+ var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
1434
+ placement: placement
1435
+ })) : offset,
1436
+ skidding = _ref[0],
1437
+ distance = _ref[1];
1438
+
1439
+ skidding = skidding || 0;
1440
+ distance = (distance || 0) * invertDistance;
1441
+ return [left, right].indexOf(basePlacement) >= 0 ? {
1442
+ x: distance,
1443
+ y: skidding
1444
+ } : {
1445
+ x: skidding,
1446
+ y: distance
1447
+ };
1448
+ }
1449
+
1450
+ function offset(_ref2) {
1451
+ var state = _ref2.state,
1452
+ options = _ref2.options,
1453
+ name = _ref2.name;
1454
+ var _options$offset = options.offset,
1455
+ offset = _options$offset === void 0 ? [0, 0] : _options$offset;
1456
+ var data = placements.reduce(function (acc, placement) {
1457
+ acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
1458
+ return acc;
1459
+ }, {});
1460
+ var _data$state$placement = data[state.placement],
1461
+ x = _data$state$placement.x,
1462
+ y = _data$state$placement.y;
1463
+
1464
+ if (state.modifiersData.popperOffsets != null) {
1465
+ state.modifiersData.popperOffsets.x += x;
1466
+ state.modifiersData.popperOffsets.y += y;
1467
+ }
1468
+
1469
+ state.modifiersData[name] = data;
1470
+ } // eslint-disable-next-line import/no-unused-modules
1471
+
1472
+
1473
+ var offset$1 = {
1474
+ name: 'offset',
1475
+ enabled: true,
1476
+ phase: 'main',
1477
+ requires: ['popperOffsets'],
1478
+ fn: offset
1479
+ };
1480
+
1481
+ var hash$1 = {
1482
+ left: 'right',
1483
+ right: 'left',
1484
+ bottom: 'top',
1485
+ top: 'bottom'
1486
+ };
1487
+ function getOppositePlacement(placement) {
1488
+ return placement.replace(/left|right|bottom|top/g, function (matched) {
1489
+ return hash$1[matched];
1490
+ });
1491
+ }
1492
+
1493
+ var hash = {
1494
+ start: 'end',
1495
+ end: 'start'
1496
+ };
1497
+ function getOppositeVariationPlacement(placement) {
1498
+ return placement.replace(/start|end/g, function (matched) {
1499
+ return hash[matched];
1500
+ });
1501
+ }
1502
+
1503
+ function computeAutoPlacement(state, options) {
1504
+ if (options === void 0) {
1505
+ options = {};
1506
+ }
1507
+
1508
+ var _options = options,
1509
+ placement = _options.placement,
1510
+ boundary = _options.boundary,
1511
+ rootBoundary = _options.rootBoundary,
1512
+ padding = _options.padding,
1513
+ flipVariations = _options.flipVariations,
1514
+ _options$allowedAutoP = _options.allowedAutoPlacements,
1515
+ allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
1516
+ var variation = getVariation(placement);
1517
+ var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
1518
+ return getVariation(placement) === variation;
1519
+ }) : basePlacements;
1520
+ var allowedPlacements = placements$1.filter(function (placement) {
1521
+ return allowedAutoPlacements.indexOf(placement) >= 0;
1522
+ });
1523
+
1524
+ if (allowedPlacements.length === 0) {
1525
+ allowedPlacements = placements$1;
1526
+
1527
+ {
1528
+ console.error(['Popper: The `allowedAutoPlacements` option did not allow any', 'placements. Ensure the `placement` option matches the variation', 'of the allowed placements.', 'For example, "auto" cannot be used to allow "bottom-start".', 'Use "auto-start" instead.'].join(' '));
1529
+ }
1530
+ } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
1531
+
1532
+
1533
+ var overflows = allowedPlacements.reduce(function (acc, placement) {
1534
+ acc[placement] = detectOverflow(state, {
1535
+ placement: placement,
1536
+ boundary: boundary,
1537
+ rootBoundary: rootBoundary,
1538
+ padding: padding
1539
+ })[getBasePlacement(placement)];
1540
+ return acc;
1541
+ }, {});
1542
+ return Object.keys(overflows).sort(function (a, b) {
1543
+ return overflows[a] - overflows[b];
1544
+ });
1545
+ }
1546
+
1547
+ function getExpandedFallbackPlacements(placement) {
1548
+ if (getBasePlacement(placement) === auto) {
1549
+ return [];
1550
+ }
1551
+
1552
+ var oppositePlacement = getOppositePlacement(placement);
1553
+ return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
1554
+ }
1555
+
1556
+ function flip(_ref) {
1557
+ var state = _ref.state,
1558
+ options = _ref.options,
1559
+ name = _ref.name;
1560
+
1561
+ if (state.modifiersData[name]._skip) {
1562
+ return;
1563
+ }
1564
+
1565
+ var _options$mainAxis = options.mainAxis,
1566
+ checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
1567
+ _options$altAxis = options.altAxis,
1568
+ checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,
1569
+ specifiedFallbackPlacements = options.fallbackPlacements,
1570
+ padding = options.padding,
1571
+ boundary = options.boundary,
1572
+ rootBoundary = options.rootBoundary,
1573
+ altBoundary = options.altBoundary,
1574
+ _options$flipVariatio = options.flipVariations,
1575
+ flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,
1576
+ allowedAutoPlacements = options.allowedAutoPlacements;
1577
+ var preferredPlacement = state.options.placement;
1578
+ var basePlacement = getBasePlacement(preferredPlacement);
1579
+ var isBasePlacement = basePlacement === preferredPlacement;
1580
+ var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
1581
+ var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {
1582
+ return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {
1583
+ placement: placement,
1584
+ boundary: boundary,
1585
+ rootBoundary: rootBoundary,
1586
+ padding: padding,
1587
+ flipVariations: flipVariations,
1588
+ allowedAutoPlacements: allowedAutoPlacements
1589
+ }) : placement);
1590
+ }, []);
1591
+ var referenceRect = state.rects.reference;
1592
+ var popperRect = state.rects.popper;
1593
+ var checksMap = new Map();
1594
+ var makeFallbackChecks = true;
1595
+ var firstFittingPlacement = placements[0];
1596
+
1597
+ for (var i = 0; i < placements.length; i++) {
1598
+ var placement = placements[i];
1599
+
1600
+ var _basePlacement = getBasePlacement(placement);
1601
+
1602
+ var isStartVariation = getVariation(placement) === start;
1603
+ var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
1604
+ var len = isVertical ? 'width' : 'height';
1605
+ var overflow = detectOverflow(state, {
1606
+ placement: placement,
1607
+ boundary: boundary,
1608
+ rootBoundary: rootBoundary,
1609
+ altBoundary: altBoundary,
1610
+ padding: padding
1611
+ });
1612
+ var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
1613
+
1614
+ if (referenceRect[len] > popperRect[len]) {
1615
+ mainVariationSide = getOppositePlacement(mainVariationSide);
1616
+ }
1617
+
1618
+ var altVariationSide = getOppositePlacement(mainVariationSide);
1619
+ var checks = [];
1620
+
1621
+ if (checkMainAxis) {
1622
+ checks.push(overflow[_basePlacement] <= 0);
1623
+ }
1624
+
1625
+ if (checkAltAxis) {
1626
+ checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
1627
+ }
1628
+
1629
+ if (checks.every(function (check) {
1630
+ return check;
1631
+ })) {
1632
+ firstFittingPlacement = placement;
1633
+ makeFallbackChecks = false;
1634
+ break;
1635
+ }
1636
+
1637
+ checksMap.set(placement, checks);
1638
+ }
1639
+
1640
+ if (makeFallbackChecks) {
1641
+ // `2` may be desired in some cases – research later
1642
+ var numberOfChecks = flipVariations ? 3 : 1;
1643
+
1644
+ var _loop = function _loop(_i) {
1645
+ var fittingPlacement = placements.find(function (placement) {
1646
+ var checks = checksMap.get(placement);
1647
+
1648
+ if (checks) {
1649
+ return checks.slice(0, _i).every(function (check) {
1650
+ return check;
1651
+ });
1652
+ }
1653
+ });
1654
+
1655
+ if (fittingPlacement) {
1656
+ firstFittingPlacement = fittingPlacement;
1657
+ return "break";
1658
+ }
1659
+ };
1660
+
1661
+ for (var _i = numberOfChecks; _i > 0; _i--) {
1662
+ var _ret = _loop(_i);
1663
+
1664
+ if (_ret === "break") break;
1665
+ }
1666
+ }
1667
+
1668
+ if (state.placement !== firstFittingPlacement) {
1669
+ state.modifiersData[name]._skip = true;
1670
+ state.placement = firstFittingPlacement;
1671
+ state.reset = true;
1672
+ }
1673
+ } // eslint-disable-next-line import/no-unused-modules
1674
+
1675
+
1676
+ var flip$1 = {
1677
+ name: 'flip',
1678
+ enabled: true,
1679
+ phase: 'main',
1680
+ fn: flip,
1681
+ requiresIfExists: ['offset'],
1682
+ data: {
1683
+ _skip: false
1684
+ }
1685
+ };
1686
+
1687
+ function getAltAxis(axis) {
1688
+ return axis === 'x' ? 'y' : 'x';
1689
+ }
1690
+
1691
+ function within(min$1, value, max$1) {
1692
+ return max(min$1, min(value, max$1));
1693
+ }
1694
+ function withinMaxClamp(min, value, max) {
1695
+ var v = within(min, value, max);
1696
+ return v > max ? max : v;
1697
+ }
1698
+
1699
+ function preventOverflow(_ref) {
1700
+ var state = _ref.state,
1701
+ options = _ref.options,
1702
+ name = _ref.name;
1703
+ var _options$mainAxis = options.mainAxis,
1704
+ checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
1705
+ _options$altAxis = options.altAxis,
1706
+ checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
1707
+ boundary = options.boundary,
1708
+ rootBoundary = options.rootBoundary,
1709
+ altBoundary = options.altBoundary,
1710
+ padding = options.padding,
1711
+ _options$tether = options.tether,
1712
+ tether = _options$tether === void 0 ? true : _options$tether,
1713
+ _options$tetherOffset = options.tetherOffset,
1714
+ tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
1715
+ var overflow = detectOverflow(state, {
1716
+ boundary: boundary,
1717
+ rootBoundary: rootBoundary,
1718
+ padding: padding,
1719
+ altBoundary: altBoundary
1720
+ });
1721
+ var basePlacement = getBasePlacement(state.placement);
1722
+ var variation = getVariation(state.placement);
1723
+ var isBasePlacement = !variation;
1724
+ var mainAxis = getMainAxisFromPlacement(basePlacement);
1725
+ var altAxis = getAltAxis(mainAxis);
1726
+ var popperOffsets = state.modifiersData.popperOffsets;
1727
+ var referenceRect = state.rects.reference;
1728
+ var popperRect = state.rects.popper;
1729
+ var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
1730
+ placement: state.placement
1731
+ })) : tetherOffset;
1732
+ var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
1733
+ mainAxis: tetherOffsetValue,
1734
+ altAxis: tetherOffsetValue
1735
+ } : Object.assign({
1736
+ mainAxis: 0,
1737
+ altAxis: 0
1738
+ }, tetherOffsetValue);
1739
+ var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
1740
+ var data = {
1741
+ x: 0,
1742
+ y: 0
1743
+ };
1744
+
1745
+ if (!popperOffsets) {
1746
+ return;
1747
+ }
1748
+
1749
+ if (checkMainAxis) {
1750
+ var _offsetModifierState$;
1751
+
1752
+ var mainSide = mainAxis === 'y' ? top : left;
1753
+ var altSide = mainAxis === 'y' ? bottom : right;
1754
+ var len = mainAxis === 'y' ? 'height' : 'width';
1755
+ var offset = popperOffsets[mainAxis];
1756
+ var min$1 = offset + overflow[mainSide];
1757
+ var max$1 = offset - overflow[altSide];
1758
+ var additive = tether ? -popperRect[len] / 2 : 0;
1759
+ var minLen = variation === start ? referenceRect[len] : popperRect[len];
1760
+ var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
1761
+ // outside the reference bounds
1762
+
1763
+ var arrowElement = state.elements.arrow;
1764
+ var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
1765
+ width: 0,
1766
+ height: 0
1767
+ };
1768
+ var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();
1769
+ var arrowPaddingMin = arrowPaddingObject[mainSide];
1770
+ var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want
1771
+ // to include its full size in the calculation. If the reference is small
1772
+ // and near the edge of a boundary, the popper can overflow even if the
1773
+ // reference is not overflowing as well (e.g. virtual elements with no
1774
+ // width or height)
1775
+
1776
+ var arrowLen = within(0, referenceRect[len], arrowRect[len]);
1777
+ var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
1778
+ var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
1779
+ var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
1780
+ var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
1781
+ var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
1782
+ var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
1783
+ var tetherMax = offset + maxOffset - offsetModifierValue;
1784
+ var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
1785
+ popperOffsets[mainAxis] = preventedOffset;
1786
+ data[mainAxis] = preventedOffset - offset;
1787
+ }
1788
+
1789
+ if (checkAltAxis) {
1790
+ var _offsetModifierState$2;
1791
+
1792
+ var _mainSide = mainAxis === 'x' ? top : left;
1793
+
1794
+ var _altSide = mainAxis === 'x' ? bottom : right;
1795
+
1796
+ var _offset = popperOffsets[altAxis];
1797
+
1798
+ var _len = altAxis === 'y' ? 'height' : 'width';
1799
+
1800
+ var _min = _offset + overflow[_mainSide];
1801
+
1802
+ var _max = _offset - overflow[_altSide];
1803
+
1804
+ var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
1805
+
1806
+ var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
1807
+
1808
+ var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
1809
+
1810
+ var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
1811
+
1812
+ var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
1813
+
1814
+ popperOffsets[altAxis] = _preventedOffset;
1815
+ data[altAxis] = _preventedOffset - _offset;
1816
+ }
1817
+
1818
+ state.modifiersData[name] = data;
1819
+ } // eslint-disable-next-line import/no-unused-modules
1820
+
1821
+
1822
+ var preventOverflow$1 = {
1823
+ name: 'preventOverflow',
1824
+ enabled: true,
1825
+ phase: 'main',
1826
+ fn: preventOverflow,
1827
+ requiresIfExists: ['offset']
1828
+ };
1829
+
1830
+ var toPaddingObject = function toPaddingObject(padding, state) {
1831
+ padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
1832
+ placement: state.placement
1833
+ })) : padding;
1834
+ return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
1835
+ };
1836
+
1837
+ function arrow(_ref) {
1838
+ var _state$modifiersData$;
1839
+
1840
+ var state = _ref.state,
1841
+ name = _ref.name,
1842
+ options = _ref.options;
1843
+ var arrowElement = state.elements.arrow;
1844
+ var popperOffsets = state.modifiersData.popperOffsets;
1845
+ var basePlacement = getBasePlacement(state.placement);
1846
+ var axis = getMainAxisFromPlacement(basePlacement);
1847
+ var isVertical = [left, right].indexOf(basePlacement) >= 0;
1848
+ var len = isVertical ? 'height' : 'width';
1849
+
1850
+ if (!arrowElement || !popperOffsets) {
1851
+ return;
1852
+ }
1853
+
1854
+ var paddingObject = toPaddingObject(options.padding, state);
1855
+ var arrowRect = getLayoutRect(arrowElement);
1856
+ var minProp = axis === 'y' ? top : left;
1857
+ var maxProp = axis === 'y' ? bottom : right;
1858
+ var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
1859
+ var startDiff = popperOffsets[axis] - state.rects.reference[axis];
1860
+ var arrowOffsetParent = getOffsetParent(arrowElement);
1861
+ var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
1862
+ var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is
1863
+ // outside of the popper bounds
1864
+
1865
+ var min = paddingObject[minProp];
1866
+ var max = clientSize - arrowRect[len] - paddingObject[maxProp];
1867
+ var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
1868
+ var offset = within(min, center, max); // Prevents breaking syntax highlighting...
1869
+
1870
+ var axisProp = axis;
1871
+ state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
1872
+ }
1873
+
1874
+ function effect(_ref2) {
1875
+ var state = _ref2.state,
1876
+ options = _ref2.options;
1877
+ var _options$element = options.element,
1878
+ arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
1879
+
1880
+ if (arrowElement == null) {
1881
+ return;
1882
+ } // CSS selector
1883
+
1884
+
1885
+ if (typeof arrowElement === 'string') {
1886
+ arrowElement = state.elements.popper.querySelector(arrowElement);
1887
+
1888
+ if (!arrowElement) {
1889
+ return;
1890
+ }
1891
+ }
1892
+
1893
+ {
1894
+ if (!isHTMLElement(arrowElement)) {
1895
+ console.error(['Popper: "arrow" element must be an HTMLElement (not an SVGElement).', 'To use an SVG arrow, wrap it in an HTMLElement that will be used as', 'the arrow.'].join(' '));
1896
+ }
1897
+ }
1898
+
1899
+ if (!contains(state.elements.popper, arrowElement)) {
1900
+ {
1901
+ console.error(['Popper: "arrow" modifier\'s `element` must be a child of the popper', 'element.'].join(' '));
1902
+ }
1903
+
1904
+ return;
1905
+ }
1906
+
1907
+ state.elements.arrow = arrowElement;
1908
+ } // eslint-disable-next-line import/no-unused-modules
1909
+
1910
+
1911
+ var arrow$1 = {
1912
+ name: 'arrow',
1913
+ enabled: true,
1914
+ phase: 'main',
1915
+ fn: arrow,
1916
+ effect: effect,
1917
+ requires: ['popperOffsets'],
1918
+ requiresIfExists: ['preventOverflow']
1919
+ };
1920
+
1921
+ function getSideOffsets(overflow, rect, preventedOffsets) {
1922
+ if (preventedOffsets === void 0) {
1923
+ preventedOffsets = {
1924
+ x: 0,
1925
+ y: 0
1926
+ };
1927
+ }
1928
+
1929
+ return {
1930
+ top: overflow.top - rect.height - preventedOffsets.y,
1931
+ right: overflow.right - rect.width + preventedOffsets.x,
1932
+ bottom: overflow.bottom - rect.height + preventedOffsets.y,
1933
+ left: overflow.left - rect.width - preventedOffsets.x
1934
+ };
1935
+ }
1936
+
1937
+ function isAnySideFullyClipped(overflow) {
1938
+ return [top, right, bottom, left].some(function (side) {
1939
+ return overflow[side] >= 0;
1940
+ });
1941
+ }
1942
+
1943
+ function hide(_ref) {
1944
+ var state = _ref.state,
1945
+ name = _ref.name;
1946
+ var referenceRect = state.rects.reference;
1947
+ var popperRect = state.rects.popper;
1948
+ var preventedOffsets = state.modifiersData.preventOverflow;
1949
+ var referenceOverflow = detectOverflow(state, {
1950
+ elementContext: 'reference'
1951
+ });
1952
+ var popperAltOverflow = detectOverflow(state, {
1953
+ altBoundary: true
1954
+ });
1955
+ var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
1956
+ var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
1957
+ var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
1958
+ var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
1959
+ state.modifiersData[name] = {
1960
+ referenceClippingOffsets: referenceClippingOffsets,
1961
+ popperEscapeOffsets: popperEscapeOffsets,
1962
+ isReferenceHidden: isReferenceHidden,
1963
+ hasPopperEscaped: hasPopperEscaped
1964
+ };
1965
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
1966
+ 'data-popper-reference-hidden': isReferenceHidden,
1967
+ 'data-popper-escaped': hasPopperEscaped
1968
+ });
1969
+ } // eslint-disable-next-line import/no-unused-modules
1970
+
1971
+
1972
+ var hide$1 = {
1973
+ name: 'hide',
1974
+ enabled: true,
1975
+ phase: 'main',
1976
+ requiresIfExists: ['preventOverflow'],
1977
+ fn: hide
1978
+ };
1979
+
1980
+ var defaultModifiers$1 = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1];
1981
+ var createPopper$1 = /*#__PURE__*/popperGenerator({
1982
+ defaultModifiers: defaultModifiers$1
1983
+ }); // eslint-disable-next-line import/no-unused-modules
1984
+
1985
+ var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
1986
+ var createPopper = /*#__PURE__*/popperGenerator({
1987
+ defaultModifiers: defaultModifiers
1988
+ }); // eslint-disable-next-line import/no-unused-modules
1989
+
1990
+ exports.applyStyles = applyStyles$1;
1991
+ exports.arrow = arrow$1;
1992
+ exports.computeStyles = computeStyles$1;
1993
+ exports.createPopper = createPopper;
1994
+ exports.createPopperLite = createPopper$1;
1995
+ exports.defaultModifiers = defaultModifiers;
1996
+ exports.detectOverflow = detectOverflow;
1997
+ exports.eventListeners = eventListeners;
1998
+ exports.flip = flip$1;
1999
+ exports.hide = hide$1;
2000
+ exports.offset = offset$1;
2001
+ exports.popperGenerator = popperGenerator;
2002
+ exports.popperOffsets = popperOffsets$1;
2003
+ exports.preventOverflow = preventOverflow$1;
2004
+
2005
+ Object.defineProperty(exports, '__esModule', { value: true });
2006
+
2007
+ })));
2008
+ //# sourceMappingURL=popper.js.map