bootstrap.js 125 KB
Newer Older
XhmikosR's avatar
Dist    
XhmikosR committed
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */


  $(document).on(Event$4.KEYDOWN_DATA_API, Selector$4.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event$4.KEYDOWN_DATA_API, Selector$4.MENU, Dropdown._dataApiKeydownHandler).on(Event$4.CLICK_DATA_API + " " + Event$4.KEYUP_DATA_API, Dropdown._clearMenus).on(Event$4.CLICK_DATA_API, Selector$4.DATA_TOGGLE, function (event) {
    event.preventDefault();
    event.stopPropagation();

    Dropdown._jQueryInterface.call($(this), 'toggle');
  }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
    e.stopPropagation();
  });
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
   */

  $.fn[NAME$4] = Dropdown._jQueryInterface;
  $.fn[NAME$4].Constructor = Dropdown;

  $.fn[NAME$4].noConflict = function () {
    $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
    return Dropdown._jQueryInterface;
  };
Jacob Thornton's avatar
Jacob Thornton committed
2030
2031

  /**
Mark Otto's avatar
dist    
Mark Otto committed
2032
   * --------------------------------------------------------------------------
Mark Otto's avatar
Mark Otto committed
2033
   * Bootstrap (v4.1.3): modal.js
Mark Otto's avatar
dist    
Mark Otto committed
2034
2035
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
Jacob Thornton's avatar
Jacob Thornton committed
2036
   */
Mark Otto's avatar
dist    
Mark Otto committed
2037

XhmikosR's avatar
Dist    
XhmikosR committed
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
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
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$5 = 'modal';
  var VERSION$5 = '4.1.3';
  var DATA_KEY$5 = 'bs.modal';
  var EVENT_KEY$5 = "." + DATA_KEY$5;
  var DATA_API_KEY$5 = '.data-api';
  var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key

  var Default$3 = {
    backdrop: true,
    keyboard: true,
    focus: true,
    show: true
  };
  var DefaultType$3 = {
    backdrop: '(boolean|string)',
    keyboard: 'boolean',
    focus: 'boolean',
    show: 'boolean'
  };
  var Event$5 = {
    HIDE: "hide" + EVENT_KEY$5,
    HIDDEN: "hidden" + EVENT_KEY$5,
    SHOW: "show" + EVENT_KEY$5,
    SHOWN: "shown" + EVENT_KEY$5,
    FOCUSIN: "focusin" + EVENT_KEY$5,
    RESIZE: "resize" + EVENT_KEY$5,
    CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
    KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
    MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
    MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
    CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  };
  var ClassName$5 = {
    SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
    BACKDROP: 'modal-backdrop',
    OPEN: 'modal-open',
    FADE: 'fade',
    SHOW: 'show'
  };
  var Selector$5 = {
    DIALOG: '.modal-dialog',
    DATA_TOGGLE: '[data-toggle="modal"]',
    DATA_DISMISS: '[data-dismiss="modal"]',
    FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
    STICKY_CONTENT: '.sticky-top'
Mark Otto's avatar
dist    
Mark Otto committed
2090
2091
    /**
     * ------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
2092
     * Class Definition
Mark Otto's avatar
dist    
Mark Otto committed
2093
2094
     * ------------------------------------------------------------------------
     */
Jacob Thornton's avatar
Jacob Thornton committed
2095

XhmikosR's avatar
Dist    
XhmikosR committed
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
  };

  var Modal =
  /*#__PURE__*/
  function () {
    function Modal(element, config) {
      this._config = this._getConfig(config);
      this._element = element;
      this._dialog = element.querySelector(Selector$5.DIALOG);
      this._backdrop = null;
      this._isShown = false;
      this._isBodyOverflowing = false;
      this._ignoreBackdropClick = false;
      this._isTransitioning = false;
      this._scrollbarWidth = 0;
    } // Getters


    var _proto = Modal.prototype;

    // Public
    _proto.toggle = function toggle(relatedTarget) {
      return this._isShown ? this.hide() : this.show(relatedTarget);
Mark Otto's avatar
dist    
Mark Otto committed
2119
    };
Jacob Thornton's avatar
Jacob Thornton committed
2120

XhmikosR's avatar
Dist    
XhmikosR committed
2121
2122
    _proto.show = function show(relatedTarget) {
      var _this = this;
Mark Otto's avatar
grunt    
Mark Otto committed
2123

XhmikosR's avatar
Dist    
XhmikosR committed
2124
2125
2126
      if (this._isShown || this._isTransitioning) {
        return;
      }
Mark Otto's avatar
grunt    
Mark Otto committed
2127

XhmikosR's avatar
Dist    
XhmikosR committed
2128
2129
2130
      if ($(this._element).hasClass(ClassName$5.FADE)) {
        this._isTransitioning = true;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2131

XhmikosR's avatar
Dist    
XhmikosR committed
2132
2133
2134
2135
      var showEvent = $.Event(Event$5.SHOW, {
        relatedTarget: relatedTarget
      });
      $(this._element).trigger(showEvent);
Jacob Thornton's avatar
Jacob Thornton committed
2136

XhmikosR's avatar
Dist    
XhmikosR committed
2137
2138
2139
      if (this._isShown || showEvent.isDefaultPrevented()) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2140

XhmikosR's avatar
Dist    
XhmikosR committed
2141
      this._isShown = true;
Mark Otto's avatar
dist    
Mark Otto committed
2142

XhmikosR's avatar
Dist    
XhmikosR committed
2143
      this._checkScrollbar();
Jacob Thornton's avatar
Jacob Thornton committed
2144

XhmikosR's avatar
Dist    
XhmikosR committed
2145
      this._setScrollbar();
Mark Otto's avatar
dist    
Mark Otto committed
2146

XhmikosR's avatar
Dist    
XhmikosR committed
2147
      this._adjustDialog();
Jacob Thornton's avatar
Jacob Thornton committed
2148

XhmikosR's avatar
Dist    
XhmikosR committed
2149
      $(document.body).addClass(ClassName$5.OPEN);
Mark Otto's avatar
dist    
Mark Otto committed
2150

XhmikosR's avatar
Dist    
XhmikosR committed
2151
      this._setEscapeEvent();
Jacob Thornton's avatar
Jacob Thornton committed
2152

XhmikosR's avatar
Dist    
XhmikosR committed
2153
      this._setResizeEvent();
Mark Otto's avatar
grunt    
Mark Otto committed
2154

XhmikosR's avatar
Dist    
XhmikosR committed
2155
2156
2157
2158
2159
2160
2161
2162
      $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
        return _this.hide(event);
      });
      $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
        $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
          if ($(event.target).is(_this._element)) {
            _this._ignoreBackdropClick = true;
          }
Mark Otto's avatar
dist    
Mark Otto committed
2163
        });
