bootstrap.bundle.js 218 KB
Newer Older
Mark Otto's avatar
dist  
Mark Otto committed
4001

Mark Otto's avatar
dist    
Mark Otto committed
4002
      this.state.eventsEnabled = eventsEnabled;
Mark Otto's avatar
dist  
Mark Otto committed
4003
4004
    }

Mark Otto's avatar
dist    
Mark Otto committed
4005
4006
    // We can't use class properties because they don't get listed in the
    // class prototype and break stuff like Sinon stubs
Mark Otto's avatar
dist  
Mark Otto committed
4007
4008


Mark Otto's avatar
dist    
Mark Otto committed
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
    createClass(Popper, [{
      key: 'update',
      value: function update$$1() {
        return update.call(this);
      }
    }, {
      key: 'destroy',
      value: function destroy$$1() {
        return destroy.call(this);
      }
    }, {
      key: 'enableEventListeners',
      value: function enableEventListeners$$1() {
        return enableEventListeners.call(this);
      }
    }, {
      key: 'disableEventListeners',
      value: function disableEventListeners$$1() {
        return disableEventListeners.call(this);
      }
Mark Otto's avatar
dist  
Mark Otto committed
4029

Mark Otto's avatar
dist    
Mark Otto committed
4030
      /**
Mark Otto's avatar
dist    
Mark Otto committed
4031
       * Schedules an update. It will run on the next UI update available.
Mark Otto's avatar
dist    
Mark Otto committed
4032
4033
4034
       * @method scheduleUpdate
       * @memberof Popper
       */
Mark Otto's avatar
dist  
Mark Otto committed
4035
4036


Mark Otto's avatar
dist    
Mark Otto committed
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
      /**
       * Collection of utilities useful when writing custom modifiers.
       * Starting from version 1.7, this method is available only if you
       * include `popper-utils.js` before `popper.js`.
       *
       * **DEPRECATION**: This way to access PopperUtils is deprecated
       * and will be removed in v2! Use the PopperUtils module directly instead.
       * Due to the high instability of the methods contained in Utils, we can't
       * guarantee them to follow semver. Use them at your own risk!
       * @static
       * @private
       * @type {Object}
       * @deprecated since version 1.8
       * @member Utils
       * @memberof Popper
       */
Mark Otto's avatar
dist  
Mark Otto committed
4053

Mark Otto's avatar
dist    
Mark Otto committed
4054
4055
4056
    }]);
    return Popper;
  }();
Mark Otto's avatar
dist  
Mark Otto committed
4057
4058

  /**
Mark Otto's avatar
dist    
Mark Otto committed
4059
4060
4061
4062
4063
4064
4065
4066
4067
   * The `referenceObject` is an object that provides an interface compatible with Popper.js
   * and lets you use it as replacement of a real DOM node.<br />
   * You can use this method to position a popper relatively to a set of coordinates
   * in case you don't have a DOM node to use as reference.
   *
   * ```
   * new Popper(referenceObject, popperNode);
   * ```
   *
Mark Otto's avatar
dist    
Mark Otto committed
4068
   * NB: This feature isn't supported in Internet Explorer 10.
Mark Otto's avatar
dist    
Mark Otto committed
4069
4070
4071
4072
4073
4074
4075
   * @name referenceObject
   * @property {Function} data.getBoundingClientRect
   * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
   * @property {number} data.clientWidth
   * An ES6 getter that will return the width of the virtual reference element.
   * @property {number} data.clientHeight
   * An ES6 getter that will return the height of the virtual reference element.
Mark Otto's avatar
dist  
Mark Otto committed
4076
   */
Mark Otto's avatar
dist    
Mark Otto committed
4077
4078
4079
4080
4081
4082


  Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  Popper.placements = placements;
  Popper.Defaults = Defaults;

XhmikosR's avatar
Dist    
XhmikosR committed
4083
4084
4085
4086
4087
4088
4089
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$4 = 'dropdown';
XhmikosR's avatar
XhmikosR committed
4090
  var VERSION$4 = '4.3.1';
XhmikosR's avatar
Dist    
XhmikosR committed
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
  var DATA_KEY$4 = 'bs.dropdown';
  var EVENT_KEY$4 = "." + DATA_KEY$4;
  var DATA_API_KEY$4 = '.data-api';
  var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key

  var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key

  var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key

  var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key

  var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key

  var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)

  var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  var Event$4 = {
    HIDE: "hide" + EVENT_KEY$4,
    HIDDEN: "hidden" + EVENT_KEY$4,
    SHOW: "show" + EVENT_KEY$4,
    SHOWN: "shown" + EVENT_KEY$4,
    CLICK: "click" + EVENT_KEY$4,
    CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
    KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
    KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  };
  var ClassName$4 = {
    DISABLED: 'disabled',
    SHOW: 'show',
    DROPUP: 'dropup',
    DROPRIGHT: 'dropright',
    DROPLEFT: 'dropleft',
    MENURIGHT: 'dropdown-menu-right',
    MENULEFT: 'dropdown-menu-left',
    POSITION_STATIC: 'position-static'
  };
  var Selector$4 = {
    DATA_TOGGLE: '[data-toggle="dropdown"]',
    FORM_CHILD: '.dropdown form',
    MENU: '.dropdown-menu',
    NAVBAR_NAV: '.navbar-nav',
    VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  };
  var AttachmentMap = {
    TOP: 'top-start',
    TOPEND: 'top-end',
    BOTTOM: 'bottom-start',
    BOTTOMEND: 'bottom-end',
    RIGHT: 'right-start',
    RIGHTEND: 'right-end',
    LEFT: 'left-start',
    LEFTEND: 'left-end'
  };
  var Default$2 = {
    offset: 0,
    flip: true,
    boundary: 'scrollParent',
    reference: 'toggle',
    display: 'dynamic'
  };
  var DefaultType$2 = {
    offset: '(number|string|function)',
    flip: 'boolean',
    boundary: '(string|element)',
    reference: '(string|element)',
    display: 'string'
Mark Otto's avatar
dist    
Mark Otto committed
4158
4159
    /**
     * ------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
4160
     * Class Definition
Mark Otto's avatar
dist    
Mark Otto committed
4161
4162
     * ------------------------------------------------------------------------
     */
Mark Otto's avatar
dist    
Mark Otto committed
4163

XhmikosR's avatar
Dist    
XhmikosR committed
4164
  };
Mark Otto's avatar
dist    
Mark Otto committed
4165

