bootstrap.esm.js 145 KB
Newer Older
XhmikosR's avatar
XhmikosR committed
1001
    return Alert.jQueryInterface;
XhmikosR's avatar
Dist.  
XhmikosR committed
1002
1003
1004
1005
1006
1007
1008
1009
1010
  };
}

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

XhmikosR's avatar
XhmikosR committed
1011
1012
1013
1014
1015
1016
var NAME$1 = 'button';
var VERSION$1 = '4.3.1';
var DATA_KEY$1 = 'bs.button';
var EVENT_KEY$1 = "." + DATA_KEY$1;
var DATA_API_KEY$1 = '.data-api';
var ClassName$1 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
1017
1018
1019
1020
  ACTIVE: 'active',
  BUTTON: 'btn',
  FOCUS: 'focus'
};
XhmikosR's avatar
XhmikosR committed
1021
var Selector$1 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
1022
1023
1024
1025
1026
1027
  DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  DATA_TOGGLE: '[data-toggle="buttons"]',
  INPUT: 'input:not([type="hidden"])',
  ACTIVE: '.active',
  BUTTON: '.btn'
};
XhmikosR's avatar
XhmikosR committed
1028
1029
1030
1031
var Event$2 = {
  CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  FOCUS_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1,
  BLUR_DATA_API: "blur" + EVENT_KEY$1 + DATA_API_KEY$1
XhmikosR's avatar
Dist.  
XhmikosR committed
1032
};
XhmikosR's avatar
XhmikosR committed
1033
1034
1035
1036
1037
/**
 * ------------------------------------------------------------------------
 * Class Definition
 * ------------------------------------------------------------------------
 */
XhmikosR's avatar
Dist.  
XhmikosR committed
1038

