bootstrap.js 94.2 KB
Newer Older
1
/*!
Mark Otto's avatar
grunt    
Mark Otto committed
2
 * Bootstrap v4.0.0-alpha.4 (https://getbootstrap.com)
Chris Rebert's avatar
grunt    
Chris Rebert committed
3
 * Copyright 2011-2016 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
Mark Otto's avatar
Mark Otto committed
4
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
Jacob Thornton's avatar
Jacob Thornton committed
5
6
7
8
9
10
11
12
 */

if (typeof jQuery === 'undefined') {
  throw new Error('Bootstrap\'s JavaScript requires jQuery')
}

+function ($) {
  var version = $.fn.jquery.split(' ')[0].split('.')
XhmikosR's avatar
XhmikosR committed
13
14
  if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] >= 4)) {
    throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0')
Jacob Thornton's avatar
Jacob Thornton committed
15
  }
Jacob Thornton's avatar
Jacob Thornton committed
16
17
18
}(jQuery);


Mark Otto's avatar
grunt    
Mark Otto committed
19
20
21
22
23
24
25
26
27
28
29
+function () {

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
Jacob Thornton's avatar
Jacob Thornton committed
30
31
32

/**
 * --------------------------------------------------------------------------
Mark Otto's avatar
Mark Otto committed
33
 * Bootstrap (v4.0.0-alpha.4): util.js
Jacob Thornton's avatar
Jacob Thornton committed
34
35
36
37
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * --------------------------------------------------------------------------
 */

Mark Otto's avatar
grunt    
Mark Otto committed
38
var Util = function ($) {
Jacob Thornton's avatar
Jacob Thornton committed
39
40
41
42
43
44
45
46
47

  /**
   * ------------------------------------------------------------------------
   * Private TransitionEnd Helpers
   * ------------------------------------------------------------------------
   */

  var transition = false;

Chris Rebert's avatar
grunt    
Chris Rebert committed
48
49
  var MAX_UID = 1000000;

Jacob Thornton's avatar
Jacob Thornton committed
50
51
52
53
54
55
56
57
58
  var TransitionEndEvent = {
    WebkitTransition: 'webkitTransitionEnd',
    MozTransition: 'transitionend',
    OTransition: 'oTransitionEnd otransitionend',
    transition: 'transitionend'
  };

  // shoutout AngusCroll (https://goo.gl/pxwQGp)
  function toType(obj) {
Mark Otto's avatar
grunt    
Mark Otto committed
59
    return {}.toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase();
Jacob Thornton's avatar
Jacob Thornton committed
60
61
62
63
64
65
66
67
68
69
70
71
  }

  function isElement(obj) {
    return (obj[0] || obj).nodeType;
  }

  function getSpecialTransitionEndEvent() {
    return {
      bindType: transition.end,
      delegateType: transition.end,
      handle: function handle(event) {
        if ($(event.target).is(this)) {
72
          return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
Jacob Thornton's avatar
Jacob Thornton committed
73
        }
Chris Rebert's avatar
grunt    
Chris Rebert committed
74
        return undefined;
Jacob Thornton's avatar
Jacob Thornton committed
75
76
77
78
79
80
81
82
83
84
85
      }
    };
  }

  function transitionEndTest() {
    if (window.QUnit) {
      return false;
    }

    var el = document.createElement('bootstrap');

Mark Otto's avatar
grunt    
Mark Otto committed
86
87
88
    for (var name in TransitionEndEvent) {
      if (el.style[name] !== undefined) {
        return { end: TransitionEndEvent[name] };
Jacob Thornton's avatar
Jacob Thornton committed
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
      }
    }

    return false;
  }

  function transitionEndEmulator(duration) {
    var _this = this;

    var called = false;

    $(this).one(Util.TRANSITION_END, function () {
      called = true;
    });

    setTimeout(function () {
      if (!called) {
        Util.triggerTransitionEnd(_this);
      }
    }, duration);

    return this;
  }

  function setTransitionEndSupport() {
    transition = transitionEndTest();

    $.fn.emulateTransitionEnd = transitionEndEmulator;

    if (Util.supportsTransitionEnd()) {
      $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
    }
  }

  /**
   * --------------------------------------------------------------------------
   * Public Util Api
   * --------------------------------------------------------------------------
   */

  var Util = {

    TRANSITION_END: 'bsTransitionEnd',

    getUID: function getUID(prefix) {
Jacob Thornton's avatar
Jacob Thornton committed
134
      do {
Chris Rebert's avatar
Chris Rebert committed
135
        /* eslint-disable no-bitwise */
Mark Otto's avatar
grunt    
Mark Otto committed
136
        prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
Chris Rebert's avatar
Chris Rebert committed
137
        /* eslint-enable no-bitwise */
Jacob Thornton's avatar
Jacob Thornton committed
138
      } while (document.getElementById(prefix));
Jacob Thornton's avatar
Jacob Thornton committed
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
      return prefix;
    },
    getSelectorFromElement: function getSelectorFromElement(element) {
      var selector = element.getAttribute('data-target');

      if (!selector) {
        selector = element.getAttribute('href') || '';
        selector = /^#[a-z]/i.test(selector) ? selector : null;
      }

      return selector;
    },
    reflow: function reflow(element) {
      new Function('bs', 'return bs')(element.offsetHeight);
    },
    triggerTransitionEnd: function triggerTransitionEnd(element) {
      $(element).trigger(transition.end);
    },
    supportsTransitionEnd: function supportsTransitionEnd() {
Jacob Thornton's avatar
Jacob Thornton committed
158
      return Boolean(transition);
Jacob Thornton's avatar
Jacob Thornton committed
159
160
161
    },
    typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
      for (var property in configTypes) {
Jacob Thornton's avatar
Jacob Thornton committed
162
163
164
        if (configTypes.hasOwnProperty(property)) {
          var expectedTypes = configTypes[property];
          var value = config[property];
Mark Otto's avatar
grunt    
Mark Otto committed
165
          var valueType = void 0;
Jacob Thornton's avatar
Jacob Thornton committed
166

Jacob Thornton's avatar
Jacob Thornton committed
167
168
169
170
171
          if (value && isElement(value)) {
            valueType = 'element';
          } else {
            valueType = toType(value);
          }
Jacob Thornton's avatar
Jacob Thornton committed
172

Jacob Thornton's avatar
Jacob Thornton committed
173
174
175
          if (!new RegExp(expectedTypes).test(valueType)) {
            throw new Error(componentName.toUpperCase() + ': ' + ('Option "' + property + '" provided type "' + valueType + '" ') + ('but expected type "' + expectedTypes + '".'));
          }
Jacob Thornton's avatar
Jacob Thornton committed
176
177
178
179
180
181
182
183
        }
      }
    }
  };

  setTransitionEndSupport();

  return Util;
Mark Otto's avatar
grunt    
Mark Otto committed
184
}(jQuery);
Jacob Thornton's avatar
Jacob Thornton committed
185
186
187

/**
 * --------------------------------------------------------------------------
Mark Otto's avatar
Mark Otto committed
188
 * Bootstrap (v4.0.0-alpha.4): alert.js
Jacob Thornton's avatar
Jacob Thornton committed
189
190
191
192
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * --------------------------------------------------------------------------
 */

Mark Otto's avatar
grunt    
Mark Otto committed
193
var Alert = function ($) {
Jacob Thornton's avatar
Jacob Thornton committed
194
195
196
197
198
199
200
201

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

  var NAME = 'alert';
Mark Otto's avatar
Mark Otto committed
202
  var VERSION = '4.0.0-alpha.4';
Jacob Thornton's avatar
Jacob Thornton committed
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
  var DATA_KEY = 'bs.alert';
  var EVENT_KEY = '.' + DATA_KEY;
  var DATA_API_KEY = '.data-api';
  var JQUERY_NO_CONFLICT = $.fn[NAME];
  var TRANSITION_DURATION = 150;

  var Selector = {
    DISMISS: '[data-dismiss="alert"]'
  };

  var Event = {
    CLOSE: 'close' + EVENT_KEY,
    CLOSED: 'closed' + EVENT_KEY,
    CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
  };

  var ClassName = {
    ALERT: 'alert',
    FADE: 'fade',
    IN: 'in'
  };

  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */

Mark Otto's avatar
grunt    
Mark Otto committed
231
  var Alert = function () {
Jacob Thornton's avatar
Jacob Thornton committed
232
233
234
235
236
237
238
239
    function Alert(element) {
      _classCallCheck(this, Alert);

      this._element = element;
    }

    // getters

Mark Otto's avatar
grunt    
Mark Otto committed
240
    // public
Jacob Thornton's avatar
Jacob Thornton committed
241

Mark Otto's avatar
grunt    
Mark Otto committed
242
243
    Alert.prototype.close = function close(element) {
      element = element || this._element;
Jacob Thornton's avatar
Jacob Thornton committed
244

Mark Otto's avatar
grunt    
Mark Otto committed
245
246
247
248
249
250
      var rootElement = this._getRootElement(element);
      var customEvent = this._triggerCloseEvent(rootElement);

      if (customEvent.isDefaultPrevented()) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
251

Mark Otto's avatar
grunt    
Mark Otto committed
252
253
      this._removeElement(rootElement);
    };
Jacob Thornton's avatar
Jacob Thornton committed
254

Mark Otto's avatar
grunt    
Mark Otto committed
255
256
257
258
259
260
    Alert.prototype.dispose = function dispose() {
      $.removeData(this._element, DATA_KEY);
      this._element = null;
    };

    // private
Jacob Thornton's avatar
Jacob Thornton committed
261

Mark Otto's avatar
grunt    
Mark Otto committed
262
263
264
265
266
267
    Alert.prototype._getRootElement = function _getRootElement(element) {
      var selector = Util.getSelectorFromElement(element);
      var parent = false;

      if (selector) {
        parent = $(selector)[0];
Jacob Thornton's avatar
Jacob Thornton committed
268
      }
Mark Otto's avatar
grunt    
Mark Otto committed
269
270
271

      if (!parent) {
        parent = $(element).closest('.' + ClassName.ALERT)[0];
Jacob Thornton's avatar
Jacob Thornton committed
272
273
      }

Mark Otto's avatar
grunt    
Mark Otto committed
274
275
      return parent;
    };
Jacob Thornton's avatar
Jacob Thornton committed
276

Mark Otto's avatar
grunt    
Mark Otto committed
277
278
    Alert.prototype._triggerCloseEvent = function _triggerCloseEvent(element) {
      var closeEvent = $.Event(Event.CLOSE);
Jacob Thornton's avatar
Jacob Thornton committed
279

Mark Otto's avatar
grunt    
Mark Otto committed
280
281
282
      $(element).trigger(closeEvent);
      return closeEvent;
    };
Jacob Thornton's avatar
Jacob Thornton committed
283

Mark Otto's avatar
grunt    
Mark Otto committed
284
285
    Alert.prototype._removeElement = function _removeElement(element) {
      $(element).removeClass(ClassName.IN);
Jacob Thornton's avatar
Jacob Thornton committed
286

Mark Otto's avatar
grunt    
Mark Otto committed
287
288
289
      if (!Util.supportsTransitionEnd() || !$(element).hasClass(ClassName.FADE)) {
        this._destroyElement(element);
        return;
Jacob Thornton's avatar
Jacob Thornton committed
290
      }
Jacob Thornton's avatar
Jacob Thornton committed
291

Mark Otto's avatar
grunt    
Mark Otto committed
292
293
      $(element).one(Util.TRANSITION_END, $.proxy(this._destroyElement, this, element)).emulateTransitionEnd(TRANSITION_DURATION);
    };
Jacob Thornton's avatar
Jacob Thornton committed
294

Mark Otto's avatar
grunt    
Mark Otto committed
295
296
297
    Alert.prototype._destroyElement = function _destroyElement(element) {
      $(element).detach().trigger(Event.CLOSED).remove();
    };
Jacob Thornton's avatar
Jacob Thornton committed
298

Mark Otto's avatar
grunt    
Mark Otto committed
299
    // static
Jacob Thornton's avatar
Jacob Thornton committed
300

Mark Otto's avatar
grunt    
Mark Otto committed
301
302
303
304
    Alert._jQueryInterface = function _jQueryInterface(config) {
      return this.each(function () {
        var $element = $(this);
        var data = $element.data(DATA_KEY);
Jacob Thornton's avatar
Jacob Thornton committed
305

Mark Otto's avatar
grunt    
Mark Otto committed
306
307
308
309
        if (!data) {
          data = new Alert(this);
          $element.data(DATA_KEY, data);
        }
Jacob Thornton's avatar
Jacob Thornton committed
310

Mark Otto's avatar
grunt    
Mark Otto committed
311
312
313
314
315
        if (config === 'close') {
          data[config](this);
        }
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
316

Mark Otto's avatar
grunt    
Mark Otto committed
317
318
319
320
321
    Alert._handleDismiss = function _handleDismiss(alertInstance) {
      return function (event) {
        if (event) {
          event.preventDefault();
        }
Jacob Thornton's avatar
Jacob Thornton committed
322

Mark Otto's avatar
grunt    
Mark Otto committed
323
324
325
326
327
        alertInstance.close(this);
      };
    };

    _createClass(Alert, null, [{
Jacob Thornton's avatar
Jacob Thornton committed
328
329
330
331
332
333
334
      key: 'VERSION',
      get: function get() {
        return VERSION;
      }
    }]);

    return Alert;
Mark Otto's avatar
grunt    
Mark Otto committed
335
336
337
338
339
340
341
  }();

  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358

  $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));

  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
   */

  $.fn[NAME] = Alert._jQueryInterface;
  $.fn[NAME].Constructor = Alert;
  $.fn[NAME].noConflict = function () {
    $.fn[NAME] = JQUERY_NO_CONFLICT;
    return Alert._jQueryInterface;
  };

  return Alert;
Mark Otto's avatar
grunt    
Mark Otto committed
359
}(jQuery);
Jacob Thornton's avatar
Jacob Thornton committed
360
361
362

/**
 * --------------------------------------------------------------------------
Mark Otto's avatar
Mark Otto committed
363
 * Bootstrap (v4.0.0-alpha.4): button.js
Jacob Thornton's avatar
Jacob Thornton committed
364
365
366
367
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * --------------------------------------------------------------------------
 */

Mark Otto's avatar
grunt    
Mark Otto committed
368
var Button = function ($) {
Jacob Thornton's avatar
Jacob Thornton committed
369
370
371
372
373
374
375
376

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

  var NAME = 'button';
Mark Otto's avatar
Mark Otto committed
377
  var VERSION = '4.0.0-alpha.4';
Jacob Thornton's avatar
Jacob Thornton committed
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
  var DATA_KEY = 'bs.button';
  var EVENT_KEY = '.' + DATA_KEY;
  var DATA_API_KEY = '.data-api';
  var JQUERY_NO_CONFLICT = $.fn[NAME];

  var ClassName = {
    ACTIVE: 'active',
    BUTTON: 'btn',
    FOCUS: 'focus'
  };

  var Selector = {
    DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
    DATA_TOGGLE: '[data-toggle="buttons"]',
    INPUT: 'input',
    ACTIVE: '.active',
    BUTTON: '.btn'
  };

  var Event = {
    CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY,
    FOCUS_BLUR_DATA_API: 'focus' + EVENT_KEY + DATA_API_KEY + ' ' + ('blur' + EVENT_KEY + DATA_API_KEY)
  };

  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */

Mark Otto's avatar
grunt    
Mark Otto committed
408
  var Button = function () {
Jacob Thornton's avatar
Jacob Thornton committed
409
410
411
412
413
414
415
416
    function Button(element) {
      _classCallCheck(this, Button);

      this._element = element;
    }

    // getters

Mark Otto's avatar
grunt    
Mark Otto committed
417
    // public
Jacob Thornton's avatar
Jacob Thornton committed
418

Mark Otto's avatar
grunt    
Mark Otto committed
419
420
421
    Button.prototype.toggle = function toggle() {
      var triggerChangeEvent = true;
      var rootElement = $(this._element).closest(Selector.DATA_TOGGLE)[0];
Jacob Thornton's avatar
Jacob Thornton committed
422

Mark Otto's avatar
grunt    
Mark Otto committed
423
424
      if (rootElement) {
        var input = $(this._element).find(Selector.INPUT)[0];
Jacob Thornton's avatar
Jacob Thornton committed
425

Mark Otto's avatar
grunt    
Mark Otto committed
426
427
428
429
430
431
        if (input) {
          if (input.type === 'radio') {
            if (input.checked && $(this._element).hasClass(ClassName.ACTIVE)) {
              triggerChangeEvent = false;
            } else {
              var activeElement = $(rootElement).find(Selector.ACTIVE)[0];
Jacob Thornton's avatar
Jacob Thornton committed
432

Mark Otto's avatar
grunt    
Mark Otto committed
433
434
              if (activeElement) {
                $(activeElement).removeClass(ClassName.ACTIVE);
Jacob Thornton's avatar
Jacob Thornton committed
435
436
              }
            }
Mark Otto's avatar
grunt    
Mark Otto committed
437
          }
Jacob Thornton's avatar
Jacob Thornton committed
438

Mark Otto's avatar
grunt    
Mark Otto committed
439
440
441
          if (triggerChangeEvent) {
            input.checked = !$(this._element).hasClass(ClassName.ACTIVE);
            $(this._element).trigger('change');
Jacob Thornton's avatar
Jacob Thornton committed
442
443
          }

Mark Otto's avatar
grunt    
Mark Otto committed
444
          input.focus();
Jacob Thornton's avatar
Jacob Thornton committed
445
        }
Mark Otto's avatar
grunt    
Mark Otto committed
446
447
      } else {
        this._element.setAttribute('aria-pressed', !$(this._element).hasClass(ClassName.ACTIVE));
Jacob Thornton's avatar
Jacob Thornton committed
448
      }
Mark Otto's avatar
grunt    
Mark Otto committed
449
450
451

      if (triggerChangeEvent) {
        $(this._element).toggleClass(ClassName.ACTIVE);
Jacob Thornton's avatar
Jacob Thornton committed
452
      }
Mark Otto's avatar
grunt    
Mark Otto committed
453
    };
Jacob Thornton's avatar
Jacob Thornton committed
454

Mark Otto's avatar
grunt    
Mark Otto committed
455
456
457
458
    Button.prototype.dispose = function dispose() {
      $.removeData(this._element, DATA_KEY);
      this._element = null;
    };
Jacob Thornton's avatar
Jacob Thornton committed
459

Mark Otto's avatar
grunt    
Mark Otto committed
460
    // static
Jacob Thornton's avatar
Jacob Thornton committed
461

Mark Otto's avatar
grunt    
Mark Otto committed
462
463
464
    Button._jQueryInterface = function _jQueryInterface(config) {
      return this.each(function () {
        var data = $(this).data(DATA_KEY);
Jacob Thornton's avatar
Jacob Thornton committed
465

Mark Otto's avatar
grunt    
Mark Otto committed
466
467
468
469
470
471
472
473
474
475
476
477
        if (!data) {
          data = new Button(this);
          $(this).data(DATA_KEY, data);
        }

        if (config === 'toggle') {
          data[config]();
        }
      });
    };

    _createClass(Button, null, [{
Jacob Thornton's avatar
Jacob Thornton committed
478
479
480
481
482
483
484
      key: 'VERSION',
      get: function get() {
        return VERSION;
      }
    }]);

    return Button;
Mark Otto's avatar
grunt    
Mark Otto committed
485
486
487
488
489
490
491
  }();

  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521

  $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
    event.preventDefault();

    var button = event.target;

    if (!$(button).hasClass(ClassName.BUTTON)) {
      button = $(button).closest(Selector.BUTTON);
    }

    Button._jQueryInterface.call($(button), 'toggle');
  }).on(Event.FOCUS_BLUR_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
    var button = $(event.target).closest(Selector.BUTTON)[0];
    $(button).toggleClass(ClassName.FOCUS, /^focus(in)?$/.test(event.type));
  });

  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
   */

  $.fn[NAME] = Button._jQueryInterface;
  $.fn[NAME].Constructor = Button;
  $.fn[NAME].noConflict = function () {
    $.fn[NAME] = JQUERY_NO_CONFLICT;
    return Button._jQueryInterface;
  };

  return Button;
