bootstrap.esm.js 145 KB
Newer Older
XhmikosR's avatar
Dist.  
XhmikosR committed
1001

XhmikosR's avatar
XhmikosR committed
1002
          input.checked = !this._element.classList.contains(CLASS_NAME_ACTIVE);
XhmikosR's avatar
Dist.  
XhmikosR committed
1003
1004
1005
1006
1007
1008
1009
1010
1011
          EventHandler.trigger(input, 'change');
        }

        input.focus();
        addAriaPressed = false;
      }
    }

    if (addAriaPressed) {
XhmikosR's avatar
XhmikosR committed
1012
      this._element.setAttribute('aria-pressed', !this._element.classList.contains(CLASS_NAME_ACTIVE));
XhmikosR's avatar
Dist.  
XhmikosR committed
1013
1014
1015
    }

    if (triggerChangeEvent) {
XhmikosR's avatar
XhmikosR committed
1016
      this._element.classList.toggle(CLASS_NAME_ACTIVE);
XhmikosR's avatar
Dist.  
XhmikosR committed
1017
    }
XhmikosR's avatar
XhmikosR committed
1018
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1019

XhmikosR's avatar
XhmikosR committed
1020
  _proto.dispose = function dispose() {
XhmikosR's avatar
Dist.  
XhmikosR committed
1021
1022
1023
    Data.removeData(this._element, DATA_KEY$1);
    this._element = null;
  } // Static
XhmikosR's avatar
XhmikosR committed
1024
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
1025

XhmikosR's avatar
XhmikosR committed
1026
  Button.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1027
    return this.each(function () {
XhmikosR's avatar
XhmikosR committed
1028
      var data = Data.getData(this, DATA_KEY$1);
XhmikosR's avatar
Dist.  
XhmikosR committed
1029
1030
1031
1032
1033
1034
1035
1036
1037

      if (!data) {
        data = new Button(this);
      }

      if (config === 'toggle') {
        data[config]();
      }
    });
XhmikosR's avatar
XhmikosR committed
1038
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1039

XhmikosR's avatar
XhmikosR committed
1040
  Button.getInstance = function getInstance(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1041
    return Data.getData(element, DATA_KEY$1);
XhmikosR's avatar
XhmikosR committed
1042
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1043

XhmikosR's avatar
XhmikosR committed
1044
1045
1046
1047
1048
1049
1050
1051
1052
  _createClass(Button, null, [{
    key: "VERSION",
    get: function get() {
      return VERSION$1;
    }
  }]);

  return Button;
}();
XhmikosR's avatar
Dist.  
XhmikosR committed
1053
1054
1055
1056
1057
1058
1059
/**
 * ------------------------------------------------------------------------
 * Data Api implementation
 * ------------------------------------------------------------------------
 */


XhmikosR's avatar
XhmikosR committed
1060
EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE_CARROT, function (event) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1061
  event.preventDefault();
XhmikosR's avatar
XhmikosR committed
1062
  var button = event.target;
XhmikosR's avatar
Dist.  
XhmikosR committed
1063

XhmikosR's avatar
XhmikosR committed
1064
1065
  if (!button.classList.contains(CLASS_NAME_BUTTON)) {
    button = SelectorEngine.closest(button, SELECTOR_BUTTON);
XhmikosR's avatar
Dist.  
XhmikosR committed
1066
1067
  }

XhmikosR's avatar
XhmikosR committed
1068
  var data = Data.getData(button, DATA_KEY$1);
XhmikosR's avatar
Dist.  
XhmikosR committed
1069
1070
1071
1072
1073
1074
1075

  if (!data) {
    data = new Button(button);
  }

  data.toggle();
});
XhmikosR's avatar
XhmikosR committed
1076
1077
EventHandler.on(document, EVENT_FOCUS_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, function (event) {
  var button = SelectorEngine.closest(event.target, SELECTOR_BUTTON);
XhmikosR's avatar
XhmikosR committed
1078
1079

  if (button) {
XhmikosR's avatar
XhmikosR committed
1080
    button.classList.add(CLASS_NAME_FOCUS);
XhmikosR's avatar
XhmikosR committed
1081
  }
XhmikosR's avatar
Dist.  
XhmikosR committed
1082
});
XhmikosR's avatar
XhmikosR committed
1083
1084
EventHandler.on(document, EVENT_BLUR_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, function (event) {
  var button = SelectorEngine.closest(event.target, SELECTOR_BUTTON);
XhmikosR's avatar
XhmikosR committed
1085
1086

  if (button) {
XhmikosR's avatar
XhmikosR committed
1087
    button.classList.remove(CLASS_NAME_FOCUS);
XhmikosR's avatar
XhmikosR committed
1088
  }
XhmikosR's avatar
Dist.  
XhmikosR committed
1089
});
XhmikosR's avatar
XhmikosR committed
1090
var $$2 = getjQuery();
XhmikosR's avatar
Dist.  
XhmikosR committed
1091
1092
1093
1094
1095
1096
1097
/**
 * ------------------------------------------------------------------------
 * jQuery
 * ------------------------------------------------------------------------
 * add .button to jQuery only if jQuery is present
 */

1098
1099
/* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
1100
1101
1102
1103
if ($$2) {
  var JQUERY_NO_CONFLICT$1 = $$2.fn[NAME$1];
  $$2.fn[NAME$1] = Button.jQueryInterface;
  $$2.fn[NAME$1].Constructor = Button;
XhmikosR's avatar
Dist.  
XhmikosR committed
1104

XhmikosR's avatar
XhmikosR committed
1105
1106
1107
  $$2.fn[NAME$1].noConflict = function () {
    $$2.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
    return Button.jQueryInterface;
XhmikosR's avatar
Dist.  
XhmikosR committed
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
1137
  };
}

/**
 * --------------------------------------------------------------------------
 * Bootstrap (v4.3.1): dom/manipulator.js
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * --------------------------------------------------------------------------
 */
function normalizeData(val) {
  if (val === 'true') {
    return true;
  }

  if (val === 'false') {
    return false;
  }

  if (val === Number(val).toString()) {
    return Number(val);
  }

  if (val === '' || val === 'null') {
    return null;
  }

  return val;
}

function normalizeDataKey(key) {
XhmikosR's avatar
XhmikosR committed
1138
  return key.replace(/[A-Z]/g, function (chr) {
XhmikosR's avatar
XhmikosR committed
1139
    return "-" + chr.toLowerCase();
XhmikosR's avatar
XhmikosR committed
1140
  });
XhmikosR's avatar
Dist.  
XhmikosR committed
1141
1142
}