XhmikosR's avatar
Dist    
XhmikosR committed
4166
4167
4168
4169
4170
4171
4172
4173
4174
  var Dropdown =
  /*#__PURE__*/
  function () {
    function Dropdown(element, config) {
      this._element = element;
      this._popper = null;
      this._config = this._getConfig(config);
      this._menu = this._getMenuElement();
      this._inNavbar = this._detectNavbar();
Mark Otto's avatar
dist    
Mark Otto committed
4175

XhmikosR's avatar
Dist    
XhmikosR committed
4176
4177
      this._addEventListeners();
    } // Getters
Mark Otto's avatar
dist    
Mark Otto committed
4178

Mark Otto's avatar
dist  
Mark Otto committed
4179

XhmikosR's avatar
Dist    
XhmikosR committed
4180
    var _proto = Dropdown.prototype;
Mark Otto's avatar
dist  
Mark Otto committed
4181

XhmikosR's avatar
Dist    
XhmikosR committed
4182
4183
4184
4185
4186
    // Public
    _proto.toggle = function toggle() {
      if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
4187

XhmikosR's avatar
Dist    
XhmikosR committed
4188
      var parent = Dropdown._getParentFromElement(this._element);
Mark Otto's avatar
dist  
Mark Otto committed
4189

XhmikosR's avatar
Dist    
XhmikosR committed
4190
      var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
Mark Otto's avatar
dist  
Mark Otto committed
4191

XhmikosR's avatar
Dist    
XhmikosR committed
4192
      Dropdown._clearMenus();
Mark Otto's avatar
dist  
Mark Otto committed
4193

XhmikosR's avatar
Dist    
XhmikosR committed
4194
4195
4196
      if (isActive) {
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
4197

XhmikosR's avatar
Dist    
XhmikosR committed
4198
4199
4200
4201
4202
      var relatedTarget = {
        relatedTarget: this._element
      };
      var showEvent = $.Event(Event$4.SHOW, relatedTarget);
      $(parent).trigger(showEvent);
Mark Otto's avatar
dist  
Mark Otto committed
4203

XhmikosR's avatar
Dist    
XhmikosR committed
4204
4205
4206
      if (showEvent.isDefaultPrevented()) {
        return;
      } // Disable totally Popper.js for Dropdown in Navbar
Mark Otto's avatar
dist    
Mark Otto committed
4207

Mark Otto's avatar
dist  
Mark Otto committed
4208

XhmikosR's avatar
Dist    
XhmikosR committed
4209
4210
4211
4212
4213
4214
4215
      if (!this._inNavbar) {
        /**
         * Check for Popper dependency
         * Popper - https://popper.js.org
         */
        if (typeof Popper === 'undefined') {
          throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
Mark Otto's avatar
dist    
Mark Otto committed
4216
        }
Mark Otto's avatar
dist  
Mark Otto committed
4217

XhmikosR's avatar
Dist    
XhmikosR committed
4218
        var referenceElement = this._element;
Mark Otto's avatar
dist  
Mark Otto committed
4219

XhmikosR's avatar
Dist    
XhmikosR committed
4220
4221
4222
4223
        if (this._config.reference === 'parent') {
          referenceElement = parent;
        } else if (Util.isElement(this._config.reference)) {
          referenceElement = this._config.reference; // Check if it's jQuery element
Mark Otto's avatar
dist    
Mark Otto committed
4224

XhmikosR's avatar
Dist    
XhmikosR committed
4225
4226
          if (typeof this._config.reference.jquery !== 'undefined') {
            referenceElement = this._config.reference[0];
Mark Otto's avatar
dist    
Mark Otto committed
4227
          }
XhmikosR's avatar
Dist    
XhmikosR committed
4228
4229
4230
        } // If boundary is not `scrollParent`, then set position to `static`
        // to allow the menu to "escape" the scroll parent's boundaries
        // https://github.com/twbs/bootstrap/issues/24251
Mark Otto's avatar
dist    
Mark Otto committed
4231

Mark Otto's avatar
dist    
Mark Otto committed
4232

XhmikosR's avatar
Dist    
XhmikosR committed
4233
4234
4235
        if (this._config.boundary !== 'scrollParent') {
          $(parent).addClass(ClassName$4.POSITION_STATIC);
        }
Mark Otto's avatar
dist    
Mark Otto committed
4236

XhmikosR's avatar
Dist    
XhmikosR committed
4237
4238
4239
4240
4241
        this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
      } // If this is a touch-enabled device we add extra
      // 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
Mark Otto's avatar
dist    
Mark Otto committed
4242

Mark Otto's avatar
dist    
Mark Otto committed
4243

XhmikosR's avatar
Dist    
XhmikosR committed
4244
4245
4246
      if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
        $(document.body).children().on('mouseover', null, $.noop);
      }
Mark Otto's avatar
dist    
Mark Otto committed
4247

XhmikosR's avatar
Dist    
XhmikosR committed
4248
      this._element.focus();
Mark Otto's avatar
dist    
Mark Otto committed
4249

XhmikosR's avatar
Dist    
XhmikosR committed
4250
      this._element.setAttribute('aria-expanded', true);
Mark Otto's avatar
dist  
Mark Otto committed
4251

XhmikosR's avatar
Dist    
XhmikosR committed
4252
4253
4254
      $(this._menu).toggleClass(ClassName$4.SHOW);
      $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
    };
Mark Otto's avatar
dist    
Mark Otto committed
4255

XhmikosR's avatar
Dist    
XhmikosR committed
4256
4257
4258
4259
    _proto.show = function show() {
      if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
4260

XhmikosR's avatar
Dist    
XhmikosR committed
4261
4262
      var relatedTarget = {
        relatedTarget: this._element
Mark Otto's avatar
dist    
Mark Otto committed
4263
      };
XhmikosR's avatar
Dist    
XhmikosR committed
4264
      var showEvent = $.Event(Event$4.SHOW, relatedTarget);
Mark Otto's avatar
dist  
Mark Otto committed
4265

XhmikosR's avatar
Dist    
XhmikosR committed
4266
      var parent = Dropdown._getParentFromElement(this._element);
Mark Otto's avatar
dist    
Mark Otto committed
4267

XhmikosR's avatar
Dist    
XhmikosR committed
4268
      $(parent).trigger(showEvent);
Mark Otto's avatar
dist  
Mark Otto committed
4269

XhmikosR's avatar
Dist    
XhmikosR committed
4270
4271
4272
      if (showEvent.isDefaultPrevented()) {
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
4273

XhmikosR's avatar
Dist    
XhmikosR committed
4274
4275
4276
      $(this._menu).toggleClass(ClassName$4.SHOW);
      $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
    };
Mark Otto's avatar
dist    
Mark Otto committed
4277

XhmikosR's avatar
Dist    
XhmikosR committed
4278
4279
4280
4281
    _proto.hide = function hide() {
      if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
4282

XhmikosR's avatar
Dist    
XhmikosR committed
4283
4284
4285
4286
      var relatedTarget = {
        relatedTarget: this._element
      };
      var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
Mark Otto's avatar
dist  
Mark Otto committed
4287

XhmikosR's avatar
Dist    
XhmikosR committed
4288
      var parent = Dropdown._getParentFromElement(this._element);
Mark Otto's avatar
dist    
Mark Otto committed
4289

XhmikosR's avatar
Dist    
XhmikosR committed
4290
      $(parent).trigger(hideEvent);
Mark Otto's avatar
dist  
Mark Otto committed
4291

XhmikosR's avatar
Dist    
XhmikosR committed
4292
4293
4294
      if (hideEvent.isDefaultPrevented()) {
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
4295

XhmikosR's avatar
Dist    
XhmikosR committed
4296
4297
4298
      $(this._menu).toggleClass(ClassName$4.SHOW);
      $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
    };
Mark Otto's avatar
dist  
Mark Otto committed
4299

XhmikosR's avatar
Dist    
XhmikosR committed
4300
4301
4302
4303
4304
    _proto.dispose = function dispose() {
      $.removeData(this._element, DATA_KEY$4);
      $(this._element).off(EVENT_KEY$4);
      this._element = null;
      this._menu = null;
Mark Otto's avatar
dist    
Mark Otto committed
4305

XhmikosR's avatar
Dist    
XhmikosR committed
4306
4307
      if (this._popper !== null) {
        this._popper.destroy();
Mark Otto's avatar
dist  
Mark Otto committed
4308

XhmikosR's avatar
Dist    
XhmikosR committed
4309
4310
4311
        this._popper = null;
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
4312

XhmikosR's avatar
Dist    
XhmikosR committed
4313
4314
    _proto.update = function update() {
      this._inNavbar = this._detectNavbar();
Mark Otto's avatar
dist    
Mark Otto committed
4315

XhmikosR's avatar
Dist    
XhmikosR committed
4316
4317
4318
      if (this._popper !== null) {
        this._popper.scheduleUpdate();
      }
Mark Otto's avatar
Mark Otto committed
4319
4320
    } // Private
    ;
Mark Otto's avatar
dist    
Mark Otto committed
4321

XhmikosR's avatar
Dist    
XhmikosR committed
4322
4323
    _proto._addEventListeners = function _addEventListeners() {
      var _this = this;
Mark Otto's avatar
dist    
Mark Otto committed
4324

XhmikosR's avatar
Dist    
XhmikosR committed
4325
4326
4327
      $(this._element).on(Event$4.CLICK, function (event) {
        event.preventDefault();
        event.stopPropagation();
Mark Otto's avatar
dist  
Mark Otto committed
4328

XhmikosR's avatar
Dist    
XhmikosR committed
4329
4330
4331
        _this.toggle();
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
4332

XhmikosR's avatar
Dist    
XhmikosR committed
4333
4334
4335
4336
4337
    _proto._getConfig = function _getConfig(config) {
      config = _objectSpread({}, this.constructor.Default, $(this._element).data(), config);
      Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
      return config;
    };
Mark Otto's avatar
dist    
Mark Otto committed
4338

XhmikosR's avatar
Dist    
XhmikosR committed
4339
4340
4341
4342
4343
4344
    _proto._getMenuElement = function _getMenuElement() {
      if (!this._menu) {
        var parent = Dropdown._getParentFromElement(this._element);

        if (parent) {
          this._menu = parent.querySelector(Selector$4.MENU);
Mark Otto's avatar
dist  
Mark Otto committed
4345
        }
XhmikosR's avatar
Dist    
XhmikosR committed
4346
      }
Mark Otto's avatar
dist    
Mark Otto committed
4347

XhmikosR's avatar
Dist    
XhmikosR committed
4348
4349
      return this._menu;
    };
Mark Otto's avatar
dist  
Mark Otto committed
4350

XhmikosR's avatar
Dist    
XhmikosR committed
4351
4352
4353
    _proto._getPlacement = function _getPlacement() {
      var $parentDropdown = $(this._element.parentNode);
      var placement = AttachmentMap.BOTTOM; // Handle dropup
Mark Otto's avatar
dist  
Mark Otto committed
4354

XhmikosR's avatar
Dist    
XhmikosR committed
4355
4356
      if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
        placement = AttachmentMap.TOP;
Mark Otto's avatar
dist    
Mark Otto committed
4357

XhmikosR's avatar
Dist    
XhmikosR committed
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
        if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
          placement = AttachmentMap.TOPEND;
        }
      } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
        placement = AttachmentMap.RIGHT;
      } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
        placement = AttachmentMap.LEFT;
      } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
        placement = AttachmentMap.BOTTOMEND;
      }
Mark Otto's avatar
dist    
Mark Otto committed
4368

XhmikosR's avatar
Dist    
XhmikosR committed
4369
4370
      return placement;
    };
Mark Otto's avatar
dist    
Mark Otto committed
4371

XhmikosR's avatar
Dist    
XhmikosR committed
4372
4373
4374
    _proto._detectNavbar = function _detectNavbar() {
      return $(this._element).closest('.navbar').length > 0;
    };
Mark Otto's avatar
dist    
Mark Otto committed
4375

Mark Otto's avatar
Mark Otto committed
4376
    _proto._getOffset = function _getOffset() {
XhmikosR's avatar
Dist    
XhmikosR committed
4377
      var _this2 = this;
Mark Otto's avatar
dist    
Mark Otto committed
4378

Mark Otto's avatar
Mark Otto committed
4379
      var offset = {};
Mark Otto's avatar
dist    
Mark Otto committed
4380

XhmikosR's avatar
Dist    
XhmikosR committed
4381
      if (typeof this._config.offset === 'function') {
Mark Otto's avatar
Mark Otto committed
4382
4383
        offset.fn = function (data) {
          data.offsets = _objectSpread({}, data.offsets, _this2._config.offset(data.offsets, _this2._element) || {});
XhmikosR's avatar
Dist    
XhmikosR committed
4384
4385
4386
          return data;
        };
      } else {
Mark Otto's avatar
Mark Otto committed
4387
        offset.offset = this._config.offset;
XhmikosR's avatar
Dist    
XhmikosR committed
4388
      }
Mark Otto's avatar
dist    
Mark Otto committed
4389

Mark Otto's avatar
Mark Otto committed
4390
4391
4392
4393
      return offset;
    };

    _proto._getPopperConfig = function _getPopperConfig() {
XhmikosR's avatar
Dist    
XhmikosR committed
4394
4395
4396
      var popperConfig = {
        placement: this._getPlacement(),
        modifiers: {
Mark Otto's avatar
Mark Otto committed
4397
          offset: this._getOffset(),
XhmikosR's avatar
Dist    
XhmikosR committed
4398
4399
4400
4401
4402
          flip: {
            enabled: this._config.flip
          },
          preventOverflow: {
            boundariesElement: this._config.boundary
Mark Otto's avatar
dist    
Mark Otto committed
4403
          }
XhmikosR's avatar
Dist    
XhmikosR committed
4404
        } // Disable Popper.js if we have a static display
Mark Otto's avatar
dist    
Mark Otto committed
4405

XhmikosR's avatar
Dist    
XhmikosR committed
4406
      };
Mark Otto's avatar
dist    
Mark Otto committed
4407

XhmikosR's avatar
Dist    
XhmikosR committed
4408
4409
4410
4411
4412
      if (this._config.display === 'static') {
        popperConfig.modifiers.applyStyle = {
          enabled: false
        };
      }
Mark Otto's avatar
dist  
Mark Otto committed
4413

XhmikosR's avatar
Dist    
XhmikosR committed
4414
      return popperConfig;
Mark Otto's avatar
Mark Otto committed
4415
4416
    } // Static
    ;
Mark Otto's avatar
dist    
Mark Otto committed
4417

XhmikosR's avatar
Dist    
XhmikosR committed
4418
4419
4420
    Dropdown._jQueryInterface = function _jQueryInterface(config) {
      return this.each(function () {
        var data = $(this).data(DATA_KEY$4);
Mark Otto's avatar
dist    
Mark Otto committed
4421

XhmikosR's avatar
Dist    
XhmikosR committed
4422
        var _config = typeof config === 'object' ? config : null;
Mark Otto's avatar
dist  
Mark Otto committed
4423

XhmikosR's avatar
Dist    
XhmikosR committed
4424
4425
4426
4427
        if (!data) {
          data = new Dropdown(this, _config);
          $(this).data(DATA_KEY$4, data);
        }
Mark Otto's avatar
dist  
Mark Otto committed
4428

XhmikosR's avatar
Dist    
XhmikosR committed
4429
4430
4431
        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
Mark Otto's avatar
dist  
Mark Otto committed
4432
          }
Mark Otto's avatar
dist    
Mark Otto committed
4433

XhmikosR's avatar
Dist    
XhmikosR committed
4434
4435
4436
4437
4438
4439
4440
4441
4442
          data[config]();
        }
      });
    };

    Dropdown._clearMenus = function _clearMenus(event) {
      if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
4443

XhmikosR's avatar
Dist    
XhmikosR committed
4444
      var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
Mark Otto's avatar
dist  
Mark Otto committed
4445

XhmikosR's avatar
Dist    
XhmikosR committed
4446
4447
      for (var i = 0, len = toggles.length; i < len; i++) {
        var parent = Dropdown._getParentFromElement(toggles[i]);
Mark Otto's avatar
dist    
Mark Otto committed
4448

XhmikosR's avatar
Dist    
XhmikosR committed
4449
4450
4451
4452
        var context = $(toggles[i]).data(DATA_KEY$4);
        var relatedTarget = {
          relatedTarget: toggles[i]
        };
Mark Otto's avatar
dist    
Mark Otto committed
4453

XhmikosR's avatar
Dist    
XhmikosR committed
4454
4455
4456
        if (event && event.type === 'click') {
          relatedTarget.clickEvent = event;
        }
Mark Otto's avatar
dist  
Mark Otto committed
4457

XhmikosR's avatar
Dist    
XhmikosR committed
4458
4459
        if (!context) {
          continue;
Mark Otto's avatar
dist  
Mark Otto committed
4460
4461
        }

XhmikosR's avatar
Dist    
XhmikosR committed
4462
        var dropdownMenu = context._menu;
Mark Otto's avatar
dist    
Mark Otto committed
4463

XhmikosR's avatar
Dist    
XhmikosR committed
4464
4465
        if (!$(parent).hasClass(ClassName$4.SHOW)) {
          continue;
Mark Otto's avatar
dist  
Mark Otto committed
4466
4467
        }

XhmikosR's avatar
Dist    
XhmikosR committed
4468
4469
4470
        if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
          continue;
        }
Mark Otto's avatar
dist  
Mark Otto committed
4471

XhmikosR's avatar
Dist    
XhmikosR committed
4472
4473
        var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
        $(parent).trigger(hideEvent);
Mark Otto's avatar
dist    
Mark Otto committed
4474

XhmikosR's avatar
Dist    
XhmikosR committed
4475
4476
4477
4478
        if (hideEvent.isDefaultPrevented()) {
          continue;
        } // If this is a touch-enabled device we remove the extra
        // empty mouseover listeners we added for iOS support
Mark Otto's avatar
dist    
Mark Otto committed
4479
4480


XhmikosR's avatar
Dist    
XhmikosR committed
4481
4482
        if ('ontouchstart' in document.documentElement) {
          $(document.body).children().off('mouseover', null, $.noop);
Mark Otto's avatar
dist  
Mark Otto committed
4483
4484
        }

XhmikosR's avatar
Dist    
XhmikosR committed
4485
4486
4487
4488
4489
        toggles[i].setAttribute('aria-expanded', 'false');
        $(dropdownMenu).removeClass(ClassName$4.SHOW);
        $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
4490

XhmikosR's avatar
Dist    
XhmikosR committed
4491
4492
4493
    Dropdown._getParentFromElement = function _getParentFromElement(element) {
      var parent;
      var selector = Util.getSelectorFromElement(element);
Mark Otto's avatar
dist  
Mark Otto committed
4494

XhmikosR's avatar
Dist    
XhmikosR committed
4495
4496
4497
      if (selector) {
        parent = document.querySelector(selector);
      }
Mark Otto's avatar
dist    
Mark Otto committed
4498

XhmikosR's avatar
Dist    
XhmikosR committed
4499
      return parent || element.parentNode;
Mark Otto's avatar
Mark Otto committed
4500
4501
    } // eslint-disable-next-line complexity
    ;
Mark Otto's avatar
dist  
Mark Otto committed
4502

XhmikosR's avatar
Dist    
XhmikosR committed
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
    Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
      // If not input/textarea:
      //  - And not a key in REGEXP_KEYDOWN => not a dropdown command
      // If input/textarea:
      //  - If space key => not a dropdown command
      //  - If key is other than escape
      //    - If key is not up or down => not a dropdown command
      //    - If trigger inside the menu => not a dropdown command
      if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $(event.target).closest(Selector$4.MENU).length) : !REGEXP_KEYDOWN.test(event.which)) {
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
4514

XhmikosR's avatar
Dist    
XhmikosR committed
4515
4516
      event.preventDefault();
      event.stopPropagation();
Mark Otto's avatar
dist  
Mark Otto committed
4517

XhmikosR's avatar
Dist    
XhmikosR committed
4518
4519
4520
      if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
4521

XhmikosR's avatar
Dist    
XhmikosR committed
4522
      var parent = Dropdown._getParentFromElement(this);
Mark Otto's avatar
dist  
Mark Otto committed
4523

XhmikosR's avatar
Dist    
XhmikosR committed
4524
4525
      var isActive = $(parent).hasClass(ClassName$4.SHOW);

Mark Otto's avatar
dist    
Mark Otto committed
4526
      if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
XhmikosR's avatar
Dist    
XhmikosR committed
4527
4528
4529
        if (event.which === ESCAPE_KEYCODE) {
          var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
          $(toggle).trigger('focus');
Mark Otto's avatar
dist  
Mark Otto committed
4530
4531
        }

XhmikosR's avatar
Dist    
XhmikosR committed
4532
4533
4534
        $(this).trigger('click');
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
4535

XhmikosR's avatar
Dist    
XhmikosR committed
4536
      var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS));
