bootstrap.bundle.js 212 KB
Newer Older
XhmikosR's avatar
Dist    
XhmikosR committed
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
        Util.reflow(nextElement);
        $(activeElement).addClass(directionalClassName);
        $(nextElement).addClass(directionalClassName);
        var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);

        if (nextElementInterval) {
          this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
          this._config.interval = nextElementInterval;
        } else {
          this._config.interval = this._config.defaultInterval || this._config.interval;
Mark Otto's avatar
dist  
Mark Otto committed
1011
1012
        }

XhmikosR's avatar
Dist    
XhmikosR committed
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
        var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
        $(activeElement).one(Util.TRANSITION_END, function () {
          $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
          $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
          _this4._isSliding = false;
          setTimeout(function () {
            return $(_this4._element).trigger(slidEvent);
          }, 0);
        }).emulateTransitionEnd(transitionDuration);
      } else {
        $(activeElement).removeClass(ClassName$2.ACTIVE);
        $(nextElement).addClass(ClassName$2.ACTIVE);
        this._isSliding = false;
        $(this._element).trigger(slidEvent);
      }

      if (isCycling) {
        this.cycle();
      }
Mark Otto's avatar
Mark Otto committed
1032
1033
    } // Static
    ;
Mark Otto's avatar
dist  
Mark Otto committed
1034

XhmikosR's avatar
Dist    
XhmikosR committed
1035
1036
1037
    Carousel._jQueryInterface = function _jQueryInterface(config) {
      return this.each(function () {
        var data = $(this).data(DATA_KEY$2);
Mark Otto's avatar
dist  
Mark Otto committed
1038

XhmikosR's avatar
Dist    
XhmikosR committed
1039
        var _config = _objectSpread({}, Default, $(this).data());
Mark Otto's avatar
dist  
Mark Otto committed
1040

XhmikosR's avatar
Dist    
XhmikosR committed
1041
1042
        if (typeof config === 'object') {
          _config = _objectSpread({}, _config, config);
Mark Otto's avatar
dist    
Mark Otto committed
1043
        }
Mark Otto's avatar
dist  
Mark Otto committed
1044

XhmikosR's avatar
Dist    
XhmikosR committed
1045
        var action = typeof config === 'string' ? config : _config.slide;
Mark Otto's avatar
dist  
Mark Otto committed
1046

XhmikosR's avatar
Dist    
XhmikosR committed
1047
1048
1049
        if (!data) {
          data = new Carousel(this, _config);
          $(this).data(DATA_KEY$2, data);
Mark Otto's avatar
dist    
Mark Otto committed
1050
        }
Mark Otto's avatar
dist  
Mark Otto committed
1051

XhmikosR's avatar
Dist    
XhmikosR committed
1052
1053
1054
1055
1056
1057
        if (typeof config === 'number') {
          data.to(config);
        } else if (typeof action === 'string') {
          if (typeof data[action] === 'undefined') {
            throw new TypeError("No method named \"" + action + "\"");
          }
Mark Otto's avatar
dist  
Mark Otto committed
1058

XhmikosR's avatar
Dist    
XhmikosR committed
1059
          data[action]();
Mark Otto's avatar
Mark Otto committed
1060
        } else if (_config.interval && _config.ride) {
XhmikosR's avatar
Dist    
XhmikosR committed
1061
1062
          data.pause();
          data.cycle();
Mark Otto's avatar
dist    
Mark Otto committed
1063
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1064
1065
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
1066

XhmikosR's avatar
Dist    
XhmikosR committed
1067
1068
    Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
      var selector = Util.getSelectorFromElement(this);
Mark Otto's avatar
dist  
Mark Otto committed
1069

XhmikosR's avatar
Dist    
XhmikosR committed
1070
1071
1072
1073
1074
1075
1076
1077
1078
      if (!selector) {
        return;
      }

      var target = $(selector)[0];

      if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
1079

XhmikosR's avatar
Dist    
XhmikosR committed
1080
      var config = _objectSpread({}, $(target).data(), $(this).data());
Mark Otto's avatar
dist    
Mark Otto committed
1081

XhmikosR's avatar
Dist    
XhmikosR committed
1082
      var slideIndex = this.getAttribute('data-slide-to');
Mark Otto's avatar
dist    
Mark Otto committed
1083

XhmikosR's avatar
Dist    
XhmikosR committed
1084
1085
      if (slideIndex) {
        config.interval = false;
Mark Otto's avatar
dist    
Mark Otto committed
1086
      }
Mark Otto's avatar
dist    
Mark Otto committed
1087

XhmikosR's avatar
Dist    
XhmikosR committed
1088
      Carousel._jQueryInterface.call($(target), config);
Mark Otto's avatar
dist  
Mark Otto committed
1089

XhmikosR's avatar
Dist    
XhmikosR committed
1090
1091
1092
1093
1094
      if (slideIndex) {
        $(target).data(DATA_KEY$2).to(slideIndex);
      }

      event.preventDefault();
Mark Otto's avatar
dist    
Mark Otto committed
1095
    };
Mark Otto's avatar
dist  
Mark Otto committed
1096

XhmikosR's avatar
Dist    
XhmikosR committed
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
    _createClass(Carousel, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$2;
      }
    }, {
      key: "Default",
      get: function get() {
        return Default;
      }
    }]);

Mark Otto's avatar
dist    
Mark Otto committed
1109
    return Carousel;
XhmikosR's avatar
Dist    
XhmikosR committed
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */


  $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  $(window).on(Event$2.LOAD_DATA_API, function () {
    var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));

    for (var i = 0, len = carousels.length; i < len; i++) {
      var $carousel = $(carousels[i]);

      Carousel._jQueryInterface.call($carousel, $carousel.data());
    }
  });
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
   */

  $.fn[NAME$2] = Carousel._jQueryInterface;
  $.fn[NAME$2].Constructor = Carousel;

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

XhmikosR's avatar
Dist    
XhmikosR committed
1142
1143
1144
1145
1146
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist  
Mark Otto committed
1147

XhmikosR's avatar
Dist    
XhmikosR committed
1148
  var NAME$3 = 'collapse';