XhmikosR's avatar
XhmikosR committed
1039
1040
1041
1042
var Button =
/*#__PURE__*/
function () {
  function Button(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1043
1044
1045
1046
1047
    this._element = element;
    Data.setData(element, DATA_KEY$1, this);
  } // Getters


XhmikosR's avatar
XhmikosR committed
1048
  var _proto = Button.prototype;
XhmikosR's avatar
Dist.  
XhmikosR committed
1049

XhmikosR's avatar
XhmikosR committed
1050
1051
1052
1053
1054
  // Public
  _proto.toggle = function toggle() {
    var triggerChangeEvent = true;
    var addAriaPressed = true;
    var rootElement = SelectorEngine.closest(this._element, Selector$1.DATA_TOGGLE);
XhmikosR's avatar
Dist.  
XhmikosR committed
1055
1056

    if (rootElement) {
XhmikosR's avatar
XhmikosR committed
1057
      var input = SelectorEngine.findOne(Selector$1.INPUT, this._element);
XhmikosR's avatar
Dist.  
XhmikosR committed
1058

XhmikosR's avatar
XhmikosR committed
1059
1060
1061
1062
1063
      if (input && input.type === 'radio') {
        if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
          triggerChangeEvent = false;
        } else {
          var activeElement = SelectorEngine.findOne(Selector$1.ACTIVE, rootElement);
XhmikosR's avatar
Dist.  
XhmikosR committed
1064

XhmikosR's avatar
XhmikosR committed
1065
1066
          if (activeElement) {
            activeElement.classList.remove(ClassName$1.ACTIVE);
XhmikosR's avatar
Dist.  
XhmikosR committed
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
          }
        }

        if (triggerChangeEvent) {
          if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains('disabled') || rootElement.classList.contains('disabled')) {
            return;
          }

          input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
          EventHandler.trigger(input, 'change');
        }

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

    if (addAriaPressed) {
      this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
    }

    if (triggerChangeEvent) {
      this._element.classList.toggle(ClassName$1.ACTIVE);
    }
XhmikosR's avatar
XhmikosR committed
1091
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1092

XhmikosR's avatar
XhmikosR committed
1093
  _proto.dispose = function dispose() {
XhmikosR's avatar
Dist.  
XhmikosR committed
1094
1095
1096
    Data.removeData(this._element, DATA_KEY$1);
    this._element = null;
  } // Static
XhmikosR's avatar
XhmikosR committed
1097
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
1098

XhmikosR's avatar
XhmikosR committed
1099
  Button.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1100
    return this.each(function () {
XhmikosR's avatar
XhmikosR committed
1101
      var data = Data.getData(this, DATA_KEY$1);
XhmikosR's avatar
Dist.  
XhmikosR committed
1102
1103
1104
1105
1106
1107
1108
1109
1110

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

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

XhmikosR's avatar
XhmikosR committed
1113
  Button.getInstance = function getInstance(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1114
    return Data.getData(element, DATA_KEY$1);
XhmikosR's avatar
XhmikosR committed
1115
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1116

XhmikosR's avatar
XhmikosR committed
1117
1118
1119
1120
1121
1122
1123
1124
1125
  _createClass(Button, null, [{
    key: "VERSION",
    get: function get() {
      return VERSION$1;
    }
  }]);

  return Button;
}();
XhmikosR's avatar
Dist.  
XhmikosR committed
1126
1127
1128
1129
1130
1131
1132
/**
 * ------------------------------------------------------------------------
 * Data Api implementation
 * ------------------------------------------------------------------------
 */


XhmikosR's avatar
XhmikosR committed
1133
EventHandler.on(document, Event$2.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1134
  event.preventDefault();
XhmikosR's avatar
XhmikosR committed
1135
  var button = event.target;
XhmikosR's avatar
Dist.  
XhmikosR committed
1136
1137
1138
1139
1140

  if (!button.classList.contains(ClassName$1.BUTTON)) {
    button = SelectorEngine.closest(button, Selector$1.BUTTON);
  }

XhmikosR's avatar
XhmikosR committed
1141
  var data = Data.getData(button, DATA_KEY$1);
XhmikosR's avatar
Dist.  
XhmikosR committed
1142
1143
1144
1145
1146
1147
1148

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

  data.toggle();
});
XhmikosR's avatar
XhmikosR committed
1149
1150
1151
1152
1153
1154
EventHandler.on(document, Event$2.FOCUS_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  var button = SelectorEngine.closest(event.target, Selector$1.BUTTON);

  if (button) {
    button.classList.add(ClassName$1.FOCUS);
  }
XhmikosR's avatar
Dist.  
XhmikosR committed
1155
});
XhmikosR's avatar
XhmikosR committed
1156
1157
1158
1159
1160
1161
EventHandler.on(document, Event$2.BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  var button = SelectorEngine.closest(event.target, Selector$1.BUTTON);

  if (button) {
    button.classList.remove(ClassName$1.FOCUS);
  }
XhmikosR's avatar
Dist.  
XhmikosR committed
1162
});
XhmikosR's avatar
XhmikosR committed
1163
var $$2 = getjQuery();
XhmikosR's avatar
Dist.  
XhmikosR committed
1164
1165
1166
1167
1168
1169
1170
/**
 * ------------------------------------------------------------------------
 * jQuery
 * ------------------------------------------------------------------------
 * add .button to jQuery only if jQuery is present
 */

1171
1172
/* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
1173
1174
1175
1176
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
1177

XhmikosR's avatar
XhmikosR committed
1178
1179
1180
  $$2.fn[NAME$1].noConflict = function () {
    $$2.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
    return Button.jQueryInterface;
XhmikosR's avatar
Dist.  
XhmikosR committed
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
  };
}

/**
 * --------------------------------------------------------------------------
 * 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
1211
  return key.replace(/[A-Z]/g, function (chr) {
XhmikosR's avatar
XhmikosR committed
1212
    return "-" + chr.toLowerCase();
XhmikosR's avatar
XhmikosR committed
1213
  });
XhmikosR's avatar
Dist.  
XhmikosR committed
1214
1215
}

XhmikosR's avatar
XhmikosR committed
1216
1217
1218
var Manipulator = {
  setDataAttribute: function setDataAttribute(element, key, value) {
    element.setAttribute("data-" + normalizeDataKey(key), value);
XhmikosR's avatar
Dist.  
XhmikosR committed
1219
  },
XhmikosR's avatar
XhmikosR committed
1220
1221
  removeDataAttribute: function removeDataAttribute(element, key) {
    element.removeAttribute("data-" + normalizeDataKey(key));
XhmikosR's avatar
Dist.  
XhmikosR committed
1222
  },
XhmikosR's avatar
XhmikosR committed
1223
  getDataAttributes: function getDataAttributes(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1224
1225
1226
1227
    if (!element) {
      return {};
    }

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

XhmikosR's avatar
XhmikosR committed
1230
    Object.keys(attributes).forEach(function (key) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1231
1232
1233
1234
      attributes[key] = normalizeData(attributes[key]);
    });
    return attributes;
  },
XhmikosR's avatar
XhmikosR committed
1235
1236
  getDataAttribute: function getDataAttribute(element, key) {
    return normalizeData(element.getAttribute("data-" + normalizeDataKey(key)));
XhmikosR's avatar
Dist.  
XhmikosR committed
1237
  },
XhmikosR's avatar
XhmikosR committed
1238
1239
  offset: function offset(element) {
    var rect = element.getBoundingClientRect();
XhmikosR's avatar
Dist.  
XhmikosR committed
1240
1241
1242
1243
1244
    return {
      top: rect.top + document.body.scrollTop,
      left: rect.left + document.body.scrollLeft
    };
  },
XhmikosR's avatar
XhmikosR committed
1245
  position: function position(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1246
1247
1248
1249
1250
    return {
      top: element.offsetTop,
      left: element.offsetLeft
    };
  },
XhmikosR's avatar
XhmikosR committed
1251
  toggleClass: function toggleClass(element, className) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
    if (!element) {
      return;
    }

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

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

XhmikosR's avatar
XhmikosR committed
1270
1271
1272
1273
1274
1275
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
1276

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

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

XhmikosR's avatar
XhmikosR committed
1281
1282
var SWIPE_THRESHOLD = 40;
var Default = {
XhmikosR's avatar
Dist.  
XhmikosR committed
1283
1284
1285
1286
1287
1288
1289
  interval: 5000,
  keyboard: true,
  slide: false,
  pause: 'hover',
  wrap: true,
  touch: true
};
XhmikosR's avatar
XhmikosR committed
1290
var DefaultType = {
XhmikosR's avatar
Dist.  
XhmikosR committed
1291
1292
1293
1294
1295
1296
1297
  interval: '(number|boolean)',
  keyboard: 'boolean',
  slide: '(boolean|string)',
  pause: '(string|boolean)',
  wrap: 'boolean',
  touch: 'boolean'
};
XhmikosR's avatar
XhmikosR committed
1298
var Direction = {
XhmikosR's avatar
Dist.  
XhmikosR committed
1299
1300
1301
1302
1303
  NEXT: 'next',
  PREV: 'prev',
  LEFT: 'left',
  RIGHT: 'right'
};
XhmikosR's avatar
XhmikosR committed
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
var Event$3 = {
  SLIDE: "slide" + EVENT_KEY$2,
  SLID: "slid" + EVENT_KEY$2,
  KEYDOWN: "keydown" + EVENT_KEY$2,
  MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  TOUCHSTART: "touchstart" + EVENT_KEY$2,
  TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  TOUCHEND: "touchend" + EVENT_KEY$2,
  POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  POINTERUP: "pointerup" + EVENT_KEY$2,
  DRAG_START: "dragstart" + EVENT_KEY$2,
  LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
XhmikosR's avatar
Dist.  
XhmikosR committed
1318
};
XhmikosR's avatar
XhmikosR committed
1319
var ClassName$2 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
  CAROUSEL: 'carousel',
  ACTIVE: 'active',
  SLIDE: 'slide',
  RIGHT: 'carousel-item-right',
  LEFT: 'carousel-item-left',
  NEXT: 'carousel-item-next',
  PREV: 'carousel-item-prev',
  ITEM: 'carousel-item',
  POINTER_EVENT: 'pointer-event'
};
XhmikosR's avatar
XhmikosR committed
1330
var Selector$2 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
1331
1332
1333
1334
1335
1336
1337
1338
1339
  ACTIVE: '.active',
  ACTIVE_ITEM: '.active.carousel-item',
  ITEM: '.carousel-item',
  ITEM_IMG: '.carousel-item img',
  NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  INDICATORS: '.carousel-indicators',
  DATA_SLIDE: '[data-slide], [data-slide-to]',
  DATA_RIDE: '[data-ride="carousel"]'
};
XhmikosR's avatar
XhmikosR committed
1340
var PointerType = {
XhmikosR's avatar
Dist.  
XhmikosR committed
1341
1342
1343
  TOUCH: 'touch',
  PEN: 'pen'
};
XhmikosR's avatar
XhmikosR committed
1344
1345
1346
1347
1348
/**
 * ------------------------------------------------------------------------
 * Class Definition
 * ------------------------------------------------------------------------
 */
XhmikosR's avatar
Dist.  
XhmikosR committed
1349

XhmikosR's avatar
XhmikosR committed
1350
1351
1352
1353
var Carousel =
/*#__PURE__*/
function () {
  function Carousel(element, config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
    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;
    this._indicatorsElement = SelectorEngine.findOne(Selector$2.INDICATORS, this._element);
    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
1374
  var _proto = Carousel.prototype;
XhmikosR's avatar
Dist.  
XhmikosR committed
1375

XhmikosR's avatar
XhmikosR committed
1376
1377
  // Public
  _proto.next = function next() {
XhmikosR's avatar
Dist.  
XhmikosR committed
1378
1379
1380
    if (!this._isSliding) {
      this._slide(Direction.NEXT);
    }
XhmikosR's avatar
XhmikosR committed
1381
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1382

XhmikosR's avatar
XhmikosR committed
1383
  _proto.nextWhenVisible = function nextWhenVisible() {
XhmikosR's avatar
Dist.  
XhmikosR committed
1384
1385
1386
1387
1388
    // 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
1389
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1390

XhmikosR's avatar
XhmikosR committed
1391
  _proto.prev = function prev() {
XhmikosR's avatar
Dist.  
XhmikosR committed
1392
1393
1394
    if (!this._isSliding) {
      this._slide(Direction.PREV);
    }
XhmikosR's avatar
XhmikosR committed
1395
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1396

XhmikosR's avatar
XhmikosR committed
1397
  _proto.pause = function pause(event) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
    if (!event) {
      this._isPaused = true;
    }

    if (SelectorEngine.findOne(Selector$2.NEXT_PREV, this._element)) {
      triggerTransitionEnd(this._element);
      this.cycle(true);
    }

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

XhmikosR's avatar
XhmikosR committed
1411
  _proto.cycle = function cycle(event) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
    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
1424
1425
1426
1427
  };

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

    this._activeElement = SelectorEngine.findOne(Selector$2.ACTIVE_ITEM, this._element);

XhmikosR's avatar
XhmikosR committed
1431
    var activeIndex = this._getItemIndex(this._activeElement);
XhmikosR's avatar
Dist.  
XhmikosR committed
1432
1433
1434
1435
1436
1437

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

    if (this._isSliding) {
XhmikosR's avatar
XhmikosR committed
1438
1439
1440
      EventHandler.one(this._element, Event$3.SLID, function () {
        return _this.to(index);
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
1441
1442
1443
1444
1445
1446
1447
1448
1449
      return;
    }

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

XhmikosR's avatar
XhmikosR committed
1450
    var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
XhmikosR's avatar
Dist.  
XhmikosR committed
1451
1452

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

XhmikosR's avatar
XhmikosR committed
1455
  _proto.dispose = function dispose() {
XhmikosR's avatar
Dist.  
XhmikosR committed
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
    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
1467
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
1468

XhmikosR's avatar
XhmikosR committed
1469
  _proto._getConfig = function _getConfig(config) {
1470
    config = _objectSpread2({}, Default, {}, config);
XhmikosR's avatar
Dist.  
XhmikosR committed
1471
1472
    typeCheckConfig(NAME$2, config, DefaultType);
    return config;
XhmikosR's avatar
XhmikosR committed
1473
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1474

XhmikosR's avatar
XhmikosR committed
1475
1476
  _proto._handleSwipe = function _handleSwipe() {
    var absDeltax = Math.abs(this.touchDeltaX);
XhmikosR's avatar
Dist.  
XhmikosR committed
1477
1478
1479
1480
1481

    if (absDeltax <= SWIPE_THRESHOLD) {
      return;
    }

XhmikosR's avatar
XhmikosR committed
1482
1483
    var direction = absDeltax / this.touchDeltaX;
    this.touchDeltaX = 0; // swipe left
XhmikosR's avatar
Dist.  
XhmikosR committed
1484
1485
1486
1487
1488
1489
1490
1491
1492

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


    if (direction < 0) {
      this.next();
    }
XhmikosR's avatar
XhmikosR committed
1493
1494
1495
1496
  };

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

    if (this._config.keyboard) {
XhmikosR's avatar
XhmikosR committed
1499
1500
1501
      EventHandler.on(this._element, Event$3.KEYDOWN, function (event) {
        return _this2._keydown(event);
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
1502
1503
1504
    }

    if (this._config.pause === 'hover') {
XhmikosR's avatar
XhmikosR committed
1505
1506
1507
1508
1509
1510
      EventHandler.on(this._element, Event$3.MOUSEENTER, function (event) {
        return _this2.pause(event);
      });
      EventHandler.on(this._element, Event$3.MOUSELEAVE, function (event) {
        return _this2.cycle(event);
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
1511
1512
    }

1513
    if (this._config.touch && this._touchSupported) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1514
1515
      this._addTouchEventListeners();
    }
XhmikosR's avatar
XhmikosR committed
1516
1517
1518
1519
  };

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

XhmikosR's avatar
XhmikosR committed
1521
1522
1523
1524
1525
    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
1526
1527
1528
      }
    };

XhmikosR's avatar
XhmikosR committed
1529
    var move = function move(event) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1530
1531
      // ensure swiping with one touch and not pinching
      if (event.touches && event.touches.length > 1) {
XhmikosR's avatar
XhmikosR committed
1532
        _this3.touchDeltaX = 0;
XhmikosR's avatar
Dist.  
XhmikosR committed
1533
      } else {
XhmikosR's avatar
XhmikosR committed
1534
        _this3.touchDeltaX = event.touches[0].clientX - _this3.touchStartX;
XhmikosR's avatar
Dist.  
XhmikosR committed
1535
1536
1537
      }
    };

XhmikosR's avatar
XhmikosR committed
1538
1539
1540
    var end = function end(event) {
      if (_this3._pointerEvent && PointerType[event.pointerType.toUpperCase()]) {
        _this3.touchDeltaX = event.clientX - _this3.touchStartX;
XhmikosR's avatar
Dist.  
XhmikosR committed
1541
1542
      }

XhmikosR's avatar
XhmikosR committed
1543
      _this3._handleSwipe();
XhmikosR's avatar
Dist.  
XhmikosR committed
1544

XhmikosR's avatar
XhmikosR committed
1545
      if (_this3._config.pause === 'hover') {
XhmikosR's avatar
Dist.  
XhmikosR committed
1546
1547
1548
1549
1550
1551
1552
        // 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
1553
        _this3.pause();
XhmikosR's avatar
Dist.  
XhmikosR committed
1554

XhmikosR's avatar
XhmikosR committed
1555
1556
        if (_this3.touchTimeout) {
          clearTimeout(_this3.touchTimeout);
XhmikosR's avatar
Dist.  
XhmikosR committed
1557
1558
        }

XhmikosR's avatar
XhmikosR committed
1559
1560
1561
        _this3.touchTimeout = setTimeout(function (event) {
          return _this3.cycle(event);
        }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
XhmikosR's avatar
Dist.  
XhmikosR committed
1562
1563
1564
      }
    };

XhmikosR's avatar
XhmikosR committed
1565
1566
1567
1568
    makeArray(SelectorEngine.find(Selector$2.ITEM_IMG, this._element)).forEach(function (itemImg) {
      EventHandler.on(itemImg, Event$3.DRAG_START, function (e) {
        return e.preventDefault();
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
1569
1570
1571
    });

    if (this._pointerEvent) {
XhmikosR's avatar
XhmikosR committed
1572
1573
1574
1575
1576
1577
      EventHandler.on(this._element, Event$3.POINTERDOWN, function (event) {
        return start(event);
      });
      EventHandler.on(this._element, Event$3.POINTERUP, function (event) {
        return end(event);
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
1578
1579
1580

      this._element.classList.add(ClassName$2.POINTER_EVENT);
    } else {
XhmikosR's avatar
XhmikosR committed
1581
1582
1583
1584
1585
1586
1587
1588
1589
      EventHandler.on(this._element, Event$3.TOUCHSTART, function (event) {
        return start(event);
      });
      EventHandler.on(this._element, Event$3.TOUCHMOVE, function (event) {
        return move(event);
      });
      EventHandler.on(this._element, Event$3.TOUCHEND, function (event) {
        return end(event);
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
1590
    }
XhmikosR's avatar
XhmikosR committed
1591
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1592

XhmikosR's avatar
XhmikosR committed
1593
  _proto._keydown = function _keydown(event) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
    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
1609
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1610

XhmikosR's avatar
XhmikosR committed
1611
  _proto._getItemIndex = function _getItemIndex(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1612
1613
    this._items = element && element.parentNode ? makeArray(SelectorEngine.find(Selector$2.ITEM, element.parentNode)) : [];
    return this._items.indexOf(element);
XhmikosR's avatar
XhmikosR committed
1614
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1615

XhmikosR's avatar
XhmikosR committed
1616
1617
1618
  _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
    var isNextDirection = direction === Direction.NEXT;
    var isPrevDirection = direction === Direction.PREV;
XhmikosR's avatar
Dist.  
XhmikosR committed
1619

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

XhmikosR's avatar
XhmikosR committed
1622
1623
    var lastItemIndex = this._items.length - 1;
    var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
XhmikosR's avatar
Dist.  
XhmikosR committed
1624
1625
1626
1627
1628

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

XhmikosR's avatar
XhmikosR committed
1629
1630
    var delta = direction === Direction.PREV ? -1 : 1;
    var itemIndex = (activeIndex + delta) % this._items.length;
XhmikosR's avatar
Dist.  
XhmikosR committed
1631
    return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
XhmikosR's avatar
XhmikosR committed
1632
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1633

XhmikosR's avatar
XhmikosR committed
1634
1635
  _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
    var targetIndex = this._getItemIndex(relatedTarget);
XhmikosR's avatar
Dist.  
XhmikosR committed
1636

XhmikosR's avatar
XhmikosR committed
1637
    var fromIndex = this._getItemIndex(SelectorEngine.findOne(Selector$2.ACTIVE_ITEM, this._element));
XhmikosR's avatar
Dist.  
XhmikosR committed
1638
1639

    return EventHandler.trigger(this._element, Event$3.SLIDE, {
XhmikosR's avatar
XhmikosR committed
1640
      relatedTarget: relatedTarget,
XhmikosR's avatar
Dist.  
XhmikosR committed
1641
1642
1643
1644
      direction: eventDirectionName,
      from: fromIndex,
      to: targetIndex
    });
XhmikosR's avatar
XhmikosR committed
1645
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1646

XhmikosR's avatar
XhmikosR committed
1647
  _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1648
    if (this._indicatorsElement) {
XhmikosR's avatar
XhmikosR committed
1649
      var indicators = SelectorEngine.find(Selector$2.ACTIVE, this._indicatorsElement);
XhmikosR's avatar
Dist.  
XhmikosR committed
1650

XhmikosR's avatar
XhmikosR committed
1651
      for (var i = 0; i < indicators.length; i++) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1652
1653
1654
        indicators[i].classList.remove(ClassName$2.ACTIVE);
      }

XhmikosR's avatar
XhmikosR committed
1655
      var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
XhmikosR's avatar
Dist.  
XhmikosR committed
1656
1657
1658
1659
1660

      if (nextIndicator) {
        nextIndicator.classList.add(ClassName$2.ACTIVE);
      }
    }
XhmikosR's avatar
XhmikosR committed
1661
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1662

XhmikosR's avatar
XhmikosR committed
1663
1664
  _proto._slide = function _slide(direction, element) {
    var _this4 = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
1665

XhmikosR's avatar
XhmikosR committed
1666
    var activeElement = SelectorEngine.findOne(Selector$2.ACTIVE_ITEM, this._element);
XhmikosR's avatar
Dist.  
XhmikosR committed
1667

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

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

XhmikosR's avatar
XhmikosR committed
1672
1673
1674
1675
1676
1677
    var nextElementIndex = this._getItemIndex(nextElement);

    var isCycling = Boolean(this._interval);
    var directionalClassName;
    var orderClassName;
    var eventDirectionName;
XhmikosR's avatar
Dist.  
XhmikosR committed
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693

    if (direction === Direction.NEXT) {
      directionalClassName = ClassName$2.LEFT;
      orderClassName = ClassName$2.NEXT;
      eventDirectionName = Direction.LEFT;
    } else {
      directionalClassName = ClassName$2.RIGHT;
      orderClassName = ClassName$2.PREV;
      eventDirectionName = Direction.RIGHT;
    }

    if (nextElement && nextElement.classList.contains(ClassName$2.ACTIVE)) {
      this._isSliding = false;
      return;
    }

XhmikosR's avatar
XhmikosR committed
1694
    var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
XhmikosR's avatar
Dist.  
XhmikosR committed
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717

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

    if (this._element.classList.contains(ClassName$2.SLIDE)) {
      nextElement.classList.add(orderClassName);
      reflow(nextElement);
      activeElement.classList.add(directionalClassName);
      nextElement.classList.add(directionalClassName);
XhmikosR's avatar
XhmikosR committed
1718
      var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
XhmikosR's avatar
Dist.  
XhmikosR committed
1719
1720
1721
1722
1723
1724
1725
1726

      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
1727
1728
      var transitionDuration = getTransitionDurationFromElement(activeElement);
      EventHandler.one(activeElement, TRANSITION_END, function () {
XhmikosR's avatar
Dist.  
XhmikosR committed
1729
1730
1731
1732
1733
1734
        nextElement.classList.remove(directionalClassName);
        nextElement.classList.remove(orderClassName);
        nextElement.classList.add(ClassName$2.ACTIVE);
        activeElement.classList.remove(ClassName$2.ACTIVE);
        activeElement.classList.remove(orderClassName);
        activeElement.classList.remove(directionalClassName);
XhmikosR's avatar
XhmikosR committed
1735
1736
1737
        _this4._isSliding = false;
        setTimeout(function () {
          EventHandler.trigger(_this4._element, Event$3.SLID, {
XhmikosR's avatar
Dist.  
XhmikosR committed
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
            relatedTarget: nextElement,
            direction: eventDirectionName,
            from: activeElementIndex,
            to: nextElementIndex
          });
        }, 0);
      });
      emulateTransitionEnd(activeElement, transitionDuration);
    } else {
      activeElement.classList.remove(ClassName$2.ACTIVE);
      nextElement.classList.add(ClassName$2.ACTIVE);
      this._isSliding = false;
      EventHandler.trigger(this._element, Event$3.SLID, {
        relatedTarget: nextElement,
        direction: eventDirectionName,
        from: activeElementIndex,
        to: nextElementIndex
      });
    }

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

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

1767
    var _config = _objectSpread2({}, Default, {}, Manipulator.getDataAttributes(element));
XhmikosR's avatar
Dist.  
XhmikosR committed
1768
1769

    if (typeof config === 'object') {
1770
      _config = _objectSpread2({}, _config, {}, config);
XhmikosR's avatar
Dist.  
XhmikosR committed
1771
1772
    }

XhmikosR's avatar
XhmikosR committed
1773
    var action = typeof config === 'string' ? config : _config.slide;
XhmikosR's avatar
Dist.  
XhmikosR committed
1774
1775
1776
1777
1778
1779
1780
1781
1782

    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
1783
        throw new TypeError("No method named \"" + action + "\"");
XhmikosR's avatar
Dist.  
XhmikosR committed
1784
1785
1786
1787
1788
1789
1790
      }

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

XhmikosR's avatar
XhmikosR committed
1793
  Carousel.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1794
    return this.each(function () {
XhmikosR's avatar
XhmikosR committed
1795
      Carousel.carouselInterface(this, config);
XhmikosR's avatar
Dist.  
XhmikosR committed
1796
    });
XhmikosR's avatar
XhmikosR committed
1797
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1798

XhmikosR's avatar
XhmikosR committed
1799
1800
  Carousel.dataApiClickHandler = function dataApiClickHandler(event) {
    var target = getElementFromSelector(this);
XhmikosR's avatar
Dist.  
XhmikosR committed
1801
1802
1803
1804
1805

    if (!target || !target.classList.contains(ClassName$2.CAROUSEL)) {
      return;
    }

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

XhmikosR's avatar
XhmikosR committed
1808
    var slideIndex = this.getAttribute('data-slide-to');
XhmikosR's avatar
Dist.  
XhmikosR committed
1809
1810
1811
1812
1813

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

XhmikosR's avatar
XhmikosR committed
1814
    Carousel.carouselInterface(target, config);
XhmikosR's avatar
Dist.  
XhmikosR committed
1815
1816
1817
1818
1819
1820

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

    event.preventDefault();
XhmikosR's avatar
XhmikosR committed
1821
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1822

XhmikosR's avatar
XhmikosR committed
1823
  Carousel.getInstance = function getInstance(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1824
    return Data.getData(element, DATA_KEY$2);
XhmikosR's avatar
XhmikosR committed
1825
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
1826

XhmikosR's avatar
XhmikosR committed
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
  _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
1841
1842
1843
1844
1845
1846
1847
/**
 * ------------------------------------------------------------------------
 * Data Api implementation
 * ------------------------------------------------------------------------
 */


XhmikosR's avatar
XhmikosR committed
1848
EventHandler.on(document, Event$3.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel.dataApiClickHandler);
XhmikosR's avatar
XhmikosR committed
1849
1850
EventHandler.on(window, Event$3.LOAD_DATA_API, function () {
  var carousels = makeArray(SelectorEngine.find(Selector$2.DATA_RIDE));
XhmikosR's avatar
Dist.  
XhmikosR committed
1851

XhmikosR's avatar
XhmikosR committed
1852
  for (var i = 0, len = carousels.length; i < len; i++) {
XhmikosR's avatar
XhmikosR committed
1853
    Carousel.carouselInterface(carousels[i], Data.getData(carousels[i], DATA_KEY$2));
XhmikosR's avatar
Dist.  
XhmikosR committed
1854
1855
  }
});
XhmikosR's avatar
XhmikosR committed
1856
var $$3 = getjQuery();
XhmikosR's avatar
Dist.  
XhmikosR committed
1857
1858
1859
1860
1861
1862
1863
/**
 * ------------------------------------------------------------------------
 * jQuery
 * ------------------------------------------------------------------------
 * add .carousel to jQuery only if jQuery is present
 */

1864
1865
/* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
1866
1867
1868
1869
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
1870

XhmikosR's avatar
XhmikosR committed
1871
1872
1873
  $$3.fn[NAME$2].noConflict = function () {
    $$3.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
    return Carousel.jQueryInterface;
XhmikosR's avatar
Dist.  
XhmikosR committed
1874
1875
1876
1877
1878
1879
1880
1881
1882
  };
}

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

XhmikosR's avatar
XhmikosR committed
1883
1884
1885
1886
1887
1888
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
1889
1890
1891
  toggle: true,
  parent: ''
};
XhmikosR's avatar
XhmikosR committed
1892
var DefaultType$1 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
1893
1894
1895
  toggle: 'boolean',
  parent: '(string|element)'
};
XhmikosR's avatar
XhmikosR committed
1896
1897
1898
1899
1900
1901
var Event$4 = {
  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
XhmikosR's avatar
Dist.  
XhmikosR committed
1902
};
XhmikosR's avatar
XhmikosR committed
1903
var ClassName$3 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
1904
1905
1906
1907
1908
  SHOW: 'show',
  COLLAPSE: 'collapse',
  COLLAPSING: 'collapsing',
  COLLAPSED: 'collapsed'
};
XhmikosR's avatar
XhmikosR committed
1909
var Dimension = {
XhmikosR's avatar
Dist.  
XhmikosR committed
1910
1911
1912
  WIDTH: 'width',
  HEIGHT: 'height'
};
XhmikosR's avatar
XhmikosR committed
1913
var Selector$3 = {
XhmikosR's avatar
Dist.  
XhmikosR committed
1914
1915
1916
  ACTIVES: '.show, .collapsing',
  DATA_TOGGLE: '[data-toggle="collapse"]'
};
XhmikosR's avatar
XhmikosR committed
1917
1918
1919
1920
1921
/**
 * ------------------------------------------------------------------------
 * Class Definition
 * ------------------------------------------------------------------------
 */
XhmikosR's avatar
Dist.  
XhmikosR committed
1922

XhmikosR's avatar
XhmikosR committed
1923
1924
1925
1926
var Collapse =
/*#__PURE__*/
function () {
  function Collapse(element, config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
1927
1928
1929
    this._isTransitioning = false;
    this._element = element;
    this._config = this._getConfig(config);
XhmikosR's avatar
XhmikosR committed
1930
1931
1932
1933
1934
1935
1936
1937
1938
    this._triggerArray = makeArray(SelectorEngine.find("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
    var toggleList = makeArray(SelectorEngine.find(Selector$3.DATA_TOGGLE));

    for (var i = 0, len = toggleList.length; i < len; i++) {
      var elem = toggleList[i];
      var selector = getSelectorFromElement(elem);
      var filterElement = makeArray(SelectorEngine.find(selector)).filter(function (foundElem) {
        return foundElem === element;
      });
XhmikosR's avatar
Dist.  
XhmikosR committed
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960

      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
1961
  var _proto = Collapse.prototype;
XhmikosR's avatar
Dist.  
XhmikosR committed
1962

XhmikosR's avatar
XhmikosR committed
1963
1964
  // Public
  _proto.toggle = function toggle() {
XhmikosR's avatar
Dist.  
XhmikosR committed
1965
1966
1967
1968
1969
    if (this._element.classList.contains(ClassName$3.SHOW)) {
      this.hide();
    } else {
      this.show();
    }
XhmikosR's avatar
XhmikosR committed
1970
1971
1972
1973
  };

  _proto.show = function show() {
    var _this = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
1974
1975
1976
1977
1978

    if (this._isTransitioning || this._element.classList.contains(ClassName$3.SHOW)) {
      return;
    }

XhmikosR's avatar
XhmikosR committed
1979
1980
    var actives;
    var activesData;
XhmikosR's avatar
Dist.  
XhmikosR committed
1981
1982

    if (this._parent) {
XhmikosR's avatar
XhmikosR committed
1983
1984
1985
      actives = makeArray(SelectorEngine.find(Selector$3.ACTIVES, this._parent)).filter(function (elem) {
        if (typeof _this._config.parent === 'string') {
          return elem.getAttribute('data-parent') === _this._config.parent;
XhmikosR's avatar
Dist.  
XhmikosR committed
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
        }

        return elem.classList.contains(ClassName$3.COLLAPSE);
      });

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

XhmikosR's avatar
XhmikosR committed
1996
    var container = SelectorEngine.findOne(this._selector);
XhmikosR's avatar
Dist.  
XhmikosR committed
1997
1998

    if (actives) {
XhmikosR's avatar
XhmikosR committed
1999
2000
      var tempActiveData = actives.filter(function (elem) {
        return container !== elem;
For faster browsing, not all history is shown. View entire blame