bootstrap.js 153 KB
Newer Older
XhmikosR's avatar
XhmikosR committed
4001
      var _this5 = this;
Jacob Thornton's avatar
Jacob Thornton committed
4002

XhmikosR's avatar
Dist    
XhmikosR committed
4003
4004
4005
      var triggers = this.config.trigger.split(' ');
      triggers.forEach(function (trigger) {
        if (trigger === 'click') {
XhmikosR's avatar
XhmikosR committed
4006
4007
          EventHandler.on(_this5.element, _this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
            return _this5.toggle(event);
Mark Otto's avatar
dist    
Mark Otto committed
4008
          });
XhmikosR's avatar
Dist    
XhmikosR committed
4009
        } else if (trigger !== Trigger.MANUAL) {
XhmikosR's avatar
XhmikosR committed
4010
4011
4012
4013
          var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
          var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
          EventHandler.on(_this5.element, eventIn, _this5.config.selector, function (event) {
            return _this5._enter(event);
XhmikosR's avatar
XhmikosR committed
4014
          });
XhmikosR's avatar
XhmikosR committed
4015
4016
          EventHandler.on(_this5.element, eventOut, _this5.config.selector, function (event) {
            return _this5._leave(event);
Mark Otto's avatar
dist    
Mark Otto committed
4017
4018
          });
        }
XhmikosR's avatar
Dist    
XhmikosR committed
4019
      });
Mark Otto's avatar
dist v5    
Mark Otto committed
4020
4021

      this._hideModalHandler = function () {
XhmikosR's avatar
XhmikosR committed
4022
4023
        if (_this5.element) {
          _this5.hide();
XhmikosR's avatar
Dist    
XhmikosR committed
4024
        }
Mark Otto's avatar
dist v5    
Mark Otto committed
4025
4026
4027
      };

      EventHandler.on(SelectorEngine.closest(this.element, '.modal'), 'hide.bs.modal', this._hideModalHandler);
Jacob Thornton's avatar
Jacob Thornton committed
4028