XhmikosR's avatar
Dist    
XhmikosR committed
2164
      });
Jacob Thornton's avatar
Jacob Thornton committed
2165

XhmikosR's avatar
Dist    
XhmikosR committed
2166
2167
2168
2169
      this._showBackdrop(function () {
        return _this._showElement(relatedTarget);
      });
    };
Mark Otto's avatar
grunt    
Mark Otto committed
2170

XhmikosR's avatar
Dist    
XhmikosR committed
2171
2172
    _proto.hide = function hide(event) {
      var _this2 = this;
Jacob Thornton's avatar
Jacob Thornton committed
2173

XhmikosR's avatar
Dist    
XhmikosR committed
2174
2175
2176
      if (event) {
        event.preventDefault();
      }
Jacob Thornton's avatar
Jacob Thornton committed
2177

XhmikosR's avatar
Dist    
XhmikosR committed
2178
2179
2180
      if (!this._isShown || this._isTransitioning) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2181

XhmikosR's avatar
Dist    
XhmikosR committed
2182
2183
      var hideEvent = $.Event(Event$5.HIDE);
      $(this._element).trigger(hideEvent);
Jacob Thornton's avatar
Jacob Thornton committed
2184

XhmikosR's avatar
Dist    
XhmikosR committed
2185
2186
2187
      if (!this._isShown || hideEvent.isDefaultPrevented()) {
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
2188

XhmikosR's avatar
Dist    
XhmikosR committed
2189
2190
      this._isShown = false;
      var transition = $(this._element).hasClass(ClassName$5.FADE);
Jacob Thornton's avatar
Jacob Thornton committed
2191

XhmikosR's avatar
Dist    
XhmikosR committed
2192
2193
2194
      if (transition) {
        this._isTransitioning = true;
      }
Mark Otto's avatar
dist    
Mark Otto committed
2195

XhmikosR's avatar
Dist    
XhmikosR committed
2196
      this._setEscapeEvent();
Jacob Thornton's avatar
Jacob Thornton committed
2197

XhmikosR's avatar
Dist    
XhmikosR committed
2198
      this._setResizeEvent();
Jacob Thornton's avatar
Jacob Thornton committed
2199

XhmikosR's avatar
Dist    
XhmikosR committed
2200
2201
2202
2203
      $(document).off(Event$5.FOCUSIN);
      $(this._element).removeClass(ClassName$5.SHOW);
      $(this._element).off(Event$5.CLICK_DISMISS);
      $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
Jacob Thornton's avatar
Jacob Thornton committed
2204

XhmikosR's avatar
Dist    
XhmikosR committed
2205
2206
2207
2208
2209
2210
2211
2212
2213
      if (transition) {
        var transitionDuration = Util.getTransitionDurationFromElement(this._element);
        $(this._element).one(Util.TRANSITION_END, function (event) {
          return _this2._hideModal(event);
        }).emulateTransitionEnd(transitionDuration);
      } else {
        this._hideModal();
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
2214

XhmikosR's avatar
Dist    
XhmikosR committed
2215
2216
2217
2218
2219
2220
2221
2222
2223
    _proto.dispose = function dispose() {
      [window, this._element, this._dialog].forEach(function (htmlElement) {
        return $(htmlElement).off(EVENT_KEY$5);
      });
      /**
       * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
       * Do not move `document` in `htmlElements` array
       * It will remove `Event.CLICK_DATA_API` event that should remain
       */
Mark Otto's avatar
grunt    
Mark Otto committed
2224

XhmikosR's avatar
Dist    
XhmikosR committed
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
      $(document).off(Event$5.FOCUSIN);
      $.removeData(this._element, DATA_KEY$5);
      this._config = null;
      this._element = null;
      this._dialog = null;
      this._backdrop = null;
      this._isShown = null;
      this._isBodyOverflowing = null;
      this._ignoreBackdropClick = null;
      this._isTransitioning = null;
      this._scrollbarWidth = null;
    };
Jacob Thornton's avatar
Jacob Thornton committed
2237

XhmikosR's avatar
Dist    
XhmikosR committed
2238
2239
2240
    _proto.handleUpdate = function handleUpdate() {
      this._adjustDialog();
    }; // Private
Jacob Thornton's avatar
Jacob Thornton committed
2241
2242


XhmikosR's avatar
Dist    
XhmikosR committed
2243
2244
2245
2246
2247
    _proto._getConfig = function _getConfig(config) {
      config = _objectSpread({}, Default$3, config);
      Util.typeCheckConfig(NAME$5, config, DefaultType$3);
      return config;
    };
Jacob Thornton's avatar
Jacob Thornton committed
2248

XhmikosR's avatar
Dist    
XhmikosR committed
2249
2250
    _proto._showElement = function _showElement(relatedTarget) {
      var _this3 = this;
Jacob Thornton's avatar
Jacob Thornton committed
2251

XhmikosR's avatar
Dist    
XhmikosR committed
2252
      var transition = $(this._element).hasClass(ClassName$5.FADE);
Mark Otto's avatar
dist    
Mark Otto committed
2253

XhmikosR's avatar
Dist    
XhmikosR committed
2254
2255
2256
2257
      if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
        // Don't move modal's DOM position
        document.body.appendChild(this._element);
      }
Mark Otto's avatar
dist    
Mark Otto committed
2258

XhmikosR's avatar
Dist    
XhmikosR committed
2259
      this._element.style.display = 'block';
Jacob Thornton's avatar
Jacob Thornton committed
2260

XhmikosR's avatar
Dist    
XhmikosR committed
2261
      this._element.removeAttribute('aria-hidden');
Mark Otto's avatar
grunt    
Mark Otto committed
2262

XhmikosR's avatar
Dist    
XhmikosR committed
2263
      this._element.scrollTop = 0;
Mark Otto's avatar
grunt    
Mark Otto committed
2264

XhmikosR's avatar
Dist    
XhmikosR committed
2265
2266
2267
      if (transition) {
        Util.reflow(this._element);
      }
Mark Otto's avatar
grunt    
Mark Otto committed
2268

XhmikosR's avatar
Dist    
XhmikosR committed
2269
      $(this._element).addClass(ClassName$5.SHOW);
Mark Otto's avatar
dist    
Mark Otto committed
2270

XhmikosR's avatar
Dist    
XhmikosR committed
2271
2272
2273
      if (this._config.focus) {
        this._enforceFocus();
      }
Mark Otto's avatar
dist    
Mark Otto committed
2274

XhmikosR's avatar
Dist    
XhmikosR committed
2275
2276
2277
      var shownEvent = $.Event(Event$5.SHOWN, {
        relatedTarget: relatedTarget
      });
Mark Otto's avatar
grunt    
Mark Otto committed
2278

XhmikosR's avatar
Dist    
XhmikosR committed
2279
2280
2281
      var transitionComplete = function transitionComplete() {
        if (_this3._config.focus) {
          _this3._element.focus();
Jacob Thornton's avatar
Jacob Thornton committed
2282
        }
Mark Otto's avatar
dist    
Mark Otto committed
2283

XhmikosR's avatar
Dist    
XhmikosR committed
2284
2285
        _this3._isTransitioning = false;
        $(_this3._element).trigger(shownEvent);
Mark Otto's avatar
grunt    
Mark Otto committed
2286
2287
      };

XhmikosR's avatar
Dist    
XhmikosR committed
2288
2289
2290
2291
2292
2293
2294
      if (transition) {
        var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
        $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
      } else {
        transitionComplete();
      }
    };
Mark Otto's avatar
grunt    
Mark Otto committed
2295

XhmikosR's avatar
Dist    
XhmikosR committed
2296
2297
    _proto._enforceFocus = function _enforceFocus() {
      var _this4 = this;
Mark Otto's avatar
grunt    
Mark Otto committed
2298

XhmikosR's avatar
Dist    
XhmikosR committed
2299
2300
2301
2302
      $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
      .on(Event$5.FOCUSIN, function (event) {
        if (document !== event.target && _this4._element !== event.target && $(_this4._element).has(event.target).length === 0) {
          _this4._element.focus();
Mark Otto's avatar
dist    
Mark Otto committed
2303
        }
XhmikosR's avatar
Dist    
XhmikosR committed
2304
2305
      });
    };
Mark Otto's avatar
dist    
Mark Otto committed
2306

XhmikosR's avatar
Dist    
XhmikosR committed
2307
2308
    _proto._setEscapeEvent = function _setEscapeEvent() {
      var _this5 = this;
Mark Otto's avatar
grunt    
Mark Otto committed
2309

XhmikosR's avatar
Dist    
XhmikosR committed
2310
2311
2312
2313
      if (this._isShown && this._config.keyboard) {
        $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
          if (event.which === ESCAPE_KEYCODE$1) {
            event.preventDefault();
Mark Otto's avatar
grunt    
Mark Otto committed
2314

XhmikosR's avatar
Dist    
XhmikosR committed
2315
2316
2317
2318
2319
2320
2321
            _this5.hide();
          }
        });
      } else if (!this._isShown) {
        $(this._element).off(Event$5.KEYDOWN_DISMISS);
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
2322

XhmikosR's avatar
Dist    
XhmikosR committed
2323
2324
    _proto._setResizeEvent = function _setResizeEvent() {
      var _this6 = this;
Jacob Thornton's avatar
Jacob Thornton committed
2325

XhmikosR's avatar
Dist    
XhmikosR committed
2326
2327
2328
2329
2330
2331
2332
2333
      if (this._isShown) {
        $(window).on(Event$5.RESIZE, function (event) {
          return _this6.handleUpdate(event);
        });
      } else {
        $(window).off(Event$5.RESIZE);
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
2334

XhmikosR's avatar
Dist    
XhmikosR committed
2335
2336
    _proto._hideModal = function _hideModal() {
      var _this7 = this;
Mark Otto's avatar
dist    
Mark Otto committed
2337

XhmikosR's avatar
Dist    
XhmikosR committed
2338
      this._element.style.display = 'none';
Mark Otto's avatar
dist    
Mark Otto committed
2339

XhmikosR's avatar
Dist    
XhmikosR committed
2340
      this._element.setAttribute('aria-hidden', true);
Mark Otto's avatar
dist    
Mark Otto committed
2341

XhmikosR's avatar
Dist    
XhmikosR committed
2342
      this._isTransitioning = false;
Mark Otto's avatar
dist    
Mark Otto committed
2343

XhmikosR's avatar
Dist    
XhmikosR committed
2344
2345
      this._showBackdrop(function () {
        $(document.body).removeClass(ClassName$5.OPEN);
Mark Otto's avatar
dist    
Mark Otto committed
2346

XhmikosR's avatar
Dist    
XhmikosR committed
2347
        _this7._resetAdjustments();
Mark Otto's avatar
dist    
Mark Otto committed
2348

XhmikosR's avatar
Dist    
XhmikosR committed
2349
        _this7._resetScrollbar();
Jacob Thornton's avatar
Jacob Thornton committed
2350

XhmikosR's avatar
Dist    
XhmikosR committed
2351
2352
2353
        $(_this7._element).trigger(Event$5.HIDDEN);
      });
    };
Mark Otto's avatar
dist    
Mark Otto committed
2354

XhmikosR's avatar
Dist    
XhmikosR committed
2355
2356
2357
2358
2359
2360
    _proto._removeBackdrop = function _removeBackdrop() {
      if (this._backdrop) {
        $(this._backdrop).remove();
        this._backdrop = null;
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
2361

XhmikosR's avatar
Dist    
XhmikosR committed
2362
2363
    _proto._showBackdrop = function _showBackdrop(callback) {
      var _this8 = this;
Jacob Thornton's avatar
Jacob Thornton committed
2364

XhmikosR's avatar
Dist    
XhmikosR committed
2365
      var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
Jacob Thornton's avatar
Jacob Thornton committed
2366

XhmikosR's avatar
Dist    
XhmikosR committed
2367
2368
2369
      if (this._isShown && this._config.backdrop) {
        this._backdrop = document.createElement('div');
        this._backdrop.className = ClassName$5.BACKDROP;
Mark Otto's avatar
grunt    
Mark Otto committed
2370

XhmikosR's avatar
Dist    
XhmikosR committed
2371
2372
2373
        if (animate) {
          this._backdrop.classList.add(animate);
        }
Jacob Thornton's avatar
Jacob Thornton committed
2374

XhmikosR's avatar
Dist    
XhmikosR committed
2375
2376
2377
2378
        $(this._backdrop).appendTo(document.body);
        $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
          if (_this8._ignoreBackdropClick) {
            _this8._ignoreBackdropClick = false;
Jacob Thornton's avatar
Jacob Thornton committed
2379
2380
            return;
          }
Mark Otto's avatar
dist    
Mark Otto committed
2381

XhmikosR's avatar
Dist    
XhmikosR committed
2382
          if (event.target !== event.currentTarget) {
Jacob Thornton's avatar
Jacob Thornton committed
2383
2384
            return;
          }
Mark Otto's avatar
dist    
Mark Otto committed
2385

XhmikosR's avatar
Dist    
XhmikosR committed
2386
2387
2388
2389
2390
2391
          if (_this8._config.backdrop === 'static') {
            _this8._element.focus();
          } else {
            _this8.hide();
          }
        });
Jacob Thornton's avatar
Jacob Thornton committed
2392

XhmikosR's avatar
Dist    
XhmikosR committed
2393
2394
2395
        if (animate) {
          Util.reflow(this._backdrop);
        }
Jacob Thornton's avatar
Jacob Thornton committed
2396

XhmikosR's avatar
Dist    
XhmikosR committed
2397
        $(this._backdrop).addClass(ClassName$5.SHOW);
Jacob Thornton's avatar
Jacob Thornton committed
2398

XhmikosR's avatar
Dist    
XhmikosR committed
2399
2400
2401
        if (!callback) {
          return;
        }
Mark Otto's avatar
grunt    
Mark Otto committed
2402

XhmikosR's avatar
Dist    
XhmikosR committed
2403
        if (!animate) {
Jacob Thornton's avatar
Jacob Thornton committed
2404
          callback();
XhmikosR's avatar
Dist    
XhmikosR committed
2405
          return;
Jacob Thornton's avatar
Jacob Thornton committed
2406
2407
        }

XhmikosR's avatar
Dist    
XhmikosR committed
2408
2409
2410
2411
        var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
        $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
      } else if (!this._isShown && this._backdrop) {
        $(this._backdrop).removeClass(ClassName$5.SHOW);
Jacob Thornton's avatar
Jacob Thornton committed
2412

XhmikosR's avatar
Dist    
XhmikosR committed
2413
2414
        var callbackRemove = function callbackRemove() {
          _this8._removeBackdrop();
Jacob Thornton's avatar
Jacob Thornton committed
2415

XhmikosR's avatar
Dist    
XhmikosR committed
2416
2417
2418
2419
2420
2421
2422
          if (callback) {
            callback();
          }
        };

        if ($(this._element).hasClass(ClassName$5.FADE)) {
          var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
Mark Otto's avatar
grunt    
Mark Otto committed
2423

XhmikosR's avatar
Dist    
XhmikosR committed
2424
2425
2426
          $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
        } else {
          callbackRemove();
Mark Otto's avatar
dist    
Mark Otto committed
2427
        }
XhmikosR's avatar
Dist    
XhmikosR committed
2428
2429
2430
2431
2432
2433
2434
      } else if (callback) {
        callback();
      }
    }; // ----------------------------------------------------------------------
    // the following methods are used to handle overflowing modals
    // todo (fat): these should probably be refactored out of modal.js
    // ----------------------------------------------------------------------
Mark Otto's avatar
dist    
Mark Otto committed
2435

Mark Otto's avatar
grunt    
Mark Otto committed
2436

XhmikosR's avatar
Dist    
XhmikosR committed
2437
2438
    _proto._adjustDialog = function _adjustDialog() {
      var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
Mark Otto's avatar
grunt    
Mark Otto committed
2439

XhmikosR's avatar
Dist    
XhmikosR committed
2440
2441
2442
      if (!this._isBodyOverflowing && isModalOverflowing) {
        this._element.style.paddingLeft = this._scrollbarWidth + "px";
      }
Mark Otto's avatar
dist    
Mark Otto committed
2443

XhmikosR's avatar
Dist    
XhmikosR committed
2444
2445
2446
2447
      if (this._isBodyOverflowing && !isModalOverflowing) {
        this._element.style.paddingRight = this._scrollbarWidth + "px";
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
2448

XhmikosR's avatar
Dist    
XhmikosR committed
2449
2450
2451
2452
    _proto._resetAdjustments = function _resetAdjustments() {
      this._element.style.paddingLeft = '';
      this._element.style.paddingRight = '';
    };
Mark Otto's avatar
dist    
Mark Otto committed
2453

XhmikosR's avatar
Dist    
XhmikosR committed
2454
2455
2456
2457
2458
    _proto._checkScrollbar = function _checkScrollbar() {
      var rect = document.body.getBoundingClientRect();
      this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
      this._scrollbarWidth = this._getScrollbarWidth();
    };
Mark Otto's avatar
dist    
Mark Otto committed
2459

XhmikosR's avatar
Dist    
XhmikosR committed
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
    _proto._setScrollbar = function _setScrollbar() {
      var _this9 = this;

      if (this._isBodyOverflowing) {
        // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
        //   while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
        var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
        var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding

        $(fixedContent).each(function (index, element) {
          var actualPadding = element.style.paddingRight;
          var calculatedPadding = $(element).css('padding-right');
          $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this9._scrollbarWidth + "px");
        }); // Adjust sticky content margin

        $(stickyContent).each(function (index, element) {
          var actualMargin = element.style.marginRight;
          var calculatedMargin = $(element).css('margin-right');
          $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this9._scrollbarWidth + "px");
        }); // Adjust body padding

        var actualPadding = document.body.style.paddingRight;
        var calculatedPadding = $(document.body).css('padding-right');
        $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
      }
    };
Mark Otto's avatar
grunt    
Mark Otto committed
2486

XhmikosR's avatar
Dist    
XhmikosR committed
2487
2488
2489
2490
2491
2492
2493
2494
    _proto._resetScrollbar = function _resetScrollbar() {
      // Restore fixed content padding
      var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
      $(fixedContent).each(function (index, element) {
        var padding = $(element).data('padding-right');
        $(element).removeData('padding-right');
        element.style.paddingRight = padding ? padding : '';
      }); // Restore sticky content
Jacob Thornton's avatar
Jacob Thornton committed
2495

XhmikosR's avatar
Dist    
XhmikosR committed
2496
2497
2498
      var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
      $(elements).each(function (index, element) {
        var margin = $(element).data('margin-right');
Mark Otto's avatar
dist    
Mark Otto committed
2499

XhmikosR's avatar
Dist    
XhmikosR committed
2500
2501
2502
2503
        if (typeof margin !== 'undefined') {
          $(element).css('margin-right', margin).removeData('margin-right');
        }
      }); // Restore body padding
Jacob Thornton's avatar
Jacob Thornton committed
2504

XhmikosR's avatar
Dist    
XhmikosR committed
2505
2506
2507
2508
      var padding = $(document.body).data('padding-right');
      $(document.body).removeData('padding-right');
      document.body.style.paddingRight = padding ? padding : '';
    };
Mark Otto's avatar
grunt    
Mark Otto committed
2509

XhmikosR's avatar
Dist    
XhmikosR committed
2510
2511
2512
2513
2514
2515
2516
2517
2518
    _proto._getScrollbarWidth = function _getScrollbarWidth() {
      // thx d.walsh
      var scrollDiv = document.createElement('div');
      scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
      document.body.appendChild(scrollDiv);
      var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
      document.body.removeChild(scrollDiv);
      return scrollbarWidth;
    }; // Static
Mark Otto's avatar
grunt    
Mark Otto committed
2519

Mark Otto's avatar
dist    
Mark Otto committed
2520

XhmikosR's avatar
Dist    
XhmikosR committed
2521
2522
2523
    Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
      return this.each(function () {
        var data = $(this).data(DATA_KEY$5);
Mark Otto's avatar
grunt    
Mark Otto committed
2524

XhmikosR's avatar
Dist    
XhmikosR committed
2525
        var _config = _objectSpread({}, Default$3, $(this).data(), typeof config === 'object' && config ? config : {});
Jacob Thornton's avatar
Jacob Thornton committed
2526

XhmikosR's avatar
Dist    
XhmikosR committed
2527
2528
2529
2530
2531
2532
2533
2534
        if (!data) {
          data = new Modal(this, _config);
          $(this).data(DATA_KEY$5, data);
        }

        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
Jacob Thornton's avatar
Jacob Thornton committed
2535
          }
Mark Otto's avatar
dist    
Mark Otto committed
2536

XhmikosR's avatar
Dist    
XhmikosR committed
2537
2538
2539
          data[config](relatedTarget);
        } else if (_config.show) {
          data.show(relatedTarget);
Mark Otto's avatar
dist    
Mark Otto committed
2540
        }
XhmikosR's avatar
Dist    
XhmikosR committed
2541
2542
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
2543

XhmikosR's avatar
Dist    
XhmikosR committed
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
    _createClass(Modal, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$5;
      }
    }, {
      key: "Default",
      get: function get() {
        return Default$3;
      }
    }]);
Mark Otto's avatar
dist    
Mark Otto committed
2555

XhmikosR's avatar
Dist    
XhmikosR committed
2556
2557
2558
2559
2560
2561
2562
    return Modal;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
2563
2564


XhmikosR's avatar
Dist    
XhmikosR committed
2565
2566
  $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
    var _this10 = this;
Jacob Thornton's avatar
Jacob Thornton committed
2567

XhmikosR's avatar
Dist    
XhmikosR committed
2568
2569
    var target;
    var selector = Util.getSelectorFromElement(this);
Jacob Thornton's avatar
Jacob Thornton committed
2570

XhmikosR's avatar
Dist    
XhmikosR committed
2571
2572
2573
    if (selector) {
      target = document.querySelector(selector);
    }
Jacob Thornton's avatar
Jacob Thornton committed
2574

XhmikosR's avatar
Dist    
XhmikosR committed
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
    var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread({}, $(target).data(), $(this).data());

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

    var $target = $(target).one(Event$5.SHOW, function (showEvent) {
      if (showEvent.isDefaultPrevented()) {
        // Only register focus restorer if modal will actually get shown
        return;
Jacob Thornton's avatar
Jacob Thornton committed
2585
2586
      }

XhmikosR's avatar
Dist    
XhmikosR committed
2587
2588
2589
      $target.one(Event$5.HIDDEN, function () {
        if ($(_this10).is(':visible')) {
          _this10.focus();
Jacob Thornton's avatar
Jacob Thornton committed
2590
        }
Mark Otto's avatar
dist    
Mark Otto committed
2591
2592
      });
    });
Mark Otto's avatar
dist    
Mark Otto committed
2593

XhmikosR's avatar
Dist    
XhmikosR committed
2594
2595
2596
2597
2598
2599
2600
    Modal._jQueryInterface.call($(target), config, this);
  });
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
2601