Mark Otto's avatar
dist  
Mark Otto committed
4537

XhmikosR's avatar
Dist    
XhmikosR committed
4538
4539
4540
      if (items.length === 0) {
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
4541

XhmikosR's avatar
Dist    
XhmikosR committed
4542
      var index = items.indexOf(event.target);
Mark Otto's avatar
dist  
Mark Otto committed
4543

XhmikosR's avatar
Dist    
XhmikosR committed
4544
4545
4546
4547
      if (event.which === ARROW_UP_KEYCODE && index > 0) {
        // Up
        index--;
      }
Mark Otto's avatar
dist  
Mark Otto committed
4548

XhmikosR's avatar
Dist    
XhmikosR committed
4549
4550
4551
4552
      if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
        // Down
        index++;
      }
Mark Otto's avatar
dist  
Mark Otto committed
4553

XhmikosR's avatar
Dist    
XhmikosR committed
4554
4555
4556
      if (index < 0) {
        index = 0;
      }
Mark Otto's avatar
dist  
Mark Otto committed
4557

XhmikosR's avatar
Dist    
XhmikosR committed
4558
      items[index].focus();
Mark Otto's avatar
dist  
Mark Otto committed
4559
4560
    };

XhmikosR's avatar
Dist    
XhmikosR committed
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
    _createClass(Dropdown, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$4;
      }
    }, {
      key: "Default",
      get: function get() {
        return Default$2;
      }
    }, {
      key: "DefaultType",
      get: function get() {
        return DefaultType$2;
      }
    }]);