XhmikosR's avatar
Dist    
XhmikosR committed
4029
      if (this.config.selector) {
4030
        this.config = _objectSpread2({}, this.config, {
XhmikosR's avatar
Dist    
XhmikosR committed
4031
4032
4033
4034
4035
4036
4037
          trigger: 'manual',
          selector: ''
        });
      } else {
        this._fixTitle();
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
4038

XhmikosR's avatar
Dist    
XhmikosR committed
4039
4040
    _proto._fixTitle = function _fixTitle() {
      var titleType = typeof this.element.getAttribute('data-original-title');
Mark Otto's avatar
dist    
Mark Otto committed
4041

XhmikosR's avatar
Dist    
XhmikosR committed
4042
4043
4044
4045
4046
      if (this.element.getAttribute('title') || titleType !== 'string') {
        this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
        this.element.setAttribute('title', '');
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
4047

XhmikosR's avatar
Dist    
XhmikosR committed
4048
4049
    _proto._enter = function _enter(event, context) {
      var dataKey = this.constructor.DATA_KEY;
XhmikosR's avatar
XhmikosR committed
4050
      context = context || Data.getData(event.delegateTarget, dataKey);
Jacob Thornton's avatar
Jacob Thornton committed
4051

XhmikosR's avatar
Dist    
XhmikosR committed
4052
      if (!context) {
XhmikosR's avatar
XhmikosR committed
4053
4054
        context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
        Data.setData(event.delegateTarget, dataKey, context);
XhmikosR's avatar
Dist    
XhmikosR committed
4055
      }
Jacob Thornton's avatar
Jacob Thornton committed
4056

XhmikosR's avatar
Dist    
XhmikosR committed
4057
4058
4059
      if (event) {
        context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
      }
Jacob Thornton's avatar
Jacob Thornton committed
4060

XhmikosR's avatar
XhmikosR committed
4061
      if (context.getTipElement().classList.contains(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
Mark Otto's avatar
dist    
Mark Otto committed
4062
        context._hoverState = HoverState.SHOW;
XhmikosR's avatar
Dist    
XhmikosR committed
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
        return;
      }

      clearTimeout(context._timeout);
      context._hoverState = HoverState.SHOW;

      if (!context.config.delay || !context.config.delay.show) {
        context.show();
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
4073

XhmikosR's avatar
Dist    
XhmikosR committed
4074
4075
      context._timeout = setTimeout(function () {
        if (context._hoverState === HoverState.SHOW) {
Mark Otto's avatar
dist    
Mark Otto committed
4076
4077
          context.show();
        }
XhmikosR's avatar
Dist    
XhmikosR committed
4078
4079
      }, context.config.delay.show);
    };
Jacob Thornton's avatar
Jacob Thornton committed
4080

XhmikosR's avatar
Dist    
XhmikosR committed
4081
4082
    _proto._leave = function _leave(event, context) {
      var dataKey = this.constructor.DATA_KEY;
XhmikosR's avatar
XhmikosR committed
4083
      context = context || Data.getData(event.delegateTarget, dataKey);
Mark Otto's avatar
grunt    
Mark Otto committed
4084

XhmikosR's avatar
Dist    
XhmikosR committed
4085
      if (!context) {
XhmikosR's avatar
XhmikosR committed
4086
4087
        context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
        Data.setData(event.delegateTarget, dataKey, context);
XhmikosR's avatar
Dist    
XhmikosR committed
4088
      }
Mark Otto's avatar
dist    
Mark Otto committed
4089

XhmikosR's avatar
Dist    
XhmikosR committed
4090
4091
4092
      if (event) {
        context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
      }
Jacob Thornton's avatar
Jacob Thornton committed
4093

XhmikosR's avatar
Dist    
XhmikosR committed
4094
4095
4096
      if (context._isWithActiveTrigger()) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
4097

XhmikosR's avatar
Dist    
XhmikosR committed
4098
4099
      clearTimeout(context._timeout);
      context._hoverState = HoverState.OUT;
Jacob Thornton's avatar
Jacob Thornton committed
4100

XhmikosR's avatar
Dist    
XhmikosR committed
4101
4102
4103
4104
      if (!context.config.delay || !context.config.delay.hide) {
        context.hide();
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
4105

XhmikosR's avatar
Dist    
XhmikosR committed
4106
4107
      context._timeout = setTimeout(function () {
        if (context._hoverState === HoverState.OUT) {
Mark Otto's avatar
dist    
Mark Otto committed
4108
4109
          context.hide();
        }
XhmikosR's avatar
Dist    
XhmikosR committed
4110
4111
      }, context.config.delay.hide);
    };
Jacob Thornton's avatar
Jacob Thornton committed
4112

XhmikosR's avatar
Dist    
XhmikosR committed
4113
4114
4115
4116
    _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
      for (var trigger in this._activeTrigger) {
        if (this._activeTrigger[trigger]) {
          return true;
Mark Otto's avatar
dist    
Mark Otto committed
4117
        }
XhmikosR's avatar
Dist    
XhmikosR committed
4118
      }
Jacob Thornton's avatar
Jacob Thornton committed
4119

XhmikosR's avatar
Dist    
XhmikosR committed
4120
4121
      return false;
    };
Jacob Thornton's avatar
Jacob Thornton committed
4122

XhmikosR's avatar
Dist    
XhmikosR committed
4123
    _proto._getConfig = function _getConfig(config) {
XhmikosR's avatar
XhmikosR committed
4124
      var dataAttributes = Manipulator.getDataAttributes(this.element);
XhmikosR's avatar
XhmikosR committed
4125
4126
4127
4128
4129
      Object.keys(dataAttributes).forEach(function (dataAttr) {
        if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
          delete dataAttributes[dataAttr];
        }
      });
XhmikosR's avatar
XhmikosR committed
4130
4131
4132
4133
4134

      if (config && typeof config.container === 'object' && config.container.jquery) {
        config.container = config.container[0];
      }

4135
      config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
Jacob Thornton's avatar
Jacob Thornton committed
4136

XhmikosR's avatar
Dist    
XhmikosR committed
4137
4138
4139
4140
4141
4142
      if (typeof config.delay === 'number') {
        config.delay = {
          show: config.delay,
          hide: config.delay
        };
      }
Mark Otto's avatar
grunt    
Mark Otto committed
4143

XhmikosR's avatar
Dist    
XhmikosR committed
4144
4145
4146
      if (typeof config.title === 'number') {
        config.title = config.title.toString();
      }
Jacob Thornton's avatar
Jacob Thornton committed
4147

XhmikosR's avatar
Dist    
XhmikosR committed
4148
4149
4150
      if (typeof config.content === 'number') {
        config.content = config.content.toString();
      }
Jacob Thornton's avatar
Jacob Thornton committed
4151

XhmikosR's avatar
XhmikosR committed
4152
      typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
XhmikosR's avatar
XhmikosR committed
4153
4154
4155
4156
4157

      if (config.sanitize) {
        config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
      }

XhmikosR's avatar
Dist    
XhmikosR committed
4158
4159
      return config;
    };
Mark Otto's avatar
dist    
Mark Otto committed
4160

XhmikosR's avatar
Dist    
XhmikosR committed
4161
4162
    _proto._getDelegateConfig = function _getDelegateConfig() {
      var config = {};
Mark Otto's avatar
dist    
Mark Otto committed
4163

XhmikosR's avatar
Dist    
XhmikosR committed
4164
4165
4166
4167
      if (this.config) {
        for (var key in this.config) {
          if (this.constructor.Default[key] !== this.config[key]) {
            config[key] = this.config[key];
Mark Otto's avatar
dist    
Mark Otto committed
4168
4169
          }
        }
XhmikosR's avatar
Dist    
XhmikosR committed
4170
      }
Mark Otto's avatar
dist    
Mark Otto committed
4171

XhmikosR's avatar
Dist    
XhmikosR committed
4172
4173
      return config;
    };
Mark Otto's avatar
dist    
Mark Otto committed
4174

XhmikosR's avatar
Dist    
XhmikosR committed
4175
    _proto._cleanTipClass = function _cleanTipClass() {
XhmikosR's avatar
XhmikosR committed
4176
4177
      var tip = this.getTipElement();
      var tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX);
Mark Otto's avatar
dist    
Mark Otto committed
4178

XhmikosR's avatar
Dist    
XhmikosR committed
4179
      if (tabClass !== null && tabClass.length) {
XhmikosR's avatar
XhmikosR committed
4180
4181
4182
4183
4184
        tabClass.map(function (token) {
          return token.trim();
        }).forEach(function (tClass) {
          return tip.classList.remove(tClass);
        });
XhmikosR's avatar
Dist    
XhmikosR committed
4185
4186
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
4187

XhmikosR's avatar
Dist    
XhmikosR committed
4188
4189
4190
    _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
      var popperInstance = popperData.instance;
      this.tip = popperInstance.popper;
Mark Otto's avatar
dist    
Mark Otto committed
4191

XhmikosR's avatar
Dist    
XhmikosR committed
4192
      this._cleanTipClass();
Mark Otto's avatar
dist    
Mark Otto committed
4193

4194
      this._addAttachmentClass(this._getAttachment(popperData.placement));
XhmikosR's avatar
Dist    
XhmikosR committed
4195
    };
Mark Otto's avatar
dist    
Mark Otto committed
4196

XhmikosR's avatar
Dist    
XhmikosR committed
4197
4198
4199
    _proto._fixTransition = function _fixTransition() {
      var tip = this.getTipElement();
      var initConfigAnimation = this.config.animation;
Jacob Thornton's avatar
Jacob Thornton committed
4200

XhmikosR's avatar
Dist    
XhmikosR committed
4201
4202
4203
      if (tip.getAttribute('x-placement') !== null) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
4204

XhmikosR's avatar
XhmikosR committed
4205
      tip.classList.remove(ClassName$6.FADE);
XhmikosR's avatar
Dist    
XhmikosR committed
4206
4207
4208
4209
      this.config.animation = false;
      this.hide();
      this.show();
      this.config.animation = initConfigAnimation;
Mark Otto's avatar
Mark Otto committed
4210
4211
    } // Static
    ;
Mark Otto's avatar
grunt    
Mark Otto committed
4212

XhmikosR's avatar
XhmikosR committed
4213
    Tooltip.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
4214
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
4215
        var data = Data.getData(this, DATA_KEY$6);
Jacob Thornton's avatar
Jacob Thornton committed
4216

XhmikosR's avatar
Dist    
XhmikosR committed
4217
        var _config = typeof config === 'object' && config;
Mark Otto's avatar
dist    
Mark Otto committed
4218

XhmikosR's avatar
Dist    
XhmikosR committed
4219
4220
4221
        if (!data && /dispose|hide/.test(config)) {
          return;
        }
Mark Otto's avatar
dist    
Mark Otto committed
4222

XhmikosR's avatar
Dist    
XhmikosR committed
4223
4224
4225
        if (!data) {
          data = new Tooltip(this, _config);
        }
Mark Otto's avatar
dist    
Mark Otto committed
4226

XhmikosR's avatar
Dist    
XhmikosR committed
4227
4228
4229
        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
Mark Otto's avatar
dist    
Mark Otto committed
4230
4231
          }

XhmikosR's avatar
Dist    
XhmikosR committed
4232
          data[config]();
Mark Otto's avatar
dist    
Mark Otto committed
4233
        }
XhmikosR's avatar
Dist    
XhmikosR committed
4234
4235
      });
    };
