bootstrap.bundle.js 212 KB
Newer Older
XhmikosR's avatar
Dist    
XhmikosR committed
1001
1002
1003
1004
1005
1006

        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
1007
1008
        }

XhmikosR's avatar
Dist    
XhmikosR committed
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
        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();
      }
    }; // Static
Mark Otto's avatar
dist  
Mark Otto committed
1029
1030


XhmikosR's avatar
Dist    
XhmikosR committed
1031
1032
1033
    Carousel._jQueryInterface = function _jQueryInterface(config) {
      return this.each(function () {
        var data = $(this).data(DATA_KEY$2);
Mark Otto's avatar
dist  
Mark Otto committed
1034

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

XhmikosR's avatar
Dist    
XhmikosR committed
1037
1038
        if (typeof config === 'object') {
          _config = _objectSpread({}, _config, config);
Mark Otto's avatar
dist    
Mark Otto committed
1039
        }
Mark Otto's avatar
dist  
Mark Otto committed
1040

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

XhmikosR's avatar
Dist    
XhmikosR committed
1043
1044
1045
        if (!data) {
          data = new Carousel(this, _config);
          $(this).data(DATA_KEY$2, data);
Mark Otto's avatar
dist    
Mark Otto committed
1046
        }
Mark Otto's avatar
dist  
Mark Otto committed
1047

XhmikosR's avatar
Dist    
XhmikosR committed
1048
1049
1050
1051
1052
1053
        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
1054

XhmikosR's avatar
Dist    
XhmikosR committed
1055
1056
1057
1058
          data[action]();
        } else if (_config.interval) {
          data.pause();
          data.cycle();
Mark Otto's avatar
dist    
Mark Otto committed
1059
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1060
1061
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
1062

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

XhmikosR's avatar
Dist    
XhmikosR committed
1066
1067
1068
1069
1070
1071
1072
1073
1074
      if (!selector) {
        return;
      }

      var target = $(selector)[0];

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

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
1080
1081
      if (slideIndex) {
        config.interval = false;
Mark Otto's avatar
dist    
Mark Otto committed
1082
      }
Mark Otto's avatar
dist    
Mark Otto committed
1083

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

XhmikosR's avatar
Dist    
XhmikosR committed
1086
1087
1088
1089
1090
      if (slideIndex) {
        $(target).data(DATA_KEY$2).to(slideIndex);
      }

      event.preventDefault();
Mark Otto's avatar
dist    
Mark Otto committed
1091
    };
Mark Otto's avatar
dist  
Mark Otto committed
1092

XhmikosR's avatar
Dist    
XhmikosR committed
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
    _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
1105
    return Carousel;
XhmikosR's avatar
Dist    
XhmikosR committed
1106
1107
1108
1109
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
  }();
  /**
   * ------------------------------------------------------------------------
   * 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
1137

XhmikosR's avatar
Dist    
XhmikosR committed
1138
1139
1140
1141
1142
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist  
Mark Otto committed
1143

XhmikosR's avatar
Dist    
XhmikosR committed
1144
  var NAME$3 = 'collapse';
Mark Otto's avatar
Mark Otto committed
1145
  var VERSION$3 = '4.2.1';
XhmikosR's avatar
Dist    
XhmikosR committed
1146
1147
1148
1149
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
  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
1183

XhmikosR's avatar
Dist    
XhmikosR committed
1184
  };
Mark Otto's avatar
dist    
Mark Otto committed
1185

XhmikosR's avatar
Dist    
XhmikosR committed
1186
1187
1188
1189
1190
1191
1192
  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
1193
      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
1194
1195
1196
1197
1198
1199
1200
1201
      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
1202

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

XhmikosR's avatar
Dist    
XhmikosR committed
1206
          this._triggerArray.push(elem);
Mark Otto's avatar
dist    
Mark Otto committed
1207
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1208
      }
Mark Otto's avatar
dist  
Mark Otto committed
1209

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

XhmikosR's avatar
Dist    
XhmikosR committed
1212
1213
1214
      if (!this._config.parent) {
        this._addAriaAndCollapsedClass(this._element, this._triggerArray);
      }
Mark Otto's avatar
dist  
Mark Otto committed
1215

XhmikosR's avatar
Dist    
XhmikosR committed
1216
1217
1218
1219
      if (this._config.toggle) {
        this.toggle();
      }
    } // Getters
Mark Otto's avatar
dist  
Mark Otto committed
1220
1221


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

XhmikosR's avatar
Dist    
XhmikosR committed
1224
1225
1226
1227
1228
1229
1230
1231
    // 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
1232

XhmikosR's avatar
Dist    
XhmikosR committed
1233
1234
    _proto.show = function show() {
      var _this = this;
Mark Otto's avatar
dist  
Mark Otto committed
1235

XhmikosR's avatar
Dist    
XhmikosR committed
1236
1237
1238
      if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1239

XhmikosR's avatar
Dist    
XhmikosR committed
1240
1241
      var actives;
      var activesData;
Mark Otto's avatar
dist    
Mark Otto committed
1242

XhmikosR's avatar
Dist    
XhmikosR committed
1243
1244
1245
1246
      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
1247
          }
Mark Otto's avatar
dist  
Mark Otto committed
1248

XhmikosR's avatar
Dist    
XhmikosR committed
1249
1250
          return elem.classList.contains(ClassName$3.COLLAPSE);
        });
Mark Otto's avatar
dist    
Mark Otto committed
1251

XhmikosR's avatar
Dist    
XhmikosR committed
1252
1253
        if (actives.length === 0) {
          actives = null;
Mark Otto's avatar
dist  
Mark Otto committed
1254
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1255
      }
Mark Otto's avatar
dist  
Mark Otto committed
1256

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

XhmikosR's avatar
Dist    
XhmikosR committed
1260
        if (activesData && activesData._isTransitioning) {
Mark Otto's avatar
dist    
Mark Otto committed
1261
1262
          return;
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1263
      }
Mark Otto's avatar
dist  
Mark Otto committed
1264

XhmikosR's avatar
Dist    
XhmikosR committed
1265
1266
      var startEvent = $.Event(Event$3.SHOW);
      $(this._element).trigger(startEvent);
Mark Otto's avatar
dist  
Mark Otto committed
1267

XhmikosR's avatar
Dist    
XhmikosR committed
1268
1269
1270
      if (startEvent.isDefaultPrevented()) {
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
1271

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

XhmikosR's avatar
Dist    
XhmikosR committed
1275
1276
        if (!activesData) {
          $(actives).data(DATA_KEY$3, null);
Mark Otto's avatar
dist    
Mark Otto committed
1277
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1278
      }
Mark Otto's avatar
dist  
Mark Otto committed
1279

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
1285
1286
1287
      if (this._triggerArray.length) {
        $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
      }
Mark Otto's avatar
dist  
Mark Otto committed
1288

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

XhmikosR's avatar
Dist    
XhmikosR committed
1291
1292
1293
1294
1295
1296
1297
      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
1298
      };
Mark Otto's avatar
dist  
Mark Otto committed
1299

XhmikosR's avatar
Dist    
XhmikosR committed
1300
1301
1302
1303
1304
1305
      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
1306

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

XhmikosR's avatar
Dist    
XhmikosR committed
1314
1315
      var startEvent = $.Event(Event$3.HIDE);
      $(this._element).trigger(startEvent);
Mark Otto's avatar
dist    
Mark Otto committed
1316

XhmikosR's avatar
Dist    
XhmikosR committed
1317
1318
1319
      if (startEvent.isDefaultPrevented()) {
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
1320

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

XhmikosR's avatar
Dist    
XhmikosR committed
1323
1324
1325
1326
      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
1327

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

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

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
1345
1346
      var complete = function complete() {
        _this2.setTransitioning(false);
Mark Otto's avatar
dist  
Mark Otto committed
1347

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

XhmikosR's avatar
Dist    
XhmikosR committed
1351
1352
1353
1354
      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
1355

XhmikosR's avatar
Dist    
XhmikosR committed
1356
1357
1358
    _proto.setTransitioning = function setTransitioning(isTransitioning) {
      this._isTransitioning = isTransitioning;
    };
Mark Otto's avatar
dist  
Mark Otto committed
1359

XhmikosR's avatar
Dist    
XhmikosR committed
1360
1361
1362
1363
1364
1365
1366
1367
    _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;
    }; // Private
Mark Otto's avatar
dist  
Mark Otto committed
1368

Mark Otto's avatar
dist    
Mark Otto committed
1369

XhmikosR's avatar
Dist    
XhmikosR committed
1370
1371
1372
    _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
1373

XhmikosR's avatar
Dist    
XhmikosR committed
1374
1375
1376
      Util.typeCheckConfig(NAME$3, config, DefaultType$1);
      return config;
    };
Mark Otto's avatar
dist  
Mark Otto committed
1377

XhmikosR's avatar
Dist    
XhmikosR committed
1378
1379
1380
1381
    _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
1382

XhmikosR's avatar
Dist    
XhmikosR committed
1383
1384
    _proto._getParent = function _getParent() {
      var _this3 = this;
Mark Otto's avatar
dist  
Mark Otto committed
1385

XhmikosR's avatar
Dist    
XhmikosR committed
1386
      var parent;
Mark Otto's avatar
dist    
Mark Otto committed
1387

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

XhmikosR's avatar
Dist    
XhmikosR committed
1391
1392
1393
1394
1395
1396
        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
1397

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

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

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


XhmikosR's avatar
Dist    
XhmikosR committed
1415
1416
1417
1418
    Collapse._getTargetFromElement = function _getTargetFromElement(element) {
      var selector = Util.getSelectorFromElement(element);
      return selector ? document.querySelector(selector) : null;
    };
Mark Otto's avatar
dist    
Mark Otto committed
1419

XhmikosR's avatar
Dist    
XhmikosR committed
1420
1421
1422
1423
    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
1424

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

XhmikosR's avatar
Dist    
XhmikosR committed
1427
1428
1429
        if (!data && _config.toggle && /show|hide/.test(config)) {
          _config.toggle = false;
        }
Mark Otto's avatar
dist    
Mark Otto committed
1430

XhmikosR's avatar
Dist    
XhmikosR committed
1431
1432
1433
1434
        if (!data) {
          data = new Collapse(this, _config);
          $this.data(DATA_KEY$3, data);
        }
Mark Otto's avatar
dist  
Mark Otto committed
1435

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

XhmikosR's avatar
Dist    
XhmikosR committed
1441
          data[config]();
Mark Otto's avatar
dist    
Mark Otto committed
1442
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1443
1444
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
1445

XhmikosR's avatar
Dist    
XhmikosR committed
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
    _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
1457

XhmikosR's avatar
Dist    
XhmikosR committed
1458
1459
1460
1461
1462
1463
1464
    return Collapse;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
1465

Mark Otto's avatar
dist  
Mark Otto committed
1466

XhmikosR's avatar
Dist    
XhmikosR committed
1467
1468
1469
1470
1471
  $(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
1472

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

XhmikosR's avatar
Dist    
XhmikosR committed
1481
1482
1483
1484
1485
1486
1487
1488
      Collapse._jQueryInterface.call($target, config);
    });
  });
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
1489

XhmikosR's avatar
Dist    
XhmikosR committed
1490
1491
  $.fn[NAME$3] = Collapse._jQueryInterface;
  $.fn[NAME$3].Constructor = Collapse;
Mark Otto's avatar
dist  
Mark Otto committed
1492

XhmikosR's avatar
Dist    
XhmikosR committed
1493
1494
1495
1496
  $.fn[NAME$3].noConflict = function () {
    $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
    return Collapse._jQueryInterface;
  };
Mark Otto's avatar
dist  
Mark Otto committed
1497

Mark Otto's avatar
dist    
Mark Otto committed
1498
1499
  /**!
   * @fileOverview Kickass library to create and place poppers near their reference elements.
Mark Otto's avatar
dist    
Mark Otto committed
1500
   * @version 1.14.6
Mark Otto's avatar
dist    
Mark Otto committed
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
   * @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
1523

Mark Otto's avatar
dist    
Mark Otto committed
1524
1525
1526
1527
1528
1529
  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
1530
    }
Mark Otto's avatar
dist    
Mark Otto committed
1531
  }
Mark Otto's avatar
dist  
Mark Otto committed
1532

Mark Otto's avatar
dist    
Mark Otto committed
1533
1534
1535
1536
1537
1538
1539
1540
1541
  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
1542
        fn();
Mark Otto's avatar
dist    
Mark Otto committed
1543
1544
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
1545
1546
  }

Mark Otto's avatar
dist    
Mark Otto committed
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
  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
1558
1559
  }

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

Mark Otto's avatar
dist    
Mark Otto committed
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
  /**
  * 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
1572

Mark Otto's avatar
dist    
Mark Otto committed
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
  /**
   * 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
1583
1584
  }

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

Mark Otto's avatar
dist    
Mark Otto committed
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
  /**
   * 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
1614
1615
  }

Mark Otto's avatar
dist    
Mark Otto committed
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
  /**
   * 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
1628

Mark Otto's avatar
dist    
Mark Otto committed
1629
1630
1631
1632
1633
1634
1635
    switch (element.nodeName) {
      case 'HTML':
      case 'BODY':
        return element.ownerDocument.body;
      case '#document':
        return element.body;
    }
Mark Otto's avatar
dist  
Mark Otto committed
1636

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

Mark Otto's avatar
dist    
Mark Otto committed
1639
1640
1641
1642
    var _getStyleComputedProp = getStyleComputedProperty(element),
        overflow = _getStyleComputedProp.overflow,
        overflowX = _getStyleComputedProp.overflowX,
        overflowY = _getStyleComputedProp.overflowY;
Mark Otto's avatar
dist  
Mark Otto committed
1643

Mark Otto's avatar
dist    
Mark Otto committed
1644
1645
    if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
      return element;
Mark Otto's avatar
dist  
Mark Otto committed
1646
1647
    }

Mark Otto's avatar
dist    
Mark Otto committed
1648
    return getScrollParent(getParentNode(element));
Mark Otto's avatar
dist  
Mark Otto committed
1649
1650
  }

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

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

Mark Otto's avatar
dist    
Mark Otto committed
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
  /**
   * 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
1681
1682
    }

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

Mark Otto's avatar
dist    
Mark Otto committed
1685
    // NOTE: 1 DOM access here
XhmikosR's avatar
Dist    
XhmikosR committed
1686
    var offsetParent = element.offsetParent || null;
Mark Otto's avatar
dist    
Mark Otto committed
1687
1688
1689
1690
    // 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
1691

Mark Otto's avatar
dist    
Mark Otto committed
1692
    var nodeName = offsetParent && offsetParent.nodeName;
Mark Otto's avatar
dist  
Mark Otto committed
1693

Mark Otto's avatar
dist    
Mark Otto committed
1694
1695
1696
    if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
      return element ? element.ownerDocument.documentElement : document.documentElement;
    }
Mark Otto's avatar
dist  
Mark Otto committed
1697

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

Mark Otto's avatar
dist    
Mark Otto committed
1704
    return offsetParent;
Mark Otto's avatar
dist  
Mark Otto committed
1705
1706
  }

Mark Otto's avatar
dist    
Mark Otto committed
1707
1708
  function isOffsetContainer(element) {
    var nodeName = element.nodeName;
Mark Otto's avatar
dist  
Mark Otto committed
1709

Mark Otto's avatar
dist    
Mark Otto committed
1710
1711
    if (nodeName === 'BODY') {
      return false;
Mark Otto's avatar
dist  
Mark Otto committed
1712
    }
Mark Otto's avatar
dist    
Mark Otto committed
1713
    return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
Mark Otto's avatar
dist  
Mark Otto committed
1714
1715
  }

Mark Otto's avatar
dist    
Mark Otto committed
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
  /**
   * 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
1727

Mark Otto's avatar
dist    
Mark Otto committed
1728
    return node;
Mark Otto's avatar
dist  
Mark Otto committed
1729
1730
  }

Mark Otto's avatar
dist    
Mark Otto committed
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
  /**
   * 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
1744

Mark Otto's avatar
dist    
Mark Otto committed
1745
1746
1747
1748
    // 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
1749

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

Mark Otto's avatar
dist    
Mark Otto committed
1756
    // Both nodes are inside #document
Mark Otto's avatar
dist  
Mark Otto committed
1757

Mark Otto's avatar
dist    
Mark Otto committed
1758
1759
1760
1761
    if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
      if (isOffsetContainer(commonAncestorContainer)) {
        return commonAncestorContainer;
      }
Mark Otto's avatar
dist  
Mark Otto committed
1762

Mark Otto's avatar
dist    
Mark Otto committed
1763
1764
      return getOffsetParent(commonAncestorContainer);
    }
Mark Otto's avatar
dist  
Mark Otto committed
1765

Mark Otto's avatar
dist    
Mark Otto committed
1766
1767
1768
1769
    // 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
1770
    } else {
Mark Otto's avatar
dist    
Mark Otto committed
1771
      return findCommonOffsetParent(element1, getRoot(element2).host);
Mark Otto's avatar
dist  
Mark Otto committed
1772
    }
Mark Otto's avatar
dist    
Mark Otto committed
1773
  }
Mark Otto's avatar
dist  
Mark Otto committed
1774

Mark Otto's avatar
dist    
Mark Otto committed
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
  /**
   * 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
1785

Mark Otto's avatar
dist    
Mark Otto committed
1786
1787
    var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
    var nodeName = element.nodeName;
Mark Otto's avatar
dist  
Mark Otto committed
1788

Mark Otto's avatar
dist    
Mark Otto committed
1789
1790
1791
1792
    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
1793
1794
    }

Mark Otto's avatar
dist    
Mark Otto committed
1795
    return element[upperSide];
Mark Otto's avatar
dist  
Mark Otto committed
1796
1797
  }

Mark Otto's avatar
dist    
Mark Otto committed
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
  /*
   * 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
1819

Mark Otto's avatar
dist    
Mark Otto committed
1820
1821
1822
1823
1824
1825
1826
1827
1828
  /*
   * 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
1829

Mark Otto's avatar
dist    
Mark Otto committed
1830
1831
1832
  function getBordersSize(styles, axis) {
    var sideA = axis === 'x' ? 'Left' : 'Top';
    var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
Mark Otto's avatar
dist  
Mark Otto committed
1833

Mark Otto's avatar
dist    
Mark Otto committed
1834
    return parseFloat(styles['border' + sideA + 'Width'], 10) + parseFloat(styles['border' + sideB + 'Width'], 10);
Mark Otto's avatar
dist  
Mark Otto committed
1835
1836
  }

Mark Otto's avatar
dist    
Mark Otto committed
1837
  function getSize(axis, body, html, computedStyle) {
Mark Otto's avatar
dist    
Mark Otto committed
1838
    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
1839
1840
  }

Mark Otto's avatar
dist    
Mark Otto committed
1841
  function getWindowSizes(document) {
Mark Otto's avatar
dist    
Mark Otto committed
1842
1843
1844
    var body = document.body;
    var html = document.documentElement;
    var computedStyle = isIE(10) && getComputedStyle(html);
Mark Otto's avatar
dist  
Mark Otto committed
1845

Mark Otto's avatar
dist    
Mark Otto committed
1846
1847
1848
1849
    return {
      height: getSize('Height', body, html, computedStyle),
      width: getSize('Width', body, html, computedStyle)
    };
Mark Otto's avatar
dist  
Mark Otto committed
1850
1851
  }

Mark Otto's avatar
dist    
Mark Otto committed
1852
1853
1854
1855
  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
1856
1857
  };

Mark Otto's avatar
dist    
Mark Otto committed
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
  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
1868

Mark Otto's avatar
dist    
Mark Otto committed
1869
1870
1871
1872
1873
1874
    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
1875
1876
1877
1878
1879





Mark Otto's avatar
dist    
Mark Otto committed
1880
1881
1882
1883
1884
1885
1886
1887
  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
1888
    } else {
Mark Otto's avatar
dist    
Mark Otto committed
1889
      obj[key] = value;
Mark Otto's avatar
dist  
Mark Otto committed
1890
1891
    }

Mark Otto's avatar
dist    
Mark Otto committed
1892
1893
    return obj;
  };
Mark Otto's avatar
dist  
Mark Otto committed
1894

Mark Otto's avatar
dist    
Mark Otto committed
1895
1896
1897
  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
1898

Mark Otto's avatar
dist    
Mark Otto committed
1899
1900
1901
1902
1903
1904
      for (var key in source) {
        if (Object.prototype.hasOwnProperty.call(source, key)) {
          target[key] = source[key];
        }
      }
    }
Mark Otto's avatar
dist  
Mark Otto committed
1905

Mark Otto's avatar
dist    
Mark Otto committed
1906
    return target;
Mark Otto's avatar
dist  
Mark Otto committed
1907
1908
  };

Mark Otto's avatar
dist    
Mark Otto committed
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
  /**
   * 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
1921
1922
  }

Mark Otto's avatar
dist    
Mark Otto committed
1923
1924
1925
1926
1927
1928
1929
1930
1931
  /**
   * 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
1932

Mark Otto's avatar
dist    
Mark Otto committed
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
    // 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
1956

Mark Otto's avatar
dist    
Mark Otto committed
1957
    // subtract scrollbar size from sizes
Mark Otto's avatar
dist    
Mark Otto committed
1958
    var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
Mark Otto's avatar
dist    
Mark Otto committed
1959
1960
    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
1961

Mark Otto's avatar
dist    
Mark Otto committed
1962
1963
    var horizScrollbar = element.offsetWidth - width;
    var vertScrollbar = element.offsetHeight - height;
Mark Otto's avatar
dist  
Mark Otto committed
1964

Mark Otto's avatar
dist    
Mark Otto committed
1965
1966
1967
1968
1969
1970
1971
1972
1973
    // 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
1974
    }
Mark Otto's avatar
dist    
Mark Otto committed
1975
1976

    return getClientRect(result);
Mark Otto's avatar
dist  
Mark Otto committed
1977
1978
  }

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

Mark Otto's avatar
dist    
Mark Otto committed
1982
1983
1984
1985
1986
    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
1987

Mark Otto's avatar
dist    
Mark Otto committed
1988
1989
1990
    var styles = getStyleComputedProperty(parent);
    var borderTopWidth = parseFloat(styles.borderTopWidth, 10);
    var borderLeftWidth = parseFloat(styles.borderLeftWidth, 10);
Mark Otto's avatar
dist  
Mark Otto committed
1991

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