Mark Otto's avatar
Mark Otto committed
1149
  var VERSION$3 = '4.2.1';
XhmikosR's avatar
Dist    
XhmikosR committed
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
  var DATA_KEY$3 = 'bs.collapse';
  var EVENT_KEY$3 = "." + DATA_KEY$3;
  var DATA_API_KEY$3 = '.data-api';
  var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  var Default$1 = {
    toggle: true,
    parent: ''
  };
  var DefaultType$1 = {
    toggle: 'boolean',
    parent: '(string|element)'
  };
  var Event$3 = {
    SHOW: "show" + EVENT_KEY$3,
    SHOWN: "shown" + EVENT_KEY$3,
    HIDE: "hide" + EVENT_KEY$3,
    HIDDEN: "hidden" + EVENT_KEY$3,
    CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  };
  var ClassName$3 = {
    SHOW: 'show',
    COLLAPSE: 'collapse',
    COLLAPSING: 'collapsing',
    COLLAPSED: 'collapsed'
  };
  var Dimension = {
    WIDTH: 'width',
    HEIGHT: 'height'
  };
  var Selector$3 = {
    ACTIVES: '.show, .collapsing',
    DATA_TOGGLE: '[data-toggle="collapse"]'
    /**
     * ------------------------------------------------------------------------
     * Class Definition
     * ------------------------------------------------------------------------
     */
Mark Otto's avatar
dist    
Mark Otto committed
1187

XhmikosR's avatar
Dist    
XhmikosR committed
1188
  };
Mark Otto's avatar
dist    
Mark Otto committed
1189

XhmikosR's avatar
Dist    
XhmikosR committed
1190
1191
1192
1193
1194
1195
1196
  var Collapse =
  /*#__PURE__*/
  function () {
    function Collapse(element, config) {
      this._isTransitioning = false;
      this._element = element;
      this._config = this._getConfig(config);
XhmikosR's avatar
Dist    
XhmikosR committed
1197
      this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
XhmikosR's avatar
Dist    
XhmikosR committed
1198
1199
1200
1201
1202
1203
1204
1205
      var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));

      for (var i = 0, len = toggleList.length; i < len; i++) {
        var elem = toggleList[i];
        var selector = Util.getSelectorFromElement(elem);
        var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
          return foundElem === element;
        });
Mark Otto's avatar
dist  
Mark Otto committed
1206

XhmikosR's avatar
Dist    
XhmikosR committed
1207
1208
        if (selector !== null && filterElement.length > 0) {
          this._selector = selector;
Mark Otto's avatar
dist  
Mark Otto committed
1209

XhmikosR's avatar
Dist    
XhmikosR committed
1210
          this._triggerArray.push(elem);
Mark Otto's avatar
dist    
Mark Otto committed
1211
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1212
      }
Mark Otto's avatar
dist  
Mark Otto committed
1213

XhmikosR's avatar
Dist    
XhmikosR committed
1214
      this._parent = this._config.parent ? this._getParent() : null;
Mark Otto's avatar
dist  
Mark Otto committed
1215

XhmikosR's avatar
Dist    
XhmikosR committed
1216
1217
1218
      if (!this._config.parent) {
        this._addAriaAndCollapsedClass(this._element, this._triggerArray);
      }
Mark Otto's avatar
dist  
Mark Otto committed
1219

XhmikosR's avatar
Dist    
XhmikosR committed
1220
1221
1222
1223
      if (this._config.toggle) {
        this.toggle();
      }
    } // Getters
Mark Otto's avatar
dist  
Mark Otto committed
1224
1225


XhmikosR's avatar
Dist    
XhmikosR committed
1226
    var _proto = Collapse.prototype;
Mark Otto's avatar
dist  
Mark Otto committed
1227