Mark Otto's avatar
dist    
Mark Otto committed
4236

XhmikosR's avatar
XhmikosR committed
4237
    Tooltip.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
4238
4239
4240
      return Data.getData(element, DATA_KEY$6);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
    _createClass(Tooltip, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$6;
      }
    }, {
      key: "Default",
      get: function get() {
        return Default$4;
      }
    }, {
      key: "NAME",
      get: function get() {
        return NAME$6;
      }
    }, {
      key: "DATA_KEY",
      get: function get() {
        return DATA_KEY$6;
      }
    }, {
      key: "Event",
      get: function get() {
XhmikosR's avatar
XhmikosR committed
4264
        return Event$7;
XhmikosR's avatar
Dist    
XhmikosR committed
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
      }
    }, {
      key: "EVENT_KEY",
      get: function get() {
        return EVENT_KEY$6;
      }
    }, {
      key: "DefaultType",
      get: function get() {
        return DefaultType$4;
      }
    }]);
Mark Otto's avatar
dist    
Mark Otto committed
4277

XhmikosR's avatar
Dist    
XhmikosR committed
4278
4279
    return Tooltip;
  }();
XhmikosR's avatar
XhmikosR committed
4280
4281

  var $$7 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
4282
4283
4284
4285
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
4286
   * add .tooltip to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
4287
   */
Mark Otto's avatar
dist    
Mark Otto committed
4288

4289
4290
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
4291
4292
4293
4294
  if ($$7) {
    var JQUERY_NO_CONFLICT$6 = $$7.fn[NAME$6];
    $$7.fn[NAME$6] = Tooltip.jQueryInterface;
    $$7.fn[NAME$6].Constructor = Tooltip;
Jacob Thornton's avatar
Jacob Thornton committed
4295

XhmikosR's avatar
XhmikosR committed
4296
4297
4298
    $$7.fn[NAME$6].noConflict = function () {
      $$7.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
      return Tooltip.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
4299
4300
    };
  }
Jacob Thornton's avatar
Jacob Thornton committed
4301

XhmikosR's avatar
Dist    
XhmikosR committed
4302
4303
4304
4305
4306
4307
4308
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$7 = 'popover';
XhmikosR's avatar
XhmikosR committed
4309
  var VERSION$7 = '4.3.1';
XhmikosR's avatar
Dist    
XhmikosR committed
4310
4311
4312
4313
4314
  var DATA_KEY$7 = 'bs.popover';
  var EVENT_KEY$7 = "." + DATA_KEY$7;
  var CLASS_PREFIX$1 = 'bs-popover';
  var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');

4315
  var Default$5 = _objectSpread2({}, Tooltip.Default, {
XhmikosR's avatar
Dist    
XhmikosR committed
4316
4317
4318
    placement: 'right',
    trigger: 'click',
    content: '',
XhmikosR's avatar
XhmikosR committed
4319
    template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
XhmikosR's avatar
Dist    
XhmikosR committed
4320
4321
  });

4322
  var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
XhmikosR's avatar
Dist    
XhmikosR committed
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
    content: '(string|element|function)'
  });

  var ClassName$7 = {
    FADE: 'fade',
    SHOW: 'show'
  };
  var Selector$7 = {
    TITLE: '.popover-header',
    CONTENT: '.popover-body'
  };
XhmikosR's avatar
XhmikosR committed
4334
  var Event$8 = {
XhmikosR's avatar
Dist    
XhmikosR committed
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
    HIDE: "hide" + EVENT_KEY$7,
    HIDDEN: "hidden" + EVENT_KEY$7,
    SHOW: "show" + EVENT_KEY$7,
    SHOWN: "shown" + EVENT_KEY$7,
    INSERTED: "inserted" + EVENT_KEY$7,
    CLICK: "click" + EVENT_KEY$7,
    FOCUSIN: "focusin" + EVENT_KEY$7,
    FOCUSOUT: "focusout" + EVENT_KEY$7,
    MOUSEENTER: "mouseenter" + EVENT_KEY$7,
    MOUSELEAVE: "mouseleave" + EVENT_KEY$7
Mark Otto's avatar
dist    
Mark Otto committed
4345
4346
    /**
     * ------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
4347
     * Class Definition
Mark Otto's avatar
dist    
Mark Otto committed
4348
4349
     * ------------------------------------------------------------------------
     */
Jacob Thornton's avatar
Jacob Thornton committed
4350

XhmikosR's avatar
Dist    
XhmikosR committed
4351
  };
Jacob Thornton's avatar
Jacob Thornton committed
4352

