margin\n\n /* istanbul ignore next: difficult to test in JSDOM */\n\n selectAll(Selector.NAVBAR_TOGGLER).forEach(function (el) {\n var actualMargin = el.style.marginRight;\n var calculatedMargin = getCS(el).marginRight || 0;\n setAttr(el, 'data-margin-right', actualMargin);\n el.style.marginRight = \"\".concat(parseFloat(calculatedMargin) + scrollbarWidth, \"px\");\n\n body._marginChangedForModal.push(el);\n }); // Adjust body padding\n\n var actualPadding = body.style.paddingRight;\n var calculatedPadding = getCS(body).paddingRight;\n setAttr(body, 'data-padding-right', actualPadding);\n body.style.paddingRight = \"\".concat(parseFloat(calculatedPadding) + scrollbarWidth, \"px\");\n }\n },\n resetScrollbar: function resetScrollbar() {\n var body = document.body;\n\n if (body._paddingChangedForModal) {\n // Restore fixed content padding\n body._paddingChangedForModal.forEach(function (el) {\n /* istanbul ignore next: difficult to test in JSDOM */\n if (hasAttr(el, 'data-padding-right')) {\n el.style.paddingRight = getAttr(el, 'data-padding-right') || '';\n removeAttr(el, 'data-padding-right');\n }\n });\n }\n\n if (body._marginChangedForModal) {\n // Restore sticky content and navbar-toggler margin\n body._marginChangedForModal.forEach(function (el) {\n /* istanbul ignore next: difficult to test in JSDOM */\n if (hasAttr(el, 'data-margin-right')) {\n el.style.marginRight = getAttr(el, 'data-margin-right') || '';\n removeAttr(el, 'data-margin-right');\n }\n });\n }\n\n body._paddingChangedForModal = null;\n body._marginChangedForModal = null; // Restore body padding\n\n if (hasAttr(body, 'data-padding-right')) {\n body.style.paddingRight = getAttr(body, 'data-padding-right') || '';\n removeAttr(body, 'data-padding-right');\n }\n }\n }\n}); // Export our ModalManager\n\nexport default new ModalManager();","function _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _get(target, property, receiver) { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }\n\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nimport BvEvent from '../../../utils/bv-event.class';\nimport warn from '../../../utils/warn';\nimport { defineProperties, readonlyDescriptor } from '../../../utils/object';\n\nvar BvModalEvent =\n/*#__PURE__*/\nfunction (_BvEvent) {\n _inherits(BvModalEvent, _BvEvent);\n\n function BvModalEvent(type) {\n var _this;\n\n var eventInit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n _classCallCheck(this, BvModalEvent);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(BvModalEvent).call(this, type, eventInit)); // Freeze our new props as readonly, but leave them enumerable\n\n defineProperties(_assertThisInitialized(_this), {\n trigger: readonlyDescriptor()\n });\n return _this;\n }\n\n _createClass(BvModalEvent, [{\n key: \"cancel\",\n value: function cancel()\n /* istanbul ignore next */\n {\n // Backwards compatibility for BootstrapVue 1.x\n warn('b-modal: evt.cancel() is deprecated. Please use evt.preventDefault().');\n this.preventDefault();\n }\n }, {\n key: \"modalId\",\n get: function get()\n /* istanbul ignore next */\n {\n // Backwards compatability <= 2.0.0-rc.19\n warn('b-modal: evt.modalId is deprecated. Please use evt.componentId.');\n return this.componentId;\n }\n }], [{\n key: \"Defaults\",\n get: function get() {\n return _objectSpread({}, _get(_getPrototypeOf(BvModalEvent), \"Defaults\", this), {\n trigger: null\n });\n }\n }]);\n\n return BvModalEvent;\n}(BvEvent); // Named exports\n\n\nexport { BvModalEvent }; // Default export\n\nexport default BvModalEvent;","import Vue from './vue';\nimport { concat } from './array';\nimport { select } from './dom';\nimport { isBrowser } from './env';\nimport { isFunction, isString } from './inspect';\nimport { HTMLElement } from './safe-types';\nimport normalizeSlotMixin from '../mixins/normalize-slot'; // BTransporterSingle/BTransporterTargetSingle:\n//\n// Single root node portaling of content, which retains parent/child hierarchy\n// Unlike Portal-Vue where portaled content is no longer a descendent of it's\n// intended parent components\n//\n// Private components for use by Tooltips, Popovers and Modals\n//\n// Based on vue-simple-portal\n// https://github.com/LinusBorg/vue-simple-portal\n// Transporter target used by BTransporterSingle\n// Supports only a single root element\n// @vue/component\n\nvar BTransporterTargetSingle =\n/*#__PURE__*/\nVue.extend({\n // As an abstract component, it doesn't appear in the $parent chain of\n // components, which means the next parent of any component rendered inside\n // of this one will be the parent from which is was portal'd\n abstract: true,\n name: 'BTransporterTargetSingle',\n props: {\n nodes: {\n // Even though we only support a single root element,\n // vNodes are always passed as an array\n type: [Array, Function] // default: undefined\n\n }\n },\n data: function data(vm) {\n return {\n updatedNodes: vm.nodes\n };\n },\n destroyed: function destroyed() {\n var el = this.$el;\n el && el.parentNode && el.parentNode.removeChild(el);\n },\n render: function render(h) {\n var nodes = isFunction(this.updatedNodes) ? this.updatedNodes({}) : this.updatedNodes;\n nodes = concat(nodes).filter(Boolean);\n /* istanbul ignore else */\n\n if (nodes && nodes.length > 0 && !nodes[0].text) {\n return nodes[0];\n } else {\n return h();\n }\n }\n}); // This component has no root element, so only a single VNode is allowed\n// @vue/component\n\nexport var BTransporterSingle =\n/*#__PURE__*/\nVue.extend({\n name: 'BTransporterSingle',\n mixins: [normalizeSlotMixin],\n props: {\n disabled: {\n type: Boolean,\n default: false\n },\n container: {\n // String: CSS selector,\n // HTMLElement: Element reference\n // Mainly needed for tooltips/popovers inside modals\n type: [String, HTMLElement],\n default: 'body'\n },\n tag: {\n // This should be set to match the root element type\n type: String,\n default: 'div'\n }\n },\n watch: {\n disabled: {\n immediate: true,\n handler: function handler(disabled) {\n disabled ? this.unmountTarget() : this.$nextTick(this.mountTarget);\n }\n }\n },\n created: function created() {\n this._bv_defaultFn = null;\n this._bv_target = null;\n },\n beforeMount: function beforeMount() {\n this.mountTarget();\n },\n updated: function updated() {\n var _this = this;\n\n // Placed in a nextTick to ensure that children have completed\n // updating before rendering in the target\n this.$nextTick(function () {\n _this.updateTarget();\n });\n },\n beforeDestroy: function beforeDestroy() {\n this.unmountTarget();\n this._bv_defaultFn = null;\n },\n methods: {\n // Get the element which the target should be appended to\n getContainer: function getContainer() {\n /* istanbul ignore else */\n if (isBrowser) {\n var container = this.container;\n return isString(container) ? select(container) : container;\n } else {\n return null;\n }\n },\n // Mount the target\n mountTarget: function mountTarget() {\n if (!this._bv_target) {\n var container = this.getContainer();\n\n if (container) {\n var el = document.createElement('div');\n container.appendChild(el);\n this._bv_target = new BTransporterTargetSingle({\n el: el,\n parent: this,\n propsData: {\n // Initial nodes to be rendered\n nodes: concat(this.normalizeSlot('default'))\n }\n });\n }\n }\n },\n // Update the content of the target\n updateTarget: function updateTarget() {\n if (isBrowser && this._bv_target) {\n var defaultFn = this.$scopedSlots.default;\n\n if (!this.disabled) {\n /* istanbul ignore else: only applicable in Vue 2.5.x */\n if (defaultFn && this._bv_defaultFn !== defaultFn) {\n // We only update the target component if the scoped slot\n // function is a fresh one. The new slot syntax (since Vue 2.6)\n // can cache unchanged slot functions and we want to respect that here\n this._bv_target.updatedNodes = defaultFn;\n } else if (!defaultFn) {\n // We also need to be back compatible with non-scoped default slot (i.e. 2.5.x)\n this._bv_target.updatedNodes = this.$slots.default;\n }\n } // Update the scoped slot function cache\n\n\n this._bv_defaultFn = defaultFn;\n }\n },\n // Unmount the target\n unmountTarget: function unmountTarget() {\n if (this._bv_target) {\n this._bv_target.$destroy();\n\n this._bv_target = null;\n }\n }\n },\n render: function render(h) {\n if (this.disabled) {\n var nodes = concat(this.normalizeSlot('default')).filter(Boolean);\n\n if (nodes.length > 0 && !nodes[0].text) {\n return nodes[0];\n }\n }\n\n return h();\n }\n});","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport Vue from '../../utils/vue';\nimport modalManager from './helpers/modal-manager';\nimport BvModalEvent from './helpers/bv-modal-event.class';\nimport idMixin from '../../mixins/id';\nimport listenOnRootMixin from '../../mixins/listen-on-root';\nimport normalizeSlotMixin from '../../mixins/normalize-slot';\nimport BVTransition from '../../utils/bv-transition';\nimport KeyCodes from '../../utils/key-codes';\nimport observeDom from '../../utils/observe-dom';\nimport { BTransporterSingle } from '../../utils/transporter';\nimport { isBrowser } from '../../utils/env';\nimport { isString } from '../../utils/inspect';\nimport { getComponentConfig } from '../../utils/config';\nimport { stripTags } from '../../utils/html';\nimport { contains, eventOff, eventOn, isVisible, select } from '../../utils/dom';\nimport { BButton } from '../button/button';\nimport { BButtonClose } from '../button/button-close'; // --- Constants ---\n\nvar NAME = 'BModal'; // ObserveDom config to detect changes in modal content\n// so that we can adjust the modal padding if needed\n\nvar OBSERVER_CONFIG = {\n subtree: true,\n childList: true,\n characterData: true,\n attributes: true,\n attributeFilter: ['style', 'class'] // Options for DOM event listeners\n\n};\nvar EVT_OPTIONS = {\n passive: true,\n capture: false\n};\nexport var props = {\n size: {\n type: String,\n default: function _default() {\n return getComponentConfig(NAME, 'size');\n }\n },\n centered: {\n type: Boolean,\n default: false\n },\n scrollable: {\n type: Boolean,\n default: false\n },\n buttonSize: {\n type: String,\n default: ''\n },\n noStacking: {\n type: Boolean,\n default: false\n },\n noFade: {\n type: Boolean,\n default: false\n },\n noCloseOnBackdrop: {\n type: Boolean,\n default: false\n },\n noCloseOnEsc: {\n type: Boolean,\n default: false\n },\n noEnforceFocus: {\n type: Boolean,\n default: false\n },\n title: {\n type: String,\n default: ''\n },\n titleHtml: {\n type: String\n },\n titleTag: {\n type: String,\n default: function _default() {\n return getComponentConfig(NAME, 'titleTag');\n }\n },\n titleClass: {\n type: [String, Array, Object],\n default: null\n },\n titleSrOnly: {\n type: Boolean,\n default: false\n },\n ariaLabel: {\n type: String,\n default: null\n },\n headerBgVariant: {\n type: String,\n default: function _default() {\n return getComponentConfig(NAME, 'headerBgVariant');\n }\n },\n headerBorderVariant: {\n type: String,\n default: function _default() {\n return getComponentConfig(NAME, 'headerBorderVariant');\n }\n },\n headerTextVariant: {\n type: String,\n default: function _default() {\n return getComponentConfig(NAME, 'headerTextVariant');\n }\n },\n headerCloseVariant: {\n type: String,\n default: function _default() {\n return getComponentConfig(NAME, 'headerCloseVariant');\n }\n },\n headerClass: {\n type: [String, Array, Object],\n default: null\n },\n bodyBgVariant: {\n type: String,\n default: function _default() {\n return getComponentConfig(NAME, 'bodyBgVariant');\n }\n },\n bodyTextVariant: {\n type: String,\n default: function _default() {\n return getComponentConfig(NAME, 'bodyTextVariant');\n }\n },\n modalClass: {\n type: [String, Array, Object],\n default: null\n },\n dialogClass: {\n type: [String, Array, Object],\n default: null\n },\n contentClass: {\n type: [String, Array, Object],\n default: null\n },\n bodyClass: {\n type: [String, Array, Object],\n default: null\n },\n footerBgVariant: {\n type: String,\n default: function _default() {\n return getComponentConfig(NAME, 'footerBgVariant');\n }\n },\n footerBorderVariant: {\n type: String,\n default: function _default() {\n return getComponentConfig(NAME, 'footerBorderVariant');\n }\n },\n footerTextVariant: {\n type: String,\n default: function _default() {\n return getComponentConfig(NAME, 'footerTextVariant');\n }\n },\n footerClass: {\n type: [String, Array, Object],\n default: null\n },\n hideHeader: {\n type: Boolean,\n default: false\n },\n hideFooter: {\n type: Boolean,\n default: false\n },\n hideHeaderClose: {\n type: Boolean,\n default: false\n },\n hideBackdrop: {\n type: Boolean,\n default: false\n },\n okOnly: {\n type: Boolean,\n default: false\n },\n okDisabled: {\n type: Boolean,\n default: false\n },\n cancelDisabled: {\n type: Boolean,\n default: false\n },\n visible: {\n type: Boolean,\n default: false\n },\n returnFocus: {\n // type: Object,\n default: null\n },\n headerCloseLabel: {\n type: String,\n default: function _default() {\n return getComponentConfig(NAME, 'headerCloseLabel');\n }\n },\n cancelTitle: {\n type: String,\n default: function _default() {\n return getComponentConfig(NAME, 'cancelTitle');\n }\n },\n cancelTitleHtml: {\n type: String\n },\n okTitle: {\n type: String,\n default: function _default() {\n return getComponentConfig(NAME, 'okTitle');\n }\n },\n okTitleHtml: {\n type: String\n },\n cancelVariant: {\n type: String,\n default: function _default() {\n return getComponentConfig(NAME, 'cancelVariant');\n }\n },\n okVariant: {\n type: String,\n default: function _default() {\n return getComponentConfig(NAME, 'okVariant');\n }\n },\n lazy: {\n type: Boolean,\n default: false\n },\n busy: {\n type: Boolean,\n default: false\n },\n static: {\n type: Boolean,\n default: false\n } // @vue/component\n\n};\nexport var BModal =\n/*#__PURE__*/\nVue.extend({\n name: NAME,\n mixins: [idMixin, listenOnRootMixin, normalizeSlotMixin],\n model: {\n prop: 'visible',\n event: 'change'\n },\n props: props,\n data: function data() {\n return {\n isHidden: true,\n // If modal should not be in document\n isVisible: false,\n // Controls modal visible state\n isTransitioning: false,\n // Used for style control\n isShow: false,\n // Used for style control\n isBlock: false,\n // Used for style control\n isOpening: false,\n // To signal that the modal is in the process of opening\n isClosing: false,\n // To signal that the modal is in the process of closing\n ignoreBackdropClick: false,\n // Used to signify if click out listener should ignore the click\n isModalOverflowing: false,\n return_focus: this.returnFocus || null,\n // The following items are controlled by the modalManager instance\n scrollbarWidth: 0,\n zIndex: modalManager.getBaseZIndex(),\n isTop: true,\n isBodyOverflowing: false\n };\n },\n computed: {\n modalClasses: function modalClasses() {\n return [{\n fade: !this.noFade,\n show: this.isShow\n }, this.modalClass];\n },\n modalStyles: function modalStyles() {\n var sbWidth = \"\".concat(this.scrollbarWidth, \"px\");\n return {\n paddingLeft: !this.isBodyOverflowing && this.isModalOverflowing ? sbWidth : '',\n paddingRight: this.isBodyOverflowing && !this.isModalOverflowing ? sbWidth : '',\n // Needed to fix issue https://github.com/bootstrap-vue/bootstrap-vue/issues/3457\n // Even though we are using v-show, we must ensure 'none' is restored in the styles\n display: this.isBlock ? 'block' : 'none'\n };\n },\n dialogClasses: function dialogClasses() {\n var _ref;\n\n return [(_ref = {}, _defineProperty(_ref, \"modal-\".concat(this.size), Boolean(this.size)), _defineProperty(_ref, 'modal-dialog-centered', this.centered), _defineProperty(_ref, 'modal-dialog-scrollable', this.scrollable), _ref), this.dialogClass];\n },\n headerClasses: function headerClasses() {\n var _ref2;\n\n return [(_ref2 = {}, _defineProperty(_ref2, \"bg-\".concat(this.headerBgVariant), Boolean(this.headerBgVariant)), _defineProperty(_ref2, \"text-\".concat(this.headerTextVariant), Boolean(this.headerTextVariant)), _defineProperty(_ref2, \"border-\".concat(this.headerBorderVariant), Boolean(this.headerBorderVariant)), _ref2), this.headerClass];\n },\n titleClases: function titleClases() {\n return [{\n 'sr-only': this.titleSrOnly\n }, this.titleClass];\n },\n bodyClasses: function bodyClasses() {\n var _ref3;\n\n return [(_ref3 = {}, _defineProperty(_ref3, \"bg-\".concat(this.bodyBgVariant), Boolean(this.bodyBgVariant)), _defineProperty(_ref3, \"text-\".concat(this.bodyTextVariant), Boolean(this.bodyTextVariant)), _ref3), this.bodyClass];\n },\n footerClasses: function footerClasses() {\n var _ref4;\n\n return [(_ref4 = {}, _defineProperty(_ref4, \"bg-\".concat(this.footerBgVariant), Boolean(this.footerBgVariant)), _defineProperty(_ref4, \"text-\".concat(this.footerTextVariant), Boolean(this.footerTextVariant)), _defineProperty(_ref4, \"border-\".concat(this.footerBorderVariant), Boolean(this.footerBorderVariant)), _ref4), this.footerClass];\n },\n modalOuterStyle: function modalOuterStyle() {\n // Styles needed for proper stacking of modals\n return {\n position: 'absolute',\n zIndex: this.zIndex\n };\n },\n slotScope: function slotScope() {\n return {\n ok: this.onOk,\n cancel: this.onCancel,\n close: this.onClose,\n hide: this.hide,\n visible: this.isVisible\n };\n }\n },\n watch: {\n visible: function visible(newVal, oldVal) {\n if (newVal !== oldVal) {\n this[newVal ? 'show' : 'hide']();\n }\n }\n },\n created: function created() {\n // Define non-reactive properties\n this._observer = null;\n },\n mounted: function mounted() {\n // Set initial z-index as queried from the DOM\n this.zIndex = modalManager.getBaseZIndex(); // Listen for events from others to either open or close ourselves\n // and listen to all modals to enable/disable enforce focus\n\n this.listenOnRoot('bv::show::modal', this.showHandler);\n this.listenOnRoot('bv::hide::modal', this.hideHandler);\n this.listenOnRoot('bv::toggle::modal', this.toggleHandler); // Listen for `bv:modal::show events`, and close ourselves if the\n // opening modal not us\n\n this.listenOnRoot('bv::modal::show', this.modalListener); // Initially show modal?\n\n if (this.visible === true) {\n this.$nextTick(this.show);\n }\n },\n beforeDestroy: function beforeDestroy() {\n // Ensure everything is back to normal\n if (this._observer) {\n this._observer.disconnect();\n\n this._observer = null;\n }\n\n this.setEnforceFocus(false);\n this.setResizeEvent(false);\n\n if (this.isVisible) {\n this.isVisible = false;\n this.isShow = false;\n this.isTransitioning = false;\n }\n },\n methods: {\n // Private method to update the v-model\n updateModel: function updateModel(val) {\n if (val !== this.visible) {\n this.$emit('change', val);\n }\n },\n // Private method to create a BvModalEvent object\n buildEvent: function buildEvent(type) {\n var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new BvModalEvent(type, _objectSpread({\n // Default options\n cancelable: false,\n target: this.$refs.modal || this.$el || null,\n relatedTarget: null,\n trigger: null\n }, opts, {\n // Options that can't be overridden\n vueTarget: this,\n componentId: this.safeId()\n }));\n },\n // Public method to show modal\n show: function show() {\n if (this.isVisible || this.isOpening) {\n // If already open, on in the process of opening, do nothing\n\n /* istanbul ignore next */\n return;\n }\n\n if (this.isClosing) {\n // If we are in the process of closing, wait until hidden before re-opening\n\n /* istanbul ignore next: very difficult to test */\n this.$once('hidden', this.show);\n /* istanbul ignore next */\n\n return;\n }\n\n this.isOpening = true; // Set the element to return focus to when closed\n\n this.return_focus = this.return_focus || this.getActiveElement();\n var showEvt = this.buildEvent('show', {\n cancelable: true\n });\n this.emitEvent(showEvt); // Don't show if canceled\n\n if (showEvt.defaultPrevented || this.isVisible) {\n this.isOpening = false; // Ensure the v-model reflects the current state\n\n this.updateModel(false);\n return;\n } // Show the modal\n\n\n this.doShow();\n },\n // Public method to hide modal\n hide: function hide() {\n var trigger = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n\n if (!this.isVisible || this.isClosing) {\n /* istanbul ignore next */\n return;\n }\n\n this.isClosing = true;\n var hideEvt = this.buildEvent('hide', {\n cancelable: trigger !== 'FORCE',\n trigger: trigger || null\n }); // We emit specific event for one of the three built-in buttons\n\n if (trigger === 'ok') {\n this.$emit('ok', hideEvt);\n } else if (trigger === 'cancel') {\n this.$emit('cancel', hideEvt);\n } else if (trigger === 'headerclose') {\n this.$emit('close', hideEvt);\n }\n\n this.emitEvent(hideEvt); // Hide if not canceled\n\n if (hideEvt.defaultPrevented || !this.isVisible) {\n this.isClosing = false; // Ensure v-model reflects current state\n\n this.updateModel(true);\n return;\n } // Stop observing for content changes\n\n\n if (this._observer) {\n this._observer.disconnect();\n\n this._observer = null;\n } // Trigger the hide transition\n\n\n this.isVisible = false; // Update the v-model\n\n this.updateModel(false);\n },\n // Public method to toggle modal visibility\n toggle: function toggle(triggerEl) {\n if (triggerEl) {\n this.return_focus = triggerEl;\n }\n\n if (this.isVisible) {\n this.hide('toggle');\n } else {\n this.show();\n }\n },\n // Private method to get the current document active element\n getActiveElement: function getActiveElement() {\n if (isBrowser) {\n var activeElement = document.activeElement; // Note: On IE11, `document.activeElement` may be null.\n // So we test it for truthiness first.\n // https://github.com/bootstrap-vue/bootstrap-vue/issues/3206\n // Returning focus to document.body may cause unwanted scrolls, so we\n // exclude setting focus on body\n\n if (activeElement && activeElement !== document.body && activeElement.focus) {\n // Preset the fallback return focus value if it is not set\n // `document.activeElement` should be the trigger element that was clicked or\n // in the case of using the v-model, which ever element has current focus\n // Will be overridden by some commands such as toggle, etc.\n return activeElement;\n }\n }\n\n return null;\n },\n // Private method to finish showing modal\n doShow: function doShow() {\n var _this = this;\n\n /* istanbul ignore next: commenting out for now until we can test stacking */\n if (modalManager.modalsAreOpen && this.noStacking) {\n // If another modal(s) is already open, wait for it(them) to close\n this.listenOnRootOnce('bv::modal::hidden', this.doShow);\n return;\n }\n\n modalManager.registerModal(this); // Place modal in DOM\n\n this.isHidden = false;\n this.$nextTick(function () {\n // We do this in `$nextTick()` to ensure the modal is in DOM first\n // before we show it\n _this.isVisible = true;\n _this.isOpening = false; // Update the v-model\n\n _this.updateModel(true);\n\n _this.$nextTick(function () {\n // In a nextTick in case modal content is lazy\n // Observe changes in modal content and adjust if necessary\n _this._observer = observeDom(_this.$refs.content, _this.checkModalOverflow.bind(_this), OBSERVER_CONFIG);\n });\n });\n },\n // Transition handlers\n onBeforeEnter: function onBeforeEnter() {\n this.isTransitioning = true;\n this.setResizeEvent(true);\n },\n onEnter: function onEnter() {\n this.isBlock = true;\n },\n onAfterEnter: function onAfterEnter() {\n var _this2 = this;\n\n this.checkModalOverflow();\n this.isShow = true;\n this.isTransitioning = false;\n this.$nextTick(function () {\n _this2.emitEvent(_this2.buildEvent('shown'));\n\n _this2.focusFirst();\n\n _this2.setEnforceFocus(true);\n });\n },\n onBeforeLeave: function onBeforeLeave() {\n this.isTransitioning = true;\n this.setResizeEvent(false);\n },\n onLeave: function onLeave() {\n // Remove the 'show' class\n this.isShow = false;\n },\n onAfterLeave: function onAfterLeave() {\n var _this3 = this;\n\n this.isBlock = false;\n this.isTransitioning = false;\n this.setEnforceFocus(false);\n this.isModalOverflowing = false;\n this.isHidden = true;\n this.$nextTick(function () {\n _this3.returnFocusTo();\n\n _this3.isClosing = false;\n _this3.return_focus = null;\n modalManager.unregisterModal(_this3); // TODO: Need to find a way to pass the `trigger` property\n // to the `hidden` event, not just only the `hide` event\n\n _this3.emitEvent(_this3.buildEvent('hidden'));\n });\n },\n // Event emitter\n emitEvent: function emitEvent(bvModalEvt) {\n var type = bvModalEvt.type; // We emit on root first incase a global listener wants to cancel\n // the event first before the instance emits it's event\n\n this.emitOnRoot(\"bv::modal::\".concat(type), bvModalEvt, bvModalEvt.componentId);\n this.$emit(type, bvModalEvt);\n },\n // UI event handlers\n onDialogMousedown: function onDialogMousedown() {\n var _this4 = this;\n\n // Watch to see if the matching mouseup event occurs outside the dialog\n // And if it does, cancel the clickOut handler\n var modal = this.$refs.modal;\n\n var onceModalMouseup = function onceModalMouseup(evt) {\n eventOff(modal, 'mouseup', onceModalMouseup, EVT_OPTIONS);\n\n if (evt.target === modal) {\n _this4.ignoreBackdropClick = true;\n }\n };\n\n eventOn(modal, 'mouseup', onceModalMouseup, EVT_OPTIONS);\n },\n onClickOut: function onClickOut(evt) {\n if (this.ignoreBackdropClick) {\n // Click was initiated inside the modal content, but finished outside.\n // Set by the above onDialogMousedown handler\n this.ignoreBackdropClick = false;\n return;\n } // Do nothing if not visible, backdrop click disabled, or element\n // that generated click event is no longer in document body\n\n\n if (!this.isVisible || this.noCloseOnBackdrop || !contains(document.body, evt.target)) {\n return;\n } // If backdrop clicked, hide modal\n\n\n if (!contains(this.$refs.content, evt.target)) {\n this.hide('backdrop');\n }\n },\n onOk: function onOk() {\n this.hide('ok');\n },\n onCancel: function onCancel() {\n this.hide('cancel');\n },\n onClose: function onClose() {\n this.hide('headerclose');\n },\n onEsc: function onEsc(evt) {\n // If ESC pressed, hide modal\n if (evt.keyCode === KeyCodes.ESC && this.isVisible && !this.noCloseOnEsc) {\n this.hide('esc');\n }\n },\n // Document focusin listener\n focusHandler: function focusHandler(evt) {\n // If focus leaves modal, bring it back\n var modal = this.$refs.modal;\n\n if (!this.noEnforceFocus && this.isTop && this.isVisible && modal && document !== evt.target && !contains(modal, evt.target)) {\n modal.focus({\n preventScroll: true\n });\n }\n },\n // Turn on/off focusin listener\n setEnforceFocus: function setEnforceFocus(on) {\n var method = on ? eventOn : eventOff;\n method(document, 'focusin', this.focusHandler, EVT_OPTIONS);\n },\n // Resize listener\n setResizeEvent: function setResizeEvent(on) {\n var method = on ? eventOn : eventOff; // These events should probably also check if\n // body is overflowing\n\n method(window, 'resize', this.checkModalOverflow, EVT_OPTIONS);\n method(window, 'orientationchange', this.checkModalOverflow, EVT_OPTIONS);\n },\n // Root listener handlers\n showHandler: function showHandler(id, triggerEl) {\n if (id === this.safeId()) {\n this.return_focus = triggerEl || this.getActiveElement();\n this.show();\n }\n },\n hideHandler: function hideHandler(id) {\n if (id === this.safeId()) {\n this.hide('event');\n }\n },\n toggleHandler: function toggleHandler(id, triggerEl) {\n if (id === this.safeId()) {\n this.toggle(triggerEl);\n }\n },\n modalListener: function modalListener(bvEvt) {\n // If another modal opens, close this one if stacking not permitted\n if (this.noStacking && bvEvt.vueTarget !== this) {\n this.hide();\n }\n },\n // Focus control handlers\n focusFirst: function focusFirst() {\n // Don't try and focus if we are SSR\n if (isBrowser) {\n var modal = this.$refs.modal;\n var activeElement = this.getActiveElement(); // If the modal contains the activeElement, we don't do anything\n\n if (modal && !(activeElement && contains(modal, activeElement))) {\n // Make sure top of modal is showing (if longer than the viewport)\n // and focus the modal content wrapper\n this.$nextTick(function () {\n modal.scrollTop = 0;\n modal.focus();\n });\n }\n }\n },\n returnFocusTo: function returnFocusTo() {\n // Prefer `returnFocus` prop over event specified\n // `return_focus` value\n var el = this.returnFocus || this.return_focus || null; // Is el a string CSS selector?\n\n el = isString(el) ? select(el) : el;\n\n if (el) {\n // Possibly could be a component reference\n el = el.$el || el;\n\n if (isVisible(el) && el.focus) {\n el.focus();\n }\n }\n },\n checkModalOverflow: function checkModalOverflow() {\n if (this.isVisible) {\n var modal = this.$refs.modal;\n this.isModalOverflowing = modal.scrollHeight > document.documentElement.clientHeight;\n }\n },\n makeModal: function makeModal(h) {\n // Modal header\n var header = h();\n\n if (!this.hideHeader) {\n var modalHeader = this.normalizeSlot('modal-header', this.slotScope);\n\n if (!modalHeader) {\n var closeButton = h();\n\n if (!this.hideHeaderClose) {\n closeButton = h(BButtonClose, {\n props: {\n disabled: this.isTransitioning,\n ariaLabel: this.headerCloseLabel,\n textVariant: this.headerCloseVariant || this.headerTextVariant\n },\n on: {\n click: this.onClose\n }\n }, [this.normalizeSlot('modal-header-close')]);\n }\n\n var domProps = !this.hasNormalizedSlot('modal-title') && this.titleHtml ? {\n innerHTML: this.titleHtml\n } : {};\n modalHeader = [h(this.titleTag, {\n staticClass: 'modal-title',\n class: this.titleClases,\n attrs: {\n id: this.safeId('__BV_modal_title_')\n },\n domProps: domProps\n }, [this.normalizeSlot('modal-title', this.slotScope) || stripTags(this.title)]), closeButton];\n }\n\n header = h('header', {\n ref: 'header',\n staticClass: 'modal-header',\n class: this.headerClasses,\n attrs: {\n id: this.safeId('__BV_modal_header_')\n }\n }, [modalHeader]);\n } // Modal body\n\n\n var body = h('div', {\n ref: 'body',\n staticClass: 'modal-body',\n class: this.bodyClasses,\n attrs: {\n id: this.safeId('__BV_modal_body_')\n }\n }, this.normalizeSlot('default', this.slotScope)); // Modal footer\n\n var footer = h();\n\n if (!this.hideFooter) {\n var modalFooter = this.normalizeSlot('modal-footer', this.slotScope);\n\n if (!modalFooter) {\n var cancelButton = h();\n\n if (!this.okOnly) {\n var cancelHtml = this.cancelTitleHtml ? {\n innerHTML: this.cancelTitleHtml\n } : null;\n cancelButton = h(BButton, {\n props: {\n variant: this.cancelVariant,\n size: this.buttonSize,\n disabled: this.cancelDisabled || this.busy || this.isTransitioning\n },\n on: {\n click: this.onCancel\n }\n }, [this.normalizeSlot('modal-cancel') || (cancelHtml ? h('span', {\n domProps: cancelHtml\n }) : stripTags(this.cancelTitle))]);\n }\n\n var okHtml = this.okTitleHtml ? {\n innerHTML: this.okTitleHtml\n } : null;\n var okButton = h(BButton, {\n props: {\n variant: this.okVariant,\n size: this.buttonSize,\n disabled: this.okDisabled || this.busy || this.isTransitioning\n },\n on: {\n click: this.onOk\n }\n }, [this.normalizeSlot('modal-ok') || (okHtml ? h('span', {\n domProps: okHtml\n }) : stripTags(this.okTitle))]);\n modalFooter = [cancelButton, okButton];\n }\n\n footer = h('footer', {\n ref: 'footer',\n staticClass: 'modal-footer',\n class: this.footerClasses,\n attrs: {\n id: this.safeId('__BV_modal_footer_')\n }\n }, [modalFooter]);\n } // Assemble modal content\n\n\n var modalContent = h('div', {\n ref: 'content',\n staticClass: 'modal-content',\n class: this.contentClass,\n attrs: {\n role: 'document',\n id: this.safeId('__BV_modal_content_')\n }\n }, [header, body, footer]); // Modal dialog wrapper\n\n var modalDialog = h('div', {\n staticClass: 'modal-dialog',\n class: this.dialogClasses,\n on: {\n mousedown: this.onDialogMousedown\n }\n }, [modalContent]); // Modal\n\n var modal = h('div', {\n ref: 'modal',\n staticClass: 'modal',\n class: this.modalClasses,\n style: this.modalStyles,\n directives: [{\n name: 'show',\n rawName: 'v-show',\n value: this.isVisible,\n expression: 'isVisible'\n }],\n attrs: {\n id: this.safeId(),\n role: 'dialog',\n tabindex: '-1',\n 'aria-hidden': this.isVisible ? null : 'true',\n 'aria-modal': this.isVisible ? 'true' : null,\n 'aria-label': this.ariaLabel,\n 'aria-labelledby': this.hideHeader || this.ariaLabel || !(this.hasNormalizedSlot('modal-title') || this.titleHtml || this.title) ? null : this.safeId('__BV_modal_title_'),\n 'aria-describedby': this.safeId('__BV_modal_body_')\n },\n on: {\n keydown: this.onEsc,\n click: this.onClickOut\n }\n }, [modalDialog]); // Wrap modal in transition\n // Sadly, we can't use BVTransition here due to the differences in\n // transition durations for .modal and .modal-dialog. Not until\n // issue https://github.com/vuejs/vue/issues/9986 is resolved\n\n modal = h('transition', {\n props: {\n enterClass: '',\n enterToClass: '',\n enterActiveClass: '',\n leaveClass: '',\n leaveActiveClass: '',\n leaveToClass: ''\n },\n on: {\n beforeEnter: this.onBeforeEnter,\n enter: this.onEnter,\n afterEnter: this.onAfterEnter,\n beforeLeave: this.onBeforeLeave,\n leave: this.onLeave,\n afterLeave: this.onAfterLeave\n }\n }, [modal]); // Modal backdrop\n\n var backdrop = h();\n\n if (!this.hideBackdrop && this.isVisible) {\n backdrop = h('div', {\n staticClass: 'modal-backdrop',\n attrs: {\n id: this.safeId('__BV_modal_backdrop_')\n }\n }, [this.normalizeSlot('modal-backdrop')]);\n }\n\n backdrop = h(BVTransition, {\n props: {\n noFade: this.noFade\n }\n }, [backdrop]); // Tab trap to prevent page from scrolling to next element in\n // tab index during enforce focus tab cycle\n\n var tabTrap = h();\n\n if (this.isVisible && this.isTop && !this.noEnforceFocus) {\n tabTrap = h('div', {\n attrs: {\n tabindex: '0'\n }\n });\n } // Assemble modal and backdrop in an outer