Mark Otto's avatar
dist  
Mark Otto committed
4578
    return Dropdown;
XhmikosR's avatar
Dist    
XhmikosR committed
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */


  $(document).on(Event$4.KEYDOWN_DATA_API, Selector$4.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event$4.KEYDOWN_DATA_API, Selector$4.MENU, Dropdown._dataApiKeydownHandler).on(Event$4.CLICK_DATA_API + " " + Event$4.KEYUP_DATA_API, Dropdown._clearMenus).on(Event$4.CLICK_DATA_API, Selector$4.DATA_TOGGLE, function (event) {
    event.preventDefault();
    event.stopPropagation();

    Dropdown._jQueryInterface.call($(this), 'toggle');
  }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
    e.stopPropagation();
  });
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
   */

  $.fn[NAME$4] = Dropdown._jQueryInterface;
  $.fn[NAME$4].Constructor = Dropdown;

  $.fn[NAME$4].noConflict = function () {
    $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
    return Dropdown._jQueryInterface;
  };
Mark Otto's avatar
dist    
Mark Otto committed
4608

XhmikosR's avatar
Dist    
XhmikosR committed
4609
4610
4611
4612
4613
4614
4615
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$5 = 'modal';
XhmikosR's avatar
XhmikosR committed
4616
  var VERSION$5 = '4.3.1';