XhmikosR's avatar
Dist    
XhmikosR committed
4353
4354
4355
4356
  var Popover =
  /*#__PURE__*/
  function (_Tooltip) {
    _inheritsLoose(Popover, _Tooltip);
Jacob Thornton's avatar
Jacob Thornton committed
4357

XhmikosR's avatar
Dist    
XhmikosR committed
4358
4359
4360
    function Popover() {
      return _Tooltip.apply(this, arguments) || this;
    }
Mark Otto's avatar
grunt    
Mark Otto committed
4361

XhmikosR's avatar
Dist    
XhmikosR committed
4362
    var _proto = Popover.prototype;
Jacob Thornton's avatar
Jacob Thornton committed
4363

XhmikosR's avatar
Dist    
XhmikosR committed
4364
4365
4366
4367
    // Overrides
    _proto.isWithContent = function isWithContent() {
      return this.getTitle() || this._getContent();
    };
Mark Otto's avatar
Mark Otto committed
4368

XhmikosR's avatar
Dist    
XhmikosR committed
4369
    _proto.setContent = function setContent() {
XhmikosR's avatar
XhmikosR committed
4370
      var tip = this.getTipElement(); // we use append for html objects to maintain js events
Jacob Thornton's avatar
Jacob Thornton committed
4371

XhmikosR's avatar
XhmikosR committed
4372
      this.setElementContent(SelectorEngine.findOne(Selector$7.TITLE, tip), this.getTitle());
Jacob Thornton's avatar
Jacob Thornton committed
4373

XhmikosR's avatar
Dist    
XhmikosR committed
4374
      var content = this._getContent();
Mark Otto's avatar
dist    
Mark Otto committed
4375

XhmikosR's avatar
Dist    
XhmikosR committed
4376
4377
4378
      if (typeof content === 'function') {
        content = content.call(this.element);
      }
Jacob Thornton's avatar
Jacob Thornton committed
4379

XhmikosR's avatar
XhmikosR committed
4380
4381
4382
      this.setElementContent(SelectorEngine.findOne(Selector$7.CONTENT, tip), content);
      tip.classList.remove(ClassName$7.FADE);
      tip.classList.remove(ClassName$7.SHOW);
XhmikosR's avatar
XhmikosR committed
4383
4384
4385
4386
    };

    _proto._addAttachmentClass = function _addAttachmentClass(attachment) {
      this.getTipElement().classList.add(CLASS_PREFIX$1 + "-" + attachment);
Mark Otto's avatar
Mark Otto committed
4387
4388
    } // Private
    ;
Mark Otto's avatar
dist    
Mark Otto committed
4389

XhmikosR's avatar
Dist    
XhmikosR committed
4390
4391
4392
    _proto._getContent = function _getContent() {
      return this.element.getAttribute('data-content') || this.config.content;
    };
Jacob Thornton's avatar
Jacob Thornton committed
4393

XhmikosR's avatar
Dist    
XhmikosR committed
4394
    _proto._cleanTipClass = function _cleanTipClass() {
XhmikosR's avatar
XhmikosR committed
4395
4396
      var tip = this.getTipElement();
      var tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX$1);
Jacob Thornton's avatar
Jacob Thornton committed
4397

XhmikosR's avatar
Dist    
XhmikosR committed
4398
      if (tabClass !== null && tabClass.length > 0) {
XhmikosR's avatar
XhmikosR committed
4399
4400
4401
4402
4403
        tabClass.map(function (token) {
          return token.trim();
        }).forEach(function (tClass) {
          return tip.classList.remove(tClass);
        });
XhmikosR's avatar
Dist    
XhmikosR committed
4404
      }
Mark Otto's avatar
Mark Otto committed
4405
4406
    } // Static
    ;
Mark Otto's avatar
dist    
Mark Otto committed
4407

XhmikosR's avatar
XhmikosR committed
4408
    Popover.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
4409
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
4410
        var data = Data.getData(this, DATA_KEY$7);
Mark Otto's avatar
dist    
Mark Otto committed
4411

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

XhmikosR's avatar
Dist    
XhmikosR committed
4414
4415
4416
        if (!data && /dispose|hide/.test(config)) {
          return;
        }
Mark Otto's avatar
build    
Mark Otto committed
4417

XhmikosR's avatar
Dist    
XhmikosR committed
4418
4419
        if (!data) {
          data = new Popover(this, _config);
XhmikosR's avatar
XhmikosR committed
4420
          Data.setData(this, DATA_KEY$7, data);
XhmikosR's avatar
Dist    
XhmikosR committed
4421
        }
Mark Otto's avatar
dist    
Mark Otto committed
4422

XhmikosR's avatar
Dist    
XhmikosR committed
4423
4424
4425
        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
Mark Otto's avatar
dist    
Mark Otto committed
4426
          }
Jacob Thornton's avatar
Jacob Thornton committed
4427

XhmikosR's avatar
Dist    
XhmikosR committed
4428
          data[config]();
Mark Otto's avatar
dist    
Mark Otto committed
4429
        }
XhmikosR's avatar
Dist    
XhmikosR committed
4430
4431
      });
    };
Mark Otto's avatar
dist    
Mark Otto committed
4432

XhmikosR's avatar
XhmikosR committed
4433
    Popover.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
4434
4435
4436
      return Data.getData(element, DATA_KEY$7);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
    _createClass(Popover, null, [{
      key: "VERSION",
      // Getters
      get: function get() {
        return VERSION$7;
      }
    }, {
      key: "Default",
      get: function get() {
        return Default$5;
      }
    }, {
      key: "NAME",
      get: function get() {
        return NAME$7;
      }
    }, {
      key: "DATA_KEY",
      get: function get() {
        return DATA_KEY$7;
      }
    }, {
      key: "Event",
      get: function get() {
XhmikosR's avatar
XhmikosR committed
4461
        return Event$8;
XhmikosR's avatar
Dist    
XhmikosR committed
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
      }
    }, {
      key: "EVENT_KEY",
      get: function get() {
        return EVENT_KEY$7;
      }
    }, {
      key: "DefaultType",
      get: function get() {
        return DefaultType$5;
      }
    }]);
Mark Otto's avatar
dist    
Mark Otto committed
4474

XhmikosR's avatar
Dist    
XhmikosR committed
4475
4476
    return Popover;
  }(Tooltip);
XhmikosR's avatar
XhmikosR committed
4477
4478

  var $$8 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
4479
4480
4481
4482
4483
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
4484

4485
4486
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
4487
4488
4489
4490
  if ($$8) {
    var JQUERY_NO_CONFLICT$7 = $$8.fn[NAME$7];
    $$8.fn[NAME$7] = Popover.jQueryInterface;
    $$8.fn[NAME$7].Constructor = Popover;
Jacob Thornton's avatar
Jacob Thornton committed
4491

XhmikosR's avatar
XhmikosR committed
4492
4493
4494
    $$8.fn[NAME$7].noConflict = function () {
      $$8.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
      return Popover.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
4495
4496
    };
  }
Jacob Thornton's avatar
Jacob Thornton committed
4497

XhmikosR's avatar
Dist    
XhmikosR committed
4498
4499
4500
4501
4502
4503
4504
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$8 = 'scrollspy';
XhmikosR's avatar
XhmikosR committed
4505
  var VERSION$8 = '4.3.1';
