bootstrap.bundle.js 218 KB
Newer Older
XhmikosR's avatar
Dist    
XhmikosR committed
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
      if ($(this._element).hasClass(ClassName$2.SLIDE)) {
        $(nextElement).addClass(orderClassName);
        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
1013
1014
        }

XhmikosR's avatar
Dist    
XhmikosR committed
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
        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
1034
1035
    } // Static
    ;
Mark Otto's avatar
dist  
Mark Otto committed
1036

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

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

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

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
1054
1055
1056
1057
1058
1059
        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
1060

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

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

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

      var target = $(selector)[0];

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

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

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

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

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

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

      event.preventDefault();
Mark Otto's avatar
dist    
Mark Otto committed
1097
    };
Mark Otto's avatar
dist  
Mark Otto committed
1098

XhmikosR's avatar
Dist    
XhmikosR committed
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
    _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
1111
    return Carousel;
XhmikosR's avatar
Dist    
XhmikosR committed
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
1141
1142
  }();
  /**
   * ------------------------------------------------------------------------
   * 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
1143

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

XhmikosR's avatar
Dist    
XhmikosR committed
1150
  var NAME$3 = 'collapse';
XhmikosR's avatar
XhmikosR committed
1151
  var VERSION$3 = '4.3.1';
XhmikosR's avatar
Dist    
XhmikosR committed
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
1187
1188
  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
1189

XhmikosR's avatar
Dist    
XhmikosR committed
1190
  };
Mark Otto's avatar
dist    
Mark Otto committed
1191

XhmikosR's avatar
Dist    
XhmikosR committed
1192
1193
1194
1195
1196
1197
1198
  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
1199
      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
1200
1201
1202
1203
1204
1205
1206
1207
      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
1208

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

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

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

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

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


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

XhmikosR's avatar
Dist    
XhmikosR committed
1230
1231
1232
1233
1234
1235
1236
1237
    // 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
1238

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
1246
1247
      var actives;
      var activesData;
Mark Otto's avatar
dist    
Mark Otto committed
1248

XhmikosR's avatar
Dist    
XhmikosR committed
1249
1250
1251
1252
      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
1253
          }
Mark Otto's avatar
dist  
Mark Otto committed
1254

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

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

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

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

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

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

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

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

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

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

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
1297
1298
1299
1300
1301
1302
1303
      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
1304
      };
Mark Otto's avatar
dist  
Mark Otto committed
1305

XhmikosR's avatar
Dist    
XhmikosR committed
1306
1307
1308
1309
1310
1311
      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
1312

XhmikosR's avatar
Dist    
XhmikosR committed
1313
1314
1315
1316
1317
1318
    _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
1319

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

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
1329
1330
1331
1332
      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
1333

XhmikosR's avatar
Dist    
XhmikosR committed
1334
1335
1336
1337
      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
1338

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

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

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

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
1357
1358
1359
1360
      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
1361

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

XhmikosR's avatar
Dist    
XhmikosR committed
1366
1367
1368
1369
1370
1371
1372
    _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
1373
1374
    } // Private
    ;
Mark Otto's avatar
dist    
Mark Otto committed
1375

XhmikosR's avatar
Dist    
XhmikosR committed
1376
1377
1378
    _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
1379

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

XhmikosR's avatar
Dist    
XhmikosR committed
1384
1385
1386
1387
    _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
1388

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

XhmikosR's avatar
Dist    
XhmikosR committed
1392
      var parent;
Mark Otto's avatar
dist    
Mark Otto committed
1393

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

XhmikosR's avatar
Dist    
XhmikosR committed
1397
1398
1399
1400
1401
1402
        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
1403

XhmikosR's avatar
Dist    
XhmikosR committed
1404
1405
1406
1407
1408
1409
1410
      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
1411

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

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
1426
1427
1428
1429
    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
1430

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

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

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

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
    _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
1463

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

Mark Otto's avatar
dist  
Mark Otto committed
1472

XhmikosR's avatar
Dist    
XhmikosR committed
1473
1474
1475
1476
1477
  $(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
1478

XhmikosR's avatar
Dist    
XhmikosR committed
1479
1480
1481
1482
1483
1484
1485
    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
1486

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

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

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

Mark Otto's avatar
dist    
Mark Otto committed
1504
1505
  /**!
   * @fileOverview Kickass library to create and place poppers near their reference elements.
Mark Otto's avatar
Mark Otto committed
1506
   * @version 1.14.7
Mark Otto's avatar
dist    
Mark Otto committed
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
   * @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
1529

Mark Otto's avatar
dist    
Mark Otto committed
1530
1531
1532
1533
1534
1535
  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
1536
    }
Mark Otto's avatar
dist    
Mark Otto committed
1537
  }
Mark Otto's avatar
dist  
Mark Otto committed
1538

Mark Otto's avatar
dist    
Mark Otto committed
1539
1540
1541
1542
1543
1544
1545
1546
1547
  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
1548
        fn();
Mark Otto's avatar
dist    
Mark Otto committed
1549
1550
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
1551
1552
  }

Mark Otto's avatar
dist    
Mark Otto committed
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
  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
1564
1565
  }

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

Mark Otto's avatar
dist    
Mark Otto committed
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
  /**
  * 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
1578

Mark Otto's avatar
dist    
Mark Otto committed
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
  /**
   * 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
1589
1590
  }

Mark Otto's avatar
dist    
Mark Otto committed
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
  /**
   * 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
1601
    }
Mark Otto's avatar
dist    
Mark Otto committed
1602
    // NOTE: 1 DOM access here
XhmikosR's avatar
Dist    
XhmikosR committed
1603
1604
    var window = element.ownerDocument.defaultView;
    var css = window.getComputedStyle(element, null);
Mark Otto's avatar
dist    
Mark Otto committed
1605
    return property ? css[property] : css;
Mark Otto's avatar
dist  
Mark Otto committed
1606
1607
  }

Mark Otto's avatar
dist    
Mark Otto committed
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
  /**
   * 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
1620
1621
  }

Mark Otto's avatar
dist    
Mark Otto committed
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
  /**
   * 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
1634

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

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

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

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

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

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

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

Mark Otto's avatar
dist    
Mark Otto committed
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
  /**
   * 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
1687
1688
    }

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

Mark Otto's avatar
dist    
Mark Otto committed
1691
    // NOTE: 1 DOM access here
XhmikosR's avatar
Dist    
XhmikosR committed
1692
    var offsetParent = element.offsetParent || null;
Mark Otto's avatar
dist    
Mark Otto committed
1693
1694
1695
1696
    // 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
1697

Mark Otto's avatar
dist    
Mark Otto committed
1698
    var nodeName = offsetParent && offsetParent.nodeName;
Mark Otto's avatar
dist  
Mark Otto committed
1699

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

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

Mark Otto's avatar
dist    
Mark Otto committed
1710
    return offsetParent;
Mark Otto's avatar
dist  
Mark Otto committed
1711
1712
  }

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

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

Mark Otto's avatar
dist    
Mark Otto committed
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
  /**
   * 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
1733

Mark Otto's avatar
dist    
Mark Otto committed
1734
    return node;
Mark Otto's avatar
dist  
Mark Otto committed
1735
1736
  }

Mark Otto's avatar
dist    
Mark Otto committed
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
  /**
   * 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
1750

Mark Otto's avatar
dist    
Mark Otto committed
1751
1752
1753
1754
    // 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
1755

Mark Otto's avatar
dist    
Mark Otto committed
1756
1757
1758
1759
1760
    // 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
1761

Mark Otto's avatar
dist    
Mark Otto committed
1762
    // Both nodes are inside #document
Mark Otto's avatar
dist  
Mark Otto committed
1763

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

Mark Otto's avatar
dist    
Mark Otto committed
1769
1770
      return getOffsetParent(commonAncestorContainer);
    }
Mark Otto's avatar
dist  
Mark Otto committed
1771

Mark Otto's avatar
dist    
Mark Otto committed
1772
1773
1774
1775
    // 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
1776
    } else {
Mark Otto's avatar
dist    
Mark Otto committed
1777
      return findCommonOffsetParent(element1, getRoot(element2).host);
Mark Otto's avatar
dist  
Mark Otto committed
1778
    }
Mark Otto's avatar
dist    
Mark Otto committed
1779
  }
Mark Otto's avatar
dist  
Mark Otto committed
1780

Mark Otto's avatar
dist    
Mark Otto committed
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
  /**
   * 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
1791

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

Mark Otto's avatar
dist    
Mark Otto committed
1795
1796
1797
1798
    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
1799
1800
    }

Mark Otto's avatar
dist    
Mark Otto committed
1801
    return element[upperSide];
Mark Otto's avatar
dist  
Mark Otto committed
1802
1803
  }

Mark Otto's avatar
dist    
Mark Otto committed
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
  /*
   * 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
1825

Mark Otto's avatar
dist    
Mark Otto committed
1826
1827
1828
1829
1830
1831
1832
1833
1834
  /*
   * 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
1835

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

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

Mark Otto's avatar
dist    
Mark Otto committed
1843
  function getSize(axis, body, html, computedStyle) {
Mark Otto's avatar
dist    
Mark Otto committed
1844
    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
1845
1846
  }

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

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

Mark Otto's avatar
dist    
Mark Otto committed
1858
1859
1860
1861
  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
1862
1863
  };

Mark Otto's avatar
dist    
Mark Otto committed
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
  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
1874

Mark Otto's avatar
dist    
Mark Otto committed
1875
1876
1877
1878
1879
1880
    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
1881
1882
1883
1884
1885





Mark Otto's avatar
dist    
Mark Otto committed
1886
1887
1888
1889
1890
1891
1892
1893
  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
1894
    } else {
Mark Otto's avatar
dist    
Mark Otto committed
1895
      obj[key] = value;
Mark Otto's avatar
dist  
Mark Otto committed
1896
1897
    }

Mark Otto's avatar
dist    
Mark Otto committed
1898
1899
    return obj;
  };
Mark Otto's avatar
dist  
Mark Otto committed
1900

Mark Otto's avatar
dist    
Mark Otto committed
1901
1902
1903
  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
1904

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

Mark Otto's avatar
dist    
Mark Otto committed
1912
    return target;
Mark Otto's avatar
dist  
Mark Otto committed
1913
1914
  };

Mark Otto's avatar
dist    
Mark Otto committed
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
  /**
   * 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
1927
1928
  }

Mark Otto's avatar
dist    
Mark Otto committed
1929
1930
1931
1932
1933
1934
1935
1936
1937
  /**
   * 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
1938

Mark Otto's avatar
dist    
Mark Otto committed
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
    // 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
1962

Mark Otto's avatar
dist    
Mark Otto committed
1963
    // subtract scrollbar size from sizes
Mark Otto's avatar
dist    
Mark Otto committed
1964
    var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
Mark Otto's avatar
dist    
Mark Otto committed
1965
1966
    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
1967

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

Mark Otto's avatar
dist    
Mark Otto committed
1971
1972
1973
1974
1975
1976
1977
1978
1979
    // 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
1980
    }
Mark Otto's avatar
dist    
Mark Otto committed
1981
1982

    return getClientRect(result);
Mark Otto's avatar
dist  
Mark Otto committed
1983
1984
  }

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

Mark Otto's avatar
dist    
Mark Otto committed
1988
1989
1990
1991
1992
    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
1993

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

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