XhmikosR's avatar
Dist    
XhmikosR committed
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
  var DATA_KEY$5 = 'bs.modal';
  var EVENT_KEY$5 = "." + DATA_KEY$5;
  var DATA_API_KEY$5 = '.data-api';
  var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key

  var Default$3 = {
    backdrop: true,
    keyboard: true,
    focus: true,
    show: true
  };
  var DefaultType$3 = {
    backdrop: '(boolean|string)',
    keyboard: 'boolean',
    focus: 'boolean',
    show: 'boolean'
  };
  var Event$5 = {
    HIDE: "hide" + EVENT_KEY$5,
    HIDDEN: "hidden" + EVENT_KEY$5,
    SHOW: "show" + EVENT_KEY$5,
    SHOWN: "shown" + EVENT_KEY$5,
    FOCUSIN: "focusin" + EVENT_KEY$5,
    RESIZE: "resize" + EVENT_KEY$5,
    CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
    KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
    MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
    MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
    CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  };
  var ClassName$5 = {
Mark Otto's avatar
Mark Otto committed
4649
    SCROLLABLE: 'modal-dialog-scrollable',
XhmikosR's avatar
Dist    
XhmikosR committed
4650
4651
4652
4653
4654
4655
4656
4657
    SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
    BACKDROP: 'modal-backdrop',
    OPEN: 'modal-open',
    FADE: 'fade',
    SHOW: 'show'
  };
  var Selector$5 = {
    DIALOG: '.modal-dialog',
Mark Otto's avatar
Mark Otto committed
4658
    MODAL_BODY: '.modal-body',
XhmikosR's avatar
Dist    
XhmikosR committed
4659
4660
4661
4662
    DATA_TOGGLE: '[data-toggle="modal"]',
    DATA_DISMISS: '[data-dismiss="modal"]',
    FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
    STICKY_CONTENT: '.sticky-top'
Mark Otto's avatar
dist    
Mark Otto committed
4663
4664
    /**
     * ------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
4665
     * Class Definition
Mark Otto's avatar
dist    
Mark Otto committed
4666
4667
     * ------------------------------------------------------------------------
     */
Mark Otto's avatar
dist    
Mark Otto committed
4668

XhmikosR's avatar
Dist    
XhmikosR committed
4669
  };