XhmikosR's avatar
Dist    
XhmikosR committed
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
  var DATA_KEY$8 = 'bs.scrollspy';
  var EVENT_KEY$8 = "." + DATA_KEY$8;
  var DATA_API_KEY$6 = '.data-api';
  var Default$6 = {
    offset: 10,
    method: 'auto',
    target: ''
  };
  var DefaultType$6 = {
    offset: 'number',
    method: 'string',
    target: '(string|element)'
  };
XhmikosR's avatar
XhmikosR committed
4519
  var Event$9 = {
XhmikosR's avatar
Dist    
XhmikosR committed
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
    ACTIVATE: "activate" + EVENT_KEY$8,
    SCROLL: "scroll" + EVENT_KEY$8,
    LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  };
  var ClassName$8 = {
    DROPDOWN_ITEM: 'dropdown-item',
    ACTIVE: 'active'
  };
  var Selector$8 = {
    DATA_SPY: '[data-spy="scroll"]',
    NAV_LIST_GROUP: '.nav, .list-group',
    NAV_LINKS: '.nav-link',
    NAV_ITEMS: '.nav-item',
    LIST_ITEMS: '.list-group-item',
    DROPDOWN: '.dropdown',
    DROPDOWN_TOGGLE: '.dropdown-toggle'
  };
  var OffsetMethod = {
    OFFSET: 'offset',
    POSITION: 'position'
Mark Otto's avatar
dist    
Mark Otto committed
4540
4541
    /**
     * ------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
4542
     * Class Definition
Mark Otto's avatar
dist    
Mark Otto committed
4543
4544
     * ------------------------------------------------------------------------
     */
XhmikosR's avatar
Dist    
XhmikosR committed
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556

  };

  var ScrollSpy =
  /*#__PURE__*/
  function () {
    function ScrollSpy(element, config) {
      var _this = this;

      this._element = element;
      this._scrollElement = element.tagName === 'BODY' ? window : element;
      this._config = this._getConfig(config);
XhmikosR's avatar
Dist.    
XhmikosR committed
4557
      this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " ." + ClassName$8.DROPDOWN_ITEM);
XhmikosR's avatar
Dist    
XhmikosR committed
4558
4559
4560
4561
      this._offsets = [];
      this._targets = [];
      this._activeTarget = null;
      this._scrollHeight = 0;
XhmikosR's avatar
XhmikosR committed
4562
      EventHandler.on(this._scrollElement, Event$9.SCROLL, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
4563
4564
4565
4566
4567
        return _this._process(event);
      });
      this.refresh();

      this._process();
XhmikosR's avatar
XhmikosR committed
4568
4569

      Data.setData(element, DATA_KEY$8, this);
XhmikosR's avatar
Dist    
XhmikosR committed
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
    } // Getters


    var _proto = ScrollSpy.prototype;

    // Public
    _proto.refresh = function refresh() {
      var _this2 = this;

      var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
      var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
      var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
      this._offsets = [];
      this._targets = [];
      this._scrollHeight = this._getScrollHeight();
XhmikosR's avatar
XhmikosR committed
4585
      var targets = makeArray(SelectorEngine.find(this._selector));
XhmikosR's avatar
Dist    
XhmikosR committed
4586
4587
      targets.map(function (element) {
        var target;
XhmikosR's avatar
XhmikosR committed
4588
        var targetSelector = getSelectorFromElement(element);
XhmikosR's avatar
Dist    
XhmikosR committed
4589
4590

        if (targetSelector) {
XhmikosR's avatar
XhmikosR committed
4591
          target = SelectorEngine.findOne(targetSelector);
XhmikosR's avatar
Dist    
XhmikosR committed
4592
4593
4594
4595
4596
4597
        }

        if (target) {
          var targetBCR = target.getBoundingClientRect();

          if (targetBCR.width || targetBCR.height) {
XhmikosR's avatar
XhmikosR committed
4598
            return [Manipulator[offsetMethod](target).top + offsetBase, targetSelector];
XhmikosR's avatar
Dist    
XhmikosR committed
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
          }
        }

        return null;
      }).filter(function (item) {
        return item;
      }).sort(function (a, b) {
        return a[0] - b[0];
      }).forEach(function (item) {
        _this2._offsets.push(item[0]);

        _this2._targets.push(item[1]);
      });
Mark Otto's avatar
dist    
Mark Otto committed
4612
    };
XhmikosR's avatar
Dist    
XhmikosR committed
4613
4614

    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
4615
4616
      Data.removeData(this._element, DATA_KEY$8);
      EventHandler.off(this._scrollElement, EVENT_KEY$8);
XhmikosR's avatar
Dist    
XhmikosR committed
4617
4618
4619
4620
4621
4622
4623
4624
      this._element = null;
      this._scrollElement = null;
      this._config = null;
      this._selector = null;
      this._offsets = null;
      this._targets = null;
      this._activeTarget = null;
      this._scrollHeight = null;
Mark Otto's avatar
Mark Otto committed
4625
4626
    } // Private
    ;
XhmikosR's avatar
Dist    
XhmikosR committed
4627
4628

    _proto._getConfig = function _getConfig(config) {
4629
      config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
XhmikosR's avatar
Dist    
XhmikosR committed
4630
4631

      if (typeof config.target !== 'string') {
XhmikosR's avatar
XhmikosR committed
4632
        var id = config.target.id;
XhmikosR's avatar
Dist    
XhmikosR committed
4633
4634

        if (!id) {
XhmikosR's avatar
XhmikosR committed
4635
4636
          id = getUID(NAME$8);
          config.target.id = id;
XhmikosR's avatar
Dist    
XhmikosR committed
4637
4638
4639
4640
4641
        }

        config.target = "#" + id;
      }

XhmikosR's avatar
XhmikosR committed
4642
      typeCheckConfig(NAME$8, config, DefaultType$6);
XhmikosR's avatar
Dist    
XhmikosR committed
4643
      return config;
Mark Otto's avatar
dist    
Mark Otto committed
4644
    };
XhmikosR's avatar
Dist    
XhmikosR committed
4645
4646
4647

    _proto._getScrollTop = function _getScrollTop() {
      return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
Mark Otto's avatar
dist    
Mark Otto committed
4648
    };
XhmikosR's avatar
Dist    
XhmikosR committed
4649
4650
4651

    _proto._getScrollHeight = function _getScrollHeight() {
      return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
Mark Otto's avatar
dist    
Mark Otto committed
4652
    };
Mark Otto's avatar
grunt    
Mark Otto committed
4653