XhmikosR's avatar
Dist    
XhmikosR committed
1228
1229
1230
1231
1232
1233
1234
1235
    // Public
    _proto.toggle = function toggle() {
      if ($(this._element).hasClass(ClassName$3.SHOW)) {
        this.hide();
      } else {
        this.show();
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
1236

XhmikosR's avatar
Dist    
XhmikosR committed
1237
1238
    _proto.show = function show() {
      var _this = this;
Mark Otto's avatar
dist  
Mark Otto committed
1239

XhmikosR's avatar
Dist    
XhmikosR committed
1240
1241
1242
      if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1243

XhmikosR's avatar
Dist    
XhmikosR committed
1244
1245
      var actives;
      var activesData;
Mark Otto's avatar
dist    
Mark Otto committed
1246

XhmikosR's avatar
Dist    
XhmikosR committed
1247
1248
1249
1250
      if (this._parent) {
        actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
          if (typeof _this._config.parent === 'string') {
            return elem.getAttribute('data-parent') === _this._config.parent;
Mark Otto's avatar
dist    
Mark Otto committed
1251
          }
Mark Otto's avatar
dist  
Mark Otto committed
1252

XhmikosR's avatar
Dist    
XhmikosR committed
1253
1254
          return elem.classList.contains(ClassName$3.COLLAPSE);
        });
Mark Otto's avatar
dist    
Mark Otto committed
1255

XhmikosR's avatar
Dist    
XhmikosR committed
1256
1257
        if (actives.length === 0) {
          actives = null;
Mark Otto's avatar
dist  
Mark Otto committed
1258
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1259
      }
Mark Otto's avatar
dist  
Mark Otto committed
1260

XhmikosR's avatar
Dist    
XhmikosR committed
1261
1262
      if (actives) {
        activesData = $(actives).not(this._selector).data(DATA_KEY$3);
Mark Otto's avatar
dist    
Mark Otto committed
1263

XhmikosR's avatar
Dist    
XhmikosR committed
1264
        if (activesData && activesData._isTransitioning) {
Mark Otto's avatar
dist    
Mark Otto committed
1265
1266
          return;
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1267
      }
Mark Otto's avatar
dist  
Mark Otto committed
1268

XhmikosR's avatar
Dist    
XhmikosR committed
1269
1270
      var startEvent = $.Event(Event$3.SHOW);
      $(this._element).trigger(startEvent);
Mark Otto's avatar
dist  
Mark Otto committed
1271

XhmikosR's avatar
Dist    
XhmikosR committed
1272
1273
1274
      if (startEvent.isDefaultPrevented()) {
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
1275

XhmikosR's avatar
Dist    
XhmikosR committed
1276
1277
      if (actives) {
        Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
Mark Otto's avatar
dist  
Mark Otto committed
1278

XhmikosR's avatar
Dist    
XhmikosR committed
1279
1280
        if (!activesData) {
          $(actives).data(DATA_KEY$3, null);
Mark Otto's avatar
dist    
Mark Otto committed
1281
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1282
      }
Mark Otto's avatar
dist  
Mark Otto committed
1283

XhmikosR's avatar
Dist    
XhmikosR committed
1284
      var dimension = this._getDimension();
Mark Otto's avatar
dist  
Mark Otto committed
1285

XhmikosR's avatar
Dist    
XhmikosR committed
1286
1287
      $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
      this._element.style[dimension] = 0;
Mark Otto's avatar
dist  
Mark Otto committed
1288

XhmikosR's avatar
Dist    
XhmikosR committed
1289
1290
1291
      if (this._triggerArray.length) {
        $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
      }
Mark Otto's avatar
dist  
Mark Otto committed
1292

XhmikosR's avatar
Dist    
XhmikosR committed
1293
      this.setTransitioning(true);
Mark Otto's avatar
dist  
Mark Otto committed
1294

XhmikosR's avatar
Dist    
XhmikosR committed
1295
1296
1297
1298
1299
1300
1301
      var complete = function complete() {
        $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
        _this._element.style[dimension] = '';

        _this.setTransitioning(false);

        $(_this._element).trigger(Event$3.SHOWN);
Mark Otto's avatar
dist    
Mark Otto committed
1302
      };
Mark Otto's avatar
dist  
Mark Otto committed
1303

XhmikosR's avatar
Dist    
XhmikosR committed
1304
1305
1306
1307
1308
1309
      var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
      var scrollSize = "scroll" + capitalizedDimension;
      var transitionDuration = Util.getTransitionDurationFromElement(this._element);
      $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
      this._element.style[dimension] = this._element[scrollSize] + "px";
    };
Mark Otto's avatar
dist  
Mark Otto committed
1310

XhmikosR's avatar
Dist    
XhmikosR committed
1311
1312
1313
1314
1315
1316
    _proto.hide = function hide() {
      var _this2 = this;

      if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
1317

XhmikosR's avatar
Dist    
XhmikosR committed
1318
1319
      var startEvent = $.Event(Event$3.HIDE);
      $(this._element).trigger(startEvent);
Mark Otto's avatar
dist    
Mark Otto committed
1320

XhmikosR's avatar
Dist    
XhmikosR committed
1321
1322
1323
      if (startEvent.isDefaultPrevented()) {
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
1324

XhmikosR's avatar
Dist    
XhmikosR committed
1325
      var dimension = this._getDimension();
Mark Otto's avatar
dist  
Mark Otto committed
1326

XhmikosR's avatar
Dist    
XhmikosR committed
1327
1328
1329
1330
      this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
      Util.reflow(this._element);
      $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
      var triggerArrayLength = this._triggerArray.length;
Mark Otto's avatar
dist  
Mark Otto committed
1331

XhmikosR's avatar
Dist    
XhmikosR committed
1332
1333
1334
1335
      if (triggerArrayLength > 0) {
        for (var i = 0; i < triggerArrayLength; i++) {
          var trigger = this._triggerArray[i];
          var selector = Util.getSelectorFromElement(trigger);
Mark Otto's avatar
dist    
Mark Otto committed
1336

XhmikosR's avatar
Dist    
XhmikosR committed
1337
1338
          if (selector !== null) {
            var $elem = $([].slice.call(document.querySelectorAll(selector)));
Mark Otto's avatar
dist    
Mark Otto committed
1339

XhmikosR's avatar
Dist    
XhmikosR committed
1340
1341
            if (!$elem.hasClass(ClassName$3.SHOW)) {
              $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
Mark Otto's avatar
dist  
Mark Otto committed
1342
1343
1344
            }
          }
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1345
      }
Mark Otto's avatar
dist  
Mark Otto committed
1346

XhmikosR's avatar
Dist    
XhmikosR committed
1347
      this.setTransitioning(true);
Mark Otto's avatar
dist  
Mark Otto committed
1348

XhmikosR's avatar
Dist    
XhmikosR committed
1349
1350
      var complete = function complete() {
        _this2.setTransitioning(false);
Mark Otto's avatar
dist  
Mark Otto committed
1351

XhmikosR's avatar
Dist    
XhmikosR committed
1352
        $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
Mark Otto's avatar
dist    
Mark Otto committed
1353
      };
Mark Otto's avatar
dist  
Mark Otto committed
1354

XhmikosR's avatar
Dist    
XhmikosR committed
1355
1356
1357
1358
      this._element.style[dimension] = '';
      var transitionDuration = Util.getTransitionDurationFromElement(this._element);
      $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
    };
Mark Otto's avatar
dist  
Mark Otto committed
1359

XhmikosR's avatar
Dist    
XhmikosR committed
1360
1361
1362
    _proto.setTransitioning = function setTransitioning(isTransitioning) {
      this._isTransitioning = isTransitioning;
    };
Mark Otto's avatar
dist  
Mark Otto committed
1363

XhmikosR's avatar
Dist    
XhmikosR committed
1364
1365
1366
1367
1368
1369
1370
    _proto.dispose = function dispose() {
      $.removeData(this._element, DATA_KEY$3);
      this._config = null;
      this._parent = null;
      this._element = null;
      this._triggerArray = null;
      this._isTransitioning = null;
Mark Otto's avatar
Mark Otto committed
1371
1372
    } // Private
    ;
Mark Otto's avatar
dist    
Mark Otto committed
1373

XhmikosR's avatar
Dist    
XhmikosR committed
1374
1375
1376
    _proto._getConfig = function _getConfig(config) {
      config = _objectSpread({}, Default$1, config);
      config.toggle = Boolean(config.toggle); // Coerce string values
Mark Otto's avatar
dist  
Mark Otto committed
1377

XhmikosR's avatar
Dist    
XhmikosR committed
1378
1379
1380
      Util.typeCheckConfig(NAME$3, config, DefaultType$1);
      return config;
    };
Mark Otto's avatar
dist  
Mark Otto committed
1381

XhmikosR's avatar
Dist    
XhmikosR committed
1382
1383
1384
1385
    _proto._getDimension = function _getDimension() {
      var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
      return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
    };
Mark Otto's avatar
dist  
Mark Otto committed
1386

XhmikosR's avatar
Dist    
XhmikosR committed
1387
1388
    _proto._getParent = function _getParent() {
      var _this3 = this;
Mark Otto's avatar
dist  
Mark Otto committed
1389

XhmikosR's avatar
Dist    
XhmikosR committed
1390
      var parent;
Mark Otto's avatar
dist    
Mark Otto committed
1391

XhmikosR's avatar
Dist    
XhmikosR committed
1392
1393
      if (Util.isElement(this._config.parent)) {
        parent = this._config.parent; // It's a jQuery object
Mark Otto's avatar
dist    
Mark Otto committed
1394

XhmikosR's avatar
Dist    
XhmikosR committed
1395
1396
1397
1398
1399
1400
        if (typeof this._config.parent.jquery !== 'undefined') {
          parent = this._config.parent[0];
        }
      } else {
        parent = document.querySelector(this._config.parent);
      }
Mark Otto's avatar
dist  
Mark Otto committed
1401

XhmikosR's avatar
Dist    
XhmikosR committed
1402
1403
1404
1405
1406
1407
1408
      var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
      var children = [].slice.call(parent.querySelectorAll(selector));
      $(children).each(function (i, element) {
        _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
      });
      return parent;
    };
Mark Otto's avatar
dist  
Mark Otto committed
1409

XhmikosR's avatar
Dist    
XhmikosR committed
1410
1411
    _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
      var isOpen = $(element).hasClass(ClassName$3.SHOW);
Mark Otto's avatar
dist  
Mark Otto committed
1412

XhmikosR's avatar
Dist    
XhmikosR committed
1413
1414
1415
      if (triggerArray.length) {
        $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
      }
Mark Otto's avatar
Mark Otto committed
1416
1417
    } // Static
    ;
Mark Otto's avatar
dist  
Mark Otto committed
1418

XhmikosR's avatar
Dist    
XhmikosR committed
1419
1420
1421
1422
    Collapse._getTargetFromElement = function _getTargetFromElement(element) {
      var selector = Util.getSelectorFromElement(element);
      return selector ? document.querySelector(selector) : null;
    };
Mark Otto's avatar
dist    
Mark Otto committed
1423

XhmikosR's avatar
Dist    
XhmikosR committed
1424
1425
1426
1427
    Collapse._jQueryInterface = function _jQueryInterface(config) {
      return this.each(function () {
        var $this = $(this);
        var data = $this.data(DATA_KEY$3);
Mark Otto's avatar
dist  
Mark Otto committed
1428

XhmikosR's avatar
Dist    
XhmikosR committed
1429
        var _config = _objectSpread({}, Default$1, $this.data(), typeof config === 'object' && config ? config : {});
Mark Otto's avatar
dist  
Mark Otto committed
1430

XhmikosR's avatar
Dist    
XhmikosR committed
1431
1432
1433
        if (!data && _config.toggle && /show|hide/.test(config)) {
          _config.toggle = false;
        }
Mark Otto's avatar
dist    
Mark Otto committed
1434

XhmikosR's avatar
Dist    
XhmikosR committed
1435
1436
1437
1438
        if (!data) {
          data = new Collapse(this, _config);
          $this.data(DATA_KEY$3, data);
        }
Mark Otto's avatar
dist  
Mark Otto committed
1439

XhmikosR's avatar
Dist    
XhmikosR committed
1440
1441
1442
        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
Mark Otto's avatar
dist  
Mark Otto committed
1443
          }
Mark Otto's avatar
dist    
Mark Otto committed
1444

XhmikosR's avatar
Dist    
XhmikosR committed
1445
          data[config]();
Mark Otto's avatar
dist    
Mark Otto committed
1446
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1447
1448
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
1449

XhmikosR's avatar
Dist    
XhmikosR committed
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
    _createClass(Collapse, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$3;
      }
    }, {
      key: "Default",
      get: function get() {
        return Default$1;
      }
    }]);
Mark Otto's avatar
dist  
Mark Otto committed
1461

XhmikosR's avatar
Dist    
XhmikosR committed
1462
1463
1464
1465
1466
1467
1468
    return Collapse;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
1469

Mark Otto's avatar
dist  
Mark Otto committed
1470

XhmikosR's avatar
Dist    
XhmikosR committed
1471
1472
1473
1474
1475
  $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
    // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
    if (event.currentTarget.tagName === 'A') {
      event.preventDefault();
    }
Mark Otto's avatar
dist    
Mark Otto committed
1476

XhmikosR's avatar
Dist    
XhmikosR committed
1477
1478
1479
1480
1481
1482
1483
    var $trigger = $(this);
    var selector = Util.getSelectorFromElement(this);
    var selectors = [].slice.call(document.querySelectorAll(selector));
    $(selectors).each(function () {
      var $target = $(this);
      var data = $target.data(DATA_KEY$3);
      var config = data ? 'toggle' : $trigger.data();
Mark Otto's avatar
dist  
Mark Otto committed
1484

XhmikosR's avatar
Dist    
XhmikosR committed
1485
1486
1487
1488
1489
1490
1491
1492
      Collapse._jQueryInterface.call($target, config);
    });
  });
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
1493

XhmikosR's avatar
Dist    
XhmikosR committed
1494
1495
  $.fn[NAME$3] = Collapse._jQueryInterface;
  $.fn[NAME$3].Constructor = Collapse;
Mark Otto's avatar
dist  
Mark Otto committed
1496

XhmikosR's avatar
Dist    
XhmikosR committed
1497
1498
1499
1500
  $.fn[NAME$3].noConflict = function () {
    $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
    return Collapse._jQueryInterface;
  };
Mark Otto's avatar
dist  
Mark Otto committed
1501

Mark Otto's avatar
dist    
Mark Otto committed
1502
1503
  /**!
   * @fileOverview Kickass library to create and place poppers near their reference elements.
Mark Otto's avatar
dist    
Mark Otto committed
1504
   * @version 1.14.6
Mark Otto's avatar
dist    
Mark Otto committed
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
   * @license
   * Copyright (c) 2016 Federico Zivolo and contributors
   *
   * Permission is hereby granted, free of charge, to any person obtaining a copy
   * of this software and associated documentation files (the "Software"), to deal
   * in the Software without restriction, including without limitation the rights
   * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
   * copies of the Software, and to permit persons to whom the Software is
   * furnished to do so, subject to the following conditions:
   *
   * The above copyright notice and this permission notice shall be included in all
   * copies or substantial portions of the Software.
   *
   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   * SOFTWARE.
   */
  var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
Mark Otto's avatar
dist    
Mark Otto committed
1527

Mark Otto's avatar
dist    
Mark Otto committed
1528
1529
1530
1531
1532
1533
  var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  var timeoutDuration = 0;
  for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
    if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
      timeoutDuration = 1;
      break;
Mark Otto's avatar
dist  
Mark Otto committed
1534
    }
Mark Otto's avatar
dist    
Mark Otto committed
1535
  }