Mark Otto's avatar
grunt    
Mark Otto committed
522
}(jQuery);
Jacob Thornton's avatar
Jacob Thornton committed
523
524
525

/**
 * --------------------------------------------------------------------------
Mark Otto's avatar
Mark Otto committed
526
 * Bootstrap (v4.0.0-alpha.4): carousel.js
Jacob Thornton's avatar
Jacob Thornton committed
527
528
529
530
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * --------------------------------------------------------------------------
 */

Mark Otto's avatar
grunt    
Mark Otto committed
531
var Carousel = function ($) {
Jacob Thornton's avatar
Jacob Thornton committed
532
533
534
535
536
537
538
539

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

  var NAME = 'carousel';
Mark Otto's avatar
Mark Otto committed
540
  var VERSION = '4.0.0-alpha.4';
Jacob Thornton's avatar
Jacob Thornton committed
541
542
543
544
545
  var DATA_KEY = 'bs.carousel';
  var EVENT_KEY = '.' + DATA_KEY;
  var DATA_API_KEY = '.data-api';
  var JQUERY_NO_CONFLICT = $.fn[NAME];
  var TRANSITION_DURATION = 600;
Chris Rebert's avatar
grunt    
Chris Rebert committed
546
547
  var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
Jacob Thornton's avatar
Jacob Thornton committed
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604

  var Default = {
    interval: 5000,
    keyboard: true,
    slide: false,
    pause: 'hover',
    wrap: true
  };

  var DefaultType = {
    interval: '(number|boolean)',
    keyboard: 'boolean',
    slide: '(boolean|string)',
    pause: '(string|boolean)',
    wrap: 'boolean'
  };

  var Direction = {
    NEXT: 'next',
    PREVIOUS: 'prev'
  };

  var Event = {
    SLIDE: 'slide' + EVENT_KEY,
    SLID: 'slid' + EVENT_KEY,
    KEYDOWN: 'keydown' + EVENT_KEY,
    MOUSEENTER: 'mouseenter' + EVENT_KEY,
    MOUSELEAVE: 'mouseleave' + EVENT_KEY,
    LOAD_DATA_API: 'load' + EVENT_KEY + DATA_API_KEY,
    CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
  };

  var ClassName = {
    CAROUSEL: 'carousel',
    ACTIVE: 'active',
    SLIDE: 'slide',
    RIGHT: 'right',
    LEFT: 'left',
    ITEM: 'carousel-item'
  };

  var Selector = {
    ACTIVE: '.active',
    ACTIVE_ITEM: '.active.carousel-item',
    ITEM: '.carousel-item',
    NEXT_PREV: '.next, .prev',
    INDICATORS: '.carousel-indicators',
    DATA_SLIDE: '[data-slide], [data-slide-to]',
    DATA_RIDE: '[data-ride="carousel"]'
  };

  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */

Mark Otto's avatar
grunt    
Mark Otto committed
605
  var Carousel = function () {
Jacob Thornton's avatar
Jacob Thornton committed
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
    function Carousel(element, config) {
      _classCallCheck(this, Carousel);

      this._items = null;
      this._interval = null;
      this._activeElement = null;

      this._isPaused = false;
      this._isSliding = false;

      this._config = this._getConfig(config);
      this._element = $(element)[0];
      this._indicatorsElement = $(this._element).find(Selector.INDICATORS)[0];

      this._addEventListeners();
    }

    // getters

Mark Otto's avatar
grunt    
Mark Otto committed
625
    // public
Jacob Thornton's avatar
Jacob Thornton committed
626

Mark Otto's avatar
grunt    
Mark Otto committed
627
628
629
630
631
    Carousel.prototype.next = function next() {
      if (!this._isSliding) {
        this._slide(Direction.NEXT);
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
632

Mark Otto's avatar
grunt    
Mark Otto committed
633
634
635
636
    Carousel.prototype.nextWhenVisible = function nextWhenVisible() {
      // Don't call next when the page isn't visible
      if (!document.hidden) {
        this.next();
Jacob Thornton's avatar
Jacob Thornton committed
637
      }
Mark Otto's avatar
grunt    
Mark Otto committed
638
639
640
641
642
    };

    Carousel.prototype.prev = function prev() {
      if (!this._isSliding) {
        this._slide(Direction.PREVIOUS);
XhmikosR's avatar
XhmikosR committed
643
      }
Mark Otto's avatar
grunt    
Mark Otto committed
644
645
646
647
648
    };

    Carousel.prototype.pause = function pause(event) {
      if (!event) {
        this._isPaused = true;
Jacob Thornton's avatar
Jacob Thornton committed
649
650
      }

Mark Otto's avatar
grunt    
Mark Otto committed
651
652
653
654
655
656
657
658
659
660
661
662
663
      if ($(this._element).find(Selector.NEXT_PREV)[0] && Util.supportsTransitionEnd()) {
        Util.triggerTransitionEnd(this._element);
        this.cycle(true);
      }

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

    Carousel.prototype.cycle = function cycle(event) {
      if (!event) {
        this._isPaused = false;
      }
Jacob Thornton's avatar
Jacob Thornton committed
664

Mark Otto's avatar
grunt    
Mark Otto committed
665
      if (this._interval) {
Jacob Thornton's avatar
Jacob Thornton committed
666
667
668
669
        clearInterval(this._interval);
        this._interval = null;
      }

Mark Otto's avatar
grunt    
Mark Otto committed
670
671
672
673
      if (this._config.interval && !this._isPaused) {
        this._interval = setInterval($.proxy(document.visibilityState ? this.nextWhenVisible : this.next, this), this._config.interval);
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
674

Mark Otto's avatar
grunt    
Mark Otto committed
675
676
677
678
679
680
681
682
683
    Carousel.prototype.to = function to(index) {
      var _this2 = this;

      this._activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0];

      var activeIndex = this._getItemIndex(this._activeElement);

      if (index > this._items.length - 1 || index < 0) {
        return;
Jacob Thornton's avatar
Jacob Thornton committed
684
685
      }

Mark Otto's avatar
grunt    
Mark Otto committed
686
687
688
689
690
691
      if (this._isSliding) {
        $(this._element).one(Event.SLID, function () {
          return _this2.to(index);
        });
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
692

Mark Otto's avatar
grunt    
Mark Otto committed
693
694
695
696
697
      if (activeIndex === index) {
        this.pause();
        this.cycle();
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
698

Mark Otto's avatar
grunt    
Mark Otto committed
699
      var direction = index > activeIndex ? Direction.NEXT : Direction.PREVIOUS;
Jacob Thornton's avatar
Jacob Thornton committed
700

Mark Otto's avatar
grunt    
Mark Otto committed
701
702
      this._slide(direction, this._items[index]);
    };
Jacob Thornton's avatar
Jacob Thornton committed
703

Mark Otto's avatar
grunt    
Mark Otto committed
704
705
706
    Carousel.prototype.dispose = function dispose() {
      $(this._element).off(EVENT_KEY);
      $.removeData(this._element, DATA_KEY);
Jacob Thornton's avatar
Jacob Thornton committed
707

Mark Otto's avatar
grunt    
Mark Otto committed
708
709
710
711
712
713
714
715
716
      this._items = null;
      this._config = null;
      this._element = null;
      this._interval = null;
      this._isPaused = null;
      this._isSliding = null;
      this._activeElement = null;
      this._indicatorsElement = null;
    };
Jacob Thornton's avatar
Jacob Thornton committed
717

Mark Otto's avatar
grunt    
Mark Otto committed
718
    // private
Jacob Thornton's avatar
Jacob Thornton committed
719

Mark Otto's avatar
grunt    
Mark Otto committed
720
721
722
723
724
    Carousel.prototype._getConfig = function _getConfig(config) {
      config = $.extend({}, Default, config);
      Util.typeCheckConfig(NAME, config, DefaultType);
      return config;
    };
Jacob Thornton's avatar
Jacob Thornton committed
725

Mark Otto's avatar
grunt    
Mark Otto committed
726
727
728
    Carousel.prototype._addEventListeners = function _addEventListeners() {
      if (this._config.keyboard) {
        $(this._element).on(Event.KEYDOWN, $.proxy(this._keydown, this));
Jacob Thornton's avatar
Jacob Thornton committed
729
730
      }

Mark Otto's avatar
grunt    
Mark Otto committed
731
732
      if (this._config.pause === 'hover' && !('ontouchstart' in document.documentElement)) {
        $(this._element).on(Event.MOUSEENTER, $.proxy(this.pause, this)).on(Event.MOUSELEAVE, $.proxy(this.cycle, this));
Jacob Thornton's avatar
Jacob Thornton committed
733
      }
Mark Otto's avatar
grunt    
Mark Otto committed
734
    };
Jacob Thornton's avatar
Jacob Thornton committed
735

Mark Otto's avatar
grunt    
Mark Otto committed
736
737
    Carousel.prototype._keydown = function _keydown(event) {
      event.preventDefault();
Jacob Thornton's avatar
Jacob Thornton committed
738

Mark Otto's avatar
grunt    
Mark Otto committed
739
740
      if (/input|textarea/i.test(event.target.tagName)) {
        return;
Jacob Thornton's avatar
Jacob Thornton committed
741
      }
Mark Otto's avatar
grunt    
Mark Otto committed
742
743
744
745
746
747
748
749
750
751

      switch (event.which) {
        case ARROW_LEFT_KEYCODE:
          this.prev();
          break;
        case ARROW_RIGHT_KEYCODE:
          this.next();
          break;
        default:
          return;
Jacob Thornton's avatar
Jacob Thornton committed
752
      }
Mark Otto's avatar
grunt    
Mark Otto committed
753
    };
Jacob Thornton's avatar
Jacob Thornton committed
754

Mark Otto's avatar
grunt    
Mark Otto committed
755
756
757
758
    Carousel.prototype._getItemIndex = function _getItemIndex(element) {
      this._items = $.makeArray($(element).parent().find(Selector.ITEM));
      return this._items.indexOf(element);
    };
Jacob Thornton's avatar
Jacob Thornton committed
759

Mark Otto's avatar
grunt    
Mark Otto committed
760
761
762
763
764
765
    Carousel.prototype._getItemByDirection = function _getItemByDirection(direction, activeElement) {
      var isNextDirection = direction === Direction.NEXT;
      var isPrevDirection = direction === Direction.PREVIOUS;
      var activeIndex = this._getItemIndex(activeElement);
      var lastItemIndex = this._items.length - 1;
      var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
Jacob Thornton's avatar
Jacob Thornton committed
766

Mark Otto's avatar
grunt    
Mark Otto committed
767
768
      if (isGoingToWrap && !this._config.wrap) {
        return activeElement;
Jacob Thornton's avatar
Jacob Thornton committed
769
770
      }

Mark Otto's avatar
grunt    
Mark Otto committed
771
772
      var delta = direction === Direction.PREVIOUS ? -1 : 1;
      var itemIndex = (activeIndex + delta) % this._items.length;
Jacob Thornton's avatar
Jacob Thornton committed
773

Mark Otto's avatar
grunt    
Mark Otto committed
774
775
      return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
    };
Jacob Thornton's avatar
Jacob Thornton committed
776

Mark Otto's avatar
grunt    
Mark Otto committed
777
778
779
780
781
    Carousel.prototype._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, directionalClassname) {
      var slideEvent = $.Event(Event.SLIDE, {
        relatedTarget: relatedTarget,
        direction: directionalClassname
      });
Jacob Thornton's avatar
Jacob Thornton committed
782

Mark Otto's avatar
grunt    
Mark Otto committed
783
      $(this._element).trigger(slideEvent);
Jacob Thornton's avatar
Jacob Thornton committed
784

Mark Otto's avatar
grunt    
Mark Otto committed
785
786
      return slideEvent;
    };
Jacob Thornton's avatar
Jacob Thornton committed
787

Mark Otto's avatar
grunt    
Mark Otto committed
788
789
790
    Carousel.prototype._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
      if (this._indicatorsElement) {
        $(this._indicatorsElement).find(Selector.ACTIVE).removeClass(ClassName.ACTIVE);
Jacob Thornton's avatar
Jacob Thornton committed
791

Mark Otto's avatar
grunt    
Mark Otto committed
792
        var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
Jacob Thornton's avatar
Jacob Thornton committed
793

Mark Otto's avatar
grunt    
Mark Otto committed
794
795
        if (nextIndicator) {
          $(nextIndicator).addClass(ClassName.ACTIVE);
Jacob Thornton's avatar
Jacob Thornton committed
796
        }
Mark Otto's avatar
grunt    
Mark Otto committed
797
798
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
799

Mark Otto's avatar
grunt    
Mark Otto committed
800
801
    Carousel.prototype._slide = function _slide(direction, element) {
      var _this3 = this;
Jacob Thornton's avatar
Jacob Thornton committed
802

Mark Otto's avatar
grunt    
Mark Otto committed
803
804
      var activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0];
      var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
Jacob Thornton's avatar
Jacob Thornton committed
805

Mark Otto's avatar
grunt    
Mark Otto committed
806
      var isCycling = Boolean(this._interval);
Jacob Thornton's avatar
Jacob Thornton committed
807

Mark Otto's avatar
grunt    
Mark Otto committed
808
809
810
811
812
813
      var directionalClassName = direction === Direction.NEXT ? ClassName.LEFT : ClassName.RIGHT;

      if (nextElement && $(nextElement).hasClass(ClassName.ACTIVE)) {
        this._isSliding = false;
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
814

Mark Otto's avatar
grunt    
Mark Otto committed
815
816
817
818
      var slideEvent = this._triggerSlideEvent(nextElement, directionalClassName);
      if (slideEvent.isDefaultPrevented()) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
819

Mark Otto's avatar
grunt    
Mark Otto committed
820
821
822
823
      if (!activeElement || !nextElement) {
        // some weirdness is happening, so we bail
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
824

Mark Otto's avatar
grunt    
Mark Otto committed
825
826
827
828
829
      this._isSliding = true;

      if (isCycling) {
        this.pause();
      }
Jacob Thornton's avatar
Jacob Thornton committed
830

Mark Otto's avatar
grunt    
Mark Otto committed
831
      this._setActiveIndicatorElement(nextElement);
Jacob Thornton's avatar
Jacob Thornton committed
832

Mark Otto's avatar
grunt    
Mark Otto committed
833
834
835
836
      var slidEvent = $.Event(Event.SLID, {
        relatedTarget: nextElement,
        direction: directionalClassName
      });
Jacob Thornton's avatar
Jacob Thornton committed
837

Mark Otto's avatar
grunt    
Mark Otto committed
838
      if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.SLIDE)) {
Jacob Thornton's avatar
Jacob Thornton committed
839

Mark Otto's avatar
grunt    
Mark Otto committed
840
        $(nextElement).addClass(direction);
Jacob Thornton's avatar
Jacob Thornton committed
841

Mark Otto's avatar
grunt    
Mark Otto committed
842
        Util.reflow(nextElement);
Jacob Thornton's avatar
Jacob Thornton committed
843

Mark Otto's avatar
grunt    
Mark Otto committed
844
845
        $(activeElement).addClass(directionalClassName);
        $(nextElement).addClass(directionalClassName);
Jacob Thornton's avatar
Jacob Thornton committed
846

Mark Otto's avatar
grunt    
Mark Otto committed
847
848
        $(activeElement).one(Util.TRANSITION_END, function () {
          $(nextElement).removeClass(directionalClassName).removeClass(direction);
Jacob Thornton's avatar
Jacob Thornton committed
849
850
851

          $(nextElement).addClass(ClassName.ACTIVE);

Mark Otto's avatar
grunt    
Mark Otto committed
852
          $(activeElement).removeClass(ClassName.ACTIVE).removeClass(direction).removeClass(directionalClassName);
Jacob Thornton's avatar
Jacob Thornton committed
853

Mark Otto's avatar
grunt    
Mark Otto committed
854
855
856
857
858
859
860
861
862
863
864
865
          _this3._isSliding = false;

          setTimeout(function () {
            return $(_this3._element).trigger(slidEvent);
          }, 0);
        }).emulateTransitionEnd(TRANSITION_DURATION);
      } else {
        $(activeElement).removeClass(ClassName.ACTIVE);
        $(nextElement).addClass(ClassName.ACTIVE);

        this._isSliding = false;
        $(this._element).trigger(slidEvent);
Jacob Thornton's avatar
Jacob Thornton committed
866
867
      }

Mark Otto's avatar
grunt    
Mark Otto committed
868
869
870
871
      if (isCycling) {
        this.cycle();
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
872

Mark Otto's avatar
grunt    
Mark Otto committed
873
    // static
Jacob Thornton's avatar
Jacob Thornton committed
874

Mark Otto's avatar
grunt    
Mark Otto committed
875
876
877
878
    Carousel._jQueryInterface = function _jQueryInterface(config) {
      return this.each(function () {
        var data = $(this).data(DATA_KEY);
        var _config = $.extend({}, Default, $(this).data());
Jacob Thornton's avatar
Jacob Thornton committed
879

Mark Otto's avatar
grunt    
Mark Otto committed
880
881
882
        if ((typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object') {
          $.extend(_config, config);
        }
Jacob Thornton's avatar
Jacob Thornton committed
883

Mark Otto's avatar
grunt    
Mark Otto committed
884
        var action = typeof config === 'string' ? config : _config.slide;
Jacob Thornton's avatar
Jacob Thornton committed
885

Mark Otto's avatar
grunt    
Mark Otto committed
886
887
888
889
        if (!data) {
          data = new Carousel(this, _config);
          $(this).data(DATA_KEY, data);
        }
Jacob Thornton's avatar
Jacob Thornton committed
890

Mark Otto's avatar
grunt    
Mark Otto committed
891
892
893
894
895
896
897
898
899
900
        if (typeof config === 'number') {
          data.to(config);
        } else if (typeof action === 'string') {
          if (data[action] === undefined) {
            throw new Error('No method named "' + action + '"');
          }
          data[action]();
        } else if (_config.interval) {
          data.pause();
          data.cycle();
Jacob Thornton's avatar
Jacob Thornton committed
901
        }
Mark Otto's avatar
grunt    
Mark Otto committed
902
903
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
904

Mark Otto's avatar
grunt    
Mark Otto committed
905
906
    Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
      var selector = Util.getSelectorFromElement(this);
Jacob Thornton's avatar
Jacob Thornton committed
907

Mark Otto's avatar
grunt    
Mark Otto committed
908
909
910
      if (!selector) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
911

Mark Otto's avatar
grunt    
Mark Otto committed
912
      var target = $(selector)[0];
Jacob Thornton's avatar
Jacob Thornton committed
913

Mark Otto's avatar
grunt    
Mark Otto committed
914
915
916
      if (!target || !$(target).hasClass(ClassName.CAROUSEL)) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
917

Mark Otto's avatar
grunt    
Mark Otto committed
918
919
      var config = $.extend({}, $(target).data(), $(this).data());
      var slideIndex = this.getAttribute('data-slide-to');
Jacob Thornton's avatar
Jacob Thornton committed
920

Mark Otto's avatar
grunt    
Mark Otto committed
921
922
923
      if (slideIndex) {
        config.interval = false;
      }
Jacob Thornton's avatar
Jacob Thornton committed
924

Mark Otto's avatar
grunt    
Mark Otto committed
925
926
927
928
      Carousel._jQueryInterface.call($(target), config);

      if (slideIndex) {
        $(target).data(DATA_KEY).to(slideIndex);
Jacob Thornton's avatar
Jacob Thornton committed
929
      }
Mark Otto's avatar
grunt    
Mark Otto committed
930
931
932
933
934

      event.preventDefault();
    };

    _createClass(Carousel, null, [{
Jacob Thornton's avatar
Jacob Thornton committed
935
936
937
938
939
940
941
942
943
944
945
946
      key: 'VERSION',
      get: function get() {
        return VERSION;
      }
    }, {
      key: 'Default',
      get: function get() {
        return Default;
      }
    }]);

    return Carousel;
Mark Otto's avatar
grunt    
Mark Otto committed
947
948
949
950
951
952
953
  }();

  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977

  $(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler);

  $(window).on(Event.LOAD_DATA_API, function () {
    $(Selector.DATA_RIDE).each(function () {
      var $carousel = $(this);
      Carousel._jQueryInterface.call($carousel, $carousel.data());
    });
  });

  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
   */

  $.fn[NAME] = Carousel._jQueryInterface;
  $.fn[NAME].Constructor = Carousel;
  $.fn[NAME].noConflict = function () {
    $.fn[NAME] = JQUERY_NO_CONFLICT;
    return Carousel._jQueryInterface;
  };

  return Carousel;
Mark Otto's avatar
grunt    
Mark Otto committed
978
}(jQuery);
Jacob Thornton's avatar
Jacob Thornton committed
979
980
981

/**
 * --------------------------------------------------------------------------
Mark Otto's avatar
Mark Otto committed
982
 * Bootstrap (v4.0.0-alpha.4): collapse.js
Jacob Thornton's avatar
Jacob Thornton committed
983
984
985
986
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * --------------------------------------------------------------------------
 */

Mark Otto's avatar
grunt    
Mark Otto committed
987
var Collapse = function ($) {
Jacob Thornton's avatar
Jacob Thornton committed
988
989
990
991
992
993
994
995

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

  var NAME = 'collapse';
Mark Otto's avatar
Mark Otto committed
996
  var VERSION = '4.0.0-alpha.4';
Jacob Thornton's avatar
Jacob Thornton committed
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
  var DATA_KEY = 'bs.collapse';
  var EVENT_KEY = '.' + DATA_KEY;
  var DATA_API_KEY = '.data-api';
  var JQUERY_NO_CONFLICT = $.fn[NAME];
  var TRANSITION_DURATION = 600;

  var Default = {
    toggle: true,
    parent: ''
  };

  var DefaultType = {
    toggle: 'boolean',
    parent: 'string'
  };

  var Event = {
    SHOW: 'show' + EVENT_KEY,
    SHOWN: 'shown' + EVENT_KEY,
    HIDE: 'hide' + EVENT_KEY,
    HIDDEN: 'hidden' + EVENT_KEY,
    CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
  };

  var ClassName = {
    IN: 'in',
    COLLAPSE: 'collapse',
    COLLAPSING: 'collapsing',
    COLLAPSED: 'collapsed'
  };

  var Dimension = {
    WIDTH: 'width',
    HEIGHT: 'height'
  };

  var Selector = {
Mark Otto's avatar
grunt    
Mark Otto committed
1034
    ACTIVES: '.card > .in, .card > .collapsing',
Jacob Thornton's avatar
Jacob Thornton committed
1035
1036
1037
1038
1039
1040
1041
1042
1043
    DATA_TOGGLE: '[data-toggle="collapse"]'
  };

  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */

Mark Otto's avatar
grunt    
Mark Otto committed
1044
  var Collapse = function () {
Jacob Thornton's avatar
Jacob Thornton committed
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
    function Collapse(element, config) {
      _classCallCheck(this, Collapse);

      this._isTransitioning = false;
      this._element = element;
      this._config = this._getConfig(config);
      this._triggerArray = $.makeArray($('[data-toggle="collapse"][href="#' + element.id + '"],' + ('[data-toggle="collapse"][data-target="#' + element.id + '"]')));

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

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

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

    // getters

Mark Otto's avatar
grunt    
Mark Otto committed
1066
    // public
Jacob Thornton's avatar
Jacob Thornton committed
1067

Mark Otto's avatar
grunt    
Mark Otto committed
1068
1069
1070
1071
1072
    Collapse.prototype.toggle = function toggle() {
      if ($(this._element).hasClass(ClassName.IN)) {
        this.hide();
      } else {
        this.show();
Jacob Thornton's avatar
Jacob Thornton committed
1073
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1074
    };
Jacob Thornton's avatar
Jacob Thornton committed
1075

Mark Otto's avatar
grunt    
Mark Otto committed
1076
1077
    Collapse.prototype.show = function show() {
      var _this4 = this;
Jacob Thornton's avatar
Jacob Thornton committed
1078

Mark Otto's avatar
grunt    
Mark Otto committed
1079
1080
1081
      if (this._isTransitioning || $(this._element).hasClass(ClassName.IN)) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1082

Mark Otto's avatar
grunt    
Mark Otto committed
1083
1084
      var actives = void 0;
      var activesData = void 0;
Jacob Thornton's avatar
Jacob Thornton committed
1085

Mark Otto's avatar
grunt    
Mark Otto committed
1086
1087
1088
1089
      if (this._parent) {
        actives = $.makeArray($(Selector.ACTIVES));
        if (!actives.length) {
          actives = null;
Jacob Thornton's avatar
Jacob Thornton committed
1090
        }
Mark Otto's avatar
grunt    
Mark Otto committed
1091
      }
Jacob Thornton's avatar
Jacob Thornton committed
1092

Mark Otto's avatar
grunt    
Mark Otto committed
1093
1094
1095
      if (actives) {
        activesData = $(actives).data(DATA_KEY);
        if (activesData && activesData._isTransitioning) {
Jacob Thornton's avatar
Jacob Thornton committed
1096
1097
          return;
        }
Mark Otto's avatar
grunt    
Mark Otto committed
1098
      }
Jacob Thornton's avatar
Jacob Thornton committed
1099

Mark Otto's avatar
grunt    
Mark Otto committed
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
      var startEvent = $.Event(Event.SHOW);
      $(this._element).trigger(startEvent);
      if (startEvent.isDefaultPrevented()) {
        return;
      }

      if (actives) {
        Collapse._jQueryInterface.call($(actives), 'hide');
        if (!activesData) {
          $(actives).data(DATA_KEY, null);
Jacob Thornton's avatar
Jacob Thornton committed
1110
        }
Mark Otto's avatar
grunt    
Mark Otto committed
1111
      }
Jacob Thornton's avatar
Jacob Thornton committed
1112

Mark Otto's avatar
grunt    
Mark Otto committed
1113
      var dimension = this._getDimension();
Jacob Thornton's avatar
Jacob Thornton committed
1114

Mark Otto's avatar
grunt    
Mark Otto committed
1115
      $(this._element).removeClass(ClassName.COLLAPSE).addClass(ClassName.COLLAPSING);
Jacob Thornton's avatar
Jacob Thornton committed
1116

Mark Otto's avatar
grunt    
Mark Otto committed
1117
1118
      this._element.style[dimension] = 0;
      this._element.setAttribute('aria-expanded', true);
Jacob Thornton's avatar
Jacob Thornton committed
1119

Mark Otto's avatar
grunt    
Mark Otto committed
1120
1121
1122
      if (this._triggerArray.length) {
        $(this._triggerArray).removeClass(ClassName.COLLAPSED).attr('aria-expanded', true);
      }
Jacob Thornton's avatar
Jacob Thornton committed
1123

Mark Otto's avatar
grunt    
Mark Otto committed
1124
      this.setTransitioning(true);
Jacob Thornton's avatar
Jacob Thornton committed
1125

Mark Otto's avatar
grunt    
Mark Otto committed
1126
1127
      var complete = function complete() {
        $(_this4._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).addClass(ClassName.IN);
Jacob Thornton's avatar
Jacob Thornton committed
1128

Mark Otto's avatar
grunt    
Mark Otto committed
1129
        _this4._element.style[dimension] = '';
Jacob Thornton's avatar
Jacob Thornton committed
1130

Mark Otto's avatar
grunt    
Mark Otto committed
1131
        _this4.setTransitioning(false);
Jacob Thornton's avatar
Jacob Thornton committed
1132

Mark Otto's avatar
grunt    
Mark Otto committed
1133
1134
        $(_this4._element).trigger(Event.SHOWN);
      };
Jacob Thornton's avatar
Jacob Thornton committed
1135

Mark Otto's avatar
grunt    
Mark Otto committed
1136
1137
1138
1139
      if (!Util.supportsTransitionEnd()) {
        complete();
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1140

Mark Otto's avatar
grunt    
Mark Otto committed
1141
1142
      var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
      var scrollSize = 'scroll' + capitalizedDimension;
Jacob Thornton's avatar
Jacob Thornton committed
1143

Mark Otto's avatar
grunt    
Mark Otto committed
1144
      $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
Jacob Thornton's avatar
Jacob Thornton committed
1145

Mark Otto's avatar
grunt    
Mark Otto committed
1146
1147
      this._element.style[dimension] = this._element[scrollSize] + 'px';
    };
Jacob Thornton's avatar
Jacob Thornton committed
1148

Mark Otto's avatar
grunt    
Mark Otto committed
1149
1150
    Collapse.prototype.hide = function hide() {
      var _this5 = this;
Jacob Thornton's avatar
Jacob Thornton committed
1151

Mark Otto's avatar
grunt    
Mark Otto committed
1152
1153
1154
      if (this._isTransitioning || !$(this._element).hasClass(ClassName.IN)) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1155

Mark Otto's avatar
grunt    
Mark Otto committed
1156
1157
1158
1159
1160
      var startEvent = $.Event(Event.HIDE);
      $(this._element).trigger(startEvent);
      if (startEvent.isDefaultPrevented()) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1161

Mark Otto's avatar
grunt    
Mark Otto committed
1162
1163
      var dimension = this._getDimension();
      var offsetDimension = dimension === Dimension.WIDTH ? 'offsetWidth' : 'offsetHeight';
Jacob Thornton's avatar
Jacob Thornton committed
1164

Mark Otto's avatar
grunt    
Mark Otto committed
1165
      this._element.style[dimension] = this._element[offsetDimension] + 'px';
Jacob Thornton's avatar
Jacob Thornton committed
1166

Mark Otto's avatar
grunt    
Mark Otto committed
1167
      Util.reflow(this._element);
Jacob Thornton's avatar
Jacob Thornton committed
1168

Mark Otto's avatar
grunt    
Mark Otto committed
1169
      $(this._element).addClass(ClassName.COLLAPSING).removeClass(ClassName.COLLAPSE).removeClass(ClassName.IN);
Jacob Thornton's avatar
Jacob Thornton committed
1170

Mark Otto's avatar
grunt    
Mark Otto committed
1171
      this._element.setAttribute('aria-expanded', false);
Jacob Thornton's avatar
Jacob Thornton committed
1172

Mark Otto's avatar
grunt    
Mark Otto committed
1173
1174
1175
      if (this._triggerArray.length) {
        $(this._triggerArray).addClass(ClassName.COLLAPSED).attr('aria-expanded', false);
      }
Jacob Thornton's avatar
Jacob Thornton committed
1176

Mark Otto's avatar
grunt    
Mark Otto committed
1177
      this.setTransitioning(true);
Jacob Thornton's avatar
Jacob Thornton committed
1178

Mark Otto's avatar
grunt    
Mark Otto committed
1179
1180
1181
1182
      var complete = function complete() {
        _this5.setTransitioning(false);
        $(_this5._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).trigger(Event.HIDDEN);
      };
Jacob Thornton's avatar
Jacob Thornton committed
1183

Mark Otto's avatar
grunt    
Mark Otto committed
1184
      this._element.style[dimension] = '';
Jacob Thornton's avatar
Jacob Thornton committed
1185

Mark Otto's avatar
grunt    
Mark Otto committed
1186
1187
1188
      if (!Util.supportsTransitionEnd()) {
        complete();
        return;
Jacob Thornton's avatar
Jacob Thornton committed
1189
1190
      }

Mark Otto's avatar
grunt    
Mark Otto committed
1191
1192
      $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
    };
Jacob Thornton's avatar
Jacob Thornton committed
1193

Mark Otto's avatar
grunt    
Mark Otto committed
1194
1195
1196
    Collapse.prototype.setTransitioning = function setTransitioning(isTransitioning) {
      this._isTransitioning = isTransitioning;
    };
Jacob Thornton's avatar
Jacob Thornton committed
1197

Mark Otto's avatar
grunt    
Mark Otto committed
1198
1199
    Collapse.prototype.dispose = function dispose() {
      $.removeData(this._element, DATA_KEY);
Jacob Thornton's avatar
Jacob Thornton committed
1200

Mark Otto's avatar
grunt    
Mark Otto committed
1201
1202
1203
1204
1205
1206
      this._config = null;
      this._parent = null;
      this._element = null;
      this._triggerArray = null;
      this._isTransitioning = null;
    };
Jacob Thornton's avatar
Jacob Thornton committed
1207

Mark Otto's avatar
grunt    
Mark Otto committed
1208
    // private
Jacob Thornton's avatar
Jacob Thornton committed
1209

Mark Otto's avatar
grunt    
Mark Otto committed
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
    Collapse.prototype._getConfig = function _getConfig(config) {
      config = $.extend({}, Default, config);
      config.toggle = Boolean(config.toggle); // coerce string values
      Util.typeCheckConfig(NAME, config, DefaultType);
      return config;
    };

    Collapse.prototype._getDimension = function _getDimension() {
      var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
      return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
    };

    Collapse.prototype._getParent = function _getParent() {
      var _this6 = this;

      var parent = $(this._config.parent)[0];
      var selector = '[data-toggle="collapse"][data-parent="' + this._config.parent + '"]';

      $(parent).find(selector).each(function (i, element) {
        _this6._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
      });

      return parent;
    };

    Collapse.prototype._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
      if (element) {
        var isOpen = $(element).hasClass(ClassName.IN);
        element.setAttribute('aria-expanded', isOpen);

        if (triggerArray.length) {
          $(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
Jacob Thornton's avatar
Jacob Thornton committed
1242
1243
        }
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1244
    };
Jacob Thornton's avatar
Jacob Thornton committed
1245

Mark Otto's avatar
grunt    
Mark Otto committed
1246
    // static
Jacob Thornton's avatar
Jacob Thornton committed
1247

Mark Otto's avatar
grunt    
Mark Otto committed
1248
1249
1250
1251
    Collapse._getTargetFromElement = function _getTargetFromElement(element) {
      var selector = Util.getSelectorFromElement(element);
      return selector ? $(selector)[0] : null;
    };
Jacob Thornton's avatar
Jacob Thornton committed
1252

Mark Otto's avatar
grunt    
Mark Otto committed
1253
1254
1255
1256
1257
    Collapse._jQueryInterface = function _jQueryInterface(config) {
      return this.each(function () {
        var $this = $(this);
        var data = $this.data(DATA_KEY);
        var _config = $.extend({}, Default, $this.data(), (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config);
Jacob Thornton's avatar
Jacob Thornton committed
1258

Mark Otto's avatar
grunt    
Mark Otto committed
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
        if (!data && _config.toggle && /show|hide/.test(config)) {
          _config.toggle = false;
        }

        if (!data) {
          data = new Collapse(this, _config);
          $this.data(DATA_KEY, data);
        }

        if (typeof config === 'string') {
          if (data[config] === undefined) {
            throw new Error('No method named "' + config + '"');
Jacob Thornton's avatar
Jacob Thornton committed
1271
          }
Mark Otto's avatar
grunt    
Mark Otto committed
1272
1273
1274
1275
1276
1277
          data[config]();
        }
      });
    };

    _createClass(Collapse, null, [{
Jacob Thornton's avatar
Jacob Thornton committed
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
      key: 'VERSION',
      get: function get() {
        return VERSION;
      }
    }, {
      key: 'Default',
      get: function get() {
        return Default;
      }
    }]);

    return Collapse;
Mark Otto's avatar
grunt    
Mark Otto committed
1290
1291
1292
1293
1294
1295
1296
  }();

  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321

  $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
    event.preventDefault();

    var target = Collapse._getTargetFromElement(this);
    var data = $(target).data(DATA_KEY);
    var config = data ? 'toggle' : $(this).data();

    Collapse._jQueryInterface.call($(target), config);
  });

  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
   */

  $.fn[NAME] = Collapse._jQueryInterface;
  $.fn[NAME].Constructor = Collapse;
  $.fn[NAME].noConflict = function () {
    $.fn[NAME] = JQUERY_NO_CONFLICT;
    return Collapse._jQueryInterface;
  };

  return Collapse;
Mark Otto's avatar
grunt    
Mark Otto committed
1322
}(jQuery);
Jacob Thornton's avatar
Jacob Thornton committed
1323
1324
1325

/**
 * --------------------------------------------------------------------------
Mark Otto's avatar
Mark Otto committed
1326
 * Bootstrap (v4.0.0-alpha.4): dropdown.js
Jacob Thornton's avatar
Jacob Thornton committed
1327
1328
1329
1330
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * --------------------------------------------------------------------------
 */

Mark Otto's avatar
grunt    
Mark Otto committed
1331
var Dropdown = function ($) {
Jacob Thornton's avatar
Jacob Thornton committed
1332
1333
1334
1335
1336
1337
1338
1339

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

  var NAME = 'dropdown';
Mark Otto's avatar
Mark Otto committed
1340
  var VERSION = '4.0.0-alpha.4';
Jacob Thornton's avatar
Jacob Thornton committed
1341
1342
1343
1344
  var DATA_KEY = 'bs.dropdown';
  var EVENT_KEY = '.' + DATA_KEY;
  var DATA_API_KEY = '.data-api';
  var JQUERY_NO_CONFLICT = $.fn[NAME];
Chris Rebert's avatar
grunt    
Chris Rebert committed
1345
1346
1347
1348
  var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
Jacob Thornton's avatar
Jacob Thornton committed
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375

  var Event = {
    HIDE: 'hide' + EVENT_KEY,
    HIDDEN: 'hidden' + EVENT_KEY,
    SHOW: 'show' + EVENT_KEY,
    SHOWN: 'shown' + EVENT_KEY,
    CLICK: 'click' + EVENT_KEY,
    CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY,
    KEYDOWN_DATA_API: 'keydown' + EVENT_KEY + DATA_API_KEY
  };

  var ClassName = {
    BACKDROP: 'dropdown-backdrop',
    DISABLED: 'disabled',
    OPEN: 'open'
  };

  var Selector = {
    BACKDROP: '.dropdown-backdrop',
    DATA_TOGGLE: '[data-toggle="dropdown"]',
    FORM_CHILD: '.dropdown form',
    ROLE_MENU: '[role="menu"]',
    ROLE_LISTBOX: '[role="listbox"]',
    NAVBAR_NAV: '.navbar-nav',
    VISIBLE_ITEMS: '[role="menu"] li:not(.disabled) a, ' + '[role="listbox"] li:not(.disabled) a'
  };

Jacob Thornton's avatar
Jacob Thornton committed
1376
  /**
Jacob Thornton's avatar
Jacob Thornton committed
1377
1378
1379
1380
1381
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */

Mark Otto's avatar
grunt    
Mark Otto committed
1382
  var Dropdown = function () {
Jacob Thornton's avatar
Jacob Thornton committed
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
    function Dropdown(element) {
      _classCallCheck(this, Dropdown);

      this._element = element;

      this._addEventListeners();
    }

    // getters

Mark Otto's avatar
grunt    
Mark Otto committed
1393
    // public
Jacob Thornton's avatar
Jacob Thornton committed
1394

Mark Otto's avatar
grunt    
Mark Otto committed
1395
1396
1397
1398
    Dropdown.prototype.toggle = function toggle() {
      if (this.disabled || $(this).hasClass(ClassName.DISABLED)) {
        return false;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1399

Mark Otto's avatar
grunt    
Mark Otto committed
1400
1401
      var parent = Dropdown._getParentFromElement(this);
      var isActive = $(parent).hasClass(ClassName.OPEN);
Jacob Thornton's avatar
Jacob Thornton committed
1402

Mark Otto's avatar
grunt    
Mark Otto committed
1403
      Dropdown._clearMenus();
Jacob Thornton's avatar
Jacob Thornton committed
1404

Mark Otto's avatar
grunt    
Mark Otto committed
1405
1406
1407
      if (isActive) {
        return false;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1408

Mark Otto's avatar
grunt    
Mark Otto committed
1409
      if ('ontouchstart' in document.documentElement && !$(parent).closest(Selector.NAVBAR_NAV).length) {
Jacob Thornton's avatar
Jacob Thornton committed
1410

Mark Otto's avatar
grunt    
Mark Otto committed
1411
1412
1413
1414
1415
1416
        // if mobile we use a backdrop because click events don't delegate
        var dropdown = document.createElement('div');
        dropdown.className = ClassName.BACKDROP;
        $(dropdown).insertBefore(this);
        $(dropdown).on('click', Dropdown._clearMenus);
      }
Jacob Thornton's avatar
Jacob Thornton committed
1417

Mark Otto's avatar
grunt    
Mark Otto committed
1418
1419
      var relatedTarget = { relatedTarget: this };
      var showEvent = $.Event(Event.SHOW, relatedTarget);
Jacob Thornton's avatar
Jacob Thornton committed
1420

Mark Otto's avatar
grunt    
Mark Otto committed
1421
      $(parent).trigger(showEvent);
Jacob Thornton's avatar
Jacob Thornton committed
1422

Mark Otto's avatar
grunt    
Mark Otto committed
1423
1424
1425
      if (showEvent.isDefaultPrevented()) {
        return false;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1426

Mark Otto's avatar
grunt    
Mark Otto committed
1427
1428
      this.focus();
      this.setAttribute('aria-expanded', 'true');
Jacob Thornton's avatar
Jacob Thornton committed
1429

Mark Otto's avatar
grunt    
Mark Otto committed
1430
1431
      $(parent).toggleClass(ClassName.OPEN);
      $(parent).trigger($.Event(Event.SHOWN, relatedTarget));
Jacob Thornton's avatar
Jacob Thornton committed
1432

Mark Otto's avatar
grunt    
Mark Otto committed
1433
1434
      return false;
    };
Jacob Thornton's avatar
Jacob Thornton committed
1435

Mark Otto's avatar
grunt    
Mark Otto committed
1436
1437
1438
1439
1440
    Dropdown.prototype.dispose = function dispose() {
      $.removeData(this._element, DATA_KEY);
      $(this._element).off(EVENT_KEY);
      this._element = null;
    };
Jacob Thornton's avatar
Jacob Thornton committed
1441

Mark Otto's avatar
grunt    
Mark Otto committed
1442
    // private
Jacob Thornton's avatar
Jacob Thornton committed
1443

Mark Otto's avatar
grunt    
Mark Otto committed
1444
1445
1446
    Dropdown.prototype._addEventListeners = function _addEventListeners() {
      $(this._element).on(Event.CLICK, this.toggle);
    };
Jacob Thornton's avatar
Jacob Thornton committed
1447

Mark Otto's avatar
grunt    
Mark Otto committed
1448
    // static
Jacob Thornton's avatar
Jacob Thornton committed
1449

Mark Otto's avatar
grunt    
Mark Otto committed
1450
1451
1452
    Dropdown._jQueryInterface = function _jQueryInterface(config) {
      return this.each(function () {
        var data = $(this).data(DATA_KEY);
Jacob Thornton's avatar
Jacob Thornton committed
1453

Mark Otto's avatar
grunt    
Mark Otto committed
1454
1455
        if (!data) {
          $(this).data(DATA_KEY, data = new Dropdown(this));
Jacob Thornton's avatar
Jacob Thornton committed
1456
1457
        }

Mark Otto's avatar
grunt    
Mark Otto committed
1458
1459
1460
1461
1462
        if (typeof config === 'string') {
          if (data[config] === undefined) {
            throw new Error('No method named "' + config + '"');
          }
          data[config].call(this);
Jacob Thornton's avatar
Jacob Thornton committed
1463
        }
Mark Otto's avatar
grunt    
Mark Otto committed
1464
1465
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
1466

Mark Otto's avatar
grunt    
Mark Otto committed
1467
1468
1469
1470
    Dropdown._clearMenus = function _clearMenus(event) {
      if (event && event.which === RIGHT_MOUSE_BUTTON_WHICH) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1471

Mark Otto's avatar
grunt    
Mark Otto committed
1472
1473
1474
1475
      var backdrop = $(Selector.BACKDROP)[0];
      if (backdrop) {
        backdrop.parentNode.removeChild(backdrop);
      }
Jacob Thornton's avatar
Jacob Thornton committed
1476

Mark Otto's avatar
grunt    
Mark Otto committed
1477
      var toggles = $.makeArray($(Selector.DATA_TOGGLE));
Jacob Thornton's avatar
Jacob Thornton committed
1478

Mark Otto's avatar
grunt    
Mark Otto committed
1479
1480
1481
      for (var i = 0; i < toggles.length; i++) {
        var parent = Dropdown._getParentFromElement(toggles[i]);
        var relatedTarget = { relatedTarget: toggles[i] };
Jacob Thornton's avatar
Jacob Thornton committed
1482

Mark Otto's avatar
grunt    
Mark Otto committed
1483
1484
1485
        if (!$(parent).hasClass(ClassName.OPEN)) {
          continue;
        }
Jacob Thornton's avatar
Jacob Thornton committed
1486

Mark Otto's avatar
grunt    
Mark Otto committed
1487
1488
1489
        if (event && event.type === 'click' && /input|textarea/i.test(event.target.tagName) && $.contains(parent, event.target)) {
          continue;
        }
Jacob Thornton's avatar
Jacob Thornton committed
1490

Mark Otto's avatar
grunt    
Mark Otto committed
1491
1492
1493
1494
        var hideEvent = $.Event(Event.HIDE, relatedTarget);
        $(parent).trigger(hideEvent);
        if (hideEvent.isDefaultPrevented()) {
          continue;
Jacob Thornton's avatar
Jacob Thornton committed
1495
        }
Mark Otto's avatar
grunt    
Mark Otto committed
1496
1497
1498
1499

        toggles[i].setAttribute('aria-expanded', 'false');

        $(parent).removeClass(ClassName.OPEN).trigger($.Event(Event.HIDDEN, relatedTarget));
Jacob Thornton's avatar
Jacob Thornton committed
1500
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1501
    };
Jacob Thornton's avatar
Jacob Thornton committed
1502

Mark Otto's avatar
grunt    
Mark Otto committed
1503
1504
1505
    Dropdown._getParentFromElement = function _getParentFromElement(element) {
      var parent = void 0;
      var selector = Util.getSelectorFromElement(element);
Jacob Thornton's avatar
Jacob Thornton committed
1506

Mark Otto's avatar
grunt    
Mark Otto committed
1507
1508
      if (selector) {
        parent = $(selector)[0];
Jacob Thornton's avatar
Jacob Thornton committed
1509
1510
      }

Mark Otto's avatar
grunt    
Mark Otto committed
1511
1512
      return parent || element.parentNode;
    };
Jacob Thornton's avatar
Jacob Thornton committed
1513

Mark Otto's avatar
grunt    
Mark Otto committed
1514
1515
1516
1517
    Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
      if (!/(38|40|27|32)/.test(event.which) || /input|textarea/i.test(event.target.tagName)) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1518

Mark Otto's avatar
grunt    
Mark Otto committed
1519
1520
      event.preventDefault();
      event.stopPropagation();
Jacob Thornton's avatar
Jacob Thornton committed
1521

Mark Otto's avatar
grunt    
Mark Otto committed
1522
1523
1524
      if (this.disabled || $(this).hasClass(ClassName.DISABLED)) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1525

Mark Otto's avatar
grunt    
Mark Otto committed
1526
1527
      var parent = Dropdown._getParentFromElement(this);
      var isActive = $(parent).hasClass(ClassName.OPEN);
Jacob Thornton's avatar
Jacob Thornton committed
1528

Mark Otto's avatar
grunt    
Mark Otto committed
1529
1530
1531
1532
1533
      if (!isActive && event.which !== ESCAPE_KEYCODE || isActive && event.which === ESCAPE_KEYCODE) {

        if (event.which === ESCAPE_KEYCODE) {
          var toggle = $(parent).find(Selector.DATA_TOGGLE)[0];
          $(toggle).trigger('focus');
Jacob Thornton's avatar
Jacob Thornton committed
1534
1535
        }

Mark Otto's avatar
grunt    
Mark Otto committed
1536
1537
1538
        $(this).trigger('click');
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1539

Mark Otto's avatar
grunt    
Mark Otto committed
1540
      var items = $.makeArray($(Selector.VISIBLE_ITEMS));
Jacob Thornton's avatar
Jacob Thornton committed
1541

Mark Otto's avatar
grunt    
Mark Otto committed
1542
1543
1544
      items = items.filter(function (item) {
        return item.offsetWidth || item.offsetHeight;
      });
Jacob Thornton's avatar
Jacob Thornton committed
1545

Mark Otto's avatar
grunt    
Mark Otto committed
1546
1547
1548
      if (!items.length) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1549

Mark Otto's avatar
grunt    
Mark Otto committed
1550
      var index = items.indexOf(event.target);
Jacob Thornton's avatar
Jacob Thornton committed
1551

Mark Otto's avatar
grunt    
Mark Otto committed
1552
1553
1554
1555
      if (event.which === ARROW_UP_KEYCODE && index > 0) {
        // up
        index--;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1556

Mark Otto's avatar
grunt    
Mark Otto committed
1557
1558
1559
1560
      if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
        // down
        index++;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1561

Mark Otto's avatar
grunt    
Mark Otto committed
1562
1563
      if (index < 0) {
        index = 0;
Jacob Thornton's avatar
Jacob Thornton committed
1564
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1565
1566
1567
1568
1569

      items[index].focus();
    };

    _createClass(Dropdown, null, [{
Jacob Thornton's avatar
Jacob Thornton committed
1570
1571
1572
1573
1574
1575
1576
      key: 'VERSION',
      get: function get() {
        return VERSION;
      }
    }]);

    return Dropdown;
Mark Otto's avatar
grunt    
Mark Otto committed
1577
1578
1579
1580
1581
1582
1583
  }();

  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602

  $(document).on(Event.KEYDOWN_DATA_API, Selector.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN_DATA_API, Selector.ROLE_MENU, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN_DATA_API, Selector.ROLE_LISTBOX, Dropdown._dataApiKeydownHandler).on(Event.CLICK_DATA_API, Dropdown._clearMenus).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, Dropdown.prototype.toggle).on(Event.CLICK_DATA_API, Selector.FORM_CHILD, function (e) {
    e.stopPropagation();
  });

  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
   */

  $.fn[NAME] = Dropdown._jQueryInterface;
  $.fn[NAME].Constructor = Dropdown;
  $.fn[NAME].noConflict = function () {
    $.fn[NAME] = JQUERY_NO_CONFLICT;
    return Dropdown._jQueryInterface;
  };

  return Dropdown;
Mark Otto's avatar
grunt    
Mark Otto committed
1603
}(jQuery);
Jacob Thornton's avatar
Jacob Thornton committed
1604
1605
1606

/**
 * --------------------------------------------------------------------------
Mark Otto's avatar
Mark Otto committed
1607
 * Bootstrap (v4.0.0-alpha.4): modal.js
Jacob Thornton's avatar
Jacob Thornton committed
1608
1609
1610
1611
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * --------------------------------------------------------------------------
 */

Mark Otto's avatar
grunt    
Mark Otto committed
1612
var Modal = function ($) {
Jacob Thornton's avatar
Jacob Thornton committed
1613
1614
1615
1616
1617
1618
1619
1620

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

  var NAME = 'modal';
Mark Otto's avatar
Mark Otto committed
1621
  var VERSION = '4.0.0-alpha.4';
Jacob Thornton's avatar
Jacob Thornton committed
1622
1623
1624
1625
1626
1627
  var DATA_KEY = 'bs.modal';
  var EVENT_KEY = '.' + DATA_KEY;
  var DATA_API_KEY = '.data-api';
  var JQUERY_NO_CONFLICT = $.fn[NAME];
  var TRANSITION_DURATION = 300;
  var BACKDROP_TRANSITION_DURATION = 150;
Chris Rebert's avatar
grunt    
Chris Rebert committed
1628
  var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
Jacob Thornton's avatar
Jacob Thornton committed
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678

  var Default = {
    backdrop: true,
    keyboard: true,
    focus: true,
    show: true
  };

  var DefaultType = {
    backdrop: '(boolean|string)',
    keyboard: 'boolean',
    focus: 'boolean',
    show: 'boolean'
  };

  var Event = {
    HIDE: 'hide' + EVENT_KEY,
    HIDDEN: 'hidden' + EVENT_KEY,
    SHOW: 'show' + EVENT_KEY,
    SHOWN: 'shown' + EVENT_KEY,
    FOCUSIN: 'focusin' + EVENT_KEY,
    RESIZE: 'resize' + EVENT_KEY,
    CLICK_DISMISS: 'click.dismiss' + EVENT_KEY,
    KEYDOWN_DISMISS: 'keydown.dismiss' + EVENT_KEY,
    MOUSEUP_DISMISS: 'mouseup.dismiss' + EVENT_KEY,
    MOUSEDOWN_DISMISS: 'mousedown.dismiss' + EVENT_KEY,
    CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
  };

  var ClassName = {
    SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
    BACKDROP: 'modal-backdrop',
    OPEN: 'modal-open',
    FADE: 'fade',
    IN: 'in'
  };

  var Selector = {
    DIALOG: '.modal-dialog',
    DATA_TOGGLE: '[data-toggle="modal"]',
    DATA_DISMISS: '[data-dismiss="modal"]',
    FIXED_CONTENT: '.navbar-fixed-top, .navbar-fixed-bottom, .is-fixed'
  };

  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */

Mark Otto's avatar
grunt    
Mark Otto committed
1679
  var Modal = function () {
Jacob Thornton's avatar
Jacob Thornton committed
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
    function Modal(element, config) {
      _classCallCheck(this, Modal);

      this._config = this._getConfig(config);
      this._element = element;
      this._dialog = $(element).find(Selector.DIALOG)[0];
      this._backdrop = null;
      this._isShown = false;
      this._isBodyOverflowing = false;
      this._ignoreBackdropClick = false;
      this._originalBodyPadding = 0;
      this._scrollbarWidth = 0;
    }

    // getters

Mark Otto's avatar
grunt    
Mark Otto committed
1696
    // public
Jacob Thornton's avatar
Jacob Thornton committed
1697

Mark Otto's avatar
grunt    
Mark Otto committed
1698
1699
1700
    Modal.prototype.toggle = function toggle(relatedTarget) {
      return this._isShown ? this.hide() : this.show(relatedTarget);
    };
Jacob Thornton's avatar
Jacob Thornton committed
1701

Mark Otto's avatar
grunt    
Mark Otto committed
1702
1703
    Modal.prototype.show = function show(relatedTarget) {
      var _this7 = this;
Jacob Thornton's avatar
Jacob Thornton committed
1704

Mark Otto's avatar
grunt    
Mark Otto committed
1705
1706
1707
      var showEvent = $.Event(Event.SHOW, {
        relatedTarget: relatedTarget
      });
Jacob Thornton's avatar
Jacob Thornton committed
1708

Mark Otto's avatar
grunt    
Mark Otto committed
1709
      $(this._element).trigger(showEvent);
Jacob Thornton's avatar
Jacob Thornton committed
1710

Mark Otto's avatar
grunt    
Mark Otto committed
1711
1712
1713
      if (this._isShown || showEvent.isDefaultPrevented()) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1714

Mark Otto's avatar
grunt    
Mark Otto committed
1715
      this._isShown = true;
Jacob Thornton's avatar
Jacob Thornton committed
1716

Mark Otto's avatar
grunt    
Mark Otto committed
1717
1718
      this._checkScrollbar();
      this._setScrollbar();
Jacob Thornton's avatar
Jacob Thornton committed
1719

Mark Otto's avatar
grunt    
Mark Otto committed
1720
      $(document.body).addClass(ClassName.OPEN);
Jacob Thornton's avatar
Jacob Thornton committed
1721

Mark Otto's avatar
grunt    
Mark Otto committed
1722
1723
      this._setEscapeEvent();
      this._setResizeEvent();
Jacob Thornton's avatar
Jacob Thornton committed
1724

Mark Otto's avatar
grunt    
Mark Otto committed
1725
      $(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, $.proxy(this.hide, this));
Jacob Thornton's avatar
Jacob Thornton committed
1726

Mark Otto's avatar
grunt    
Mark Otto committed
1727
1728
1729
1730
1731
      $(this._dialog).on(Event.MOUSEDOWN_DISMISS, function () {
        $(_this7._element).one(Event.MOUSEUP_DISMISS, function (event) {
          if ($(event.target).is(_this7._element)) {
            _this7._ignoreBackdropClick = true;
          }
Jacob Thornton's avatar
Jacob Thornton committed
1732
        });
Mark Otto's avatar
grunt    
Mark Otto committed
1733
1734
1735
1736
      });

      this._showBackdrop($.proxy(this._showElement, this, relatedTarget));
    };
Jacob Thornton's avatar
Jacob Thornton committed
1737

Mark Otto's avatar
grunt    
Mark Otto committed
1738
1739
1740
    Modal.prototype.hide = function hide(event) {
      if (event) {
        event.preventDefault();
Jacob Thornton's avatar
Jacob Thornton committed
1741
1742
      }

Mark Otto's avatar
grunt    
Mark Otto committed
1743
      var hideEvent = $.Event(Event.HIDE);
Jacob Thornton's avatar
Jacob Thornton committed
1744

Mark Otto's avatar
grunt    
Mark Otto committed
1745
      $(this._element).trigger(hideEvent);
Jacob Thornton's avatar
Jacob Thornton committed
1746

Mark Otto's avatar
grunt    
Mark Otto committed
1747
1748
1749
      if (!this._isShown || hideEvent.isDefaultPrevented()) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1750

Mark Otto's avatar
grunt    
Mark Otto committed
1751
      this._isShown = false;
Jacob Thornton's avatar
Jacob Thornton committed
1752

Mark Otto's avatar
grunt    
Mark Otto committed
1753
1754
      this._setEscapeEvent();
      this._setResizeEvent();
Jacob Thornton's avatar
Jacob Thornton committed
1755

Mark Otto's avatar
grunt    
Mark Otto committed
1756
      $(document).off(Event.FOCUSIN);
Jacob Thornton's avatar
Jacob Thornton committed
1757

Mark Otto's avatar
grunt    
Mark Otto committed
1758
      $(this._element).removeClass(ClassName.IN);
Jacob Thornton's avatar
Jacob Thornton committed
1759

Mark Otto's avatar
grunt    
Mark Otto committed
1760
1761
      $(this._element).off(Event.CLICK_DISMISS);
      $(this._dialog).off(Event.MOUSEDOWN_DISMISS);
Jacob Thornton's avatar
Jacob Thornton committed
1762

Mark Otto's avatar
grunt    
Mark Otto committed
1763
      if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) {
Jacob Thornton's avatar
Jacob Thornton committed
1764

Mark Otto's avatar
grunt    
Mark Otto committed
1765
1766
1767
        $(this._element).one(Util.TRANSITION_END, $.proxy(this._hideModal, this)).emulateTransitionEnd(TRANSITION_DURATION);
      } else {
        this._hideModal();
Jacob Thornton's avatar
Jacob Thornton committed
1768
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1769
    };
Jacob Thornton's avatar
Jacob Thornton committed
1770

Mark Otto's avatar
grunt    
Mark Otto committed
1771
1772
    Modal.prototype.dispose = function dispose() {
      $.removeData(this._element, DATA_KEY);
Jacob Thornton's avatar
Jacob Thornton committed
1773

Mark Otto's avatar
grunt    
Mark Otto committed
1774
1775
1776
1777
      $(window).off(EVENT_KEY);
      $(document).off(EVENT_KEY);
      $(this._element).off(EVENT_KEY);
      $(this._backdrop).off(EVENT_KEY);
Jacob Thornton's avatar
Jacob Thornton committed
1778

Mark Otto's avatar
grunt    
Mark Otto committed
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
      this._config = null;
      this._element = null;
      this._dialog = null;
      this._backdrop = null;
      this._isShown = null;
      this._isBodyOverflowing = null;
      this._ignoreBackdropClick = null;
      this._originalBodyPadding = null;
      this._scrollbarWidth = null;
    };
Jacob Thornton's avatar
Jacob Thornton committed
1789

Mark Otto's avatar
grunt    
Mark Otto committed
1790
    // private
Jacob Thornton's avatar
Jacob Thornton committed
1791

Mark Otto's avatar
grunt    
Mark Otto committed
1792
1793
1794
1795
1796
    Modal.prototype._getConfig = function _getConfig(config) {
      config = $.extend({}, Default, config);
      Util.typeCheckConfig(NAME, config, DefaultType);
      return config;
    };
Jacob Thornton's avatar
Jacob Thornton committed
1797

Mark Otto's avatar
grunt    
Mark Otto committed
1798
1799
    Modal.prototype._showElement = function _showElement(relatedTarget) {
      var _this8 = this;
Jacob Thornton's avatar
Jacob Thornton committed
1800

Mark Otto's avatar
grunt    
Mark Otto committed
1801
      var transition = Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE);
Jacob Thornton's avatar
Jacob Thornton committed
1802

Mark Otto's avatar
grunt    
Mark Otto committed
1803
1804
1805
1806
      if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
        // don't move modals dom position
        document.body.appendChild(this._element);
      }
Jacob Thornton's avatar
Jacob Thornton committed
1807

Mark Otto's avatar
grunt    
Mark Otto committed
1808
1809
1810
      this._element.style.display = 'block';
      this._element.removeAttribute('aria-hidden');
      this._element.scrollTop = 0;
Jacob Thornton's avatar
Jacob Thornton committed
1811

Mark Otto's avatar
grunt    
Mark Otto committed
1812
1813
      if (transition) {
        Util.reflow(this._element);
Jacob Thornton's avatar
Jacob Thornton committed
1814
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1815
1816
1817
1818
1819

      $(this._element).addClass(ClassName.IN);

      if (this._config.focus) {
        this._enforceFocus();
Jacob Thornton's avatar
Jacob Thornton committed
1820
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1821
1822
1823
1824
1825
1826
1827
1828

      var shownEvent = $.Event(Event.SHOWN, {
        relatedTarget: relatedTarget
      });

      var transitionComplete = function transitionComplete() {
        if (_this8._config.focus) {
          _this8._element.focus();
Jacob Thornton's avatar
Jacob Thornton committed
1829
        }
Mark Otto's avatar
grunt    
Mark Otto committed
1830
1831
1832
1833
1834
1835
1836
        $(_this8._element).trigger(shownEvent);
      };

      if (transition) {
        $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(TRANSITION_DURATION);
      } else {
        transitionComplete();
Jacob Thornton's avatar
Jacob Thornton committed
1837
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1838
1839
1840
1841
1842
1843
1844
1845
1846
    };

    Modal.prototype._enforceFocus = function _enforceFocus() {
      var _this9 = this;

      $(document).off(Event.FOCUSIN) // guard against infinite focus loop
      .on(Event.FOCUSIN, function (event) {
        if (document !== event.target && _this9._element !== event.target && !$(_this9._element).has(event.target).length) {
          _this9._element.focus();
Jacob Thornton's avatar
Jacob Thornton committed
1847
        }
Mark Otto's avatar
grunt    
Mark Otto committed
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
      });
    };

    Modal.prototype._setEscapeEvent = function _setEscapeEvent() {
      var _this10 = this;

      if (this._isShown && this._config.keyboard) {
        $(this._element).on(Event.KEYDOWN_DISMISS, function (event) {
          if (event.which === ESCAPE_KEYCODE) {
            _this10.hide();
          }
Jacob Thornton's avatar
Jacob Thornton committed
1859
        });
Mark Otto's avatar
grunt    
Mark Otto committed
1860
1861
      } else if (!this._isShown) {
        $(this._element).off(Event.KEYDOWN_DISMISS);
Jacob Thornton's avatar
Jacob Thornton committed
1862
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1863
1864
1865
1866
1867
1868
1869
    };

    Modal.prototype._setResizeEvent = function _setResizeEvent() {
      if (this._isShown) {
        $(window).on(Event.RESIZE, $.proxy(this._handleUpdate, this));
      } else {
        $(window).off(Event.RESIZE);
Jacob Thornton's avatar
Jacob Thornton committed
1870
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1871
    };
Jacob Thornton's avatar
Jacob Thornton committed
1872

Mark Otto's avatar
grunt    
Mark Otto committed
1873
1874
    Modal.prototype._hideModal = function _hideModal() {
      var _this11 = this;
Jacob Thornton's avatar
Jacob Thornton committed
1875

Mark Otto's avatar
grunt    
Mark Otto committed
1876
1877
1878
1879
1880
1881
1882
1883
1884
      this._element.style.display = 'none';
      this._element.setAttribute('aria-hidden', 'true');
      this._showBackdrop(function () {
        $(document.body).removeClass(ClassName.OPEN);
        _this11._resetAdjustments();
        _this11._resetScrollbar();
        $(_this11._element).trigger(Event.HIDDEN);
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
1885

Mark Otto's avatar
grunt    
Mark Otto committed
1886
1887
1888
1889
1890
1891
    Modal.prototype._removeBackdrop = function _removeBackdrop() {
      if (this._backdrop) {
        $(this._backdrop).remove();
        this._backdrop = null;
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
1892

Mark Otto's avatar
grunt    
Mark Otto committed
1893
1894
    Modal.prototype._showBackdrop = function _showBackdrop(callback) {
      var _this12 = this;
Jacob Thornton's avatar
Jacob Thornton committed
1895

Mark Otto's avatar
grunt    
Mark Otto committed
1896
      var animate = $(this._element).hasClass(ClassName.FADE) ? ClassName.FADE : '';
Jacob Thornton's avatar
Jacob Thornton committed
1897

Mark Otto's avatar
grunt    
Mark Otto committed
1898
1899
      if (this._isShown && this._config.backdrop) {
        var doAnimate = Util.supportsTransitionEnd() && animate;
Jacob Thornton's avatar
Jacob Thornton committed
1900

Mark Otto's avatar
grunt    
Mark Otto committed
1901
1902
1903
1904
1905
1906
        this._backdrop = document.createElement('div');
        this._backdrop.className = ClassName.BACKDROP;

        if (animate) {
          $(this._backdrop).addClass(animate);
        }
Jacob Thornton's avatar
Jacob Thornton committed
1907

Mark Otto's avatar
grunt    
Mark Otto committed
1908
        $(this._backdrop).appendTo(document.body);
Jacob Thornton's avatar
Jacob Thornton committed
1909

Mark Otto's avatar
grunt    
Mark Otto committed
1910
1911
1912
        $(this._element).on(Event.CLICK_DISMISS, function (event) {
          if (_this12._ignoreBackdropClick) {
            _this12._ignoreBackdropClick = false;
Jacob Thornton's avatar
Jacob Thornton committed
1913
1914
            return;
          }
Mark Otto's avatar
grunt    
Mark Otto committed
1915
          if (event.target !== event.currentTarget) {
Jacob Thornton's avatar
Jacob Thornton committed
1916
1917
            return;
          }
Mark Otto's avatar
grunt    
Mark Otto committed
1918
1919
1920
1921
1922
1923
          if (_this12._config.backdrop === 'static') {
            _this12._element.focus();
          } else {
            _this12.hide();
          }
        });
Jacob Thornton's avatar
Jacob Thornton committed
1924

Mark Otto's avatar
grunt    
Mark Otto committed
1925
1926
1927
        if (doAnimate) {
          Util.reflow(this._backdrop);
        }
Jacob Thornton's avatar
Jacob Thornton committed
1928

Mark Otto's avatar
grunt    
Mark Otto committed
1929
        $(this._backdrop).addClass(ClassName.IN);
Jacob Thornton's avatar
Jacob Thornton committed
1930

Mark Otto's avatar
grunt    
Mark Otto committed
1931
1932
1933
1934
1935
        if (!callback) {
          return;
        }

        if (!doAnimate) {
Jacob Thornton's avatar
Jacob Thornton committed
1936
          callback();
Mark Otto's avatar
grunt    
Mark Otto committed
1937
          return;
Jacob Thornton's avatar
Jacob Thornton committed
1938
1939
        }

Mark Otto's avatar
grunt    
Mark Otto committed
1940
1941
1942
        $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(BACKDROP_TRANSITION_DURATION);
      } else if (!this._isShown && this._backdrop) {
        $(this._backdrop).removeClass(ClassName.IN);
Jacob Thornton's avatar
Jacob Thornton committed
1943

Mark Otto's avatar
grunt    
Mark Otto committed
1944
1945
1946
1947
1948
1949
        var callbackRemove = function callbackRemove() {
          _this12._removeBackdrop();
          if (callback) {
            callback();
          }
        };
Jacob Thornton's avatar
Jacob Thornton committed
1950

Mark Otto's avatar
grunt    
Mark Otto committed
1951
1952
1953
1954
        if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) {
          $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(BACKDROP_TRANSITION_DURATION);
        } else {
          callbackRemove();
Jacob Thornton's avatar
Jacob Thornton committed
1955
        }
Mark Otto's avatar
grunt    
Mark Otto committed
1956
1957
1958
1959
      } else if (callback) {
        callback();
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
1960

Mark Otto's avatar
grunt    
Mark Otto committed
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
    // ----------------------------------------------------------------------
    // the following methods are used to handle overflowing modals
    // todo (fat): these should probably be refactored out of modal.js
    // ----------------------------------------------------------------------

    Modal.prototype._handleUpdate = function _handleUpdate() {
      this._adjustDialog();
    };

    Modal.prototype._adjustDialog = function _adjustDialog() {
      var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;

      if (!this._isBodyOverflowing && isModalOverflowing) {
        this._element.style.paddingLeft = this._scrollbarWidth + 'px';
Jacob Thornton's avatar
Jacob Thornton committed
1975
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1976
1977
1978

      if (this._isBodyOverflowing && !isModalOverflowing) {
        this._element.style.paddingRight = this._scrollbarWidth + 'px';
Jacob Thornton's avatar
Jacob Thornton committed
1979
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
    };

    Modal.prototype._resetAdjustments = function _resetAdjustments() {
      this._element.style.paddingLeft = '';
      this._element.style.paddingRight = '';
    };

    Modal.prototype._checkScrollbar = function _checkScrollbar() {
      this._isBodyOverflowing = document.body.clientWidth < window.innerWidth;
      this._scrollbarWidth = this._getScrollbarWidth();
    };

    Modal.prototype._setScrollbar = function _setScrollbar() {
      var bodyPadding = parseInt($(Selector.FIXED_CONTENT).css('padding-right') || 0, 10);

      this._originalBodyPadding = document.body.style.paddingRight || '';

      if (this._isBodyOverflowing) {
        document.body.style.paddingRight = bodyPadding + this._scrollbarWidth + 'px';
Jacob Thornton's avatar
Jacob Thornton committed
1999
      }
Mark Otto's avatar
grunt    
Mark Otto committed
2000
    };
Jacob Thornton's avatar
Jacob Thornton committed
2001

Mark Otto's avatar
grunt    
Mark Otto committed
2002
2003
2004
    Modal.prototype._resetScrollbar = function _resetScrollbar() {
      document.body.style.paddingRight = this._originalBodyPadding;
    };
Jacob Thornton's avatar
Jacob Thornton committed
2005

Mark Otto's avatar
grunt    
Mark Otto committed
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
    Modal.prototype._getScrollbarWidth = function _getScrollbarWidth() {
      // thx d.walsh
      var scrollDiv = document.createElement('div');
      scrollDiv.className = ClassName.SCROLLBAR_MEASURER;
      document.body.appendChild(scrollDiv);
      var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
      document.body.removeChild(scrollDiv);
      return scrollbarWidth;
    };

    // static

    Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
      return this.each(function () {
        var data = $(this).data(DATA_KEY);
        var _config = $.extend({}, Modal.Default, $(this).data(), (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config);

        if (!data) {
          data = new Modal(this, _config);
          $(this).data(DATA_KEY, data);
Jacob Thornton's avatar
Jacob Thornton committed
2026
2027
        }

Mark Otto's avatar
grunt    
Mark Otto committed
2028
2029
2030
        if (typeof config === 'string') {
          if (data[config] === undefined) {
            throw new Error('No method named "' + config + '"');
Jacob Thornton's avatar
Jacob Thornton committed
2031
          }
Mark Otto's avatar
grunt    
Mark Otto committed
2032
2033
2034
2035
2036
2037
2038
2039
          data[config](relatedTarget);
        } else if (_config.show) {
          data.show(relatedTarget);
        }
      });
    };

    _createClass(Modal, null, [{
Jacob Thornton's avatar
Jacob Thornton committed
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
      key: 'VERSION',
      get: function get() {
        return VERSION;
      }
    }, {
      key: 'Default',
      get: function get() {
        return Default;
      }
    }]);

    return Modal;
Mark Otto's avatar
grunt    
Mark Otto committed
2052
2053
2054
2055
2056
2057
2058
  }();

  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
2059
2060
2061
2062

  $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
    var _this13 = this;

Mark Otto's avatar
grunt    
Mark Otto committed
2063
    var target = void 0;
Jacob Thornton's avatar
Jacob Thornton committed
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
    var selector = Util.getSelectorFromElement(this);

    if (selector) {
      target = $(selector)[0];
    }

    var config = $(target).data(DATA_KEY) ? 'toggle' : $.extend({}, $(target).data(), $(this).data());

    if (this.tagName === 'A') {
      event.preventDefault();
    }

    var $target = $(target).one(Event.SHOW, function (showEvent) {
      if (showEvent.isDefaultPrevented()) {
        // only register focus restorer if modal will actually get shown
        return;
      }

      $target.one(Event.HIDDEN, function () {
        if ($(_this13).is(':visible')) {
          _this13.focus();
        }
      });
    });

    Modal._jQueryInterface.call($(target), config, this);
  });

  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
   */

  $.fn[NAME] = Modal._jQueryInterface;
  $.fn[NAME].Constructor = Modal;
  $.fn[NAME].noConflict = function () {
    $.fn[NAME] = JQUERY_NO_CONFLICT;
    return Modal._jQueryInterface;
  };

  return Modal;
Mark Otto's avatar
grunt    
Mark Otto committed
2106
}(jQuery);
Jacob Thornton's avatar
Jacob Thornton committed
2107
2108
2109

/**
 * --------------------------------------------------------------------------
Mark Otto's avatar
Mark Otto committed
2110
 * Bootstrap (v4.0.0-alpha.4): scrollspy.js
Jacob Thornton's avatar
Jacob Thornton committed
2111
2112
2113
2114
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * --------------------------------------------------------------------------
 */

Mark Otto's avatar
grunt    
Mark Otto committed
2115
var ScrollSpy = function ($) {
Jacob Thornton's avatar
Jacob Thornton committed
2116
2117
2118
2119
2120
2121
2122
2123

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

  var NAME = 'scrollspy';
Mark Otto's avatar
Mark Otto committed
2124
  var VERSION = '4.0.0-alpha.4';
Jacob Thornton's avatar
Jacob Thornton committed
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
  var DATA_KEY = 'bs.scrollspy';
  var EVENT_KEY = '.' + DATA_KEY;
  var DATA_API_KEY = '.data-api';
  var JQUERY_NO_CONFLICT = $.fn[NAME];

  var Default = {
    offset: 10,
    method: 'auto',
    target: ''
  };

  var DefaultType = {
    offset: 'number',
    method: 'string',
    target: '(string|element)'
  };

  var Event = {
    ACTIVATE: 'activate' + EVENT_KEY,
    SCROLL: 'scroll' + EVENT_KEY,
    LOAD_DATA_API: 'load' + EVENT_KEY + DATA_API_KEY
  };

  var ClassName = {
Jacob Thornton's avatar
Jacob Thornton committed
2149
    DROPDOWN_ITEM: 'dropdown-item',
Jacob Thornton's avatar
Jacob Thornton committed
2150
    DROPDOWN_MENU: 'dropdown-menu',
Jacob Thornton's avatar
Jacob Thornton committed
2151
2152
    NAV_LINK: 'nav-link',
    NAV: 'nav',
Jacob Thornton's avatar
Jacob Thornton committed
2153
2154
2155
2156
2157
2158
    ACTIVE: 'active'
  };

  var Selector = {
    DATA_SPY: '[data-spy="scroll"]',
    ACTIVE: '.active',
Jacob Thornton's avatar
Jacob Thornton committed
2159
    LIST_ITEM: '.list-item',
Jacob Thornton's avatar
Jacob Thornton committed
2160
2161
    LI: 'li',
    LI_DROPDOWN: 'li.dropdown',
Jacob Thornton's avatar
Jacob Thornton committed
2162
2163
2164
2165
    NAV_LINKS: '.nav-link',
    DROPDOWN: '.dropdown',
    DROPDOWN_ITEMS: '.dropdown-item',
    DROPDOWN_TOGGLE: '.dropdown-toggle'
Jacob Thornton's avatar
Jacob Thornton committed
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
  };

  var OffsetMethod = {
    OFFSET: 'offset',
    POSITION: 'position'
  };

  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */

Mark Otto's avatar
grunt    
Mark Otto committed
2179
  var ScrollSpy = function () {
Jacob Thornton's avatar
Jacob Thornton committed
2180
2181
2182
2183
2184
2185
    function ScrollSpy(element, config) {
      _classCallCheck(this, ScrollSpy);

      this._element = element;
      this._scrollElement = element.tagName === 'BODY' ? window : element;
      this._config = this._getConfig(config);
Jacob Thornton's avatar
Jacob Thornton committed
2186
      this._selector = this._config.target + ' ' + Selector.NAV_LINKS + ',' + (this._config.target + ' ' + Selector.DROPDOWN_ITEMS);
Jacob Thornton's avatar
Jacob Thornton committed
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
      this._offsets = [];
      this._targets = [];
      this._activeTarget = null;
      this._scrollHeight = 0;

      $(this._scrollElement).on(Event.SCROLL, $.proxy(this._process, this));

      this.refresh();
      this._process();
    }

    // getters

Mark Otto's avatar
grunt    
Mark Otto committed
2200
    // public
Jacob Thornton's avatar
Jacob Thornton committed
2201

Mark Otto's avatar
grunt    
Mark Otto committed
2202
2203
    ScrollSpy.prototype.refresh = function refresh() {
      var _this14 = this;
Jacob Thornton's avatar
Jacob Thornton committed
2204

Mark Otto's avatar
grunt    
Mark Otto committed
2205
      var autoMethod = this._scrollElement !== this._scrollElement.window ? OffsetMethod.POSITION : OffsetMethod.OFFSET;
Jacob Thornton's avatar
Jacob Thornton committed
2206

Mark Otto's avatar
grunt    
Mark Otto committed
2207
      var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
Jacob Thornton's avatar
Jacob Thornton committed
2208

Mark Otto's avatar
grunt    
Mark Otto committed
2209
      var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
Jacob Thornton's avatar
Jacob Thornton committed
2210

Mark Otto's avatar
grunt    
Mark Otto committed
2211
2212
      this._offsets = [];
      this._targets = [];
Jacob Thornton's avatar
Jacob Thornton committed
2213

Mark Otto's avatar
grunt    
Mark Otto committed
2214
      this._scrollHeight = this._getScrollHeight();
Jacob Thornton's avatar
Jacob Thornton committed
2215

Mark Otto's avatar
grunt    
Mark Otto committed
2216
      var targets = $.makeArray($(this._selector));
Jacob Thornton's avatar
Jacob Thornton committed
2217

Mark Otto's avatar
grunt    
Mark Otto committed
2218
2219
2220
      targets.map(function (element) {
        var target = void 0;
        var targetSelector = Util.getSelectorFromElement(element);
Jacob Thornton's avatar
Jacob Thornton committed
2221

Mark Otto's avatar
grunt    
Mark Otto committed
2222
2223
2224
        if (targetSelector) {
          target = $(targetSelector)[0];
        }
Jacob Thornton's avatar
Jacob Thornton committed
2225

Mark Otto's avatar
grunt    
Mark Otto committed
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
        if (target && (target.offsetWidth || target.offsetHeight)) {
          // todo (fat): remove sketch reliance on jQuery position/offset
          return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
        }
        return null;
      }).filter(function (item) {
        return item;
      }).sort(function (a, b) {
        return a[0] - b[0];
      }).forEach(function (item) {
        _this14._offsets.push(item[0]);
        _this14._targets.push(item[1]);
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
2240

Mark Otto's avatar
grunt    
Mark Otto committed
2241
2242
2243
    ScrollSpy.prototype.dispose = function dispose() {
      $.removeData(this._element, DATA_KEY);
      $(this._scrollElement).off(EVENT_KEY);
Jacob Thornton's avatar
Jacob Thornton committed
2244

Mark Otto's avatar
grunt    
Mark Otto committed
2245
2246
2247
2248
2249
2250
2251
2252
2253
      this._element = null;
      this._scrollElement = null;
      this._config = null;
      this._selector = null;
      this._offsets = null;
      this._targets = null;
      this._activeTarget = null;
      this._scrollHeight = null;
    };
Jacob Thornton's avatar
Jacob Thornton committed
2254

Mark Otto's avatar
grunt    
Mark Otto committed
2255
    // private
Jacob Thornton's avatar
Jacob Thornton committed
2256

Mark Otto's avatar
grunt    
Mark Otto committed
2257
2258
    ScrollSpy.prototype._getConfig = function _getConfig(config) {
      config = $.extend({}, Default, config);
Jacob Thornton's avatar
Jacob Thornton committed
2259

Mark Otto's avatar
grunt    
Mark Otto committed
2260
2261
2262
2263
2264
2265
2266
      if (typeof config.target !== 'string') {
        var id = $(config.target).attr('id');
        if (!id) {
          id = Util.getUID(NAME);
          $(config.target).attr('id', id);
        }
        config.target = '#' + id;
Jacob Thornton's avatar
Jacob Thornton committed
2267
2268
      }

Mark Otto's avatar
grunt    
Mark Otto committed
2269
2270
2271
2272
      Util.typeCheckConfig(NAME, config, DefaultType);

      return config;
    };
Jacob Thornton's avatar
Jacob Thornton committed
2273

Mark Otto's avatar
grunt    
Mark Otto committed
2274
2275
2276
    ScrollSpy.prototype._getScrollTop = function _getScrollTop() {
      return this._scrollElement === window ? this._scrollElement.scrollY : this._scrollElement.scrollTop;
    };
Jacob Thornton's avatar
Jacob Thornton committed
2277

Mark Otto's avatar
grunt    
Mark Otto committed
2278
2279
2280
    ScrollSpy.prototype._getScrollHeight = function _getScrollHeight() {
      return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
    };
Jacob Thornton's avatar
Jacob Thornton committed
2281

Mark Otto's avatar
grunt    
Mark Otto committed
2282
2283
2284
2285
    ScrollSpy.prototype._process = function _process() {
      var scrollTop = this._getScrollTop() + this._config.offset;
      var scrollHeight = this._getScrollHeight();
      var maxScroll = this._config.offset + scrollHeight - this._scrollElement.offsetHeight;
Jacob Thornton's avatar
Jacob Thornton committed
2286

Mark Otto's avatar
grunt    
Mark Otto committed
2287
2288
2289
      if (this._scrollHeight !== scrollHeight) {
        this.refresh();
      }
Jacob Thornton's avatar
Jacob Thornton committed
2290

Mark Otto's avatar
grunt    
Mark Otto committed
2291
2292
2293
2294
2295
      if (scrollTop >= maxScroll) {
        var target = this._targets[this._targets.length - 1];

        if (this._activeTarget !== target) {
          this._activate(target);
Jacob Thornton's avatar
Jacob Thornton committed
2296
2297
        }
      }
Jacob Thornton's avatar
Jacob Thornton committed
2298

Mark Otto's avatar
grunt    
Mark Otto committed
2299
2300
      if (this._activeTarget && scrollTop < this._offsets[0]) {
        this._activeTarget = null;
Jacob Thornton's avatar
Jacob Thornton committed
2301
        this._clear();
Mark Otto's avatar
grunt    
Mark Otto committed
2302
2303
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2304

Mark Otto's avatar
grunt    
Mark Otto committed
2305
2306
      for (var i = this._offsets.length; i--;) {
        var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (this._offsets[i + 1] === undefined || scrollTop < this._offsets[i + 1]);
Jacob Thornton's avatar
Jacob Thornton committed
2307

Mark Otto's avatar
grunt    
Mark Otto committed
2308
2309
        if (isActiveTarget) {
          this._activate(this._targets[i]);
Jacob Thornton's avatar
Jacob Thornton committed
2310
        }
Jacob Thornton's avatar
Jacob Thornton committed
2311
      }
Mark Otto's avatar
grunt    
Mark Otto committed
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
    };

    ScrollSpy.prototype._activate = function _activate(target) {
      this._activeTarget = target;

      this._clear();

      var queries = this._selector.split(',');
      queries = queries.map(function (selector) {
        return selector + '[data-target="' + target + '"],' + (selector + '[href="' + target + '"]');
      });

      var $link = $(queries.join(','));

      if ($link.hasClass(ClassName.DROPDOWN_ITEM)) {
        $link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
        $link.addClass(ClassName.ACTIVE);
      } else {
        // todo (fat) this is kinda sus...
        // recursively add actives to tested nav-links
        $link.parents(Selector.LI).find(Selector.NAV_LINKS).addClass(ClassName.ACTIVE);
Jacob Thornton's avatar
Jacob Thornton committed
2333
2334
      }

Mark Otto's avatar
grunt    
Mark Otto committed
2335
2336
2337
2338
      $(this._scrollElement).trigger(Event.ACTIVATE, {
        relatedTarget: target
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
2339

Mark Otto's avatar
grunt    
Mark Otto committed
2340
2341
2342
    ScrollSpy.prototype._clear = function _clear() {
      $(this._selector).filter(Selector.ACTIVE).removeClass(ClassName.ACTIVE);
    };
Jacob Thornton's avatar
Jacob Thornton committed
2343

Mark Otto's avatar
grunt    
Mark Otto committed
2344
    // static
Jacob Thornton's avatar
Jacob Thornton committed
2345

Mark Otto's avatar
grunt    
Mark Otto committed
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
    ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
      return this.each(function () {
        var data = $(this).data(DATA_KEY);
        var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config || null;

        if (!data) {
          data = new ScrollSpy(this, _config);
          $(this).data(DATA_KEY, data);
        }

        if (typeof config === 'string') {
          if (data[config] === undefined) {
            throw new Error('No method named "' + config + '"');
Jacob Thornton's avatar
Jacob Thornton committed
2359
          }
Mark Otto's avatar
grunt    
Mark Otto committed
2360
2361
2362
2363
2364
2365
          data[config]();
        }
      });
    };

    _createClass(ScrollSpy, null, [{
Jacob Thornton's avatar
Jacob Thornton committed
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
      key: 'VERSION',
      get: function get() {
        return VERSION;
      }
    }, {
      key: 'Default',
      get: function get() {
        return Default;
      }
    }]);

    return ScrollSpy;
Mark Otto's avatar
grunt    
Mark Otto committed
2378
2379
2380
2381
2382
2383
2384
  }();

  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408

  $(window).on(Event.LOAD_DATA_API, function () {
    var scrollSpys = $.makeArray($(Selector.DATA_SPY));

    for (var i = scrollSpys.length; i--;) {
      var $spy = $(scrollSpys[i]);
      ScrollSpy._jQueryInterface.call($spy, $spy.data());
    }
  });

  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
   */

  $.fn[NAME] = ScrollSpy._jQueryInterface;
  $.fn[NAME].Constructor = ScrollSpy;
  $.fn[NAME].noConflict = function () {
    $.fn[NAME] = JQUERY_NO_CONFLICT;
    return ScrollSpy._jQueryInterface;
  };

  return ScrollSpy;
Mark Otto's avatar
grunt    
Mark Otto committed
2409
}(jQuery);
Jacob Thornton's avatar
Jacob Thornton committed
2410
2411
2412

/**
 * --------------------------------------------------------------------------
Mark Otto's avatar
Mark Otto committed
2413
 * Bootstrap (v4.0.0-alpha.4): tab.js
Jacob Thornton's avatar
Jacob Thornton committed
2414
2415
2416
2417
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * --------------------------------------------------------------------------
 */

Mark Otto's avatar
grunt    
Mark Otto committed
2418
var Tab = function ($) {
Jacob Thornton's avatar
Jacob Thornton committed
2419
2420
2421
2422
2423
2424
2425
2426

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

  var NAME = 'tab';
Mark Otto's avatar
Mark Otto committed
2427
  var VERSION = '4.0.0-alpha.4';
Jacob Thornton's avatar
Jacob Thornton committed
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
  var DATA_KEY = 'bs.tab';
  var EVENT_KEY = '.' + DATA_KEY;
  var DATA_API_KEY = '.data-api';
  var JQUERY_NO_CONFLICT = $.fn[NAME];
  var TRANSITION_DURATION = 150;

  var Event = {
    HIDE: 'hide' + EVENT_KEY,
    HIDDEN: 'hidden' + EVENT_KEY,
    SHOW: 'show' + EVENT_KEY,
    SHOWN: 'shown' + EVENT_KEY,
    CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
  };

  var ClassName = {
    DROPDOWN_MENU: 'dropdown-menu',
    ACTIVE: 'active',
    FADE: 'fade',
    IN: 'in'
  };

  var Selector = {
    A: 'a',
    LI: 'li',
Jacob Thornton's avatar
Jacob Thornton committed
2452
    DROPDOWN: '.dropdown',
Jacob Thornton's avatar
Jacob Thornton committed
2453
    UL: 'ul:not(.dropdown-menu)',
Jacob Thornton's avatar
Jacob Thornton committed
2454
    FADE_CHILD: '> .nav-item .fade, > .fade',
Jacob Thornton's avatar
Jacob Thornton committed
2455
    ACTIVE: '.active',
Jacob Thornton's avatar
Jacob Thornton committed
2456
    ACTIVE_CHILD: '> .nav-item > .active, > .active',
Jacob Thornton's avatar
Jacob Thornton committed
2457
    DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"]',
Jacob Thornton's avatar
Jacob Thornton committed
2458
2459
    DROPDOWN_TOGGLE: '.dropdown-toggle',
    DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
Jacob Thornton's avatar
Jacob Thornton committed
2460
2461
2462
2463
2464
2465
2466
2467
  };

  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */

Mark Otto's avatar
grunt    
Mark Otto committed
2468
  var Tab = function () {
Jacob Thornton's avatar
Jacob Thornton committed
2469
2470
2471
2472
    function Tab(element) {
      _classCallCheck(this, Tab);

      this._element = element;
Jacob Thornton's avatar
Jacob Thornton committed
2473
    }
Jacob Thornton's avatar
Jacob Thornton committed
2474
2475
2476

    // getters

Mark Otto's avatar
grunt    
Mark Otto committed
2477
    // public
Jacob Thornton's avatar
Jacob Thornton committed
2478

Mark Otto's avatar
grunt    
Mark Otto committed
2479
2480
    Tab.prototype.show = function show() {
      var _this15 = this;
Jacob Thornton's avatar
Jacob Thornton committed
2481

Mark Otto's avatar
grunt    
Mark Otto committed
2482
2483
2484
      if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName.ACTIVE)) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2485

Mark Otto's avatar
grunt    
Mark Otto committed
2486
2487
2488
2489
      var target = void 0;
      var previous = void 0;
      var ulElement = $(this._element).closest(Selector.UL)[0];
      var selector = Util.getSelectorFromElement(this._element);
Jacob Thornton's avatar
Jacob Thornton committed
2490

Mark Otto's avatar
grunt    
Mark Otto committed
2491
2492
2493
2494
      if (ulElement) {
        previous = $.makeArray($(ulElement).find(Selector.ACTIVE));
        previous = previous[previous.length - 1];
      }
Jacob Thornton's avatar
Jacob Thornton committed
2495

Mark Otto's avatar
grunt    
Mark Otto committed
2496
2497
2498
      var hideEvent = $.Event(Event.HIDE, {
        relatedTarget: this._element
      });
Jacob Thornton's avatar
Jacob Thornton committed
2499

Mark Otto's avatar
grunt    
Mark Otto committed
2500
2501
2502
      var showEvent = $.Event(Event.SHOW, {
        relatedTarget: previous
      });
Jacob Thornton's avatar
Jacob Thornton committed
2503

Mark Otto's avatar
grunt    
Mark Otto committed
2504
2505
2506
      if (previous) {
        $(previous).trigger(hideEvent);
      }
Jacob Thornton's avatar
Jacob Thornton committed
2507

Mark Otto's avatar
grunt    
Mark Otto committed
2508
      $(this._element).trigger(showEvent);
Jacob Thornton's avatar
Jacob Thornton committed
2509

Mark Otto's avatar
grunt    
Mark Otto committed
2510
2511
2512
      if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2513

Mark Otto's avatar
grunt    
Mark Otto committed
2514
2515
2516
      if (selector) {
        target = $(selector)[0];
      }
Jacob Thornton's avatar
Jacob Thornton committed
2517

Mark Otto's avatar
grunt    
Mark Otto committed
2518
      this._activate(this._element, ulElement);
Jacob Thornton's avatar
Jacob Thornton committed
2519

Mark Otto's avatar
grunt    
Mark Otto committed
2520
2521
2522
2523
      var complete = function complete() {
        var hiddenEvent = $.Event(Event.HIDDEN, {
          relatedTarget: _this15._element
        });
Jacob Thornton's avatar
Jacob Thornton committed
2524

Mark Otto's avatar
grunt    
Mark Otto committed
2525
2526
2527
        var shownEvent = $.Event(Event.SHOWN, {
          relatedTarget: previous
        });
Jacob Thornton's avatar
Jacob Thornton committed
2528

Mark Otto's avatar
grunt    
Mark Otto committed
2529
2530
2531
        $(previous).trigger(hiddenEvent);
        $(_this15._element).trigger(shownEvent);
      };
Jacob Thornton's avatar
Jacob Thornton committed
2532

Mark Otto's avatar
grunt    
Mark Otto committed
2533
2534
2535
2536
      if (target) {
        this._activate(target, target.parentNode, complete);
      } else {
        complete();
Jacob Thornton's avatar
Jacob Thornton committed
2537
      }
Mark Otto's avatar
grunt    
Mark Otto committed
2538
    };
Jacob Thornton's avatar
Jacob Thornton committed
2539

Mark Otto's avatar
grunt    
Mark Otto committed
2540
2541
2542
2543
    Tab.prototype.dispose = function dispose() {
      $.removeClass(this._element, DATA_KEY);
      this._element = null;
    };
Jacob Thornton's avatar
Jacob Thornton committed
2544

Mark Otto's avatar
grunt    
Mark Otto committed
2545
    // private
Jacob Thornton's avatar
Jacob Thornton committed
2546

Mark Otto's avatar
grunt    
Mark Otto committed
2547
2548
2549
    Tab.prototype._activate = function _activate(element, container, callback) {
      var active = $(container).find(Selector.ACTIVE_CHILD)[0];
      var isTransitioning = callback && Util.supportsTransitionEnd() && (active && $(active).hasClass(ClassName.FADE) || Boolean($(container).find(Selector.FADE_CHILD)[0]));
Jacob Thornton's avatar
Jacob Thornton committed
2550

Mark Otto's avatar
grunt    
Mark Otto committed
2551
      var complete = $.proxy(this._transitionComplete, this, element, active, isTransitioning, callback);
Jacob Thornton's avatar
Jacob Thornton committed
2552

Mark Otto's avatar
grunt    
Mark Otto committed
2553
2554
2555
2556
      if (active && isTransitioning) {
        $(active).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
      } else {
        complete();
Jacob Thornton's avatar
Jacob Thornton committed
2557
2558
      }

Mark Otto's avatar
grunt    
Mark Otto committed
2559
2560
2561
2562
      if (active) {
        $(active).removeClass(ClassName.IN);
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
2563

Mark Otto's avatar
grunt    
Mark Otto committed
2564
2565
2566
    Tab.prototype._transitionComplete = function _transitionComplete(element, active, isTransitioning, callback) {
      if (active) {
        $(active).removeClass(ClassName.ACTIVE);
Jacob Thornton's avatar
Jacob Thornton committed
2567

Mark Otto's avatar
grunt    
Mark Otto committed
2568
2569
2570
2571
        var dropdownChild = $(active).find(Selector.DROPDOWN_ACTIVE_CHILD)[0];

        if (dropdownChild) {
          $(dropdownChild).removeClass(ClassName.ACTIVE);
Jacob Thornton's avatar
Jacob Thornton committed
2572
2573
        }

Mark Otto's avatar
grunt    
Mark Otto committed
2574
2575
        active.setAttribute('aria-expanded', false);
      }
Jacob Thornton's avatar
Jacob Thornton committed
2576

Mark Otto's avatar
grunt    
Mark Otto committed
2577
2578
      $(element).addClass(ClassName.ACTIVE);
      element.setAttribute('aria-expanded', true);
Jacob Thornton's avatar
Jacob Thornton committed
2579

Mark Otto's avatar
grunt    
Mark Otto committed
2580
2581
2582
2583
2584
2585
      if (isTransitioning) {
        Util.reflow(element);
        $(element).addClass(ClassName.IN);
      } else {
        $(element).removeClass(ClassName.FADE);
      }
Jacob Thornton's avatar
Jacob Thornton committed
2586

Mark Otto's avatar
grunt    
Mark Otto committed
2587
      if (element.parentNode && $(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) {
Jacob Thornton's avatar
Jacob Thornton committed
2588

Mark Otto's avatar
grunt    
Mark Otto committed
2589
2590
2591
        var dropdownElement = $(element).closest(Selector.DROPDOWN)[0];
        if (dropdownElement) {
          $(dropdownElement).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
Jacob Thornton's avatar
Jacob Thornton committed
2592
2593
        }

Mark Otto's avatar
grunt    
Mark Otto committed
2594
2595
2596
2597
2598
        element.setAttribute('aria-expanded', true);
      }

      if (callback) {
        callback();
Jacob Thornton's avatar
Jacob Thornton committed
2599
      }
Mark Otto's avatar
grunt    
Mark Otto committed
2600
    };
Jacob Thornton's avatar
Jacob Thornton committed
2601

Mark Otto's avatar
grunt    
Mark Otto committed
2602
    // static
Jacob Thornton's avatar
Jacob Thornton committed
2603

Mark Otto's avatar
grunt    
Mark Otto committed
2604
2605
2606
2607
    Tab._jQueryInterface = function _jQueryInterface(config) {
      return this.each(function () {
        var $this = $(this);
        var data = $this.data(DATA_KEY);
Jacob Thornton's avatar
Jacob Thornton committed
2608

Mark Otto's avatar
grunt    
Mark Otto committed
2609
2610
2611
2612
        if (!data) {
          data = data = new Tab(this);
          $this.data(DATA_KEY, data);
        }
Jacob Thornton's avatar
Jacob Thornton committed
2613

Mark Otto's avatar
grunt    
Mark Otto committed
2614
2615
2616
        if (typeof config === 'string') {
          if (data[config] === undefined) {
            throw new Error('No method named "' + config + '"');
Jacob Thornton's avatar
Jacob Thornton committed
2617
          }
Mark Otto's avatar
grunt    
Mark Otto committed
2618
2619
2620
2621
2622
2623
          data[config]();
        }
      });
    };

    _createClass(Tab, null, [{
Jacob Thornton's avatar
Jacob Thornton committed
2624
2625
2626
2627
2628
2629
2630
      key: 'VERSION',
      get: function get() {
        return VERSION;
      }
    }]);

    return Tab;
Mark Otto's avatar
grunt    
Mark Otto committed
2631
2632
2633
2634
2635
2636
2637
  }();

  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657

  $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
    event.preventDefault();
    Tab._jQueryInterface.call($(this), 'show');
  });

  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
   */

  $.fn[NAME] = Tab._jQueryInterface;
  $.fn[NAME].Constructor = Tab;
  $.fn[NAME].noConflict = function () {
    $.fn[NAME] = JQUERY_NO_CONFLICT;
    return Tab._jQueryInterface;
  };

  return Tab;
Mark Otto's avatar
grunt    
Mark Otto committed
2658
}(jQuery);
Jacob Thornton's avatar
Jacob Thornton committed
2659

XhmikosR's avatar
XhmikosR committed
2660
2661
/* global Tether */

Jacob Thornton's avatar
Jacob Thornton committed
2662
2663
/**
 * --------------------------------------------------------------------------
Mark Otto's avatar
Mark Otto committed
2664
 * Bootstrap (v4.0.0-alpha.4): tooltip.js
Jacob Thornton's avatar
Jacob Thornton committed
2665
2666
2667
2668
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * --------------------------------------------------------------------------
 */

Mark Otto's avatar
grunt    
Mark Otto committed
2669
var Tooltip = function ($) {
Jacob Thornton's avatar
Jacob Thornton committed
2670

2671
2672
  /**
   * Check for Tether dependency
Mark Otto's avatar
grunt    
Mark Otto committed
2673
   * Tether - http://tether.io/
2674
   */
XhmikosR's avatar
XhmikosR committed
2675
  if (window.Tether === undefined) {
Mark Otto's avatar
grunt    
Mark Otto committed
2676
    throw new Error('Bootstrap tooltips require Tether (http://tether.io/)');
2677
2678
  }

Jacob Thornton's avatar
Jacob Thornton committed
2679
2680
2681
2682
2683
2684
2685
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME = 'tooltip';
Mark Otto's avatar
Mark Otto committed
2686
  var VERSION = '4.0.0-alpha.4';
Jacob Thornton's avatar
Jacob Thornton committed
2687
2688
2689
2690
2691
2692
2693
2694
  var DATA_KEY = 'bs.tooltip';
  var EVENT_KEY = '.' + DATA_KEY;
  var JQUERY_NO_CONFLICT = $.fn[NAME];
  var TRANSITION_DURATION = 150;
  var CLASS_PREFIX = 'bs-tether';

  var Default = {
    animation: true,
Mark Otto's avatar
grunt    
Mark Otto committed
2695
    template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-inner"></div></div>',
Jacob Thornton's avatar
Jacob Thornton committed
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
    trigger: 'hover focus',
    title: '',
    delay: 0,
    html: false,
    selector: false,
    placement: 'top',
    offset: '0 0',
    constraints: []
  };

  var DefaultType = {
    animation: 'boolean',
    template: 'string',
XhmikosR's avatar
XhmikosR committed
2709
    title: '(string|element|function)',
Jacob Thornton's avatar
Jacob Thornton committed
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
    trigger: 'string',
    delay: '(number|object)',
    html: 'boolean',
    selector: '(string|boolean)',
    placement: '(string|function)',
    offset: 'string',
    constraints: 'array'
  };

  var AttachmentMap = {
    TOP: 'bottom center',
    RIGHT: 'middle left',
    BOTTOM: 'top center',
    LEFT: 'middle right'
  };

  var HoverState = {
    IN: 'in',
    OUT: 'out'
  };

  var Event = {
    HIDE: 'hide' + EVENT_KEY,
    HIDDEN: 'hidden' + EVENT_KEY,
    SHOW: 'show' + EVENT_KEY,
    SHOWN: 'shown' + EVENT_KEY,
    INSERTED: 'inserted' + EVENT_KEY,
    CLICK: 'click' + EVENT_KEY,
    FOCUSIN: 'focusin' + EVENT_KEY,
    FOCUSOUT: 'focusout' + EVENT_KEY,
    MOUSEENTER: 'mouseenter' + EVENT_KEY,
    MOUSELEAVE: 'mouseleave' + EVENT_KEY
  };

  var ClassName = {
    FADE: 'fade',
    IN: 'in'
  };

  var Selector = {
    TOOLTIP: '.tooltip',
    TOOLTIP_INNER: '.tooltip-inner'
  };

  var TetherClass = {
    element: false,
    enabled: false
  };

  var Trigger = {
    HOVER: 'hover',
    FOCUS: 'focus',
    CLICK: 'click',
    MANUAL: 'manual'
  };

  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */

Mark Otto's avatar
grunt    
Mark Otto committed
2772
  var Tooltip = function () {
Jacob Thornton's avatar
Jacob Thornton committed
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
    function Tooltip(element, config) {
      _classCallCheck(this, Tooltip);

      // private
      this._isEnabled = true;
      this._timeout = 0;
      this._hoverState = '';
      this._activeTrigger = {};
      this._tether = null;

      // protected
      this.element = element;
      this.config = this._getConfig(config);
      this.tip = null;

      this._setListeners();
    }

    // getters

Mark Otto's avatar
grunt    
Mark Otto committed
2793
    // public
Jacob Thornton's avatar
Jacob Thornton committed
2794

Mark Otto's avatar
grunt    
Mark Otto committed
2795
2796
2797
    Tooltip.prototype.enable = function enable() {
      this._isEnabled = true;
    };
Jacob Thornton's avatar
Jacob Thornton committed
2798

Mark Otto's avatar
grunt    
Mark Otto committed
2799
2800
2801
    Tooltip.prototype.disable = function disable() {
      this._isEnabled = false;
    };
Jacob Thornton's avatar
Jacob Thornton committed
2802

Mark Otto's avatar
grunt    
Mark Otto committed
2803
2804
2805
2806
2807
2808
2809
2810
    Tooltip.prototype.toggleEnabled = function toggleEnabled() {
      this._isEnabled = !this._isEnabled;
    };

    Tooltip.prototype.toggle = function toggle(event) {
      if (event) {
        var dataKey = this.constructor.DATA_KEY;
        var context = $(event.currentTarget).data(dataKey);
Jacob Thornton's avatar
Jacob Thornton committed
2811

Mark Otto's avatar
grunt    
Mark Otto committed
2812
2813
2814
2815
        if (!context) {
          context = new this.constructor(event.currentTarget, this._getDelegateConfig());
          $(event.currentTarget).data(dataKey, context);
        }
Jacob Thornton's avatar
Jacob Thornton committed
2816

Mark Otto's avatar
grunt    
Mark Otto committed
2817
        context._activeTrigger.click = !context._activeTrigger.click;
Jacob Thornton's avatar
Jacob Thornton committed
2818

Mark Otto's avatar
grunt    
Mark Otto committed
2819
2820
2821
2822
2823
2824
        if (context._isWithActiveTrigger()) {
          context._enter(null, context);
        } else {
          context._leave(null, context);
        }
      } else {
Jacob Thornton's avatar
Jacob Thornton committed
2825

Mark Otto's avatar
grunt    
Mark Otto committed
2826
2827
2828
        if ($(this.getTipElement()).hasClass(ClassName.IN)) {
          this._leave(null, this);
          return;
Jacob Thornton's avatar
Jacob Thornton committed
2829
2830
        }

Mark Otto's avatar
grunt    
Mark Otto committed
2831
2832
2833
        this._enter(null, this);
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
2834

Mark Otto's avatar
grunt    
Mark Otto committed
2835
2836
    Tooltip.prototype.dispose = function dispose() {
      clearTimeout(this._timeout);
Jacob Thornton's avatar
Jacob Thornton committed
2837

Mark Otto's avatar
grunt    
Mark Otto committed
2838
      this.cleanupTether();
Jacob Thornton's avatar
Jacob Thornton committed
2839

Mark Otto's avatar
grunt    
Mark Otto committed
2840
      $.removeData(this.element, this.constructor.DATA_KEY);
Jacob Thornton's avatar
Jacob Thornton committed
2841

Mark Otto's avatar
grunt    
Mark Otto committed
2842
      $(this.element).off(this.constructor.EVENT_KEY);
Jacob Thornton's avatar
Jacob Thornton committed
2843

Mark Otto's avatar
grunt    
Mark Otto committed
2844
2845
      if (this.tip) {
        $(this.tip).remove();
Jacob Thornton's avatar
Jacob Thornton committed
2846
2847
      }

Mark Otto's avatar
grunt    
Mark Otto committed
2848
2849
2850
2851
2852
      this._isEnabled = null;
      this._timeout = null;
      this._hoverState = null;
      this._activeTrigger = null;
      this._tether = null;
Jacob Thornton's avatar
Jacob Thornton committed
2853

Mark Otto's avatar
grunt    
Mark Otto committed
2854
2855
2856
2857
      this.element = null;
      this.config = null;
      this.tip = null;
    };
Jacob Thornton's avatar
Jacob Thornton committed
2858

Mark Otto's avatar
grunt    
Mark Otto committed
2859
2860
    Tooltip.prototype.show = function show() {
      var _this16 = this;
Jacob Thornton's avatar
Jacob Thornton committed
2861

Mark Otto's avatar
grunt    
Mark Otto committed
2862
      var showEvent = $.Event(this.constructor.Event.SHOW);
Jacob Thornton's avatar
Jacob Thornton committed
2863

Mark Otto's avatar
grunt    
Mark Otto committed
2864
2865
      if (this.isWithContent() && this._isEnabled) {
        $(this.element).trigger(showEvent);
Jacob Thornton's avatar
Jacob Thornton committed
2866

Mark Otto's avatar
grunt    
Mark Otto committed
2867
        var isInTheDom = $.contains(this.element.ownerDocument.documentElement, this.element);
Jacob Thornton's avatar
Jacob Thornton committed
2868

Mark Otto's avatar
grunt    
Mark Otto committed
2869
2870
2871
        if (showEvent.isDefaultPrevented() || !isInTheDom) {
          return;
        }
Jacob Thornton's avatar
Jacob Thornton committed
2872

Mark Otto's avatar
grunt    
Mark Otto committed
2873
2874
        var tip = this.getTipElement();
        var tipId = Util.getUID(this.constructor.NAME);
Jacob Thornton's avatar
Jacob Thornton committed
2875

Mark Otto's avatar
grunt    
Mark Otto committed
2876
2877
        tip.setAttribute('id', tipId);
        this.element.setAttribute('aria-describedby', tipId);
Jacob Thornton's avatar
Jacob Thornton committed
2878

Mark Otto's avatar
grunt    
Mark Otto committed
2879
        this.setContent();
Jacob Thornton's avatar
Jacob Thornton committed
2880

Mark Otto's avatar
grunt    
Mark Otto committed
2881
2882
2883
        if (this.config.animation) {
          $(tip).addClass(ClassName.FADE);
        }
Jacob Thornton's avatar
Jacob Thornton committed
2884

Mark Otto's avatar
grunt    
Mark Otto committed
2885
        var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
Jacob Thornton's avatar
Jacob Thornton committed
2886

Mark Otto's avatar
grunt    
Mark Otto committed
2887
        var attachment = this._getAttachment(placement);
Jacob Thornton's avatar
Jacob Thornton committed
2888

Mark Otto's avatar
grunt    
Mark Otto committed
2889
        $(tip).data(this.constructor.DATA_KEY, this).appendTo(document.body);
Jacob Thornton's avatar
Jacob Thornton committed
2890

Mark Otto's avatar
grunt    
Mark Otto committed
2891
        $(this.element).trigger(this.constructor.Event.INSERTED);
Jacob Thornton's avatar
Jacob Thornton committed
2892

Mark Otto's avatar
grunt    
Mark Otto committed
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
        this._tether = new Tether({
          attachment: attachment,
          element: tip,
          target: this.element,
          classes: TetherClass,
          classPrefix: CLASS_PREFIX,
          offset: this.config.offset,
          constraints: this.config.constraints,
          addTargetClasses: false
        });
Jacob Thornton's avatar
Jacob Thornton committed
2903

Mark Otto's avatar
grunt    
Mark Otto committed
2904
2905
        Util.reflow(tip);
        this._tether.position();
Jacob Thornton's avatar
Jacob Thornton committed
2906

Mark Otto's avatar
grunt    
Mark Otto committed
2907
        $(tip).addClass(ClassName.IN);
Jacob Thornton's avatar
Jacob Thornton committed
2908
2909

        var complete = function complete() {
Mark Otto's avatar
grunt    
Mark Otto committed
2910
2911
          var prevHoverState = _this16._hoverState;
          _this16._hoverState = null;
Jacob Thornton's avatar
Jacob Thornton committed
2912

Mark Otto's avatar
grunt    
Mark Otto committed
2913
          $(_this16.element).trigger(_this16.constructor.Event.SHOWN);
Jacob Thornton's avatar
Jacob Thornton committed
2914

Mark Otto's avatar
grunt    
Mark Otto committed
2915
2916
          if (prevHoverState === HoverState.OUT) {
            _this16._leave(null, _this16);
Jacob Thornton's avatar
Jacob Thornton committed
2917
          }
Jacob Thornton's avatar
Jacob Thornton committed
2918
2919
        };

Mark Otto's avatar
grunt    
Mark Otto committed
2920
2921
        if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) {
          $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(Tooltip._TRANSITION_DURATION);
Jacob Thornton's avatar
Jacob Thornton committed
2922
          return;
Jacob Thornton's avatar
Jacob Thornton committed
2923
2924
        }

Mark Otto's avatar
grunt    
Mark Otto committed
2925
2926
2927
        complete();
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
2928

Mark Otto's avatar
grunt    
Mark Otto committed
2929
2930
    Tooltip.prototype.hide = function hide(callback) {
      var _this17 = this;
Jacob Thornton's avatar
Jacob Thornton committed
2931

Mark Otto's avatar
grunt    
Mark Otto committed
2932
2933
2934
2935
2936
      var tip = this.getTipElement();
      var hideEvent = $.Event(this.constructor.Event.HIDE);
      var complete = function complete() {
        if (_this17._hoverState !== HoverState.IN && tip.parentNode) {
          tip.parentNode.removeChild(tip);
Jacob Thornton's avatar
Jacob Thornton committed
2937
2938
        }

Mark Otto's avatar
grunt    
Mark Otto committed
2939
2940
2941
        _this17.element.removeAttribute('aria-describedby');
        $(_this17.element).trigger(_this17.constructor.Event.HIDDEN);
        _this17.cleanupTether();
Jacob Thornton's avatar
Jacob Thornton committed
2942

Mark Otto's avatar
grunt    
Mark Otto committed
2943
2944
2945
2946
        if (callback) {
          callback();
        }
      };
Jacob Thornton's avatar
Jacob Thornton committed
2947

Mark Otto's avatar
grunt    
Mark Otto committed
2948
2949
2950
2951
      $(this.element).trigger(hideEvent);

      if (hideEvent.isDefaultPrevented()) {
        return;
Jacob Thornton's avatar
Jacob Thornton committed
2952
2953
      }

Mark Otto's avatar
grunt    
Mark Otto committed
2954
      $(tip).removeClass(ClassName.IN);
Jacob Thornton's avatar
Jacob Thornton committed
2955

Mark Otto's avatar
grunt    
Mark Otto committed
2956
      if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) {
Jacob Thornton's avatar
Jacob Thornton committed
2957

Mark Otto's avatar
grunt    
Mark Otto committed
2958
2959
2960
        $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
      } else {
        complete();
Jacob Thornton's avatar
Jacob Thornton committed
2961
      }
Mark Otto's avatar
grunt    
Mark Otto committed
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992

      this._hoverState = '';
    };

    // protected

    Tooltip.prototype.isWithContent = function isWithContent() {
      return Boolean(this.getTitle());
    };

    Tooltip.prototype.getTipElement = function getTipElement() {
      return this.tip = this.tip || $(this.config.template)[0];
    };

    Tooltip.prototype.setContent = function setContent() {
      var $tip = $(this.getTipElement());

      this.setElementContent($tip.find(Selector.TOOLTIP_INNER), this.getTitle());

      $tip.removeClass(ClassName.FADE).removeClass(ClassName.IN);

      this.cleanupTether();
    };

    Tooltip.prototype.setElementContent = function setElementContent($element, content) {
      var html = this.config.html;
      if ((typeof content === 'undefined' ? 'undefined' : _typeof(content)) === 'object' && (content.nodeType || content.jquery)) {
        // content is a DOM node or a jQuery
        if (html) {
          if (!$(content).parent().is($element)) {
            $element.empty().append(content);
XhmikosR's avatar
XhmikosR committed
2993
2994
          }
        } else {
Mark Otto's avatar
grunt    
Mark Otto committed
2995
          $element.text($(content).text());
XhmikosR's avatar
XhmikosR committed
2996
        }
Mark Otto's avatar
grunt    
Mark Otto committed
2997
2998
      } else {
        $element[html ? 'html' : 'text'](content);
XhmikosR's avatar
XhmikosR committed
2999
      }
Mark Otto's avatar
grunt    
Mark Otto committed
3000
    };
Jacob Thornton's avatar
Jacob Thornton committed
3001

Mark Otto's avatar
grunt    
Mark Otto committed
3002
3003
    Tooltip.prototype.getTitle = function getTitle() {
      var title = this.element.getAttribute('data-original-title');
Jacob Thornton's avatar
Jacob Thornton committed
3004

Mark Otto's avatar
grunt    
Mark Otto committed
3005
3006
      if (!title) {
        title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
Jacob Thornton's avatar
Jacob Thornton committed
3007
3008
      }

Mark Otto's avatar
grunt    
Mark Otto committed
3009
3010
      return title;
    };
Jacob Thornton's avatar
Jacob Thornton committed
3011

Mark Otto's avatar
grunt    
Mark Otto committed
3012
3013
3014
    Tooltip.prototype.cleanupTether = function cleanupTether() {
      if (this._tether) {
        this._tether.destroy();
Jacob Thornton's avatar
Jacob Thornton committed
3015
      }
Mark Otto's avatar
grunt    
Mark Otto committed
3016
    };
Jacob Thornton's avatar
Jacob Thornton committed
3017

Mark Otto's avatar
grunt    
Mark Otto committed
3018
    // private
Jacob Thornton's avatar
Jacob Thornton committed
3019

Mark Otto's avatar
grunt    
Mark Otto committed
3020
3021
3022
    Tooltip.prototype._getAttachment = function _getAttachment(placement) {
      return AttachmentMap[placement.toUpperCase()];
    };
Jacob Thornton's avatar
Jacob Thornton committed
3023

Mark Otto's avatar
grunt    
Mark Otto committed
3024
3025
    Tooltip.prototype._setListeners = function _setListeners() {
      var _this18 = this;
Jacob Thornton's avatar
Jacob Thornton committed
3026

Mark Otto's avatar
grunt    
Mark Otto committed
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
      var triggers = this.config.trigger.split(' ');

      triggers.forEach(function (trigger) {
        if (trigger === 'click') {
          $(_this18.element).on(_this18.constructor.Event.CLICK, _this18.config.selector, $.proxy(_this18.toggle, _this18));
        } else if (trigger !== Trigger.MANUAL) {
          var eventIn = trigger === Trigger.HOVER ? _this18.constructor.Event.MOUSEENTER : _this18.constructor.Event.FOCUSIN;
          var eventOut = trigger === Trigger.HOVER ? _this18.constructor.Event.MOUSELEAVE : _this18.constructor.Event.FOCUSOUT;

          $(_this18.element).on(eventIn, _this18.config.selector, $.proxy(_this18._enter, _this18)).on(eventOut, _this18.config.selector, $.proxy(_this18._leave, _this18));
Jacob Thornton's avatar
Jacob Thornton committed
3037
        }
Mark Otto's avatar
grunt    
Mark Otto committed
3038
3039
3040
3041
3042
3043
3044
3045
3046
      });

      if (this.config.selector) {
        this.config = $.extend({}, this.config, {
          trigger: 'manual',
          selector: ''
        });
      } else {
        this._fixTitle();
Jacob Thornton's avatar
Jacob Thornton committed
3047
      }
Mark Otto's avatar
grunt    
Mark Otto committed
3048
    };
Jacob Thornton's avatar
Jacob Thornton committed
3049

Mark Otto's avatar
grunt    
Mark Otto committed
3050
3051
3052
3053
3054
3055
3056
    Tooltip.prototype._fixTitle = function _fixTitle() {
      var titleType = _typeof(this.element.getAttribute('data-original-title'));
      if (this.element.getAttribute('title') || titleType !== 'string') {
        this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
        this.element.setAttribute('title', '');
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
3057

Mark Otto's avatar
grunt    
Mark Otto committed
3058
3059
    Tooltip.prototype._enter = function _enter(event, context) {
      var dataKey = this.constructor.DATA_KEY;
Jacob Thornton's avatar
Jacob Thornton committed
3060

Mark Otto's avatar
grunt    
Mark Otto committed
3061
      context = context || $(event.currentTarget).data(dataKey);
Jacob Thornton's avatar
Jacob Thornton committed
3062

Mark Otto's avatar
grunt    
Mark Otto committed
3063
3064
3065
3066
      if (!context) {
        context = new this.constructor(event.currentTarget, this._getDelegateConfig());
        $(event.currentTarget).data(dataKey, context);
      }
Jacob Thornton's avatar
Jacob Thornton committed
3067

Mark Otto's avatar
grunt    
Mark Otto committed
3068
3069
3070
      if (event) {
        context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
      }
Jacob Thornton's avatar
Jacob Thornton committed
3071

Mark Otto's avatar
grunt    
Mark Otto committed
3072
      if ($(context.getTipElement()).hasClass(ClassName.IN) || context._hoverState === HoverState.IN) {
Jacob Thornton's avatar
Jacob Thornton committed
3073
        context._hoverState = HoverState.IN;
Mark Otto's avatar
grunt    
Mark Otto committed
3074
3075
3076
3077
3078
3079
        return;
      }

      clearTimeout(context._timeout);

      context._hoverState = HoverState.IN;
Jacob Thornton's avatar
Jacob Thornton committed
3080

Mark Otto's avatar
grunt    
Mark Otto committed
3081
3082
3083
3084
3085
3086
3087
      if (!context.config.delay || !context.config.delay.show) {
        context.show();
        return;
      }

      context._timeout = setTimeout(function () {
        if (context._hoverState === HoverState.IN) {
Jacob Thornton's avatar
Jacob Thornton committed
3088
3089
          context.show();
        }
Mark Otto's avatar
grunt    
Mark Otto committed
3090
3091
      }, context.config.delay.show);
    };
Jacob Thornton's avatar
Jacob Thornton committed
3092

Mark Otto's avatar
grunt    
Mark Otto committed
3093
3094
    Tooltip.prototype._leave = function _leave(event, context) {
      var dataKey = this.constructor.DATA_KEY;
Jacob Thornton's avatar
Jacob Thornton committed
3095

Mark Otto's avatar
grunt    
Mark Otto committed
3096
      context = context || $(event.currentTarget).data(dataKey);
Jacob Thornton's avatar
Jacob Thornton committed
3097

Mark Otto's avatar
grunt    
Mark Otto committed
3098
3099
3100
3101
      if (!context) {
        context = new this.constructor(event.currentTarget, this._getDelegateConfig());
        $(event.currentTarget).data(dataKey, context);
      }
Jacob Thornton's avatar
Jacob Thornton committed
3102

Mark Otto's avatar
grunt    
Mark Otto committed
3103
3104
3105
      if (event) {
        context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
      }
Jacob Thornton's avatar
Jacob Thornton committed
3106

Mark Otto's avatar
grunt    
Mark Otto committed
3107
3108
3109
      if (context._isWithActiveTrigger()) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
3110

Mark Otto's avatar
grunt    
Mark Otto committed
3111
      clearTimeout(context._timeout);
Jacob Thornton's avatar
Jacob Thornton committed
3112

Mark Otto's avatar
grunt    
Mark Otto committed
3113
3114
3115
3116
3117
3118
      context._hoverState = HoverState.OUT;

      if (!context.config.delay || !context.config.delay.hide) {
        context.hide();
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
3119

Mark Otto's avatar
grunt    
Mark Otto committed
3120
3121
      context._timeout = setTimeout(function () {
        if (context._hoverState === HoverState.OUT) {
Jacob Thornton's avatar
Jacob Thornton committed
3122
3123
          context.hide();
        }
Mark Otto's avatar
grunt    
Mark Otto committed
3124
3125
      }, context.config.delay.hide);
    };
Jacob Thornton's avatar
Jacob Thornton committed
3126

Mark Otto's avatar
grunt    
Mark Otto committed
3127
3128
3129
3130
    Tooltip.prototype._isWithActiveTrigger = function _isWithActiveTrigger() {
      for (var trigger in this._activeTrigger) {
        if (this._activeTrigger[trigger]) {
          return true;
Jacob Thornton's avatar
Jacob Thornton committed
3131
3132
3133
        }
      }

Mark Otto's avatar
grunt    
Mark Otto committed
3134
3135
      return false;
    };
Jacob Thornton's avatar
Jacob Thornton committed
3136

Mark Otto's avatar
grunt    
Mark Otto committed
3137
3138
    Tooltip.prototype._getConfig = function _getConfig(config) {
      config = $.extend({}, this.constructor.Default, $(this.element).data(), config);
Jacob Thornton's avatar
Jacob Thornton committed
3139

Mark Otto's avatar
grunt    
Mark Otto committed
3140
3141
3142
3143
3144
      if (config.delay && typeof config.delay === 'number') {
        config.delay = {
          show: config.delay,
          hide: config.delay
        };
Jacob Thornton's avatar
Jacob Thornton committed
3145
      }
Mark Otto's avatar
grunt    
Mark Otto committed
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158

      Util.typeCheckConfig(NAME, config, this.constructor.DefaultType);

      return config;
    };

    Tooltip.prototype._getDelegateConfig = function _getDelegateConfig() {
      var config = {};

      if (this.config) {
        for (var key in this.config) {
          if (this.constructor.Default[key] !== this.config[key]) {
            config[key] = this.config[key];
Jacob Thornton's avatar
Jacob Thornton committed
3159
3160
3161
3162
          }
        }
      }

Mark Otto's avatar
grunt    
Mark Otto committed
3163
3164
      return config;
    };
Jacob Thornton's avatar
Jacob Thornton committed
3165

Mark Otto's avatar
grunt    
Mark Otto committed
3166
    // static
Jacob Thornton's avatar
Jacob Thornton committed
3167

Mark Otto's avatar
grunt    
Mark Otto committed
3168
3169
3170
3171
    Tooltip._jQueryInterface = function _jQueryInterface(config) {
      return this.each(function () {
        var data = $(this).data(DATA_KEY);
        var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' ? config : null;
Jacob Thornton's avatar
Jacob Thornton committed
3172

Mark Otto's avatar
grunt    
Mark Otto committed
3173
        if (!data && /dispose|hide/.test(config)) {
Mark Otto's avatar
grunt    
Mark Otto committed
3174
3175
          return;
        }
Jacob Thornton's avatar
Jacob Thornton committed
3176

Mark Otto's avatar
grunt    
Mark Otto committed
3177
3178
3179
3180
3181
3182
3183
3184
        if (!data) {
          data = new Tooltip(this, _config);
          $(this).data(DATA_KEY, data);
        }

        if (typeof config === 'string') {
          if (data[config] === undefined) {
            throw new Error('No method named "' + config + '"');
Jacob Thornton's avatar
Jacob Thornton committed
3185
          }
Mark Otto's avatar
grunt    
Mark Otto committed
3186
3187
3188
3189
3190
3191
          data[config]();
        }
      });
    };

    _createClass(Tooltip, null, [{
Jacob Thornton's avatar
Jacob Thornton committed
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
      key: 'VERSION',
      get: function get() {
        return VERSION;
      }
    }, {
      key: 'Default',
      get: function get() {
        return Default;
      }
    }, {
      key: 'NAME',
      get: function get() {
        return NAME;
      }
    }, {
      key: 'DATA_KEY',
      get: function get() {
        return DATA_KEY;
      }
    }, {
      key: 'Event',
      get: function get() {
        return Event;
      }
    }, {
      key: 'EVENT_KEY',
      get: function get() {
        return EVENT_KEY;
      }
    }, {
      key: 'DefaultType',
      get: function get() {
        return DefaultType;
      }
    }]);

    return Tooltip;
Mark Otto's avatar
grunt    
Mark Otto committed
3229
3230
3231
3232
3233
3234
3235
  }();

  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
3236
3237
3238
3239
3240
3241
3242
3243
3244

  $.fn[NAME] = Tooltip._jQueryInterface;
  $.fn[NAME].Constructor = Tooltip;
  $.fn[NAME].noConflict = function () {
    $.fn[NAME] = JQUERY_NO_CONFLICT;
    return Tooltip._jQueryInterface;
  };

  return Tooltip;
Mark Otto's avatar
grunt    
Mark Otto committed
3245
}(jQuery);
Jacob Thornton's avatar
Jacob Thornton committed
3246
3247
3248

/**
 * --------------------------------------------------------------------------
Mark Otto's avatar
Mark Otto committed
3249
 * Bootstrap (v4.0.0-alpha.4): popover.js
Jacob Thornton's avatar
Jacob Thornton committed
3250
3251
3252
3253
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * --------------------------------------------------------------------------
 */

Mark Otto's avatar
grunt    
Mark Otto committed
3254
var Popover = function ($) {
Jacob Thornton's avatar
Jacob Thornton committed
3255
3256
3257
3258
3259
3260
3261
3262

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

  var NAME = 'popover';
Mark Otto's avatar
Mark Otto committed
3263
  var VERSION = '4.0.0-alpha.4';
Jacob Thornton's avatar
Jacob Thornton committed
3264
3265
3266
3267
3268
3269
3270
3271
  var DATA_KEY = 'bs.popover';
  var EVENT_KEY = '.' + DATA_KEY;
  var JQUERY_NO_CONFLICT = $.fn[NAME];

  var Default = $.extend({}, Tooltip.Default, {
    placement: 'right',
    trigger: 'click',
    content: '',
Mark Otto's avatar
grunt    
Mark Otto committed
3272
    template: '<div class="popover" role="tooltip">' + '<h3 class="popover-title"></h3>' + '<div class="popover-content"></div></div>'
Jacob Thornton's avatar
Jacob Thornton committed
3273
3274
3275
  });

  var DefaultType = $.extend({}, Tooltip.DefaultType, {
XhmikosR's avatar
XhmikosR committed
3276
    content: '(string|element|function)'
Jacob Thornton's avatar
Jacob Thornton committed
3277
3278
3279
3280
3281
3282
3283
3284
3285
  });

  var ClassName = {
    FADE: 'fade',
    IN: 'in'
  };

  var Selector = {
    TITLE: '.popover-title',
Mark Otto's avatar
grunt    
Mark Otto committed
3286
    CONTENT: '.popover-content'
Jacob Thornton's avatar
Jacob Thornton committed
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
  };

  var Event = {
    HIDE: 'hide' + EVENT_KEY,
    HIDDEN: 'hidden' + EVENT_KEY,
    SHOW: 'show' + EVENT_KEY,
    SHOWN: 'shown' + EVENT_KEY,
    INSERTED: 'inserted' + EVENT_KEY,
    CLICK: 'click' + EVENT_KEY,
    FOCUSIN: 'focusin' + EVENT_KEY,
    FOCUSOUT: 'focusout' + EVENT_KEY,
    MOUSEENTER: 'mouseenter' + EVENT_KEY,
    MOUSELEAVE: 'mouseleave' + EVENT_KEY
  };

  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */

Mark Otto's avatar
grunt    
Mark Otto committed
3308
  var Popover = function (_Tooltip) {
Jacob Thornton's avatar
Jacob Thornton committed
3309
3310
3311
3312
3313
    _inherits(Popover, _Tooltip);

    function Popover() {
      _classCallCheck(this, Popover);

Mark Otto's avatar
grunt    
Mark Otto committed
3314
      return _possibleConstructorReturn(this, _Tooltip.apply(this, arguments));
Jacob Thornton's avatar
Jacob Thornton committed
3315
3316
    }

Mark Otto's avatar
grunt    
Mark Otto committed
3317
    // overrides
Jacob Thornton's avatar
Jacob Thornton committed
3318

Mark Otto's avatar
grunt    
Mark Otto committed
3319
3320
3321
    Popover.prototype.isWithContent = function isWithContent() {
      return this.getTitle() || this._getContent();
    };
Jacob Thornton's avatar
Jacob Thornton committed
3322

Mark Otto's avatar
grunt    
Mark Otto committed
3323
3324
3325
    Popover.prototype.getTipElement = function getTipElement() {
      return this.tip = this.tip || $(this.config.template)[0];
    };
Jacob Thornton's avatar
Jacob Thornton committed
3326

Mark Otto's avatar
grunt    
Mark Otto committed
3327
3328
    Popover.prototype.setContent = function setContent() {
      var $tip = $(this.getTipElement());
Jacob Thornton's avatar
Jacob Thornton committed
3329

Mark Otto's avatar
grunt    
Mark Otto committed
3330
3331
3332
      // we use append for html objects to maintain js events
      this.setElementContent($tip.find(Selector.TITLE), this.getTitle());
      this.setElementContent($tip.find(Selector.CONTENT), this._getContent());
Jacob Thornton's avatar
Jacob Thornton committed
3333

Mark Otto's avatar
grunt    
Mark Otto committed
3334
      $tip.removeClass(ClassName.FADE).removeClass(ClassName.IN);
Jacob Thornton's avatar
Jacob Thornton committed
3335

Mark Otto's avatar
grunt    
Mark Otto committed
3336
3337
      this.cleanupTether();
    };
Jacob Thornton's avatar
Jacob Thornton committed
3338

Mark Otto's avatar
grunt    
Mark Otto committed
3339
    // private
Jacob Thornton's avatar
Jacob Thornton committed
3340

Mark Otto's avatar
grunt    
Mark Otto committed
3341
3342
3343
    Popover.prototype._getContent = function _getContent() {
      return this.element.getAttribute('data-content') || (typeof this.config.content === 'function' ? this.config.content.call(this.element) : this.config.content);
    };
Jacob Thornton's avatar
Jacob Thornton committed
3344

Mark Otto's avatar
grunt    
Mark Otto committed
3345
    // static
Jacob Thornton's avatar
Jacob Thornton committed
3346

Mark Otto's avatar
grunt    
Mark Otto committed
3347
3348
3349
3350
    Popover._jQueryInterface = function _jQueryInterface(config) {
      return this.each(function () {
        var data = $(this).data(DATA_KEY);
        var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' ? config : null;
Jacob Thornton's avatar
Jacob Thornton committed
3351

Mark Otto's avatar
grunt    
Mark Otto committed
3352
3353
3354
        if (!data && /destroy|hide/.test(config)) {
          return;
        }
Jacob Thornton's avatar
Jacob Thornton committed
3355

Mark Otto's avatar
grunt    
Mark Otto committed
3356
3357
3358
3359
        if (!data) {
          data = new Popover(this, _config);
          $(this).data(DATA_KEY, data);
        }
Jacob Thornton's avatar
Jacob Thornton committed
3360

Mark Otto's avatar
grunt    
Mark Otto committed
3361
3362
3363
        if (typeof config === 'string') {
          if (data[config] === undefined) {
            throw new Error('No method named "' + config + '"');
Mark Otto's avatar
grunt    
Mark Otto committed
3364
          }
Mark Otto's avatar
grunt    
Mark Otto committed
3365
3366
3367
3368
3369
3370
          data[config]();
        }
      });
    };

    _createClass(Popover, null, [{
Jacob Thornton's avatar
Jacob Thornton committed
3371
3372
      key: 'VERSION',

Mark Otto's avatar
grunt    
Mark Otto committed
3373

Jacob Thornton's avatar
Jacob Thornton committed
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
      // getters

      get: function get() {
        return VERSION;
      }
    }, {
      key: 'Default',
      get: function get() {
        return Default;
      }
    }, {
      key: 'NAME',
      get: function get() {
        return NAME;
      }
    }, {
      key: 'DATA_KEY',
      get: function get() {
        return DATA_KEY;
      }
    }, {
      key: 'Event',
      get: function get() {
        return Event;
      }
    }, {
      key: 'EVENT_KEY',
      get: function get() {
        return EVENT_KEY;
      }
    }, {
      key: 'DefaultType',
      get: function get() {
        return DefaultType;
      }
    }]);

    return Popover;
Mark Otto's avatar
grunt    
Mark Otto committed
3412
3413
3414
3415
3416
3417
3418
  }(Tooltip);

  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428

  $.fn[NAME] = Popover._jQueryInterface;
  $.fn[NAME].Constructor = Popover;
  $.fn[NAME].noConflict = function () {
    $.fn[NAME] = JQUERY_NO_CONFLICT;
    return Popover._jQueryInterface;
  };

  return Popover;
}(jQuery);
Mark Otto's avatar
grunt    
Mark Otto committed
3429
3430

}();