XhmikosR's avatar
Dist    
XhmikosR committed
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
    _proto._getOffsetHeight = function _getOffsetHeight() {
      return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
    };

    _proto._process = function _process() {
      var scrollTop = this._getScrollTop() + this._config.offset;

      var scrollHeight = this._getScrollHeight();

      var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();

      if (this._scrollHeight !== scrollHeight) {
        this.refresh();
      }

      if (scrollTop >= maxScroll) {
        var target = this._targets[this._targets.length - 1];

        if (this._activeTarget !== target) {
          this._activate(target);
        }

        return;
      }

      if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
        this._activeTarget = null;

        this._clear();

        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
4686

XhmikosR's avatar
Dist    
XhmikosR committed
4687
      var offsetLength = this._offsets.length;
Mark Otto's avatar
grunt    
Mark Otto committed
4688

XhmikosR's avatar
Dist    
XhmikosR committed
4689
4690
      for (var i = offsetLength; i--;) {
        var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
Mark Otto's avatar
dist    
Mark Otto committed
4691

XhmikosR's avatar
Dist    
XhmikosR committed
4692
4693
4694
4695
4696
        if (isActiveTarget) {
          this._activate(this._targets[i]);
        }
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
4697

XhmikosR's avatar
Dist    
XhmikosR committed
4698
4699
    _proto._activate = function _activate(target) {
      this._activeTarget = target;
Jacob Thornton's avatar
Jacob Thornton committed
4700

XhmikosR's avatar
Dist    
XhmikosR committed
4701
      this._clear();
Jacob Thornton's avatar
Jacob Thornton committed
4702

XhmikosR's avatar
Dist    
XhmikosR committed
4703
4704
      var queries = this._selector.split(',').map(function (selector) {
        return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
XhmikosR's avatar
Dist    
XhmikosR committed
4705
      });
XhmikosR's avatar
Dist    
XhmikosR committed
4706

XhmikosR's avatar
XhmikosR committed
4707
      var link = SelectorEngine.findOne(queries.join(','));
Mark Otto's avatar
dist    
Mark Otto committed
4708

XhmikosR's avatar
XhmikosR committed
4709
4710
4711
      if (link.classList.contains(ClassName$8.DROPDOWN_ITEM)) {
        SelectorEngine.findOne(Selector$8.DROPDOWN_TOGGLE, SelectorEngine.closest(link, Selector$8.DROPDOWN)).classList.add(ClassName$8.ACTIVE);
        link.classList.add(ClassName$8.ACTIVE);
XhmikosR's avatar
Dist    
XhmikosR committed
4712
4713
      } else {
        // Set triggered link as active
XhmikosR's avatar
XhmikosR committed
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
        link.classList.add(ClassName$8.ACTIVE);
        SelectorEngine.parents(link, Selector$8.NAV_LIST_GROUP).forEach(function (listGroup) {
          // Set triggered links parents as active
          // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
          SelectorEngine.prev(listGroup, Selector$8.NAV_LINKS + ", " + Selector$8.LIST_ITEMS).forEach(function (item) {
            return item.classList.add(ClassName$8.ACTIVE);
          }); // Handle special case when .nav-link is inside .nav-item

          SelectorEngine.prev(listGroup, Selector$8.NAV_ITEMS).forEach(function (navItem) {
            SelectorEngine.children(navItem, Selector$8.NAV_LINKS).forEach(function (item) {
              return item.classList.add(ClassName$8.ACTIVE);
            });
          });
        });
XhmikosR's avatar
Dist    
XhmikosR committed
4728
      }
Mark Otto's avatar
dist    
Mark Otto committed
4729

XhmikosR's avatar
XhmikosR committed
4730
      EventHandler.trigger(this._scrollElement, Event$9.ACTIVATE, {
XhmikosR's avatar
Dist    
XhmikosR committed
4731
4732
4733
        relatedTarget: target
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
4734

XhmikosR's avatar
Dist    
XhmikosR committed
4735
    _proto._clear = function _clear() {
XhmikosR's avatar
XhmikosR committed
4736
      makeArray(SelectorEngine.find(this._selector)).filter(function (node) {
XhmikosR's avatar
Dist    
XhmikosR committed
4737
4738
4739
4740
        return node.classList.contains(ClassName$8.ACTIVE);
      }).forEach(function (node) {
        return node.classList.remove(ClassName$8.ACTIVE);
      });
Mark Otto's avatar
Mark Otto committed
4741
4742
    } // Static
    ;
Jacob Thornton's avatar
Jacob Thornton committed
4743

XhmikosR's avatar
XhmikosR committed
4744
    ScrollSpy.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
4745
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
4746
        var data = Data.getData(this, DATA_KEY$8);
Jacob Thornton's avatar
Jacob Thornton committed
4747

XhmikosR's avatar
Dist    
XhmikosR committed
4748
        var _config = typeof config === 'object' && config;
Mark Otto's avatar
dist    
Mark Otto committed
4749

XhmikosR's avatar
Dist    
XhmikosR committed
4750
4751
        if (!data) {
          data = new ScrollSpy(this, _config);
Mark Otto's avatar
dist    
Mark Otto committed
4752
        }
Mark Otto's avatar
dist    
Mark Otto committed
4753

XhmikosR's avatar
Dist    
XhmikosR committed
4754
4755
4756
4757
        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
          }
Mark Otto's avatar
grunt    
Mark Otto committed
4758

XhmikosR's avatar
Dist    
XhmikosR committed
4759
4760
4761
4762
          data[config]();
        }
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
4763

XhmikosR's avatar
XhmikosR committed
4764
    ScrollSpy.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
4765
4766
4767
      return Data.getData(element, DATA_KEY$8);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
    _createClass(ScrollSpy, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$8;
      }
    }, {
      key: "Default",
      get: function get() {
        return Default$6;
      }
    }]);
Mark Otto's avatar
grunt    
Mark Otto committed
4779

XhmikosR's avatar
Dist    
XhmikosR committed
4780
4781
4782
4783
4784
4785
4786
    return ScrollSpy;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
4787
4788


XhmikosR's avatar
XhmikosR committed
4789
4790
4791
4792
  EventHandler.on(window, Event$9.LOAD_DATA_API, function () {
    makeArray(SelectorEngine.find(Selector$8.DATA_SPY)).forEach(function (spy) {
      return new ScrollSpy(spy, Manipulator.getDataAttributes(spy));
    });
XhmikosR's avatar
Dist    
XhmikosR committed
4793
  });