Mark Otto's avatar
dist  
Mark Otto committed
1536

Mark Otto's avatar
dist    
Mark Otto committed
1537
1538
1539
1540
1541
1542
1543
1544
1545
  function microtaskDebounce(fn) {
    var called = false;
    return function () {
      if (called) {
        return;
      }
      called = true;
      window.Promise.resolve().then(function () {
        called = false;
Mark Otto's avatar
dist  
Mark Otto committed
1546
        fn();
Mark Otto's avatar
dist    
Mark Otto committed
1547
1548
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
1549
1550
  }

Mark Otto's avatar
dist    
Mark Otto committed
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
  function taskDebounce(fn) {
    var scheduled = false;
    return function () {
      if (!scheduled) {
        scheduled = true;
        setTimeout(function () {
          scheduled = false;
          fn();
        }, timeoutDuration);
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
1562
1563
  }

Mark Otto's avatar
dist    
Mark Otto committed
1564
  var supportsMicroTasks = isBrowser && window.Promise;
Mark Otto's avatar
dist  
Mark Otto committed
1565

Mark Otto's avatar
dist    
Mark Otto committed
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
  /**
  * Create a debounced version of a method, that's asynchronously deferred
  * but called in the minimum time possible.
  *
  * @method
  * @memberof Popper.Utils
  * @argument {Function} fn
  * @returns {Function}
  */
  var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
Mark Otto's avatar
dist  
Mark Otto committed
1576

Mark Otto's avatar
dist    
Mark Otto committed
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
  /**
   * Check if the given variable is a function
   * @method
   * @memberof Popper.Utils
   * @argument {Any} functionToCheck - variable to check
   * @returns {Boolean} answer to: is a function?
   */
  function isFunction(functionToCheck) {
    var getType = {};
    return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
Mark Otto's avatar
dist  
Mark Otto committed
1587
1588
  }

Mark Otto's avatar
dist    
Mark Otto committed
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
  /**
   * Get CSS computed property of the given element
   * @method
   * @memberof Popper.Utils
   * @argument {Eement} element
   * @argument {String} property
   */
  function getStyleComputedProperty(element, property) {
    if (element.nodeType !== 1) {
      return [];
Mark Otto's avatar
dist    
Mark Otto committed
1599
    }
Mark Otto's avatar
dist    
Mark Otto committed
1600
    // NOTE: 1 DOM access here
XhmikosR's avatar
Dist    
XhmikosR committed
1601
1602
    var window = element.ownerDocument.defaultView;
    var css = window.getComputedStyle(element, null);
Mark Otto's avatar
dist    
Mark Otto committed
1603
    return property ? css[property] : css;
Mark Otto's avatar
dist  
Mark Otto committed
1604
1605
  }

Mark Otto's avatar
dist    
Mark Otto committed
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
  /**
   * Returns the parentNode or the host of the element
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element
   * @returns {Element} parent
   */
  function getParentNode(element) {
    if (element.nodeName === 'HTML') {
      return element;
    }
    return element.parentNode || element.host;
Mark Otto's avatar
dist  
Mark Otto committed
1618
1619
  }

Mark Otto's avatar
dist    
Mark Otto committed
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
  /**
   * Returns the scrolling parent of the given element
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element
   * @returns {Element} scroll parent
   */
  function getScrollParent(element) {
    // Return body, `getScroll` will take care to get the correct `scrollTop` from it
    if (!element) {
      return document.body;
    }
Mark Otto's avatar
dist  
Mark Otto committed
1632

Mark Otto's avatar
dist    
Mark Otto committed
1633
1634
1635
1636
1637
1638
1639
    switch (element.nodeName) {
      case 'HTML':
      case 'BODY':
        return element.ownerDocument.body;
      case '#document':
        return element.body;
    }
Mark Otto's avatar
dist  
Mark Otto committed
1640

Mark Otto's avatar
dist    
Mark Otto committed
1641
    // Firefox want us to check `-x` and `-y` variations as well
Mark Otto's avatar
dist  
Mark Otto committed
1642

Mark Otto's avatar
dist    
Mark Otto committed
1643
1644
1645
1646
    var _getStyleComputedProp = getStyleComputedProperty(element),
        overflow = _getStyleComputedProp.overflow,
        overflowX = _getStyleComputedProp.overflowX,
        overflowY = _getStyleComputedProp.overflowY;
Mark Otto's avatar
dist  
Mark Otto committed
1647

Mark Otto's avatar
dist    
Mark Otto committed
1648
1649
    if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
      return element;
Mark Otto's avatar
dist  
Mark Otto committed
1650
1651
    }

Mark Otto's avatar
dist    
Mark Otto committed
1652
    return getScrollParent(getParentNode(element));
Mark Otto's avatar
dist  
Mark Otto committed
1653
1654
  }

Mark Otto's avatar
dist    
Mark Otto committed
1655
1656
1657
  var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);

Mark Otto's avatar
dist    
Mark Otto committed
1658
  /**
Mark Otto's avatar
dist    
Mark Otto committed
1659
   * Determines if the browser is Internet Explorer
Mark Otto's avatar
dist    
Mark Otto committed
1660
1661
   * @method
   * @memberof Popper.Utils
Mark Otto's avatar
dist    
Mark Otto committed
1662
   * @param {Number} version to check
Mark Otto's avatar
dist    
Mark Otto committed
1663
1664
   * @returns {Boolean} isIE
   */
Mark Otto's avatar
dist    
Mark Otto committed
1665
1666
1667
  function isIE(version) {
    if (version === 11) {
      return isIE11;
Mark Otto's avatar
dist    
Mark Otto committed
1668
    }
Mark Otto's avatar
dist    
Mark Otto committed
1669
1670
    if (version === 10) {
      return isIE10;
Mark Otto's avatar
dist    
Mark Otto committed
1671
    }
Mark Otto's avatar
dist    
Mark Otto committed
1672
1673
    return isIE11 || isIE10;
  }
Mark Otto's avatar
dist  
Mark Otto committed
1674

Mark Otto's avatar
dist    
Mark Otto committed
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
  /**
   * Returns the offset parent of the given element
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element
   * @returns {Element} offset parent
   */
  function getOffsetParent(element) {
    if (!element) {
      return document.documentElement;
Mark Otto's avatar
dist  
Mark Otto committed
1685
1686
    }

Mark Otto's avatar
dist    
Mark Otto committed
1687
    var noOffsetParent = isIE(10) ? document.body : null;
Mark Otto's avatar
dist  
Mark Otto committed
1688

Mark Otto's avatar
dist    
Mark Otto committed
1689
    // NOTE: 1 DOM access here
XhmikosR's avatar
Dist    
XhmikosR committed
1690
    var offsetParent = element.offsetParent || null;
Mark Otto's avatar
dist    
Mark Otto committed
1691
1692
1693
1694
    // Skip hidden elements which don't have an offsetParent
    while (offsetParent === noOffsetParent && element.nextElementSibling) {
      offsetParent = (element = element.nextElementSibling).offsetParent;
    }
Mark Otto's avatar
dist  
Mark Otto committed
1695

Mark Otto's avatar
dist    
Mark Otto committed
1696
    var nodeName = offsetParent && offsetParent.nodeName;
Mark Otto's avatar
dist  
Mark Otto committed
1697

Mark Otto's avatar
dist    
Mark Otto committed
1698
1699
1700
    if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
      return element ? element.ownerDocument.documentElement : document.documentElement;
    }
Mark Otto's avatar
dist  
Mark Otto committed
1701

XhmikosR's avatar
Dist    
XhmikosR committed
1702
    // .offsetParent will return the closest TH, TD or TABLE in case
Mark Otto's avatar
dist    
Mark Otto committed
1703
    // no offsetParent is present, I hate this job...
XhmikosR's avatar
Dist    
XhmikosR committed
1704
    if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
Mark Otto's avatar
dist    
Mark Otto committed
1705
1706
      return getOffsetParent(offsetParent);
    }
Mark Otto's avatar
dist  
Mark Otto committed
1707

Mark Otto's avatar
dist    
Mark Otto committed
1708
    return offsetParent;
Mark Otto's avatar
dist  
Mark Otto committed
1709
1710
  }

Mark Otto's avatar
dist    
Mark Otto committed
1711
1712
  function isOffsetContainer(element) {
    var nodeName = element.nodeName;
Mark Otto's avatar
dist  
Mark Otto committed
1713

Mark Otto's avatar
dist    
Mark Otto committed
1714
1715
    if (nodeName === 'BODY') {
      return false;
Mark Otto's avatar
dist  
Mark Otto committed
1716
    }
Mark Otto's avatar
dist    
Mark Otto committed
1717
    return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
Mark Otto's avatar
dist  
Mark Otto committed
1718
1719
  }

Mark Otto's avatar
dist    
Mark Otto committed
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
  /**
   * Finds the root node (document, shadowDOM root) of the given element
   * @method
   * @memberof Popper.Utils
   * @argument {Element} node
   * @returns {Element} root node
   */
  function getRoot(node) {
    if (node.parentNode !== null) {
      return getRoot(node.parentNode);
    }
Mark Otto's avatar
dist  
Mark Otto committed
1731

Mark Otto's avatar
dist    
Mark Otto committed
1732
    return node;
Mark Otto's avatar
dist  
Mark Otto committed
1733
1734
  }

Mark Otto's avatar
dist    
Mark Otto committed
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
  /**
   * Finds the offset parent common to the two provided nodes
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element1
   * @argument {Element} element2
   * @returns {Element} common offset parent
   */
  function findCommonOffsetParent(element1, element2) {
    // This check is needed to avoid errors in case one of the elements isn't defined for any reason
    if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
      return document.documentElement;
    }
Mark Otto's avatar
dist  
Mark Otto committed
1748

Mark Otto's avatar
dist    
Mark Otto committed
1749
1750
1751
1752
    // Here we make sure to give as "start" the element that comes first in the DOM
    var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
    var start = order ? element1 : element2;
    var end = order ? element2 : element1;
Mark Otto's avatar
dist  
Mark Otto committed
1753

Mark Otto's avatar
dist    
Mark Otto committed
1754
1755
1756
1757
1758
    // Get common ancestor container
    var range = document.createRange();
    range.setStart(start, 0);
    range.setEnd(end, 0);
    var commonAncestorContainer = range.commonAncestorContainer;
Mark Otto's avatar
dist  
Mark Otto committed
1759

Mark Otto's avatar
dist    
Mark Otto committed
1760
    // Both nodes are inside #document
Mark Otto's avatar
dist  
Mark Otto committed
1761

Mark Otto's avatar
dist    
Mark Otto committed
1762
1763
1764
1765
    if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
      if (isOffsetContainer(commonAncestorContainer)) {
        return commonAncestorContainer;
      }
Mark Otto's avatar
dist  
Mark Otto committed
1766

Mark Otto's avatar
dist    
Mark Otto committed
1767
1768
      return getOffsetParent(commonAncestorContainer);
    }