Mark Otto's avatar
dist  
Mark Otto committed
4670

XhmikosR's avatar
Dist    
XhmikosR committed
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
  var Modal =
  /*#__PURE__*/
  function () {
    function Modal(element, config) {
      this._config = this._getConfig(config);
      this._element = element;
      this._dialog = element.querySelector(Selector$5.DIALOG);
      this._backdrop = null;
      this._isShown = false;
      this._isBodyOverflowing = false;
      this._ignoreBackdropClick = false;
      this._isTransitioning = false;
      this._scrollbarWidth = 0;
    } // Getters


    var _proto = Modal.prototype;

    // Public
    _proto.toggle = function toggle(relatedTarget) {
      return this._isShown ? this.hide() : this.show(relatedTarget);
Mark Otto's avatar
dist  
Mark Otto committed
4692
4693
    };

XhmikosR's avatar
Dist    
XhmikosR committed
4694
4695
    _proto.show = function show(relatedTarget) {
      var _this = this;
Mark Otto's avatar
dist  
Mark Otto committed
4696

XhmikosR's avatar
Dist    
XhmikosR committed
4697
4698
4699
      if (this._isShown || this._isTransitioning) {
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
4700

XhmikosR's avatar
Dist    
XhmikosR committed
4701
4702
4703
      if ($(this._element).hasClass(ClassName$5.FADE)) {
        this._isTransitioning = true;
      }
Mark Otto's avatar
dist  
Mark Otto committed
4704

XhmikosR's avatar
Dist    
XhmikosR committed
4705
4706
4707
4708
      var showEvent = $.Event(Event$5.SHOW, {
        relatedTarget: relatedTarget
      });
      $(this._element).trigger(showEvent);
Mark Otto's avatar
dist    
Mark Otto committed
4709

XhmikosR's avatar
Dist    
XhmikosR committed
4710
4711
4712
      if (this._isShown || showEvent.isDefaultPrevented()) {
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
4713

XhmikosR's avatar
Dist    
XhmikosR committed
4714
      this._isShown = true;
Mark Otto's avatar
dist    
Mark Otto committed
4715

XhmikosR's avatar
Dist    
XhmikosR committed
4716
      this._checkScrollbar();
Mark Otto's avatar
dist    
Mark Otto committed
4717

XhmikosR's avatar
Dist    
XhmikosR committed
4718
      this._setScrollbar();
Mark Otto's avatar
dist    
Mark Otto committed
4719

XhmikosR's avatar
Dist    
XhmikosR committed
4720
      this._adjustDialog();
Mark Otto's avatar
dist  
Mark Otto committed
4721

XhmikosR's avatar
Dist    
XhmikosR committed
4722
      this._setEscapeEvent();
Mark Otto's avatar
dist  
Mark Otto committed
4723

XhmikosR's avatar
Dist    
XhmikosR committed
4724
      this._setResizeEvent();
Mark Otto's avatar
dist    
Mark Otto committed
4725

XhmikosR's avatar
Dist    
XhmikosR committed
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
      $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
        return _this.hide(event);
      });
      $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
        $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
          if ($(event.target).is(_this._element)) {
            _this._ignoreBackdropClick = true;
          }
        });
      });
Mark Otto's avatar
dist  
Mark Otto committed
4736

