popper.js 64 KB

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