XhmikosR's avatar
Dist    
XhmikosR committed
2602
2603
  $.fn[NAME$5] = Modal._jQueryInterface;
  $.fn[NAME$5].Constructor = Modal;
Jacob Thornton's avatar
Jacob Thornton committed
2604

XhmikosR's avatar
Dist    
XhmikosR committed
2605
2606
2607
2608
  $.fn[NAME$5].noConflict = function () {
    $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
    return Modal._jQueryInterface;
  };
Jacob Thornton's avatar
Jacob Thornton committed
2609
2610

  /**
Mark Otto's avatar
dist    
Mark Otto committed
2611
   * --------------------------------------------------------------------------
Mark Otto's avatar
Mark Otto committed
2612
   * Bootstrap (v4.1.3): tooltip.js
Mark Otto's avatar
dist    
Mark Otto committed
2613
2614
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
Jacob Thornton's avatar
Jacob Thornton committed
2615
   */
Mark Otto's avatar
dist    
Mark Otto committed
2616

XhmikosR's avatar
Dist    
XhmikosR committed
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$6 = 'tooltip';
  var VERSION$6 = '4.1.3';
  var DATA_KEY$6 = 'bs.tooltip';
  var EVENT_KEY$6 = "." + DATA_KEY$6;
  var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  var CLASS_PREFIX = 'bs-tooltip';
  var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  var DefaultType$4 = {
    animation: 'boolean',
    template: 'string',
    title: '(string|element|function)',
    trigger: 'string',
    delay: '(number|object)',
    html: 'boolean',
    selector: '(string|boolean)',
    placement: '(string|function)',
    offset: '(number|string)',
    container: '(string|element|boolean)',
    fallbackPlacement: '(string|array)',
    boundary: '(string|element)'
  };
  var AttachmentMap$1 = {
    AUTO: 'auto',
    TOP: 'top',
    RIGHT: 'right',
    BOTTOM: 'bottom',
    LEFT: 'left'
  };
  var Default$4 = {
    animation: true,
    template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
    trigger: 'hover focus',
    title: '',
    delay: 0,
    html: false,
    selector: false,
    placement: 'top',
    offset: 0,
    container: false,
    fallbackPlacement: 'flip',
    boundary: 'scrollParent'
  };
  var HoverState = {
    SHOW: 'show',
    OUT: 'out'
  };
  var Event$6 = {
    HIDE: "hide" + EVENT_KEY$6,
    HIDDEN: "hidden" + EVENT_KEY$6,
    SHOW: "show" + EVENT_KEY$6,
    SHOWN: "shown" + EVENT_KEY$6,
    INSERTED: "inserted" + EVENT_KEY$6,
    CLICK: "click" + EVENT_KEY$6,
    FOCUSIN: "focusin" + EVENT_KEY$6,
    FOCUSOUT: "focusout" + EVENT_KEY$6,
    MOUSEENTER: "mouseenter" + EVENT_KEY$6,
    MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  };
  var ClassName$6 = {
    FADE: 'fade',
    SHOW: 'show'
  };
  var Selector$6 = {
    TOOLTIP: '.tooltip',
    TOOLTIP_INNER: '.tooltip-inner',
    ARROW: '.arrow'
  };
  var Trigger = {
    HOVER: 'hover',
    FOCUS: 'focus',
    CLICK: 'click',
    MANUAL: 'manual'
Mark Otto's avatar
dist    
Mark Otto committed
2695
2696
    /**
     * ------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
2697
     * Class Definition
Mark Otto's avatar
dist    
Mark Otto committed
2698
2699
     * ------------------------------------------------------------------------
     */
XhmikosR's avatar
Dist    
XhmikosR committed
2700
2701
2702
2703
2704
2705
2706

  };

  var Tooltip =
  /*#__PURE__*/
  function () {
    function Tooltip(element, config) {
Mark Otto's avatar
dist    
Mark Otto committed
2707
      /**
XhmikosR's avatar
Dist    
XhmikosR committed
2708
2709
       * Check for Popper dependency
       * Popper - https://popper.js.org
Mark Otto's avatar
dist    
Mark Otto committed
2710
       */
XhmikosR's avatar
Dist    
XhmikosR committed
2711
2712
2713
      if (typeof Popper === 'undefined') {
        throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
      } // private
Mark Otto's avatar
dist    
Mark Otto committed
2714
2715


XhmikosR's avatar
Dist    
XhmikosR committed
2716
2717
2718
2719
2720
      this._isEnabled = true;
      this._timeout = 0;
      this._hoverState = '';
      this._activeTrigger = {};
      this._popper = null; // Protected
Jacob Thornton's avatar
Jacob Thornton committed
2721

XhmikosR's avatar
Dist    
XhmikosR committed
2722
2723
2724
      this.element = element;
      this.config = this._getConfig(config);
      this.tip = null;
Jacob Thornton's avatar
Jacob Thornton committed
2725

XhmikosR's avatar
Dist    
XhmikosR committed
2726
2727
      this._setListeners();
    } // Getters
Jacob Thornton's avatar
Jacob Thornton committed
2728
2729


XhmikosR's avatar
Dist    
XhmikosR committed
2730
    var _proto = Tooltip.prototype;
Jacob Thornton's avatar
Jacob Thornton committed
2731

XhmikosR's avatar
Dist    
XhmikosR committed
2732
2733
2734
2735
    // Public
    _proto.enable = function enable() {
      this._isEnabled = true;
    };
Jacob Thornton's avatar
Jacob Thornton committed
2736

XhmikosR's avatar
Dist    
XhmikosR committed
2737
2738
2739
    _proto.disable = function disable() {
      this._isEnabled = false;
    };
Jacob Thornton's avatar
Jacob Thornton committed
2740

XhmikosR's avatar
Dist    
XhmikosR committed
2741
2742
2743
    _proto.toggleEnabled = function toggleEnabled() {
      this._isEnabled = !this._isEnabled;
    };
Jacob Thornton's avatar
Jacob Thornton committed
2744

XhmikosR's avatar
Dist    
XhmikosR committed
2745
2746
2747
2748
    _proto.toggle = function toggle(event) {
      if (!this._isEnabled) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2749

XhmikosR's avatar
Dist    
XhmikosR committed
2750
2751
2752
      if (event) {
        var dataKey = this.constructor.DATA_KEY;
        var context = $(event.currentTarget).data(dataKey);
Jacob Thornton's avatar
Jacob Thornton committed
2753

XhmikosR's avatar
Dist    
XhmikosR committed
2754
2755
2756
        if (!context) {
          context = new this.constructor(event.currentTarget, this._getDelegateConfig());
          $(event.currentTarget).data(dataKey, context);
Mark Otto's avatar
dist    
Mark Otto committed
2757
        }
Jacob Thornton's avatar
Jacob Thornton committed
2758

XhmikosR's avatar
Dist    
XhmikosR committed
2759
        context._activeTrigger.click = !context._activeTrigger.click;
Jacob Thornton's avatar
Jacob Thornton committed
2760

XhmikosR's avatar
Dist    
XhmikosR committed
2761
2762
        if (context._isWithActiveTrigger()) {
          context._enter(null, context);
Mark Otto's avatar
dist    
Mark Otto committed
2763
        } else {
XhmikosR's avatar
Dist    
XhmikosR committed
2764
2765
2766
2767
2768
          context._leave(null, context);
        }
      } else {
        if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
          this._leave(null, this);
Jacob Thornton's avatar
Jacob Thornton committed
2769

XhmikosR's avatar
Dist    
XhmikosR committed
2770
          return;
Mark Otto's avatar
dist    
Mark Otto committed
2771
        }
Jacob Thornton's avatar
Jacob Thornton committed
2772

XhmikosR's avatar
Dist    
XhmikosR committed
2773
2774
2775
        this._enter(null, this);
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
2776

XhmikosR's avatar
Dist    
XhmikosR committed
2777
2778
2779
2780
2781
    _proto.dispose = function dispose() {
      clearTimeout(this._timeout);
      $.removeData(this.element, this.constructor.DATA_KEY);
      $(this.element).off(this.constructor.EVENT_KEY);
      $(this.element).closest('.modal').off('hide.bs.modal');
Jacob Thornton's avatar
Jacob Thornton committed
2782

XhmikosR's avatar
Dist    
XhmikosR committed
2783
2784
2785
      if (this.tip) {
        $(this.tip).remove();
      }
Mark Otto's avatar
dist    
Mark Otto committed
2786

XhmikosR's avatar
Dist    
XhmikosR committed
2787
2788
2789
2790
      this._isEnabled = null;
      this._timeout = null;
      this._hoverState = null;
      this._activeTrigger = null;
Mark Otto's avatar
grunt    
Mark Otto committed
2791

XhmikosR's avatar
Dist    
XhmikosR committed
2792
2793
2794
      if (this._popper !== null) {
        this._popper.destroy();
      }
Jacob Thornton's avatar
Jacob Thornton committed
2795

XhmikosR's avatar
Dist    
XhmikosR committed
2796
2797
2798
2799
2800
      this._popper = null;
      this.element = null;
      this.config = null;
      this.tip = null;
    };
Jacob Thornton's avatar
Jacob Thornton committed
2801

XhmikosR's avatar
Dist    
XhmikosR committed
2802
2803
    _proto.show = function show() {
      var _this = this;
Jacob Thornton's avatar
Jacob Thornton committed
2804

XhmikosR's avatar
Dist    
XhmikosR committed
2805
2806
2807
      if ($(this.element).css('display') === 'none') {
        throw new Error('Please use show on visible elements');
      }
Mark Otto's avatar
dist    
Mark Otto committed
2808

XhmikosR's avatar
Dist    
XhmikosR committed
2809
      var showEvent = $.Event(this.constructor.Event.SHOW);
Jacob Thornton's avatar
Jacob Thornton committed
2810

XhmikosR's avatar
Dist    
XhmikosR committed
2811
2812
2813
      if (this.isWithContent() && this._isEnabled) {
        $(this.element).trigger(showEvent);
        var isInTheDom = $.contains(this.element.ownerDocument.documentElement, this.element);
Jacob Thornton's avatar
Jacob Thornton committed
2814

XhmikosR's avatar
Dist    
XhmikosR committed
2815
2816
2817
        if (showEvent.isDefaultPrevented() || !isInTheDom) {
          return;
        }
Mark Otto's avatar
dist    
Mark Otto committed
2818

XhmikosR's avatar
Dist    
XhmikosR committed
2819
2820
2821
2822
2823
        var tip = this.getTipElement();
        var tipId = Util.getUID(this.constructor.NAME);
        tip.setAttribute('id', tipId);
        this.element.setAttribute('aria-describedby', tipId);
        this.setContent();
Jacob Thornton's avatar
Jacob Thornton committed
2824

XhmikosR's avatar
Dist    
XhmikosR committed
2825
2826
2827
        if (this.config.animation) {
          $(tip).addClass(ClassName$6.FADE);
        }
Jacob Thornton's avatar
Jacob Thornton committed
2828

XhmikosR's avatar
Dist    
XhmikosR committed
2829
        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
2830

XhmikosR's avatar
Dist    
XhmikosR committed
2831
        var attachment = this._getAttachment(placement);
Mark Otto's avatar
dist    
Mark Otto committed
2832

XhmikosR's avatar
Dist    
XhmikosR committed
2833
2834
2835
        this.addAttachmentClass(attachment);
        var container = this.config.container === false ? document.body : $(document).find(this.config.container);
        $(tip).data(this.constructor.DATA_KEY, this);
Mark Otto's avatar
grunt    
Mark Otto committed
2836

XhmikosR's avatar
Dist    
XhmikosR committed
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
        if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
          $(tip).appendTo(container);
        }

        $(this.element).trigger(this.constructor.Event.INSERTED);
        this._popper = new Popper(this.element, tip, {
          placement: attachment,
          modifiers: {
            offset: {
              offset: this.config.offset
Mark Otto's avatar
dist    
Mark Otto committed
2847
            },
XhmikosR's avatar
Dist    
XhmikosR committed
2848
2849
2850
2851
2852
            flip: {
              behavior: this.config.fallbackPlacement
            },
            arrow: {
              element: Selector$6.ARROW
Mark Otto's avatar
dist    
Mark Otto committed
2853
            },
XhmikosR's avatar
Dist    
XhmikosR committed
2854
2855
2856
2857
2858
2859
            preventOverflow: {
              boundariesElement: this.config.boundary
            }
          },
          onCreate: function onCreate(data) {
            if (data.originalPlacement !== data.placement) {
Mark Otto's avatar
dist    
Mark Otto committed
2860
2861
              _this._handlePopperPlacementChange(data);
            }
XhmikosR's avatar
Dist    
XhmikosR committed
2862
2863
2864
          },
          onUpdate: function onUpdate(data) {
            _this._handlePopperPlacementChange(data);
Mark Otto's avatar
dist    
Mark Otto committed
2865
          }
XhmikosR's avatar
Dist    
XhmikosR committed
2866
2867
2868
2869
2870
        });
        $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
        // empty mouseover listeners to the body's immediate children;
        // only needed because of broken event delegation on iOS
        // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
Mark Otto's avatar
dist    
Mark Otto committed
2871

XhmikosR's avatar
Dist    
XhmikosR committed
2872
2873
2874
        if ('ontouchstart' in document.documentElement) {
          $(document.body).children().on('mouseover', null, $.noop);
        }
Mark Otto's avatar
grunt    
Mark Otto committed
2875

XhmikosR's avatar
Dist    
XhmikosR committed
2876
2877
2878
2879
        var complete = function complete() {
          if (_this.config.animation) {
            _this._fixTransition();
          }
Mark Otto's avatar
dist    
Mark Otto committed
2880

XhmikosR's avatar
Dist    
XhmikosR committed
2881
2882
2883
          var prevHoverState = _this._hoverState;
          _this._hoverState = null;
          $(_this.element).trigger(_this.constructor.Event.SHOWN);
Jacob Thornton's avatar
Jacob Thornton committed
2884

XhmikosR's avatar
Dist    
XhmikosR committed
2885
2886
          if (prevHoverState === HoverState.OUT) {
            _this._leave(null, _this);
Mark Otto's avatar
dist    
Mark Otto committed
2887
          }
XhmikosR's avatar
Dist    
XhmikosR committed
2888
2889
2890
2891
2892
2893
2894
        };

        if ($(this.tip).hasClass(ClassName$6.FADE)) {
          var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
          $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
        } else {
          complete();
Mark Otto's avatar
dist    
Mark Otto committed
2895
        }
XhmikosR's avatar
Dist    
XhmikosR committed
2896
2897
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
2898

XhmikosR's avatar
Dist    
XhmikosR committed
2899
2900
    _proto.hide = function hide(callback) {
      var _this2 = this;
Jacob Thornton's avatar
Jacob Thornton committed
2901

XhmikosR's avatar
Dist    
XhmikosR committed
2902
2903
      var tip = this.getTipElement();
      var hideEvent = $.Event(this.constructor.Event.HIDE);
Mark Otto's avatar
dist    
Mark Otto committed
2904

XhmikosR's avatar
Dist    
XhmikosR committed
2905
2906
2907
2908
      var complete = function complete() {
        if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
          tip.parentNode.removeChild(tip);
        }
Mark Otto's avatar
grunt    
Mark Otto committed
2909

XhmikosR's avatar
Dist    
XhmikosR committed
2910
        _this2._cleanTipClass();
Mark Otto's avatar
dist    
Mark Otto committed
2911

XhmikosR's avatar
Dist    
XhmikosR committed
2912
        _this2.element.removeAttribute('aria-describedby');
Mark Otto's avatar
dist    
Mark Otto committed
2913

XhmikosR's avatar
Dist    
XhmikosR committed
2914
        $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
Mark Otto's avatar
dist    
Mark Otto committed
2915

XhmikosR's avatar
Dist    
XhmikosR committed
2916
2917
2918
        if (_this2._popper !== null) {
          _this2._popper.destroy();
        }
Mark Otto's avatar
grunt    
Mark Otto committed
2919

XhmikosR's avatar
Dist    
XhmikosR committed
2920
2921
2922
2923
        if (callback) {
          callback();
        }
      };
Mark Otto's avatar
grunt    
Mark Otto committed
2924

XhmikosR's avatar
Dist    
XhmikosR committed
2925
      $(this.element).trigger(hideEvent);
Mark Otto's avatar
dist    
Mark Otto committed
2926

XhmikosR's avatar
Dist    
XhmikosR committed
2927
2928
2929
      if (hideEvent.isDefaultPrevented()) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2930

XhmikosR's avatar
Dist    
XhmikosR committed
2931
2932
      $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
      // empty mouseover listeners we added for iOS support
Mark Otto's avatar
dist    
Mark Otto committed
2933

XhmikosR's avatar
Dist    
XhmikosR committed
2934
2935
2936
      if ('ontouchstart' in document.documentElement) {
        $(document.body).children().off('mouseover', null, $.noop);
      }
Jacob Thornton's avatar
Jacob Thornton committed
2937

XhmikosR's avatar
Dist    
XhmikosR committed
2938
2939
2940
      this._activeTrigger[Trigger.CLICK] = false;
      this._activeTrigger[Trigger.FOCUS] = false;
      this._activeTrigger[Trigger.HOVER] = false;
Jacob Thornton's avatar
Jacob Thornton committed
2941

XhmikosR's avatar
Dist    
XhmikosR committed
2942
2943
2944
2945
2946
2947
      if ($(this.tip).hasClass(ClassName$6.FADE)) {
        var transitionDuration = Util.getTransitionDurationFromElement(tip);
        $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
      } else {
        complete();
      }
Jacob Thornton's avatar
Jacob Thornton committed
2948

XhmikosR's avatar
Dist    
XhmikosR committed
2949
2950
      this._hoverState = '';
    };
Jacob Thornton's avatar
Jacob Thornton committed
2951

XhmikosR's avatar
Dist    
XhmikosR committed
2952
2953
2954
2955
2956
    _proto.update = function update() {
      if (this._popper !== null) {
        this._popper.scheduleUpdate();
      }
    }; // Protected
Jacob Thornton's avatar
Jacob Thornton committed
2957
2958


XhmikosR's avatar
Dist    
XhmikosR committed
2959
2960
2961
    _proto.isWithContent = function isWithContent() {
      return Boolean(this.getTitle());
    };
Jacob Thornton's avatar
Jacob Thornton committed
2962

XhmikosR's avatar
Dist    
XhmikosR committed
2963
2964
2965
    _proto.addAttachmentClass = function addAttachmentClass(attachment) {
      $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
    };
Jacob Thornton's avatar
Jacob Thornton committed
2966

XhmikosR's avatar
Dist    
XhmikosR committed
2967
2968
2969
2970
    _proto.getTipElement = function getTipElement() {
      this.tip = this.tip || $(this.config.template)[0];
      return this.tip;
    };
Jacob Thornton's avatar
Jacob Thornton committed
2971

XhmikosR's avatar
Dist    
XhmikosR committed
2972
2973
2974
2975
2976
    _proto.setContent = function setContent() {
      var tip = this.getTipElement();
      this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
      $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
    };
Jacob Thornton's avatar
Jacob Thornton committed
2977

XhmikosR's avatar
Dist    
XhmikosR committed
2978
2979
    _proto.setElementContent = function setElementContent($element, content) {
      var html = this.config.html;
Mark Otto's avatar
dist    
Mark Otto committed
2980

XhmikosR's avatar
Dist    
XhmikosR committed
2981
2982
2983
2984
2985
      if (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);
Mark Otto's avatar
dist    
Mark Otto committed
2986
2987
          }
        } else {
XhmikosR's avatar
Dist    
XhmikosR committed
2988
          $element.text($(content).text());
Mark Otto's avatar
dist    
Mark Otto committed
2989
        }
XhmikosR's avatar
Dist    
XhmikosR committed
2990
2991
2992
2993
      } else {
        $element[html ? 'html' : 'text'](content);
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
2994

XhmikosR's avatar
Dist    
XhmikosR committed
2995
2996
    _proto.getTitle = function getTitle() {
      var title = this.element.getAttribute('data-original-title');
Jacob Thornton's avatar
Jacob Thornton committed
2997

XhmikosR's avatar
Dist    
XhmikosR committed
2998
2999
3000
      if (!title) {
        title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
      }
For faster browsing, not all history is shown. View entire blame