XhmikosR's avatar
Dist    
XhmikosR committed
4737
4738
4739
4740
      this._showBackdrop(function () {
        return _this._showElement(relatedTarget);
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
4741

XhmikosR's avatar
Dist    
XhmikosR committed
4742
4743
    _proto.hide = function hide(event) {
      var _this2 = this;
Mark Otto's avatar
dist  
Mark Otto committed
4744

XhmikosR's avatar
Dist    
XhmikosR committed
4745
4746
4747
      if (event) {
        event.preventDefault();
      }
Mark Otto's avatar
dist    
Mark Otto committed
4748

XhmikosR's avatar
Dist    
XhmikosR committed
4749
4750
4751
      if (!this._isShown || this._isTransitioning) {
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
4752

XhmikosR's avatar
Dist    
XhmikosR committed
4753
4754
      var hideEvent = $.Event(Event$5.HIDE);
      $(this._element).trigger(hideEvent);
Mark Otto's avatar
dist  
Mark Otto committed
4755

XhmikosR's avatar
Dist    
XhmikosR committed
4756
4757
4758
      if (!this._isShown || hideEvent.isDefaultPrevented()) {
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
4759

XhmikosR's avatar
Dist    
XhmikosR committed
4760
4761
      this._isShown = false;
      var transition = $(this._element).hasClass(ClassName$5.FADE);
Mark Otto's avatar
dist  
Mark Otto committed
4762

XhmikosR's avatar
Dist    
XhmikosR committed
4763
4764
4765
      if (transition) {
        this._isTransitioning = true;
      }
Mark Otto's avatar
dist  
Mark Otto committed
4766

XhmikosR's avatar
Dist    
XhmikosR committed
4767
      this._setEscapeEvent();
Mark Otto's avatar
dist  
Mark Otto committed
4768

XhmikosR's avatar
Dist    
XhmikosR committed
4769
      this._setResizeEvent();
Mark Otto's avatar
dist  
Mark Otto committed
4770

XhmikosR's avatar
Dist    
XhmikosR committed
4771
4772
4773
4774
      $(document).off(Event$5.FOCUSIN);
      $(this._element).removeClass(ClassName$5.SHOW);
      $(this._element).off(Event$5.CLICK_DISMISS);
      $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
Mark Otto's avatar
dist  
Mark Otto committed
4775

XhmikosR's avatar
Dist    
XhmikosR committed
4776
4777
4778
4779
4780
4781
4782
4783
4784
      if (transition) {
        var transitionDuration = Util.getTransitionDurationFromElement(this._element);
        $(this._element).one(Util.TRANSITION_END, function (event) {
          return _this2._hideModal(event);
        }).emulateTransitionEnd(transitionDuration);
      } else {
        this._hideModal();
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
4785

XhmikosR's avatar
Dist    
XhmikosR committed
4786
4787
4788
4789
4790
4791
4792
4793
4794
    _proto.dispose = function dispose() {
      [window, this._element, this._dialog].forEach(function (htmlElement) {
        return $(htmlElement).off(EVENT_KEY$5);
      });
      /**
       * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
       * Do not move `document` in `htmlElements` array
       * It will remove `Event.CLICK_DATA_API` event that should remain
       */
Mark Otto's avatar
dist  
Mark Otto committed
4795

XhmikosR's avatar
Dist    
XhmikosR committed
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
      $(document).off(Event$5.FOCUSIN);
      $.removeData(this._element, DATA_KEY$5);
      this._config = null;
      this._element = null;
      this._dialog = null;
      this._backdrop = null;
      this._isShown = null;
      this._isBodyOverflowing = null;
      this._ignoreBackdropClick = null;
      this._isTransitioning = null;
      this._scrollbarWidth = null;
    };
Mark Otto's avatar
dist    
Mark Otto committed
4808

XhmikosR's avatar
Dist    
XhmikosR committed
4809
4810
    _proto.handleUpdate = function handleUpdate() {
      this._adjustDialog();
Mark Otto's avatar
Mark Otto committed
4811
4812
    } // Private
    ;
Mark Otto's avatar
dist  
Mark Otto committed
4813

XhmikosR's avatar
Dist    
XhmikosR committed
4814
4815
4816
4817
4818
    _proto._getConfig = function _getConfig(config) {
      config = _objectSpread({}, Default$3, config);
      Util.typeCheckConfig(NAME$5, config, DefaultType$3);
      return config;
    };
Mark Otto's avatar
dist  
Mark Otto committed
4819

XhmikosR's avatar
Dist    
XhmikosR committed
4820
4821
    _proto._showElement = function _showElement(relatedTarget) {
      var _this3 = this;
Mark Otto's avatar
dist  
Mark Otto committed
4822

XhmikosR's avatar
Dist    
XhmikosR committed
4823
      var transition = $(this._element).hasClass(ClassName$5.FADE);
Mark Otto's avatar
dist  
Mark Otto committed
4824

XhmikosR's avatar
Dist    
XhmikosR committed
4825
4826
4827
4828
      if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
        // Don't move modal's DOM position
        document.body.appendChild(this._element);
      }
Mark Otto's avatar
dist  
Mark Otto committed
4829

XhmikosR's avatar
Dist    
XhmikosR committed
4830
      this._element.style.display = 'block';
Mark Otto's avatar
dist  
Mark Otto committed
4831

XhmikosR's avatar
Dist    
XhmikosR committed
4832
      this._element.removeAttribute('aria-hidden');
Mark Otto's avatar
dist  
Mark Otto committed
4833

Mark Otto's avatar
dist    
Mark Otto committed
4834
4835
      this._element.setAttribute('aria-modal', true);

Mark Otto's avatar
Mark Otto committed
4836
4837
4838
4839
4840
      if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE)) {
        this._dialog.querySelector(Selector$5.MODAL_BODY).scrollTop = 0;
      } else {
        this._element.scrollTop = 0;
      }
Mark Otto's avatar
dist  
Mark Otto committed
4841

XhmikosR's avatar
Dist    
XhmikosR committed
4842
4843
4844
      if (transition) {
        Util.reflow(this._element);
      }
Mark Otto's avatar
dist  
Mark Otto committed
4845

XhmikosR's avatar
Dist    
XhmikosR committed
4846
      $(this._element).addClass(ClassName$5.SHOW);
Mark Otto's avatar
dist    
Mark Otto committed
4847

XhmikosR's avatar
Dist    
XhmikosR committed
4848
4849
4850
      if (this._config.focus) {
        this._enforceFocus();
      }
Mark Otto's avatar
dist    
Mark Otto committed
4851

XhmikosR's avatar
Dist    
XhmikosR committed
4852
4853
4854
      var shownEvent = $.Event(Event$5.SHOWN, {
        relatedTarget: relatedTarget
      });
Mark Otto's avatar
dist  
Mark Otto committed
4855

XhmikosR's avatar
Dist    
XhmikosR committed
4856
4857
4858
      var transitionComplete = function transitionComplete() {
        if (_this3._config.focus) {
          _this3._element.focus();
Mark Otto's avatar
dist    
Mark Otto committed
4859
        }
Mark Otto's avatar
dist  
Mark Otto committed
4860

XhmikosR's avatar
Dist    
XhmikosR committed
4861
4862
4863
        _this3._isTransitioning = false;
        $(_this3._element).trigger(shownEvent);
      };
Mark Otto's avatar
dist  
Mark Otto committed
4864

XhmikosR's avatar
Dist    
XhmikosR committed
4865
4866
4867
4868
4869
4870
4871
      if (transition) {
        var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
        $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
      } else {
        transitionComplete();
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
4872

XhmikosR's avatar
Dist    
XhmikosR committed
4873
4874
    _proto._enforceFocus = function _enforceFocus() {
      var _this4 = this;
Mark Otto's avatar
dist  
Mark Otto committed
4875

XhmikosR's avatar
Dist    
XhmikosR committed
4876
4877
4878
4879
      $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
      .on(Event$5.FOCUSIN, function (event) {
        if (document !== event.target && _this4._element !== event.target && $(_this4._element).has(event.target).length === 0) {
          _this4._element.focus();
Mark Otto's avatar
dist  
Mark Otto committed
4880
        }
XhmikosR's avatar
Dist    
XhmikosR committed
4881
4882
      });
    };
Mark Otto's avatar
dist    
Mark Otto committed
4883

XhmikosR's avatar
Dist    
XhmikosR committed
4884
4885
4886
4887
4888
4889
4890
    _proto._setEscapeEvent = function _setEscapeEvent() {
      var _this5 = this;

      if (this._isShown && this._config.keyboard) {
        $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
          if (event.which === ESCAPE_KEYCODE$1) {
            event.preventDefault();
Mark Otto's avatar
dist    
Mark Otto committed
4891

XhmikosR's avatar
Dist    
XhmikosR committed
4892
            _this5.hide();
Mark Otto's avatar
dist    
Mark Otto committed
4893
4894
          }
        });
XhmikosR's avatar
Dist    
XhmikosR committed
4895
4896
4897
4898
4899
4900
4901
      } else if (!this._isShown) {
        $(this._element).off(Event$5.KEYDOWN_DISMISS);
      }
    };

    _proto._setResizeEvent = function _setResizeEvent() {
      var _this6 = this;
Mark Otto's avatar
dist  
Mark Otto committed
4902

XhmikosR's avatar
Dist    
XhmikosR committed
4903
4904
4905
4906
4907
4908
4909
4910
      if (this._isShown) {
        $(window).on(Event$5.RESIZE, function (event) {
          return _this6.handleUpdate(event);
        });
      } else {
        $(window).off(Event$5.RESIZE);
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
4911

XhmikosR's avatar
Dist    
XhmikosR committed
4912
4913
    _proto._hideModal = function _hideModal() {
      var _this7 = this;
Mark Otto's avatar
dist  
Mark Otto committed
4914

XhmikosR's avatar
Dist    
XhmikosR committed
4915
      this._element.style.display = 'none';
Mark Otto's avatar
dist  
Mark Otto committed
4916

XhmikosR's avatar
Dist    
XhmikosR committed
4917
      this._element.setAttribute('aria-hidden', true);
Mark Otto's avatar
dist  
Mark Otto committed
4918

Mark Otto's avatar
dist    
Mark Otto committed
4919
4920
      this._element.removeAttribute('aria-modal');

XhmikosR's avatar
Dist    
XhmikosR committed
4921
      this._isTransitioning = false;
Mark Otto's avatar
dist    
Mark Otto committed
4922

XhmikosR's avatar
Dist    
XhmikosR committed
4923
4924
      this._showBackdrop(function () {
        $(document.body).removeClass(ClassName$5.OPEN);
Mark Otto's avatar
dist  
Mark Otto committed
4925

XhmikosR's avatar
Dist    
XhmikosR committed
4926
        _this7._resetAdjustments();
Mark Otto's avatar
dist  
Mark Otto committed
4927

XhmikosR's avatar
Dist    
XhmikosR committed
4928
        _this7._resetScrollbar();
Mark Otto's avatar
dist  
Mark Otto committed
4929

XhmikosR's avatar
Dist    
XhmikosR committed
4930
4931
4932
        $(_this7._element).trigger(Event$5.HIDDEN);
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
4933

XhmikosR's avatar
Dist    
XhmikosR committed
4934
4935
4936
4937
4938
4939
    _proto._removeBackdrop = function _removeBackdrop() {
      if (this._backdrop) {
        $(this._backdrop).remove();
        this._backdrop = null;
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
4940

XhmikosR's avatar
Dist    
XhmikosR committed
4941
4942
    _proto._showBackdrop = function _showBackdrop(callback) {
      var _this8 = this;
Mark Otto's avatar
dist    
Mark Otto committed
4943

XhmikosR's avatar
Dist    
XhmikosR committed
4944
      var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
Mark Otto's avatar
dist    
Mark Otto committed
4945

XhmikosR's avatar
Dist    
XhmikosR committed
4946
4947
4948
      if (this._isShown && this._config.backdrop) {
        this._backdrop = document.createElement('div');
        this._backdrop.className = ClassName$5.BACKDROP;
Mark Otto's avatar
dist    
Mark Otto committed
4949

XhmikosR's avatar
Dist    
XhmikosR committed
4950
4951
        if (animate) {
          this._backdrop.classList.add(animate);
Mark Otto's avatar
dist    
Mark Otto committed
4952
        }
Mark Otto's avatar
dist    
Mark Otto committed
4953

XhmikosR's avatar
Dist    
XhmikosR committed
4954
4955
4956
4957
4958
4959
        $(this._backdrop).appendTo(document.body);
        $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
          if (_this8._ignoreBackdropClick) {
            _this8._ignoreBackdropClick = false;
            return;
          }
Mark Otto's avatar
dist  
Mark Otto committed
4960

XhmikosR's avatar
Dist    
XhmikosR committed
4961
4962
4963
          if (event.target !== event.currentTarget) {
            return;
          }
Mark Otto's avatar
dist  
Mark Otto committed
4964

XhmikosR's avatar
Dist    
XhmikosR committed
4965
4966
4967
4968
          if (_this8._config.backdrop === 'static') {
            _this8._element.focus();
          } else {
            _this8.hide();
Mark Otto's avatar
dist    
Mark Otto committed
4969
          }
XhmikosR's avatar
Dist    
XhmikosR committed
4970
        });
Mark Otto's avatar
dist  
Mark Otto committed
4971

XhmikosR's avatar
Dist    
XhmikosR committed
4972
4973
4974
        if (animate) {
          Util.reflow(this._backdrop);
        }
Mark Otto's avatar
dist  
Mark Otto committed
4975

XhmikosR's avatar
Dist    
XhmikosR committed
4976
        $(this._backdrop).addClass(ClassName$5.SHOW);
Mark Otto's avatar
dist  
Mark Otto committed
4977

XhmikosR's avatar
Dist    
XhmikosR committed
4978
4979
4980
        if (!callback) {
          return;
        }
Mark Otto's avatar
dist  
Mark Otto committed
4981

XhmikosR's avatar
Dist    
XhmikosR committed
4982
4983
4984
4985
        if (!animate) {
          callback();
          return;
        }
Mark Otto's avatar
dist    
Mark Otto committed
4986

XhmikosR's avatar
Dist    
XhmikosR committed
4987
4988
4989
4990
        var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
        $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
      } else if (!this._isShown && this._backdrop) {
        $(this._backdrop).removeClass(ClassName$5.SHOW);
Mark Otto's avatar
dist    
Mark Otto committed
4991

XhmikosR's avatar
Dist    
XhmikosR committed
4992
4993
        var callbackRemove = function callbackRemove() {
          _this8._removeBackdrop();
Mark Otto's avatar
dist    
Mark Otto committed
4994

XhmikosR's avatar
Dist    
XhmikosR committed
4995
          if (callback) {
Mark Otto's avatar
dist    
Mark Otto committed
4996
            callback();
Mark Otto's avatar
dist  
Mark Otto committed
4997
          }
XhmikosR's avatar
Dist    
XhmikosR committed
4998
        };
Mark Otto's avatar
dist  
Mark Otto committed
4999

XhmikosR's avatar
Dist    
XhmikosR committed
5000
        if ($(this._element).hasClass(ClassName$5.FADE)) {
For faster browsing, not all history is shown. View entire blame