| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  | /*! | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |   * Bootstrap dropdown.js v5.3.0-alpha1 (https://getbootstrap.com/)
 | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |   * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
 | 
					
						
							| 
									
										
										
										
											2020-06-17 02:50:01 +08:00
										 |  |  |   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
 | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |   */ | 
					
						
							| 
									
										
										
										
											2018-07-24 08:51:14 +08:00
										 |  |  | (function (global, factory) { | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |   typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@popperjs/core'), require('./util/index.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js'), require('./base-component.js')) : | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |   typeof define === 'function' && define.amd ? define(['@popperjs/core', './util/index', './dom/event-handler', './dom/manipulator', './dom/selector-engine', './base-component'], factory) : | 
					
						
							|  |  |  |   (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Dropdown = factory(global["@popperjs/core"], global.Index, global.EventHandler, global.Manipulator, global.SelectorEngine, global.BaseComponent)); | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  | })(this, (function (Popper, index_js, EventHandler, Manipulator, SelectorEngine, BaseComponent) { 'use strict'; | 
					
						
							| 
									
										
										
										
											2019-03-02 00:31:34 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |   function _interopNamespaceDefault(e) { | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |     const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } }); | 
					
						
							| 
									
										
										
										
											2020-12-07 23:50:24 +08:00
										 |  |  |     if (e) { | 
					
						
							| 
									
										
										
										
											2021-10-05 23:50:18 +08:00
										 |  |  |       for (const k in e) { | 
					
						
							| 
									
										
										
										
											2020-12-07 23:50:24 +08:00
										 |  |  |         if (k !== 'default') { | 
					
						
							| 
									
										
										
										
											2021-10-05 23:50:18 +08:00
										 |  |  |           const d = Object.getOwnPropertyDescriptor(e, k); | 
					
						
							| 
									
										
										
										
											2020-12-07 23:50:24 +08:00
										 |  |  |           Object.defineProperty(n, k, d.get ? d : { | 
					
						
							|  |  |  |             enumerable: true, | 
					
						
							| 
									
										
										
										
											2021-10-05 23:50:18 +08:00
										 |  |  |             get: () => e[k] | 
					
						
							| 
									
										
										
										
											2020-12-07 23:50:24 +08:00
										 |  |  |           }); | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2021-10-05 23:50:18 +08:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2020-12-07 23:50:24 +08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2021-10-05 23:50:18 +08:00
										 |  |  |     n.default = e; | 
					
						
							| 
									
										
										
										
											2020-12-07 23:50:24 +08:00
										 |  |  |     return Object.freeze(n); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |   const Popper__namespace = /*#__PURE__*/_interopNamespaceDefault(Popper); | 
					
						
							| 
									
										
										
										
											2021-02-11 00:14:51 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-04 23:41:51 +08:00
										 |  |  |   /** | 
					
						
							|  |  |  |    * -------------------------------------------------------------------------- | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |    * Bootstrap (v5.3.0-alpha1): dropdown.js | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |    * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
 | 
					
						
							|  |  |  |    * -------------------------------------------------------------------------- | 
					
						
							|  |  |  |    */ | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-03 22:18:59 +08:00
										 |  |  |   /** | 
					
						
							|  |  |  |    * Constants | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |   const NAME = 'dropdown'; | 
					
						
							|  |  |  |   const DATA_KEY = 'bs.dropdown'; | 
					
						
							|  |  |  |   const EVENT_KEY = `.${DATA_KEY}`; | 
					
						
							|  |  |  |   const DATA_API_KEY = '.data-api'; | 
					
						
							|  |  |  |   const ESCAPE_KEY = 'Escape'; | 
					
						
							|  |  |  |   const TAB_KEY = 'Tab'; | 
					
						
							|  |  |  |   const ARROW_UP_KEY = 'ArrowUp'; | 
					
						
							|  |  |  |   const ARROW_DOWN_KEY = 'ArrowDown'; | 
					
						
							|  |  |  |   const RIGHT_MOUSE_BUTTON = 2; // MouseEvent.button value for the secondary button, usually the right button
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   const EVENT_HIDE = `hide${EVENT_KEY}`; | 
					
						
							|  |  |  |   const EVENT_HIDDEN = `hidden${EVENT_KEY}`; | 
					
						
							|  |  |  |   const EVENT_SHOW = `show${EVENT_KEY}`; | 
					
						
							|  |  |  |   const EVENT_SHOWN = `shown${EVENT_KEY}`; | 
					
						
							|  |  |  |   const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`; | 
					
						
							|  |  |  |   const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY}${DATA_API_KEY}`; | 
					
						
							|  |  |  |   const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY}${DATA_API_KEY}`; | 
					
						
							|  |  |  |   const CLASS_NAME_SHOW = 'show'; | 
					
						
							|  |  |  |   const CLASS_NAME_DROPUP = 'dropup'; | 
					
						
							|  |  |  |   const CLASS_NAME_DROPEND = 'dropend'; | 
					
						
							|  |  |  |   const CLASS_NAME_DROPSTART = 'dropstart'; | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |   const CLASS_NAME_DROPUP_CENTER = 'dropup-center'; | 
					
						
							|  |  |  |   const CLASS_NAME_DROPDOWN_CENTER = 'dropdown-center'; | 
					
						
							|  |  |  |   const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)'; | 
					
						
							|  |  |  |   const SELECTOR_DATA_TOGGLE_SHOWN = `${SELECTOR_DATA_TOGGLE}.${CLASS_NAME_SHOW}`; | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |   const SELECTOR_MENU = '.dropdown-menu'; | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |   const SELECTOR_NAVBAR = '.navbar'; | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |   const SELECTOR_NAVBAR_NAV = '.navbar-nav'; | 
					
						
							|  |  |  |   const SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'; | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |   const PLACEMENT_TOP = index_js.isRTL() ? 'top-end' : 'top-start'; | 
					
						
							|  |  |  |   const PLACEMENT_TOPEND = index_js.isRTL() ? 'top-start' : 'top-end'; | 
					
						
							|  |  |  |   const PLACEMENT_BOTTOM = index_js.isRTL() ? 'bottom-end' : 'bottom-start'; | 
					
						
							|  |  |  |   const PLACEMENT_BOTTOMEND = index_js.isRTL() ? 'bottom-start' : 'bottom-end'; | 
					
						
							|  |  |  |   const PLACEMENT_RIGHT = index_js.isRTL() ? 'left-start' : 'right-start'; | 
					
						
							|  |  |  |   const PLACEMENT_LEFT = index_js.isRTL() ? 'right-start' : 'left-start'; | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |   const PLACEMENT_TOPCENTER = 'top'; | 
					
						
							|  |  |  |   const PLACEMENT_BOTTOMCENTER = 'bottom'; | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |   const Default = { | 
					
						
							| 
									
										
										
										
											2022-07-19 23:43:58 +08:00
										 |  |  |     autoClose: true, | 
					
						
							| 
									
										
										
										
											2020-12-07 23:50:24 +08:00
										 |  |  |     boundary: 'clippingParents', | 
					
						
							| 
									
										
										
										
											2019-08-27 21:03:21 +08:00
										 |  |  |     display: 'dynamic', | 
					
						
							| 
									
										
										
										
											2022-07-19 23:43:58 +08:00
										 |  |  |     offset: [0, 2], | 
					
						
							| 
									
										
										
										
											2021-05-06 03:32:12 +08:00
										 |  |  |     popperConfig: null, | 
					
						
							| 
									
										
										
										
											2022-07-19 23:43:58 +08:00
										 |  |  |     reference: 'toggle' | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |   }; | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |   const DefaultType = { | 
					
						
							| 
									
										
										
										
											2022-07-19 23:43:58 +08:00
										 |  |  |     autoClose: '(boolean|string)', | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |     boundary: '(string|element)', | 
					
						
							| 
									
										
										
										
											2019-08-27 21:03:21 +08:00
										 |  |  |     display: 'string', | 
					
						
							| 
									
										
										
										
											2022-07-19 23:43:58 +08:00
										 |  |  |     offset: '(array|string|function)', | 
					
						
							| 
									
										
										
										
											2021-05-06 03:32:12 +08:00
										 |  |  |     popperConfig: '(null|object|function)', | 
					
						
							| 
									
										
										
										
											2022-07-19 23:43:58 +08:00
										 |  |  |     reference: '(string|element|object)' | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |   }; | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-08 14:39:10 +08:00
										 |  |  |   /** | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |    * Class definition | 
					
						
							| 
									
										
										
										
											2019-10-08 14:39:10 +08:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2015-05-14 03:48:34 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |   class Dropdown extends BaseComponent { | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |     constructor(element, config) { | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |       super(element, config); | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |       this._popper = null; | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |       this._parent = this._element.parentNode; // dropdown wrapper
 | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |       // todo: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.3/forms/input-group/
 | 
					
						
							|  |  |  |       this._menu = SelectorEngine.next(this._element, SELECTOR_MENU)[0] || SelectorEngine.prev(this._element, SELECTOR_MENU)[0] || SelectorEngine.findOne(SELECTOR_MENU, this._parent); | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |       this._inNavbar = this._detectNavbar(); | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2015-05-11 04:47:11 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |     // Getters
 | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |     static get Default() { | 
					
						
							|  |  |  |       return Default; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     static get DefaultType() { | 
					
						
							|  |  |  |       return DefaultType; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2021-05-14 00:22:20 +08:00
										 |  |  |     static get NAME() { | 
					
						
							|  |  |  |       return NAME; | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2015-05-11 04:47:11 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |     // Public
 | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |     toggle() { | 
					
						
							| 
									
										
										
										
											2021-08-04 23:41:51 +08:00
										 |  |  |       return this._isShown() ? this.hide() : this.show(); | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |     } | 
					
						
							|  |  |  |     show() { | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |       if (index_js.isDisabled(this._element) || this._isShown()) { | 
					
						
							| 
									
										
										
										
											2019-08-27 21:03:21 +08:00
										 |  |  |         return; | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |       const relatedTarget = { | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |         relatedTarget: this._element | 
					
						
							|  |  |  |       }; | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |       const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, relatedTarget); | 
					
						
							| 
									
										
										
										
											2019-03-02 00:31:34 +08:00
										 |  |  |       if (showEvent.defaultPrevented) { | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |         return; | 
					
						
							| 
									
										
										
										
											2021-08-04 23:41:51 +08:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |       this._createPopper(); | 
					
						
							| 
									
										
										
										
											2017-09-06 12:05:12 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |       // If this is a touch-enabled device we add extra
 | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |       // empty mouseover listeners to the body's immediate children;
 | 
					
						
							|  |  |  |       // only needed because of broken event delegation on iOS
 | 
					
						
							|  |  |  |       // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
 | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |       if ('ontouchstart' in document.documentElement && !this._parent.closest(SELECTOR_NAVBAR_NAV)) { | 
					
						
							|  |  |  |         for (const element of [].concat(...document.body.children)) { | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |           EventHandler.on(element, 'mouseover', index_js.noop); | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |       } | 
					
						
							|  |  |  |       this._element.focus(); | 
					
						
							|  |  |  |       this._element.setAttribute('aria-expanded', true); | 
					
						
							| 
									
										
										
										
											2021-08-04 23:41:51 +08:00
										 |  |  |       this._menu.classList.add(CLASS_NAME_SHOW); | 
					
						
							|  |  |  |       this._element.classList.add(CLASS_NAME_SHOW); | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |       EventHandler.trigger(this._element, EVENT_SHOWN, relatedTarget); | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |     } | 
					
						
							|  |  |  |     hide() { | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |       if (index_js.isDisabled(this._element) || !this._isShown()) { | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |         return; | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |       const relatedTarget = { | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |         relatedTarget: this._element | 
					
						
							| 
									
										
										
										
											2018-07-24 08:51:14 +08:00
										 |  |  |       }; | 
					
						
							| 
									
										
										
										
											2021-05-06 03:32:12 +08:00
										 |  |  |       this._completeHide(relatedTarget); | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |     } | 
					
						
							|  |  |  |     dispose() { | 
					
						
							| 
									
										
										
										
											2019-08-27 21:03:21 +08:00
										 |  |  |       if (this._popper) { | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |         this._popper.destroy(); | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |       super.dispose(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     update() { | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |       this._inNavbar = this._detectNavbar(); | 
					
						
							| 
									
										
										
										
											2019-08-27 21:03:21 +08:00
										 |  |  |       if (this._popper) { | 
					
						
							| 
									
										
										
										
											2020-12-07 23:50:24 +08:00
										 |  |  |         this._popper.update(); | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2017-10-16 06:51:44 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |     // Private
 | 
					
						
							| 
									
										
										
										
											2021-05-06 03:32:12 +08:00
										 |  |  |     _completeHide(relatedTarget) { | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |       const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE, relatedTarget); | 
					
						
							| 
									
										
										
										
											2021-05-06 03:32:12 +08:00
										 |  |  |       if (hideEvent.defaultPrevented) { | 
					
						
							|  |  |  |         return; | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2021-05-06 03:32:12 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |       // If this is a touch-enabled device we remove the extra
 | 
					
						
							|  |  |  |       // empty mouseover listeners we added for iOS support
 | 
					
						
							| 
									
										
										
										
											2021-05-06 03:32:12 +08:00
										 |  |  |       if ('ontouchstart' in document.documentElement) { | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |         for (const element of [].concat(...document.body.children)) { | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |           EventHandler.off(element, 'mouseover', index_js.noop); | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2021-05-06 03:32:12 +08:00
										 |  |  |       } | 
					
						
							|  |  |  |       if (this._popper) { | 
					
						
							|  |  |  |         this._popper.destroy(); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       this._menu.classList.remove(CLASS_NAME_SHOW); | 
					
						
							|  |  |  |       this._element.classList.remove(CLASS_NAME_SHOW); | 
					
						
							|  |  |  |       this._element.setAttribute('aria-expanded', 'false'); | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |       Manipulator.removeDataAttribute(this._menu, 'popper'); | 
					
						
							|  |  |  |       EventHandler.trigger(this._element, EVENT_HIDDEN, relatedTarget); | 
					
						
							| 
									
										
										
										
											2021-05-06 03:32:12 +08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |     _getConfig(config) { | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |       config = super._getConfig(config); | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |       if (typeof config.reference === 'object' && !index_js.isElement(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') { | 
					
						
							| 
									
										
										
										
											2021-02-11 00:14:51 +08:00
										 |  |  |         // Popper virtual elements require a getBoundingClientRect method
 | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |         throw new TypeError(`${NAME.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`); | 
					
						
							| 
									
										
										
										
											2021-02-11 00:14:51 +08:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |       return config; | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |     _createPopper() { | 
					
						
							| 
									
										
										
										
											2021-08-04 23:41:51 +08:00
										 |  |  |       if (typeof Popper__namespace === 'undefined') { | 
					
						
							|  |  |  |         throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)'); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       let referenceElement = this._element; | 
					
						
							|  |  |  |       if (this._config.reference === 'parent') { | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |         referenceElement = this._parent; | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |       } else if (index_js.isElement(this._config.reference)) { | 
					
						
							|  |  |  |         referenceElement = index_js.getElement(this._config.reference); | 
					
						
							| 
									
										
										
										
											2021-08-04 23:41:51 +08:00
										 |  |  |       } else if (typeof this._config.reference === 'object') { | 
					
						
							|  |  |  |         referenceElement = this._config.reference; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       const popperConfig = this._getPopperConfig(); | 
					
						
							|  |  |  |       this._popper = Popper__namespace.createPopper(referenceElement, this._menu, popperConfig); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |     _isShown() { | 
					
						
							|  |  |  |       return this._menu.classList.contains(CLASS_NAME_SHOW); | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |     } | 
					
						
							|  |  |  |     _getPlacement() { | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |       const parentDropdown = this._parent; | 
					
						
							| 
									
										
										
										
											2020-12-07 23:50:24 +08:00
										 |  |  |       if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) { | 
					
						
							|  |  |  |         return PLACEMENT_RIGHT; | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2020-12-07 23:50:24 +08:00
										 |  |  |       if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) { | 
					
						
							|  |  |  |         return PLACEMENT_LEFT; | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |       } | 
					
						
							|  |  |  |       if (parentDropdown.classList.contains(CLASS_NAME_DROPUP_CENTER)) { | 
					
						
							|  |  |  |         return PLACEMENT_TOPCENTER; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       if (parentDropdown.classList.contains(CLASS_NAME_DROPDOWN_CENTER)) { | 
					
						
							|  |  |  |         return PLACEMENT_BOTTOMCENTER; | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |       // We need to trim the value because custom properties can also include spaces
 | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |       const isEnd = getComputedStyle(this._menu).getPropertyValue('--bs-position').trim() === 'end'; | 
					
						
							| 
									
										
										
										
											2020-12-07 23:50:24 +08:00
										 |  |  |       if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) { | 
					
						
							|  |  |  |         return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP; | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2020-12-07 23:50:24 +08:00
										 |  |  |       return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM; | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |     } | 
					
						
							|  |  |  |     _detectNavbar() { | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |       return this._element.closest(SELECTOR_NAVBAR) !== null; | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |     } | 
					
						
							|  |  |  |     _getOffset() { | 
					
						
							|  |  |  |       const { | 
					
						
							|  |  |  |         offset | 
					
						
							|  |  |  |       } = this._config; | 
					
						
							| 
									
										
										
										
											2021-02-11 00:14:51 +08:00
										 |  |  |       if (typeof offset === 'string') { | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |         return offset.split(',').map(value => Number.parseInt(value, 10)); | 
					
						
							| 
									
										
										
										
											2021-02-11 00:14:51 +08:00
										 |  |  |       } | 
					
						
							|  |  |  |       if (typeof offset === 'function') { | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |         return popperData => offset(popperData, this._element); | 
					
						
							| 
									
										
										
										
											2021-02-11 00:14:51 +08:00
										 |  |  |       } | 
					
						
							|  |  |  |       return offset; | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |     } | 
					
						
							|  |  |  |     _getPopperConfig() { | 
					
						
							|  |  |  |       const defaultBsPopperConfig = { | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |         placement: this._getPlacement(), | 
					
						
							| 
									
										
										
										
											2020-12-07 23:50:24 +08:00
										 |  |  |         modifiers: [{ | 
					
						
							|  |  |  |           name: 'preventOverflow', | 
					
						
							|  |  |  |           options: { | 
					
						
							| 
									
										
										
										
											2021-02-11 00:14:51 +08:00
										 |  |  |             boundary: this._config.boundary | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |         }, { | 
					
						
							|  |  |  |           name: 'offset', | 
					
						
							|  |  |  |           options: { | 
					
						
							|  |  |  |             offset: this._getOffset() | 
					
						
							| 
									
										
										
										
											2017-09-06 12:05:12 +08:00
										 |  |  |           } | 
					
						
							| 
									
										
										
										
											2020-12-07 23:50:24 +08:00
										 |  |  |         }] | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |       }; | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |       // Disable Popper if we have a static display or Dropdown is in Navbar
 | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |       if (this._inNavbar || this._config.display === 'static') { | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |         Manipulator.setDataAttribute(this._menu, 'popper', 'static'); // todo:v6 remove
 | 
					
						
							| 
									
										
										
										
											2021-02-11 00:14:51 +08:00
										 |  |  |         defaultBsPopperConfig.modifiers = [{ | 
					
						
							| 
									
										
										
										
											2020-12-07 23:50:24 +08:00
										 |  |  |           name: 'applyStyles', | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |           enabled: false | 
					
						
							| 
									
										
										
										
											2020-12-07 23:50:24 +08:00
										 |  |  |         }]; | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |       return { | 
					
						
							|  |  |  |         ...defaultBsPopperConfig, | 
					
						
							|  |  |  |         ...index_js.execute(this._config.popperConfig, [defaultBsPopperConfig]) | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |       }; | 
					
						
							| 
									
										
										
										
											2021-05-06 03:32:12 +08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2021-06-23 02:29:16 +08:00
										 |  |  |     _selectMenuItem({ | 
					
						
							|  |  |  |       key, | 
					
						
							|  |  |  |       target | 
					
						
							|  |  |  |     }) { | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |       const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(element => index_js.isVisible(element)); | 
					
						
							| 
									
										
										
										
											2021-05-06 03:32:12 +08:00
										 |  |  |       if (!items.length) { | 
					
						
							|  |  |  |         return; | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2015-05-11 04:47:11 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |       // if target isn't included in items (e.g. when expanding the dropdown)
 | 
					
						
							|  |  |  |       // allow cycling to get the last item in case key equals ARROW_UP_KEY
 | 
					
						
							|  |  |  |       index_js.getNextActiveElement(items, target, key === ARROW_DOWN_KEY, !items.includes(target)).focus(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2015-05-11 04:47:11 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |     // Static
 | 
					
						
							| 
									
										
										
										
											2021-08-04 23:41:51 +08:00
										 |  |  |     static jQueryInterface(config) { | 
					
						
							|  |  |  |       return this.each(function () { | 
					
						
							|  |  |  |         const data = Dropdown.getOrCreateInstance(this, config); | 
					
						
							|  |  |  |         if (typeof config !== 'string') { | 
					
						
							|  |  |  |           return; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2019-03-02 00:31:34 +08:00
										 |  |  |         if (typeof data[config] === 'undefined') { | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |           throw new TypeError(`No method named "${config}"`); | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2019-03-02 00:31:34 +08:00
										 |  |  |         data[config](); | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |       }); | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |     } | 
					
						
							|  |  |  |     static clearMenus(event) { | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |       if (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY) { | 
					
						
							| 
									
										
										
										
											2021-05-14 00:22:20 +08:00
										 |  |  |         return; | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |       const openToggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE_SHOWN); | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |       for (const toggle of openToggles) { | 
					
						
							|  |  |  |         const context = Dropdown.getInstance(toggle); | 
					
						
							| 
									
										
										
										
											2021-05-06 03:32:12 +08:00
										 |  |  |         if (!context || context._config.autoClose === false) { | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |           continue; | 
					
						
							| 
									
										
										
										
											2018-07-24 08:51:14 +08:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |         const composedPath = event.composedPath(); | 
					
						
							|  |  |  |         const isMenuTarget = composedPath.includes(context._menu); | 
					
						
							|  |  |  |         if (composedPath.includes(context._element) || context._config.autoClose === 'inside' && !isMenuTarget || context._config.autoClose === 'outside' && isMenuTarget) { | 
					
						
							|  |  |  |           continue; | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |         // Tab navigation through the dropdown menu or events from contained inputs shouldn't close the menu
 | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |         if (context._menu.contains(event.target) && (event.type === 'keyup' && event.key === TAB_KEY || /input|select|option|textarea|form/i.test(event.target.tagName))) { | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |           continue; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2021-05-06 03:32:12 +08:00
										 |  |  |         const relatedTarget = { | 
					
						
							|  |  |  |           relatedTarget: context._element | 
					
						
							|  |  |  |         }; | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |         if (event.type === 'click') { | 
					
						
							|  |  |  |           relatedTarget.clickEvent = event; | 
					
						
							| 
									
										
										
										
											2019-08-27 21:03:21 +08:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2021-05-06 03:32:12 +08:00
										 |  |  |         context._completeHide(relatedTarget); | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |     } | 
					
						
							|  |  |  |     static dataApiKeydownHandler(event) { | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |       // If not an UP | DOWN | ESCAPE key => not a dropdown command
 | 
					
						
							|  |  |  |       // If input/textarea && if key is other than ESCAPE => not a dropdown command
 | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |       const isInput = /input|textarea/i.test(event.target.tagName); | 
					
						
							|  |  |  |       const isEscapeEvent = event.key === ESCAPE_KEY; | 
					
						
							|  |  |  |       const isUpOrDownEvent = [ARROW_UP_KEY, ARROW_DOWN_KEY].includes(event.key); | 
					
						
							|  |  |  |       if (!isUpOrDownEvent && !isEscapeEvent) { | 
					
						
							| 
									
										
										
										
											2021-05-06 03:32:12 +08:00
										 |  |  |         return; | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |       if (isInput && !isEscapeEvent) { | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |         return; | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |       event.preventDefault(); | 
					
						
							| 
									
										
										
										
											2015-08-19 11:28:28 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |       // todo: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.3/forms/input-group/
 | 
					
						
							|  |  |  |       const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE)[0] || SelectorEngine.next(this, SELECTOR_DATA_TOGGLE)[0] || SelectorEngine.findOne(SELECTOR_DATA_TOGGLE, event.delegateTarget.parentNode); | 
					
						
							| 
									
										
										
										
											2021-08-04 23:41:51 +08:00
										 |  |  |       const instance = Dropdown.getOrCreateInstance(getToggleButton); | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |       if (isUpOrDownEvent) { | 
					
						
							|  |  |  |         event.stopPropagation(); | 
					
						
							|  |  |  |         instance.show(); | 
					
						
							| 
									
										
										
										
											2021-08-04 23:41:51 +08:00
										 |  |  |         instance._selectMenuItem(event); | 
					
						
							| 
									
										
										
										
											2021-02-11 00:14:51 +08:00
										 |  |  |         return; | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |       if (instance._isShown()) { | 
					
						
							|  |  |  |         // else is escape and we check if it is shown
 | 
					
						
							|  |  |  |         event.stopPropagation(); | 
					
						
							|  |  |  |         instance.hide(); | 
					
						
							|  |  |  |         getToggleButton.focus(); | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2021-03-24 00:26:54 +08:00
										 |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |   /** | 
					
						
							| 
									
										
										
										
											2022-05-13 14:07:23 +08:00
										 |  |  |    * Data API implementation | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |    */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |   EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE, Dropdown.dataApiKeydownHandler); | 
					
						
							|  |  |  |   EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler); | 
					
						
							|  |  |  |   EventHandler.on(document, EVENT_CLICK_DATA_API, Dropdown.clearMenus); | 
					
						
							|  |  |  |   EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus); | 
					
						
							|  |  |  |   EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) { | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |     event.preventDefault(); | 
					
						
							| 
									
										
										
										
											2021-08-04 23:41:51 +08:00
										 |  |  |     Dropdown.getOrCreateInstance(this).toggle(); | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |   }); | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-13 14:41:12 +08:00
										 |  |  |   /** | 
					
						
							|  |  |  |    * jQuery | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-25 00:37:22 +08:00
										 |  |  |   index_js.defineJQueryPlugin(Dropdown); | 
					
						
							| 
									
										
										
										
											2015-05-11 04:47:11 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   return Dropdown; | 
					
						
							| 
									
										
										
										
											2018-07-24 08:51:14 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-05 23:50:18 +08:00
										 |  |  | })); | 
					
						
							| 
									
										
										
										
											2018-07-24 08:51:14 +08:00
										 |  |  | //# sourceMappingURL=dropdown.js.map
 |