Mark Otto's avatar
dist  
Mark Otto committed
1769

Mark Otto's avatar
dist    
Mark Otto committed
1770
1771
1772
1773
    // one of the nodes is inside shadowDOM, find which one
    var element1root = getRoot(element1);
    if (element1root.host) {
      return findCommonOffsetParent(element1root.host, element2);
Mark Otto's avatar
dist  
Mark Otto committed
1774
    } else {
Mark Otto's avatar
dist    
Mark Otto committed
1775
      return findCommonOffsetParent(element1, getRoot(element2).host);
Mark Otto's avatar
dist  
Mark Otto committed
1776
    }
Mark Otto's avatar
dist    
Mark Otto committed
1777
  }
Mark Otto's avatar
dist  
Mark Otto committed
1778

Mark Otto's avatar
dist    
Mark Otto committed
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
  /**
   * Gets the scroll value of the given element in the given side (top and left)
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element
   * @argument {String} side `top` or `left`
   * @returns {number} amount of scrolled pixels
   */
  function getScroll(element) {
    var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
Mark Otto's avatar
dist  
Mark Otto committed
1789

Mark Otto's avatar
dist    
Mark Otto committed
1790
1791
    var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
    var nodeName = element.nodeName;
Mark Otto's avatar
dist  
Mark Otto committed
1792

Mark Otto's avatar
dist    
Mark Otto committed
1793
1794
1795
1796
    if (nodeName === 'BODY' || nodeName === 'HTML') {
      var html = element.ownerDocument.documentElement;
      var scrollingElement = element.ownerDocument.scrollingElement || html;
      return scrollingElement[upperSide];
Mark Otto's avatar
dist  
Mark Otto committed
1797
1798
    }

Mark Otto's avatar
dist    
Mark Otto committed
1799
    return element[upperSide];
Mark Otto's avatar
dist  
Mark Otto committed
1800
1801
  }