XhmikosR's avatar
XhmikosR committed
4794
  var $$9 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
4795
4796
4797
4798
4799
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
4800

4801
4802
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
4803
4804
4805
4806
  if ($$9) {
    var JQUERY_NO_CONFLICT$8 = $$9.fn[NAME$8];
    $$9.fn[NAME$8] = ScrollSpy.jQueryInterface;
    $$9.fn[NAME$8].Constructor = ScrollSpy;
Jacob Thornton's avatar
Jacob Thornton committed
4807

XhmikosR's avatar
XhmikosR committed
4808
4809
4810
    $$9.fn[NAME$8].noConflict = function () {
      $$9.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
      return ScrollSpy.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
4811
4812
    };
  }
Jacob Thornton's avatar
Jacob Thornton committed
4813

XhmikosR's avatar
Dist    
XhmikosR committed
4814
4815
4816
4817
4818
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
4819

XhmikosR's avatar
Dist    
XhmikosR committed
4820
  var NAME$9 = 'tab';
XhmikosR's avatar
XhmikosR committed
4821
  var VERSION$9 = '4.3.1';
XhmikosR's avatar
Dist    
XhmikosR committed
4822
4823
4824
  var DATA_KEY$9 = 'bs.tab';
  var EVENT_KEY$9 = "." + DATA_KEY$9;
  var DATA_API_KEY$7 = '.data-api';
XhmikosR's avatar
XhmikosR committed
4825
  var Event$a = {
XhmikosR's avatar
Dist    
XhmikosR committed
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
    HIDE: "hide" + EVENT_KEY$9,
    HIDDEN: "hidden" + EVENT_KEY$9,
    SHOW: "show" + EVENT_KEY$9,
    SHOWN: "shown" + EVENT_KEY$9,
    CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  };
  var ClassName$9 = {
    DROPDOWN_MENU: 'dropdown-menu',
    ACTIVE: 'active',
    DISABLED: 'disabled',
    FADE: 'fade',
    SHOW: 'show'
  };
  var Selector$9 = {
    DROPDOWN: '.dropdown',
    NAV_LIST_GROUP: '.nav, .list-group',
    ACTIVE: '.active',
XhmikosR's avatar
XhmikosR committed
4843
    ACTIVE_UL: ':scope > li > .active',
XhmikosR's avatar
Dist    
XhmikosR committed
4844
4845
    DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
    DROPDOWN_TOGGLE: '.dropdown-toggle',
XhmikosR's avatar
XhmikosR committed
4846
    DROPDOWN_ACTIVE_CHILD: ':scope > .dropdown-menu .active'
XhmikosR's avatar
Dist    
XhmikosR committed
4847
4848
4849
4850
4851
    /**
     * ------------------------------------------------------------------------
     * Class Definition
     * ------------------------------------------------------------------------
     */
Mark Otto's avatar
dist    
Mark Otto committed
4852

XhmikosR's avatar
Dist    
XhmikosR committed
4853
  };
Mark Otto's avatar
dist    
Mark Otto committed
4854

XhmikosR's avatar
Dist    
XhmikosR committed
4855
4856
4857
4858
4859
  var Tab =
  /*#__PURE__*/
  function () {
    function Tab(element) {
      this._element = element;
XhmikosR's avatar
XhmikosR committed
4860
      Data.setData(this._element, DATA_KEY$9, this);
XhmikosR's avatar
Dist    
XhmikosR committed
4861
    } // Getters
Jacob Thornton's avatar
Jacob Thornton committed
4862

Mark Otto's avatar
dist    
Mark Otto committed
4863

XhmikosR's avatar
Dist    
XhmikosR committed
4864
    var _proto = Tab.prototype;
Jacob Thornton's avatar
Jacob Thornton committed
4865

XhmikosR's avatar
Dist    
XhmikosR committed
4866
4867
4868
    // Public
    _proto.show = function show() {
      var _this = this;
Jacob Thornton's avatar
Jacob Thornton committed
4869

XhmikosR's avatar
XhmikosR committed
4870
      if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(ClassName$9.ACTIVE) || this._element.classList.contains(ClassName$9.DISABLED)) {
XhmikosR's avatar
Dist    
XhmikosR committed
4871
4872
        return;
      }
Mark Otto's avatar
grunt    
Mark Otto committed
4873

XhmikosR's avatar
Dist    
XhmikosR committed
4874
      var previous;
XhmikosR's avatar
XhmikosR committed
4875
      var target = getElementFromSelector(this._element);
XhmikosR's avatar
XhmikosR committed
4876
      var listElement = SelectorEngine.closest(this._element, Selector$9.NAV_LIST_GROUP);
XhmikosR's avatar
Dist    
XhmikosR committed
4877
4878

      if (listElement) {
XhmikosR's avatar
Dist    
XhmikosR committed
4879
        var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
XhmikosR's avatar
XhmikosR committed
4880
        previous = makeArray(SelectorEngine.find(itemSelector, listElement));
XhmikosR's avatar
Dist    
XhmikosR committed
4881
4882
        previous = previous[previous.length - 1];
      }
Mark Otto's avatar
grunt    
Mark Otto committed
4883

XhmikosR's avatar
XhmikosR committed
4884
      var hideEvent = null;
Mark Otto's avatar
dist    
Mark Otto committed
4885

XhmikosR's avatar
Dist    
XhmikosR committed
4886
      if (previous) {
XhmikosR's avatar
XhmikosR committed
4887
4888
4889
        hideEvent = EventHandler.trigger(previous, Event$a.HIDE, {
          relatedTarget: this._element
        });
XhmikosR's avatar
Dist    
XhmikosR committed
4890
      }
Mark Otto's avatar
dist    
Mark Otto committed
4891

XhmikosR's avatar
XhmikosR committed
4892
4893
4894
      var showEvent = EventHandler.trigger(this._element, Event$a.SHOW, {
        relatedTarget: previous
      });
Jacob Thornton's avatar
Jacob Thornton committed
4895

XhmikosR's avatar
XhmikosR committed
4896
      if (showEvent.defaultPrevented || hideEvent !== null && hideEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
4897
4898
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
4899

XhmikosR's avatar
Dist    
XhmikosR committed
4900
      this._activate(this._element, listElement);
Johann-S's avatar
build    
Johann-S committed
4901

XhmikosR's avatar
Dist    
XhmikosR committed
4902
      var complete = function complete() {
XhmikosR's avatar
XhmikosR committed
4903
        EventHandler.trigger(previous, Event$a.HIDDEN, {
XhmikosR's avatar
Dist    
XhmikosR committed
4904
          relatedTarget: _this._element
Mark Otto's avatar
dist    
Mark Otto committed
4905
        });
XhmikosR's avatar
XhmikosR committed
4906
        EventHandler.trigger(_this._element, Event$a.SHOWN, {
XhmikosR's avatar
Dist    
XhmikosR committed
4907
4908
          relatedTarget: previous
        });
Mark Otto's avatar
dist    
Mark Otto committed
4909
      };
Johann-S's avatar
build    
Johann-S committed
4910

XhmikosR's avatar
Dist    
XhmikosR committed
4911
4912
4913
4914
4915
4916
      if (target) {
        this._activate(target, target.parentNode, complete);
      } else {
        complete();
      }
    };
Johann-S's avatar
build    
Johann-S committed
4917

XhmikosR's avatar
Dist    
XhmikosR committed
4918
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
4919
      Data.removeData(this._element, DATA_KEY$9);
XhmikosR's avatar
Dist    
XhmikosR committed
4920
      this._element = null;
Mark Otto's avatar
Mark Otto committed
4921
4922
    } // Private
    ;