XhmikosR's avatar
XhmikosR committed
1143
1144
1145
var Manipulator = {
  setDataAttribute: function setDataAttribute(element, key, value) {
    element.setAttribute("data-" + normalizeDataKey(key), value);
XhmikosR's avatar
Dist.  
XhmikosR committed
1146
  },
XhmikosR's avatar
XhmikosR committed
1147
1148
  removeDataAttribute: function removeDataAttribute(element, key) {
    element.removeAttribute("data-" + normalizeDataKey(key));
XhmikosR's avatar
Dist.  
XhmikosR committed
1149
  },
XhmikosR's avatar
XhmikosR committed
1150
  getDataAttributes: function getDataAttributes(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1151
1152
1153
1154
    if (!element) {
      return {};
    }

1155
    var attributes = _objectSpread2({}, element.dataset);
XhmikosR's avatar
Dist.  
XhmikosR committed
1156

XhmikosR's avatar
XhmikosR committed
1157
    Object.keys(attributes).forEach(function (key) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1158
1159
1160
1161
      attributes[key] = normalizeData(attributes[key]);
    });
    return attributes;
  },
XhmikosR's avatar
XhmikosR committed
1162
1163
  getDataAttribute: function getDataAttribute(element, key) {
    return normalizeData(element.getAttribute("data-" + normalizeDataKey(key)));
XhmikosR's avatar
Dist.  
XhmikosR committed
1164
  },
XhmikosR's avatar
XhmikosR committed
1165
1166
  offset: function offset(element) {
    var rect = element.getBoundingClientRect();
XhmikosR's avatar
Dist.  
XhmikosR committed
1167
1168
1169
1170
1171
    return {
      top: rect.top + document.body.scrollTop,
      left: rect.left + document.body.scrollLeft
    };
  },
XhmikosR's avatar
XhmikosR committed
1172
  position: function position(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1173
1174
1175
1176
1177
    return {
      top: element.offsetTop,
      left: element.offsetLeft
    };
  },
XhmikosR's avatar
XhmikosR committed
1178
  toggleClass: function toggleClass(element, className) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
    if (!element) {
      return;
    }

    if (element.classList.contains(className)) {
      element.classList.remove(className);
    } else {
      element.classList.add(className);
    }
  }
};

/**
 * ------------------------------------------------------------------------
 * Constants
 * ------------------------------------------------------------------------
 */

XhmikosR's avatar
XhmikosR committed
1197
1198
1199
1200
1201
1202
var NAME$2 = 'carousel';
var VERSION$2 = '4.3.1';
var DATA_KEY$2 = 'bs.carousel';
var EVENT_KEY$2 = "." + DATA_KEY$2;
var DATA_API_KEY$2 = '.data-api';
var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
XhmikosR's avatar
Dist.  
XhmikosR committed
1203

XhmikosR's avatar
XhmikosR committed
1204
var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
XhmikosR's avatar
Dist.  
XhmikosR committed
1205

XhmikosR's avatar
XhmikosR committed
1206
var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
XhmikosR's avatar
Dist.  
XhmikosR committed
1207

XhmikosR's avatar
XhmikosR committed
1208
1209
var SWIPE_THRESHOLD = 40;
var Default = {
XhmikosR's avatar
Dist.  
XhmikosR committed
1210
1211
1212
1213
1214
1215
1216
  interval: 5000,
  keyboard: true,
  slide: false,
  pause: 'hover',
  wrap: true,
  touch: true
};
XhmikosR's avatar
XhmikosR committed
1217
var DefaultType = {
XhmikosR's avatar
Dist.  
XhmikosR committed
1218
1219
1220
1221
1222
1223
1224
  interval: '(number|boolean)',
  keyboard: 'boolean',
  slide: '(boolean|string)',
  pause: '(string|boolean)',
  wrap: 'boolean',
  touch: 'boolean'
};
XhmikosR's avatar
XhmikosR committed
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
var DIRECTION_NEXT = 'next';
var DIRECTION_PREV = 'prev';
var DIRECTION_LEFT = 'left';
var DIRECTION_RIGHT = 'right';
var EVENT_SLIDE = "slide" + EVENT_KEY$2;
var EVENT_SLID = "slid" + EVENT_KEY$2;
var EVENT_KEYDOWN = "keydown" + EVENT_KEY$2;
var EVENT_MOUSEENTER = "mouseenter" + EVENT_KEY$2;
var EVENT_MOUSELEAVE = "mouseleave" + EVENT_KEY$2;
var EVENT_TOUCHSTART = "touchstart" + EVENT_KEY$2;
var EVENT_TOUCHMOVE = "touchmove" + EVENT_KEY$2;
var EVENT_TOUCHEND = "touchend" + EVENT_KEY$2;
var EVENT_POINTERDOWN = "pointerdown" + EVENT_KEY$2;
var EVENT_POINTERUP = "pointerup" + EVENT_KEY$2;
var EVENT_DRAG_START = "dragstart" + EVENT_KEY$2;
var EVENT_LOAD_DATA_API = "load" + EVENT_KEY$2 + DATA_API_KEY$2;
var EVENT_CLICK_DATA_API$2 = "click" + EVENT_KEY$2 + DATA_API_KEY$2;
var CLASS_NAME_CAROUSEL = 'carousel';
var CLASS_NAME_ACTIVE$1 = 'active';
var CLASS_NAME_SLIDE = 'slide';
var CLASS_NAME_RIGHT = 'carousel-item-right';
var CLASS_NAME_LEFT = 'carousel-item-left';
var CLASS_NAME_NEXT = 'carousel-item-next';
var CLASS_NAME_PREV = 'carousel-item-prev';
var CLASS_NAME_POINTER_EVENT = 'pointer-event';
var SELECTOR_ACTIVE$1 = '.active';
var SELECTOR_ACTIVE_ITEM = '.active.carousel-item';
var SELECTOR_ITEM = '.carousel-item';
var SELECTOR_ITEM_IMG = '.carousel-item img';
var SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev';
var SELECTOR_INDICATORS = '.carousel-indicators';
var SELECTOR_DATA_SLIDE = '[data-slide], [data-slide-to]';
var SELECTOR_DATA_RIDE = '[data-ride="carousel"]';
XhmikosR's avatar
XhmikosR committed
1258
var PointerType = {
XhmikosR's avatar
Dist.  
XhmikosR committed
1259
1260
1261
  TOUCH: 'touch',
  PEN: 'pen'
};
XhmikosR's avatar
XhmikosR committed
1262
1263
1264
1265
1266
/**
 * ------------------------------------------------------------------------
 * Class Definition
 * ------------------------------------------------------------------------
 */