Mark Otto's avatar
dist    
Mark Otto committed
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
  /*
   * Sum or subtract the element scroll values (left and top) from a given rect object
   * @method
   * @memberof Popper.Utils
   * @param {Object} rect - Rect object you want to change
   * @param {HTMLElement} element - The element from the function reads the scroll values
   * @param {Boolean} subtract - set to true if you want to subtract the scroll values
   * @return {Object} rect - The modifier rect object
   */
  function includeScroll(rect, element) {
    var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;

    var scrollTop = getScroll(element, 'top');
    var scrollLeft = getScroll(element, 'left');
    var modifier = subtract ? -1 : 1;
    rect.top += scrollTop * modifier;
    rect.bottom += scrollTop * modifier;
    rect.left += scrollLeft * modifier;
    rect.right += scrollLeft * modifier;
    return rect;
  }
Mark Otto's avatar
dist  
Mark Otto committed
1823

Mark Otto's avatar
dist    
Mark Otto committed
1824
1825
1826
1827
1828
1829
1830
1831
1832
  /*
   * Helper to detect borders of a given element
   * @method
   * @memberof Popper.Utils
   * @param {CSSStyleDeclaration} styles
   * Result of `getStyleComputedProperty` on the given element
   * @param {String} axis - `x` or `y`
   * @return {number} borders - The borders size of the given axis
   */