Mark Otto's avatar
dist    
Mark Otto committed
4923

XhmikosR's avatar
Dist    
XhmikosR committed
4924
4925
    _proto._activate = function _activate(element, container, callback) {
      var _this2 = this;
Jacob Thornton's avatar
Jacob Thornton committed
4926

XhmikosR's avatar
XhmikosR committed
4927
      var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? SelectorEngine.find(Selector$9.ACTIVE_UL, container) : SelectorEngine.children(container, Selector$9.ACTIVE);
XhmikosR's avatar
Dist    
XhmikosR committed
4928
      var active = activeElements[0];
XhmikosR's avatar
XhmikosR committed
4929
      var isTransitioning = callback && active && active.classList.contains(ClassName$9.FADE);
XhmikosR's avatar
Dist    
XhmikosR committed
4930
4931
4932

      var complete = function complete() {
        return _this2._transitionComplete(element, active, callback);
Mark Otto's avatar
dist    
Mark Otto committed
4933
      };
Mark Otto's avatar
dist    
Mark Otto committed
4934

XhmikosR's avatar
Dist    
XhmikosR committed
4935
      if (active && isTransitioning) {
XhmikosR's avatar
XhmikosR committed
4936
4937
4938
4939
        var transitionDuration = getTransitionDurationFromElement(active);
        active.classList.remove(ClassName$9.SHOW);
        EventHandler.one(active, TRANSITION_END, complete);
        emulateTransitionEnd(active, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
4940
4941
4942
4943
4944
4945
4946
      } else {
        complete();
      }
    };

    _proto._transitionComplete = function _transitionComplete(element, active, callback) {
      if (active) {
XhmikosR's avatar
XhmikosR committed
4947
4948
        active.classList.remove(ClassName$9.ACTIVE);
        var dropdownChild = SelectorEngine.findOne(Selector$9.DROPDOWN_ACTIVE_CHILD, active.parentNode);
XhmikosR's avatar
Dist    
XhmikosR committed
4949
4950

        if (dropdownChild) {
XhmikosR's avatar
XhmikosR committed
4951
          dropdownChild.classList.remove(ClassName$9.ACTIVE);
Mark Otto's avatar
grunt    
Mark Otto committed
4952
        }
XhmikosR's avatar
Dist    
XhmikosR committed
4953
4954
4955

        if (active.getAttribute('role') === 'tab') {
          active.setAttribute('aria-selected', false);
Mark Otto's avatar
dist    
Mark Otto committed
4956
        }
XhmikosR's avatar
Dist    
XhmikosR committed
4957
      }
Mark Otto's avatar
dist    
Mark Otto committed
4958

XhmikosR's avatar
XhmikosR committed
4959
      element.classList.add(ClassName$9.ACTIVE);
XhmikosR's avatar
Dist    
XhmikosR committed
4960
4961
4962
4963

      if (element.getAttribute('role') === 'tab') {
        element.setAttribute('aria-selected', true);
      }
Mark Otto's avatar
dist    
Mark Otto committed
4964

XhmikosR's avatar
XhmikosR committed
4965
      reflow(element);
Mark Otto's avatar
Mark Otto committed
4966
4967
4968
4969

      if (element.classList.contains(ClassName$9.FADE)) {
        element.classList.add(ClassName$9.SHOW);
      }
Mark Otto's avatar
dist    
Mark Otto committed
4970

XhmikosR's avatar
XhmikosR committed
4971
4972
      if (element.parentNode && element.parentNode.classList.contains(ClassName$9.DROPDOWN_MENU)) {
        var dropdownElement = SelectorEngine.closest(element, Selector$9.DROPDOWN);
Mark Otto's avatar
dist    
Mark Otto committed
4973

XhmikosR's avatar
Dist    
XhmikosR committed
4974
        if (dropdownElement) {
XhmikosR's avatar
XhmikosR committed
4975
4976
4977
          makeArray(SelectorEngine.find(Selector$9.DROPDOWN_TOGGLE)).forEach(function (dropdown) {
            return dropdown.classList.add(ClassName$9.ACTIVE);
          });
XhmikosR's avatar
Dist    
XhmikosR committed
4978
        }
Jacob Thornton's avatar
Jacob Thornton committed
4979

XhmikosR's avatar
Dist    
XhmikosR committed
4980
        element.setAttribute('aria-expanded', true);
Mark Otto's avatar
dist    
Mark Otto committed
4981
      }
Mark Otto's avatar
dist    
Mark Otto committed
4982

XhmikosR's avatar
Dist    
XhmikosR committed
4983
4984
4985
      if (callback) {
        callback();
      }
Mark Otto's avatar
Mark Otto committed
4986
4987
    } // Static
    ;
Jacob Thornton's avatar
Jacob Thornton committed
4988

XhmikosR's avatar
XhmikosR committed
4989
    Tab.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
4990
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
4991
        var data = Data.getData(this, DATA_KEY$9) || new Tab(this);
XhmikosR's avatar
Dist    
XhmikosR committed
4992
4993
4994
4995
4996
4997
4998
4999
5000

        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
          }

          data[config]();
        }
      });
For faster browsing, not all history is shown. View entire blame