XhmikosR's avatar
Dist.  
XhmikosR committed
1267

XhmikosR's avatar
XhmikosR committed
1268
var Carousel = /*#__PURE__*/function () {
XhmikosR's avatar
XhmikosR committed
1269
  function Carousel(element, config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
    this._items = null;
    this._interval = null;
    this._activeElement = null;
    this._isPaused = false;
    this._isSliding = false;
    this.touchTimeout = null;
    this.touchStartX = 0;
    this.touchDeltaX = 0;
    this._config = this._getConfig(config);
    this._element = element;
XhmikosR's avatar
XhmikosR committed
1280
    this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element);
XhmikosR's avatar
Dist.  
XhmikosR committed
1281
1282
1283
1284
1285
1286
1287
1288
1289
    this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
    this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);

    this._addEventListeners();

    Data.setData(element, DATA_KEY$2, this);
  } // Getters


XhmikosR's avatar
XhmikosR committed
1290
  var _proto = Carousel.prototype;
XhmikosR's avatar
Dist.  
XhmikosR committed
1291

XhmikosR's avatar
XhmikosR committed
1292
1293
  // Public
  _proto.next = function next() {
XhmikosR's avatar
Dist.  
XhmikosR committed
1294
    if (!this._isSliding) {
XhmikosR's avatar
XhmikosR committed
1295
      this._slide(DIRECTION_NEXT);
XhmikosR's avatar
Dist.  
XhmikosR committed
1296
    }
XhmikosR's avatar
XhmikosR committed
1297
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1298

XhmikosR's avatar
XhmikosR committed
1299
  _proto.nextWhenVisible = function nextWhenVisible() {
XhmikosR's avatar
Dist.  
XhmikosR committed
1300
1301
1302
1303
1304
    // Don't call next when the page isn't visible
    // or the carousel or its parent isn't visible
    if (!document.hidden && isVisible(this._element)) {
      this.next();
    }
XhmikosR's avatar
XhmikosR committed
1305
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1306

XhmikosR's avatar
XhmikosR committed
1307
  _proto.prev = function prev() {
XhmikosR's avatar
Dist.  
XhmikosR committed
1308
    if (!this._isSliding) {
XhmikosR's avatar
XhmikosR committed
1309
      this._slide(DIRECTION_PREV);
XhmikosR's avatar
Dist.  
XhmikosR committed
1310
    }
XhmikosR's avatar
XhmikosR committed
1311
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1312

XhmikosR's avatar
XhmikosR committed
1313
  _proto.pause = function pause(event) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1314
1315
1316
1317
    if (!event) {
      this._isPaused = true;
    }

XhmikosR's avatar
XhmikosR committed
1318
    if (SelectorEngine.findOne(SELECTOR_NEXT_PREV, this._element)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1319
1320
1321
1322
1323
1324
      triggerTransitionEnd(this._element);
      this.cycle(true);
    }

    clearInterval(this._interval);
    this._interval = null;
XhmikosR's avatar
XhmikosR committed
1325
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1326

XhmikosR's avatar
XhmikosR committed
1327
  _proto.cycle = function cycle(event) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
    if (!event) {
      this._isPaused = false;
    }

    if (this._interval) {
      clearInterval(this._interval);
      this._interval = null;
    }

    if (this._config && this._config.interval && !this._isPaused) {
      this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
    }
XhmikosR's avatar
XhmikosR committed
1340
1341
1342
1343
  };

  _proto.to = function to(index) {
    var _this = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
1344

XhmikosR's avatar
XhmikosR committed
1345
    this._activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
XhmikosR's avatar
Dist.  
XhmikosR committed
1346

XhmikosR's avatar
XhmikosR committed
1347
    var activeIndex = this._getItemIndex(this._activeElement);
XhmikosR's avatar
Dist.  
XhmikosR committed
1348
1349
1350
1351
1352
1353

    if (index > this._items.length - 1 || index < 0) {
      return;
    }

    if (this._isSliding) {
XhmikosR's avatar
XhmikosR committed
1354
      EventHandler.one(this._element, EVENT_SLID, function () {
XhmikosR's avatar
XhmikosR committed
1355
1356
        return _this.to(index);
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
1357
1358
1359
1360
1361
1362
1363
1364
1365
      return;
    }

    if (activeIndex === index) {
      this.pause();
      this.cycle();
      return;
    }

XhmikosR's avatar
XhmikosR committed
1366
    var direction = index > activeIndex ? DIRECTION_NEXT : DIRECTION_PREV;
XhmikosR's avatar
Dist.  
XhmikosR committed
1367
1368

    this._slide(direction, this._items[index]);
XhmikosR's avatar
XhmikosR committed
1369
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1370

XhmikosR's avatar
XhmikosR committed
1371
  _proto.dispose = function dispose() {
XhmikosR's avatar
Dist.  
XhmikosR committed
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
    EventHandler.off(this._element, EVENT_KEY$2);
    Data.removeData(this._element, DATA_KEY$2);
    this._items = null;
    this._config = null;
    this._element = null;
    this._interval = null;
    this._isPaused = null;
    this._isSliding = null;
    this._activeElement = null;
    this._indicatorsElement = null;
  } // Private
XhmikosR's avatar
XhmikosR committed
1383
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
1384

XhmikosR's avatar
XhmikosR committed
1385
  _proto._getConfig = function _getConfig(config) {
1386
    config = _objectSpread2({}, Default, {}, config);
XhmikosR's avatar
Dist.  
XhmikosR committed
1387
1388
    typeCheckConfig(NAME$2, config, DefaultType);
    return config;
XhmikosR's avatar
XhmikosR committed
1389
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1390

XhmikosR's avatar
XhmikosR committed
1391
1392
  _proto._handleSwipe = function _handleSwipe() {
    var absDeltax = Math.abs(this.touchDeltaX);
XhmikosR's avatar
Dist.  
XhmikosR committed
1393
1394
1395
1396
1397

    if (absDeltax <= SWIPE_THRESHOLD) {
      return;
    }

XhmikosR's avatar
XhmikosR committed
1398
1399
    var direction = absDeltax / this.touchDeltaX;
    this.touchDeltaX = 0; // swipe left
XhmikosR's avatar
Dist.  
XhmikosR committed
1400
1401
1402
1403
1404
1405
1406
1407
1408

    if (direction > 0) {
      this.prev();
    } // swipe right


    if (direction < 0) {
      this.next();
    }
XhmikosR's avatar
XhmikosR committed
1409
1410
1411
1412
  };

  _proto._addEventListeners = function _addEventListeners() {
    var _this2 = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
1413
1414

    if (this._config.keyboard) {
XhmikosR's avatar
XhmikosR committed
1415
      EventHandler.on(this._element, EVENT_KEYDOWN, function (event) {
XhmikosR's avatar
XhmikosR committed
1416
1417
        return _this2._keydown(event);
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
1418
1419
1420
    }

    if (this._config.pause === 'hover') {
XhmikosR's avatar
XhmikosR committed
1421
      EventHandler.on(this._element, EVENT_MOUSEENTER, function (event) {
XhmikosR's avatar
XhmikosR committed
1422
1423
        return _this2.pause(event);
      });
XhmikosR's avatar
XhmikosR committed
1424
      EventHandler.on(this._element, EVENT_MOUSELEAVE, function (event) {
XhmikosR's avatar
XhmikosR committed
1425
1426
        return _this2.cycle(event);
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
1427
1428
    }

1429
    if (this._config.touch && this._touchSupported) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1430
1431
      this._addTouchEventListeners();
    }
XhmikosR's avatar
XhmikosR committed
1432
1433
1434
1435
  };

  _proto._addTouchEventListeners = function _addTouchEventListeners() {
    var _this3 = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
1436

XhmikosR's avatar
XhmikosR committed
1437
1438
1439
1440
1441
    var start = function start(event) {
      if (_this3._pointerEvent && PointerType[event.pointerType.toUpperCase()]) {
        _this3.touchStartX = event.clientX;
      } else if (!_this3._pointerEvent) {
        _this3.touchStartX = event.touches[0].clientX;
XhmikosR's avatar
Dist.  
XhmikosR committed
1442
1443
1444
      }
    };

XhmikosR's avatar
XhmikosR committed
1445
    var move = function move(event) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1446
1447
      // ensure swiping with one touch and not pinching
      if (event.touches && event.touches.length > 1) {
XhmikosR's avatar
XhmikosR committed
1448
        _this3.touchDeltaX = 0;
XhmikosR's avatar
Dist.  
XhmikosR committed
1449
      } else {
XhmikosR's avatar
XhmikosR committed
1450
        _this3.touchDeltaX = event.touches[0].clientX - _this3.touchStartX;
XhmikosR's avatar
Dist.  
XhmikosR committed
1451
1452
1453
      }
    };

XhmikosR's avatar
XhmikosR committed
1454
1455
1456
    var end = function end(event) {
      if (_this3._pointerEvent && PointerType[event.pointerType.toUpperCase()]) {
        _this3.touchDeltaX = event.clientX - _this3.touchStartX;
XhmikosR's avatar
Dist.  
XhmikosR committed
1457
1458
      }

XhmikosR's avatar
XhmikosR committed
1459
      _this3._handleSwipe();
XhmikosR's avatar
Dist.  
XhmikosR committed
1460

XhmikosR's avatar
XhmikosR committed
1461
      if (_this3._config.pause === 'hover') {
XhmikosR's avatar
Dist.  
XhmikosR committed
1462
1463
1464
1465
1466
1467
1468
        // If it's a touch-enabled device, mouseenter/leave are fired as
        // part of the mouse compatibility events on first tap - the carousel
        // would stop cycling until user tapped out of it;
        // here, we listen for touchend, explicitly pause the carousel
        // (as if it's the second time we tap on it, mouseenter compat event
        // is NOT fired) and after a timeout (to allow for mouse compatibility
        // events to fire) we explicitly restart cycling
XhmikosR's avatar
XhmikosR committed
1469
        _this3.pause();
XhmikosR's avatar
Dist.  
XhmikosR committed
1470

XhmikosR's avatar
XhmikosR committed
1471
1472
        if (_this3.touchTimeout) {
          clearTimeout(_this3.touchTimeout);
XhmikosR's avatar
Dist.  
XhmikosR committed
1473
1474
        }

XhmikosR's avatar
XhmikosR committed
1475
1476
1477
        _this3.touchTimeout = setTimeout(function (event) {
          return _this3.cycle(event);
        }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
XhmikosR's avatar
Dist.  
XhmikosR committed
1478
1479
1480
      }
    };

XhmikosR's avatar
XhmikosR committed
1481
1482
    SelectorEngine.find(SELECTOR_ITEM_IMG, this._element).forEach(function (itemImg) {
      EventHandler.on(itemImg, EVENT_DRAG_START, function (e) {
XhmikosR's avatar
XhmikosR committed
1483
1484
        return e.preventDefault();
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
1485
1486
1487
    });

    if (this._pointerEvent) {
XhmikosR's avatar
XhmikosR committed
1488
      EventHandler.on(this._element, EVENT_POINTERDOWN, function (event) {
XhmikosR's avatar
XhmikosR committed
1489
1490
        return start(event);
      });
XhmikosR's avatar
XhmikosR committed
1491
      EventHandler.on(this._element, EVENT_POINTERUP, function (event) {
XhmikosR's avatar
XhmikosR committed
1492
1493
        return end(event);
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
1494

XhmikosR's avatar
XhmikosR committed
1495
      this._element.classList.add(CLASS_NAME_POINTER_EVENT);
XhmikosR's avatar
Dist.  
XhmikosR committed
1496
    } else {
XhmikosR's avatar
XhmikosR committed
1497
      EventHandler.on(this._element, EVENT_TOUCHSTART, function (event) {
XhmikosR's avatar
XhmikosR committed
1498
1499
        return start(event);
      });
XhmikosR's avatar
XhmikosR committed
1500
      EventHandler.on(this._element, EVENT_TOUCHMOVE, function (event) {
XhmikosR's avatar
XhmikosR committed
1501
1502
        return move(event);
      });
XhmikosR's avatar
XhmikosR committed
1503
      EventHandler.on(this._element, EVENT_TOUCHEND, function (event) {
XhmikosR's avatar
XhmikosR committed
1504
1505
        return end(event);
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
1506
    }
XhmikosR's avatar
XhmikosR committed
1507
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1508

XhmikosR's avatar
XhmikosR committed
1509
  _proto._keydown = function _keydown(event) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
    if (/input|textarea/i.test(event.target.tagName)) {
      return;
    }

    switch (event.which) {
      case ARROW_LEFT_KEYCODE:
        event.preventDefault();
        this.prev();
        break;

      case ARROW_RIGHT_KEYCODE:
        event.preventDefault();
        this.next();
        break;
    }
XhmikosR's avatar
XhmikosR committed
1525
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1526

XhmikosR's avatar
XhmikosR committed
1527
  _proto._getItemIndex = function _getItemIndex(element) {
XhmikosR's avatar
XhmikosR committed
1528
    this._items = element && element.parentNode ? SelectorEngine.find(SELECTOR_ITEM, element.parentNode) : [];
XhmikosR's avatar
Dist.  
XhmikosR committed
1529
    return this._items.indexOf(element);
XhmikosR's avatar
XhmikosR committed
1530
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1531

XhmikosR's avatar
XhmikosR committed
1532
  _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
XhmikosR's avatar
XhmikosR committed
1533
1534
    var isNextDirection = direction === DIRECTION_NEXT;
    var isPrevDirection = direction === DIRECTION_PREV;
XhmikosR's avatar
Dist.  
XhmikosR committed
1535

XhmikosR's avatar
XhmikosR committed
1536
    var activeIndex = this._getItemIndex(activeElement);
XhmikosR's avatar
Dist.  
XhmikosR committed
1537

XhmikosR's avatar
XhmikosR committed
1538
1539
    var lastItemIndex = this._items.length - 1;
    var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
XhmikosR's avatar
Dist.  
XhmikosR committed
1540
1541
1542
1543
1544

    if (isGoingToWrap && !this._config.wrap) {
      return activeElement;
    }

XhmikosR's avatar
XhmikosR committed
1545
    var delta = direction === DIRECTION_PREV ? -1 : 1;
XhmikosR's avatar
XhmikosR committed
1546
    var itemIndex = (activeIndex + delta) % this._items.length;
XhmikosR's avatar
Dist.  
XhmikosR committed
1547
    return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
XhmikosR's avatar
XhmikosR committed
1548
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1549

XhmikosR's avatar
XhmikosR committed
1550
1551
  _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
    var targetIndex = this._getItemIndex(relatedTarget);
XhmikosR's avatar
Dist.  
XhmikosR committed
1552

XhmikosR's avatar
XhmikosR committed
1553
    var fromIndex = this._getItemIndex(SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element));
XhmikosR's avatar
Dist.  
XhmikosR committed
1554

XhmikosR's avatar
XhmikosR committed
1555
    return EventHandler.trigger(this._element, EVENT_SLIDE, {
XhmikosR's avatar
XhmikosR committed
1556
      relatedTarget: relatedTarget,
XhmikosR's avatar
Dist.  
XhmikosR committed
1557
1558
1559
1560
      direction: eventDirectionName,
      from: fromIndex,
      to: targetIndex
    });
XhmikosR's avatar
XhmikosR committed
1561
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1562

XhmikosR's avatar
XhmikosR committed
1563
  _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1564
    if (this._indicatorsElement) {
XhmikosR's avatar
XhmikosR committed
1565
      var indicators = SelectorEngine.find(SELECTOR_ACTIVE$1, this._indicatorsElement);
XhmikosR's avatar
Dist.  
XhmikosR committed
1566

XhmikosR's avatar
XhmikosR committed
1567
      for (var i = 0; i < indicators.length; i++) {
XhmikosR's avatar
XhmikosR committed
1568
        indicators[i].classList.remove(CLASS_NAME_ACTIVE$1);
XhmikosR's avatar
Dist.  
XhmikosR committed
1569
1570
      }

XhmikosR's avatar
XhmikosR committed
1571
      var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
XhmikosR's avatar
Dist.  
XhmikosR committed
1572
1573

      if (nextIndicator) {
XhmikosR's avatar
XhmikosR committed
1574
        nextIndicator.classList.add(CLASS_NAME_ACTIVE$1);
XhmikosR's avatar
Dist.  
XhmikosR committed
1575
1576
      }
    }
XhmikosR's avatar
XhmikosR committed
1577
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1578

XhmikosR's avatar
XhmikosR committed
1579
1580
  _proto._slide = function _slide(direction, element) {
    var _this4 = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
1581

XhmikosR's avatar
XhmikosR committed
1582
    var activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
XhmikosR's avatar
Dist.  
XhmikosR committed
1583

XhmikosR's avatar
XhmikosR committed
1584
    var activeElementIndex = this._getItemIndex(activeElement);
XhmikosR's avatar
Dist.  
XhmikosR committed
1585

XhmikosR's avatar
XhmikosR committed
1586
    var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
XhmikosR's avatar
Dist.  
XhmikosR committed
1587

XhmikosR's avatar
XhmikosR committed
1588
1589
1590
1591
1592
1593
    var nextElementIndex = this._getItemIndex(nextElement);

    var isCycling = Boolean(this._interval);
    var directionalClassName;
    var orderClassName;
    var eventDirectionName;
XhmikosR's avatar
Dist.  
XhmikosR committed
1594

XhmikosR's avatar
XhmikosR committed
1595
1596
1597
1598
    if (direction === DIRECTION_NEXT) {
      directionalClassName = CLASS_NAME_LEFT;
      orderClassName = CLASS_NAME_NEXT;
      eventDirectionName = DIRECTION_LEFT;
XhmikosR's avatar
Dist.  
XhmikosR committed
1599
    } else {
XhmikosR's avatar
XhmikosR committed
1600
1601
1602
      directionalClassName = CLASS_NAME_RIGHT;
      orderClassName = CLASS_NAME_PREV;
      eventDirectionName = DIRECTION_RIGHT;
XhmikosR's avatar
Dist.  
XhmikosR committed
1603
1604
    }

XhmikosR's avatar
XhmikosR committed
1605
    if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE$1)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1606
1607
1608
1609
      this._isSliding = false;
      return;
    }

XhmikosR's avatar
XhmikosR committed
1610
    var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
XhmikosR's avatar
Dist.  
XhmikosR committed
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628

    if (slideEvent.defaultPrevented) {
      return;
    }

    if (!activeElement || !nextElement) {
      // Some weirdness is happening, so we bail
      return;
    }

    this._isSliding = true;

    if (isCycling) {
      this.pause();
    }

    this._setActiveIndicatorElement(nextElement);

XhmikosR's avatar
XhmikosR committed
1629
    if (this._element.classList.contains(CLASS_NAME_SLIDE)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1630
1631
1632
1633
      nextElement.classList.add(orderClassName);
      reflow(nextElement);
      activeElement.classList.add(directionalClassName);
      nextElement.classList.add(directionalClassName);
XhmikosR's avatar
XhmikosR committed
1634
      var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
XhmikosR's avatar
Dist.  
XhmikosR committed
1635
1636
1637
1638
1639
1640
1641
1642

      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;
      }

XhmikosR's avatar
XhmikosR committed
1643
1644
      var transitionDuration = getTransitionDurationFromElement(activeElement);
      EventHandler.one(activeElement, TRANSITION_END, function () {
XhmikosR's avatar
Dist.  
XhmikosR committed
1645
1646
        nextElement.classList.remove(directionalClassName);
        nextElement.classList.remove(orderClassName);
XhmikosR's avatar
XhmikosR committed
1647
1648
        nextElement.classList.add(CLASS_NAME_ACTIVE$1);
        activeElement.classList.remove(CLASS_NAME_ACTIVE$1);
XhmikosR's avatar
Dist.  
XhmikosR committed
1649
1650
        activeElement.classList.remove(orderClassName);
        activeElement.classList.remove(directionalClassName);
XhmikosR's avatar
XhmikosR committed
1651
1652
        _this4._isSliding = false;
        setTimeout(function () {
XhmikosR's avatar
XhmikosR committed
1653
          EventHandler.trigger(_this4._element, EVENT_SLID, {
XhmikosR's avatar
Dist.  
XhmikosR committed
1654
1655
1656
1657
1658
1659
1660
1661
1662
            relatedTarget: nextElement,
            direction: eventDirectionName,
            from: activeElementIndex,
            to: nextElementIndex
          });
        }, 0);
      });
      emulateTransitionEnd(activeElement, transitionDuration);
    } else {
XhmikosR's avatar
XhmikosR committed
1663
1664
      activeElement.classList.remove(CLASS_NAME_ACTIVE$1);
      nextElement.classList.add(CLASS_NAME_ACTIVE$1);
XhmikosR's avatar
Dist.  
XhmikosR committed
1665
      this._isSliding = false;
XhmikosR's avatar
XhmikosR committed
1666
      EventHandler.trigger(this._element, EVENT_SLID, {
XhmikosR's avatar
Dist.  
XhmikosR committed
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
        relatedTarget: nextElement,
        direction: eventDirectionName,
        from: activeElementIndex,
        to: nextElementIndex
      });
    }

    if (isCycling) {
      this.cycle();
    }
  } // Static
XhmikosR's avatar
XhmikosR committed
1678
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
1679

XhmikosR's avatar
XhmikosR committed
1680
  Carousel.carouselInterface = function carouselInterface(element, config) {
XhmikosR's avatar
XhmikosR committed
1681
    var data = Data.getData(element, DATA_KEY$2);
XhmikosR's avatar
Dist.  
XhmikosR committed
1682

1683
    var _config = _objectSpread2({}, Default, {}, Manipulator.getDataAttributes(element));
XhmikosR's avatar
Dist.  
XhmikosR committed
1684
1685

    if (typeof config === 'object') {
1686
      _config = _objectSpread2({}, _config, {}, config);
XhmikosR's avatar
Dist.  
XhmikosR committed
1687
1688
    }

XhmikosR's avatar
XhmikosR committed
1689
    var action = typeof config === 'string' ? config : _config.slide;
XhmikosR's avatar
Dist.  
XhmikosR committed
1690
1691
1692
1693
1694
1695
1696
1697
1698

    if (!data) {
      data = new Carousel(element, _config);
    }

    if (typeof config === 'number') {
      data.to(config);
    } else if (typeof action === 'string') {
      if (typeof data[action] === 'undefined') {
XhmikosR's avatar
XhmikosR committed
1699
        throw new TypeError("No method named \"" + action + "\"");
XhmikosR's avatar
Dist.  
XhmikosR committed
1700
1701
1702
1703
1704
1705
1706
      }

      data[action]();
    } else if (_config.interval && _config.ride) {
      data.pause();
      data.cycle();
    }
XhmikosR's avatar
XhmikosR committed
1707
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1708

XhmikosR's avatar
XhmikosR committed
1709
  Carousel.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1710
    return this.each(function () {
XhmikosR's avatar
XhmikosR committed
1711
      Carousel.carouselInterface(this, config);
XhmikosR's avatar
Dist.  
XhmikosR committed
1712
    });
XhmikosR's avatar
XhmikosR committed
1713
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1714

XhmikosR's avatar
XhmikosR committed
1715
1716
  Carousel.dataApiClickHandler = function dataApiClickHandler(event) {
    var target = getElementFromSelector(this);
XhmikosR's avatar
Dist.  
XhmikosR committed
1717

XhmikosR's avatar
XhmikosR committed
1718
    if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1719
1720
1721
      return;
    }

1722
    var config = _objectSpread2({}, Manipulator.getDataAttributes(target), {}, Manipulator.getDataAttributes(this));
XhmikosR's avatar
Dist.  
XhmikosR committed
1723

XhmikosR's avatar
XhmikosR committed
1724
    var slideIndex = this.getAttribute('data-slide-to');
XhmikosR's avatar
Dist.  
XhmikosR committed
1725
1726
1727
1728
1729

    if (slideIndex) {
      config.interval = false;
    }

XhmikosR's avatar
XhmikosR committed
1730
    Carousel.carouselInterface(target, config);
XhmikosR's avatar
Dist.  
XhmikosR committed
1731
1732
1733
1734
1735
1736

    if (slideIndex) {
      Data.getData(target, DATA_KEY$2).to(slideIndex);
    }

    event.preventDefault();
XhmikosR's avatar
XhmikosR committed
1737
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1738

XhmikosR's avatar
XhmikosR committed
1739
  Carousel.getInstance = function getInstance(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1740
    return Data.getData(element, DATA_KEY$2);
XhmikosR's avatar
XhmikosR committed
1741
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1742

XhmikosR's avatar
XhmikosR committed
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
  _createClass(Carousel, null, [{
    key: "VERSION",
    get: function get() {
      return VERSION$2;
    }
  }, {
    key: "Default",
    get: function get() {
      return Default;
    }
  }]);

  return Carousel;
}();
XhmikosR's avatar
Dist.  
XhmikosR committed
1757
1758
1759
1760
1761
1762
1763
/**
 * ------------------------------------------------------------------------
 * Data Api implementation
 * ------------------------------------------------------------------------
 */


XhmikosR's avatar
XhmikosR committed
1764
1765
1766
EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_SLIDE, Carousel.dataApiClickHandler);
EventHandler.on(window, EVENT_LOAD_DATA_API, function () {
  var carousels = SelectorEngine.find(SELECTOR_DATA_RIDE);
XhmikosR's avatar
Dist.  
XhmikosR committed
1767

XhmikosR's avatar
XhmikosR committed
1768
  for (var i = 0, len = carousels.length; i < len; i++) {
XhmikosR's avatar
XhmikosR committed
1769
    Carousel.carouselInterface(carousels[i], Data.getData(carousels[i], DATA_KEY$2));
XhmikosR's avatar
Dist.  
XhmikosR committed
1770
1771
  }
});
XhmikosR's avatar
XhmikosR committed
1772
var $$3 = getjQuery();
XhmikosR's avatar
Dist.  
XhmikosR committed
1773
1774
1775
1776
1777
1778
1779
/**
 * ------------------------------------------------------------------------
 * jQuery
 * ------------------------------------------------------------------------
 * add .carousel to jQuery only if jQuery is present
 */

1780
1781
/* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
1782
1783
1784
1785
if ($$3) {
  var JQUERY_NO_CONFLICT$2 = $$3.fn[NAME$2];
  $$3.fn[NAME$2] = Carousel.jQueryInterface;
  $$3.fn[NAME$2].Constructor = Carousel;
XhmikosR's avatar
Dist.  
XhmikosR committed
1786

XhmikosR's avatar
XhmikosR committed
1787
1788
1789
  $$3.fn[NAME$2].noConflict = function () {
    $$3.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
    return Carousel.jQueryInterface;
XhmikosR's avatar
Dist.  
XhmikosR committed
1790
1791
1792
1793
1794
1795
1796
1797
1798
  };
}

/**
 * ------------------------------------------------------------------------
 * Constants
 * ------------------------------------------------------------------------
 */

XhmikosR's avatar
XhmikosR committed
1799
1800
1801
1802
1803
1804
var NAME$3 = 'collapse';
var VERSION$3 = '4.3.1';
var DATA_KEY$3 = 'bs.collapse';
var EVENT_KEY$3 = "." + DATA_KEY$3;
var DATA_API_KEY$3 = '.data-api';
var Default$1 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
1805
1806
1807
  toggle: true,
  parent: ''
};
XhmikosR's avatar
XhmikosR committed
1808
var DefaultType$1 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
1809
1810
1811
  toggle: 'boolean',
  parent: '(string|element)'
};
XhmikosR's avatar
XhmikosR committed
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
var EVENT_SHOW = "show" + EVENT_KEY$3;
var EVENT_SHOWN = "shown" + EVENT_KEY$3;
var EVENT_HIDE = "hide" + EVENT_KEY$3;
var EVENT_HIDDEN = "hidden" + EVENT_KEY$3;
var EVENT_CLICK_DATA_API$3 = "click" + EVENT_KEY$3 + DATA_API_KEY$3;
var CLASS_NAME_SHOW = 'show';
var CLASS_NAME_COLLAPSE = 'collapse';
var CLASS_NAME_COLLAPSING = 'collapsing';
var CLASS_NAME_COLLAPSED = 'collapsed';
var WIDTH = 'width';
var HEIGHT = 'height';
var SELECTOR_ACTIVES = '.show, .collapsing';
var SELECTOR_DATA_TOGGLE$1 = '[data-toggle="collapse"]';
XhmikosR's avatar
XhmikosR committed
1825
1826
1827
1828
1829
/**
 * ------------------------------------------------------------------------
 * Class Definition
 * ------------------------------------------------------------------------
 */
XhmikosR's avatar
Dist.  
XhmikosR committed
1830

XhmikosR's avatar
XhmikosR committed
1831
var Collapse = /*#__PURE__*/function () {
XhmikosR's avatar
XhmikosR committed
1832
  function Collapse(element, config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1833
1834
1835
    this._isTransitioning = false;
    this._element = element;
    this._config = this._getConfig(config);
XhmikosR's avatar
XhmikosR committed
1836
1837
    this._triggerArray = SelectorEngine.find(SELECTOR_DATA_TOGGLE$1 + "[href=\"#" + element.id + "\"]," + (SELECTOR_DATA_TOGGLE$1 + "[data-target=\"#" + element.id + "\"]"));
    var toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$1);
XhmikosR's avatar
XhmikosR committed
1838
1839
1840
1841

    for (var i = 0, len = toggleList.length; i < len; i++) {
      var elem = toggleList[i];
      var selector = getSelectorFromElement(elem);
XhmikosR's avatar
XhmikosR committed
1842
      var filterElement = SelectorEngine.find(selector).filter(function (foundElem) {
XhmikosR's avatar
XhmikosR committed
1843
1844
        return foundElem === element;
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866

      if (selector !== null && filterElement.length) {
        this._selector = selector;

        this._triggerArray.push(elem);
      }
    }

    this._parent = this._config.parent ? this._getParent() : null;

    if (!this._config.parent) {
      this._addAriaAndCollapsedClass(this._element, this._triggerArray);
    }

    if (this._config.toggle) {
      this.toggle();
    }

    Data.setData(element, DATA_KEY$3, this);
  } // Getters


XhmikosR's avatar
XhmikosR committed
1867
  var _proto = Collapse.prototype;
XhmikosR's avatar
Dist.  
XhmikosR committed
1868

XhmikosR's avatar
XhmikosR committed
1869
1870
  // Public
  _proto.toggle = function toggle() {
XhmikosR's avatar
XhmikosR committed
1871
    if (this._element.classList.contains(CLASS_NAME_SHOW)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1872
1873
1874
1875
      this.hide();
    } else {
      this.show();
    }
XhmikosR's avatar
XhmikosR committed
1876
1877
1878
1879
  };

  _proto.show = function show() {
    var _this = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
1880

XhmikosR's avatar
XhmikosR committed
1881
    if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1882
1883
1884
      return;
    }

XhmikosR's avatar
XhmikosR committed
1885
1886
    var actives;
    var activesData;
XhmikosR's avatar
Dist.  
XhmikosR committed
1887
1888

    if (this._parent) {
XhmikosR's avatar
XhmikosR committed
1889
      actives = SelectorEngine.find(SELECTOR_ACTIVES, this._parent).filter(function (elem) {
XhmikosR's avatar
XhmikosR committed
1890
1891
        if (typeof _this._config.parent === 'string') {
          return elem.getAttribute('data-parent') === _this._config.parent;
XhmikosR's avatar
Dist.  
XhmikosR committed
1892
1893
        }

XhmikosR's avatar
XhmikosR committed
1894
        return elem.classList.contains(CLASS_NAME_COLLAPSE);
XhmikosR's avatar
Dist.  
XhmikosR committed
1895
1896
1897
1898
1899
1900
1901
      });

      if (actives.length === 0) {
        actives = null;
      }
    }

XhmikosR's avatar
XhmikosR committed
1902
    var container = SelectorEngine.findOne(this._selector);
XhmikosR's avatar
Dist.  
XhmikosR committed
1903
1904

    if (actives) {
XhmikosR's avatar
XhmikosR committed
1905
1906
1907
      var tempActiveData = actives.filter(function (elem) {
        return container !== elem;
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
1908
1909
1910
1911
1912
1913
1914
      activesData = tempActiveData[0] ? Data.getData(tempActiveData[0], DATA_KEY$3) : null;

      if (activesData && activesData._isTransitioning) {
        return;
      }
    }

XhmikosR's avatar
XhmikosR committed
1915
    var startEvent = EventHandler.trigger(this._element, EVENT_SHOW);
XhmikosR's avatar
Dist.  
XhmikosR committed
1916
1917
1918
1919
1920
1921

    if (startEvent.defaultPrevented) {
      return;
    }

    if (actives) {
XhmikosR's avatar
XhmikosR committed
1922
      actives.forEach(function (elemActive) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1923
        if (container !== elemActive) {
XhmikosR's avatar
XhmikosR committed
1924
          Collapse.collapseInterface(elemActive, 'hide');
XhmikosR's avatar
Dist.  
XhmikosR committed
1925
1926
1927
1928
1929
1930
1931
1932
        }

        if (!activesData) {
          Data.setData(elemActive, DATA_KEY$3, null);
        }
      });
    }

XhmikosR's avatar
XhmikosR committed
1933
    var dimension = this._getDimension();
XhmikosR's avatar
Dist.  
XhmikosR committed
1934

XhmikosR's avatar
XhmikosR committed
1935
    this._element.classList.remove(CLASS_NAME_COLLAPSE);
XhmikosR's avatar
Dist.  
XhmikosR committed
1936

XhmikosR's avatar
XhmikosR committed
1937
    this._element.classList.add(CLASS_NAME_COLLAPSING);
XhmikosR's avatar
Dist.  
XhmikosR committed
1938
1939
1940
1941

    this._element.style[dimension] = 0;

    if (this._triggerArray.length) {
XhmikosR's avatar
XhmikosR committed
1942
      this._triggerArray.forEach(function (element) {
XhmikosR's avatar
XhmikosR committed
1943
        element.classList.remove(CLASS_NAME_COLLAPSED);
XhmikosR's avatar
Dist.  
XhmikosR committed
1944
1945
1946
1947
1948
1949
        element.setAttribute('aria-expanded', true);
      });
    }

    this.setTransitioning(true);

XhmikosR's avatar
XhmikosR committed
1950
    var complete = function complete() {
XhmikosR's avatar
XhmikosR committed
1951
      _this._element.classList.remove(CLASS_NAME_COLLAPSING);
XhmikosR's avatar
XhmikosR committed
1952

XhmikosR's avatar
XhmikosR committed
1953
      _this._element.classList.add(CLASS_NAME_COLLAPSE);
XhmikosR's avatar
XhmikosR committed
1954

XhmikosR's avatar
XhmikosR committed
1955
      _this._element.classList.add(CLASS_NAME_SHOW);
XhmikosR's avatar
Dist.  
XhmikosR committed
1956

XhmikosR's avatar
XhmikosR committed
1957
      _this._element.style[dimension] = '';
XhmikosR's avatar
Dist.  
XhmikosR committed
1958

XhmikosR's avatar
XhmikosR committed
1959
      _this.setTransitioning(false);
XhmikosR's avatar
Dist.  
XhmikosR committed
1960

XhmikosR's avatar
XhmikosR committed
1961
      EventHandler.trigger(_this._element, EVENT_SHOWN);
XhmikosR's avatar
Dist.  
XhmikosR committed
1962
1963
    };

XhmikosR's avatar
XhmikosR committed
1964
1965
1966
    var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
    var scrollSize = "scroll" + capitalizedDimension;
    var transitionDuration = getTransitionDurationFromElement(this._element);
XhmikosR's avatar
Dist.  
XhmikosR committed
1967
1968
    EventHandler.one(this._element, TRANSITION_END, complete);
    emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
XhmikosR committed
1969
1970
1971
1972
1973
    this._element.style[dimension] = this._element[scrollSize] + "px";
  };

  _proto.hide = function hide() {
    var _this2 = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
1974

XhmikosR's avatar
XhmikosR committed
1975
    if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1976
1977
1978
      return;
    }

XhmikosR's avatar
XhmikosR committed
1979
    var startEvent = EventHandler.trigger(this._element, EVENT_HIDE);
XhmikosR's avatar
Dist.  
XhmikosR committed
1980
1981
1982
1983
1984

    if (startEvent.defaultPrevented) {
      return;
    }

XhmikosR's avatar
XhmikosR committed
1985
    var dimension = this._getDimension();
XhmikosR's avatar
Dist.  
XhmikosR committed
1986

XhmikosR's avatar
XhmikosR committed
1987
    this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
XhmikosR's avatar
Dist.  
XhmikosR committed
1988
1989
    reflow(this._element);

XhmikosR's avatar
XhmikosR committed
1990
    this._element.classList.add(CLASS_NAME_COLLAPSING);
XhmikosR's avatar
Dist.  
XhmikosR committed
1991

XhmikosR's avatar
XhmikosR committed
1992
    this._element.classList.remove(CLASS_NAME_COLLAPSE);
XhmikosR's avatar
Dist.  
XhmikosR committed
1993

XhmikosR's avatar
XhmikosR committed
1994
    this._element.classList.remove(CLASS_NAME_SHOW);
XhmikosR's avatar
Dist.  
XhmikosR committed
1995

XhmikosR's avatar
XhmikosR committed
1996
    var triggerArrayLength = this._triggerArray.length;
XhmikosR's avatar
Dist.  
XhmikosR committed
1997
1998

    if (triggerArrayLength > 0) {
XhmikosR's avatar
XhmikosR committed
1999
2000
      for (var i = 0; i < triggerArrayLength; i++) {
        var trigger = this._triggerArray[i];
For faster browsing, not all history is shown. View entire blame