Mark Otto's avatar
dist  
Mark Otto committed
1833

Mark Otto's avatar
dist    
Mark Otto committed
1834
1835
1836
  function getBordersSize(styles, axis) {
    var sideA = axis === 'x' ? 'Left' : 'Top';
    var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
Mark Otto's avatar
dist  
Mark Otto committed
1837

Mark Otto's avatar
dist    
Mark Otto committed
1838
    return parseFloat(styles['border' + sideA + 'Width'], 10) + parseFloat(styles['border' + sideB + 'Width'], 10);
Mark Otto's avatar
dist  
Mark Otto committed
1839
1840
  }

Mark Otto's avatar
dist    
Mark Otto committed
1841
  function getSize(axis, body, html, computedStyle) {
Mark Otto's avatar
dist    
Mark Otto committed
1842
    return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE(10) ? parseInt(html['offset' + axis]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')]) : 0);
Mark Otto's avatar
dist  
Mark Otto committed
1843
1844
  }

Mark Otto's avatar
dist    
Mark Otto committed
1845
  function getWindowSizes(document) {
Mark Otto's avatar
dist    
Mark Otto committed
1846
1847
1848
    var body = document.body;
    var html = document.documentElement;
    var computedStyle = isIE(10) && getComputedStyle(html);
Mark Otto's avatar
dist  
Mark Otto committed
1849

Mark Otto's avatar
dist    
Mark Otto committed
1850
1851
1852
1853
    return {
      height: getSize('Height', body, html, computedStyle),
      width: getSize('Width', body, html, computedStyle)
    };
Mark Otto's avatar
dist  
Mark Otto committed
1854
1855
  }

Mark Otto's avatar
dist    
Mark Otto committed
1856
1857
1858
1859
  var classCallCheck = function (instance, Constructor) {
    if (!(instance instanceof Constructor)) {
      throw new TypeError("Cannot call a class as a function");
    }
Mark Otto's avatar
dist  
Mark Otto committed
1860
1861
  };

Mark Otto's avatar
dist    
Mark Otto committed
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
  var createClass = function () {
    function defineProperties(target, props) {
      for (var i = 0; i < props.length; i++) {
        var descriptor = props[i];
        descriptor.enumerable = descriptor.enumerable || false;
        descriptor.configurable = true;
        if ("value" in descriptor) descriptor.writable = true;
        Object.defineProperty(target, descriptor.key, descriptor);
      }
    }
Mark Otto's avatar
dist  
Mark Otto committed
1872

Mark Otto's avatar
dist    
Mark Otto committed
1873
1874
1875
1876
1877
1878
    return function (Constructor, protoProps, staticProps) {
      if (protoProps) defineProperties(Constructor.prototype, protoProps);
      if (staticProps) defineProperties(Constructor, staticProps);
      return Constructor;
    };
  }();
Mark Otto's avatar
dist  
Mark Otto committed
1879
1880
1881
1882
1883





Mark Otto's avatar
dist    
Mark Otto committed
1884
1885
1886
1887
1888
1889
1890
1891
  var defineProperty = function (obj, key, value) {
    if (key in obj) {
      Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
      });
Mark Otto's avatar
dist  
Mark Otto committed
1892
    } else {
Mark Otto's avatar
dist    
Mark Otto committed
1893
      obj[key] = value;
Mark Otto's avatar
dist  
Mark Otto committed
1894
1895
    }

Mark Otto's avatar
dist    
Mark Otto committed
1896
1897
    return obj;
  };
Mark Otto's avatar
dist  
Mark Otto committed
1898

Mark Otto's avatar
dist    
Mark Otto committed
1899
1900
1901
  var _extends = Object.assign || function (target) {
    for (var i = 1; i < arguments.length; i++) {
      var source = arguments[i];
Mark Otto's avatar
dist  
Mark Otto committed
1902

Mark Otto's avatar
dist    
Mark Otto committed
1903
1904
1905
1906
1907
1908
      for (var key in source) {
        if (Object.prototype.hasOwnProperty.call(source, key)) {
          target[key] = source[key];
        }
      }
    }
Mark Otto's avatar
dist  
Mark Otto committed
1909

Mark Otto's avatar
dist    
Mark Otto committed
1910
    return target;
Mark Otto's avatar
dist  
Mark Otto committed
1911
1912
  };

Mark Otto's avatar
dist    
Mark Otto committed
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
  /**
   * Given element offsets, generate an output similar to getBoundingClientRect
   * @method
   * @memberof Popper.Utils
   * @argument {Object} offsets
   * @returns {Object} ClientRect like output
   */
  function getClientRect(offsets) {
    return _extends({}, offsets, {
      right: offsets.left + offsets.width,
      bottom: offsets.top + offsets.height
    });
Mark Otto's avatar
dist  
Mark Otto committed
1925
1926
  }

Mark Otto's avatar
dist    
Mark Otto committed
1927
1928
1929
1930
1931
1932
1933
1934
1935
  /**
   * Get bounding client rect of given element
   * @method
   * @memberof Popper.Utils
   * @param {HTMLElement} element
   * @return {Object} client rect
   */
  function getBoundingClientRect(element) {
    var rect = {};
Mark Otto's avatar
dist  
Mark Otto committed
1936

Mark Otto's avatar
dist    
Mark Otto committed
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
    // IE10 10 FIX: Please, don't ask, the element isn't
    // considered in DOM in some circumstances...
    // This isn't reproducible in IE10 compatibility mode of IE11
    try {
      if (isIE(10)) {
        rect = element.getBoundingClientRect();
        var scrollTop = getScroll(element, 'top');
        var scrollLeft = getScroll(element, 'left');
        rect.top += scrollTop;
        rect.left += scrollLeft;
        rect.bottom += scrollTop;
        rect.right += scrollLeft;
      } else {
        rect = element.getBoundingClientRect();
      }
    } catch (e) {}

    var result = {
      left: rect.left,
      top: rect.top,
      width: rect.right - rect.left,
      height: rect.bottom - rect.top
    };
Mark Otto's avatar
dist  
Mark Otto committed
1960

Mark Otto's avatar
dist    
Mark Otto committed
1961
    // subtract scrollbar size from sizes
Mark Otto's avatar
dist    
Mark Otto committed
1962
    var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
Mark Otto's avatar
dist    
Mark Otto committed
1963
1964
    var width = sizes.width || element.clientWidth || result.right - result.left;
    var height = sizes.height || element.clientHeight || result.bottom - result.top;
Mark Otto's avatar
dist  
Mark Otto committed
1965

Mark Otto's avatar
dist    
Mark Otto committed
1966
1967
    var horizScrollbar = element.offsetWidth - width;
    var vertScrollbar = element.offsetHeight - height;
Mark Otto's avatar
dist  
Mark Otto committed
1968

Mark Otto's avatar
dist    
Mark Otto committed
1969
1970
1971
1972
1973
1974
1975
1976
1977
    // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
    // we make this check conditional for performance reasons
    if (horizScrollbar || vertScrollbar) {
      var styles = getStyleComputedProperty(element);
      horizScrollbar -= getBordersSize(styles, 'x');
      vertScrollbar -= getBordersSize(styles, 'y');

      result.width -= horizScrollbar;
      result.height -= vertScrollbar;
Mark Otto's avatar
dist  
Mark Otto committed
1978
    }
Mark Otto's avatar
dist    
Mark Otto committed
1979
1980

    return getClientRect(result);
Mark Otto's avatar
dist  
Mark Otto committed
1981
1982
  }

Mark Otto's avatar
dist    
Mark Otto committed
1983
1984
  function getOffsetRectRelativeToArbitraryNode(children, parent) {
    var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
Mark Otto's avatar
dist  
Mark Otto committed
1985

Mark Otto's avatar
dist    
Mark Otto committed
1986
1987
1988
1989
1990
    var isIE10 = isIE(10);
    var isHTML = parent.nodeName === 'HTML';
    var childrenRect = getBoundingClientRect(children);
    var parentRect = getBoundingClientRect(parent);
    var scrollParent = getScrollParent(children);
Mark Otto's avatar
dist  
Mark Otto committed
1991

Mark Otto's avatar
dist    
Mark Otto committed
1992
1993
1994
    var styles = getStyleComputedProperty(parent);
    var borderTopWidth = parseFloat(styles.borderTopWidth, 10);
    var borderLeftWidth = parseFloat(styles.borderLeftWidth, 10);
Mark Otto's avatar
dist  
Mark Otto committed
1995

Mark Otto's avatar
dist    
Mark Otto committed
1996
    // In cases where the parent is fixed, we must ignore negative scroll in offset calc
Mark Otto's avatar
dist    
Mark Otto committed
1997
    if (fixedPosition && isHTML) {
Mark Otto's avatar
dist    
Mark Otto committed
1998
1999
2000
      parentRect.top = Math.max(parentRect.top, 0);
      parentRect.left = Math.max(parentRect.left, 0);
    }
For faster browsing, not all history is shown. View entire blame