tooltip.js 32.3 KB
Newer Older
XhmikosR's avatar
Dist    
XhmikosR committed
1
/*!
XhmikosR's avatar
XhmikosR committed
2
  * Bootstrap tooltip.js v5.0.0-alpha3 (https://getbootstrap.com/)
XhmikosR's avatar
XhmikosR committed
3
  * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
XhmikosR's avatar
XhmikosR committed
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
XhmikosR's avatar
Dist    
XhmikosR committed
5
  */
Mark Otto's avatar
dist    
Mark Otto committed
6
(function (global, factory) {
XhmikosR's avatar
XhmikosR committed
7
8
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('popper.js'), require('./dom/selector-engine.js')) :
  typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/event-handler.js', './dom/manipulator.js', 'popper.js', './dom/selector-engine.js'], factory) :
XhmikosR's avatar
XhmikosR committed
9
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tooltip = factory(global.Data, global.EventHandler, global.Manipulator, global.Popper, global.SelectorEngine));
XhmikosR's avatar
XhmikosR committed
10
}(this, (function (Data, EventHandler, Manipulator, Popper, SelectorEngine) { 'use strict';
XhmikosR's avatar
XhmikosR committed
11

XhmikosR's avatar
XhmikosR committed
12
13
14
15
16
17
18
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

  var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
  var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
  var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
  var Popper__default = /*#__PURE__*/_interopDefaultLegacy(Popper);
  var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
Mark Otto's avatar
dist    
Mark Otto committed
19

XhmikosR's avatar
XhmikosR committed
20
21
  /**
   * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
22
   * Bootstrap (v5.0.0-alpha3): util/index.js
XhmikosR's avatar
XhmikosR committed
23
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
XhmikosR's avatar
XhmikosR committed
24
25
26
27
   * --------------------------------------------------------------------------
   */
  var MAX_UID = 1000000;
  var MILLISECONDS_MULTIPLIER = 1000;
XhmikosR's avatar
XhmikosR committed
28
  var TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
XhmikosR's avatar
XhmikosR committed
29
30

  var toType = function toType(obj) {
XhmikosR's avatar
XhmikosR committed
31
32
33
34
    if (obj === null || obj === undefined) {
      return "" + obj;
    }

XhmikosR's avatar
XhmikosR committed
35
36
37
38
39
40
41
42
43
44
45
    return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  };
  /**
   * --------------------------------------------------------------------------
   * Public Util Api
   * --------------------------------------------------------------------------
   */


  var getUID = function getUID(prefix) {
    do {
Mark Otto's avatar
Mark Otto committed
46
      prefix += Math.floor(Math.random() * MAX_UID);
XhmikosR's avatar
XhmikosR committed
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
    } while (document.getElementById(prefix));

    return prefix;
  };

  var getTransitionDurationFromElement = function getTransitionDurationFromElement(element) {
    if (!element) {
      return 0;
    } // Get transition-duration of the element


    var _window$getComputedSt = window.getComputedStyle(element),
        transitionDuration = _window$getComputedSt.transitionDuration,
        transitionDelay = _window$getComputedSt.transitionDelay;

XhmikosR's avatar
XhmikosR committed
62
63
    var floatTransitionDuration = Number.parseFloat(transitionDuration);
    var floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
XhmikosR's avatar
XhmikosR committed
64
65
66
67
68
69
70
71

    if (!floatTransitionDuration && !floatTransitionDelay) {
      return 0;
    } // If multiple durations are defined, take the first


    transitionDuration = transitionDuration.split(',')[0];
    transitionDelay = transitionDelay.split(',')[0];
XhmikosR's avatar
XhmikosR committed
72
    return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
XhmikosR's avatar
XhmikosR committed
73
74
75
  };

  var triggerTransitionEnd = function triggerTransitionEnd(element) {
XhmikosR's avatar
XhmikosR committed
76
    element.dispatchEvent(new Event(TRANSITION_END));
XhmikosR's avatar
XhmikosR committed
77
78
79
80
81
82
83
84
85
86
87
88
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
  };

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

  var emulateTransitionEnd = function emulateTransitionEnd(element, duration) {
    var called = false;
    var durationPadding = 5;
    var emulatedDuration = duration + durationPadding;

    function listener() {
      called = true;
      element.removeEventListener(TRANSITION_END, listener);
    }

    element.addEventListener(TRANSITION_END, listener);
    setTimeout(function () {
      if (!called) {
        triggerTransitionEnd(element);
      }
    }, emulatedDuration);
  };

  var typeCheckConfig = function typeCheckConfig(componentName, config, configTypes) {
    Object.keys(configTypes).forEach(function (property) {
      var expectedTypes = configTypes[property];
      var value = config[property];
      var valueType = value && isElement(value) ? 'element' : toType(value);

      if (!new RegExp(expectedTypes).test(valueType)) {
        throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
      }
    });
  };

  var findShadowRoot = function findShadowRoot(element) {
    if (!document.documentElement.attachShadow) {
      return null;
    } // Can find the shadow root otherwise it'll return the document


    if (typeof element.getRootNode === 'function') {
      var root = element.getRootNode();
      return root instanceof ShadowRoot ? root : null;
    }

    if (element instanceof ShadowRoot) {
      return element;
    } // when we don't find a shadow root


    if (!element.parentNode) {
      return null;
    }

    return findShadowRoot(element.parentNode);
XhmikosR's avatar
XhmikosR committed
134
  };
XhmikosR's avatar
XhmikosR committed
135
136
137
138
139

  var noop = function noop() {
    return function () {};
  };

XhmikosR's avatar
XhmikosR committed
140
141
142
143
  var getjQuery = function getjQuery() {
    var _window = window,
        jQuery = _window.jQuery;

XhmikosR's avatar
XhmikosR committed
144
    if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
XhmikosR's avatar
XhmikosR committed
145
146
147
148
149
150
      return jQuery;
    }

    return null;
  };

XhmikosR's avatar
XhmikosR committed
151
152
153
154
155
156
157
158
  var onDOMContentLoaded = function onDOMContentLoaded(callback) {
    if (document.readyState === 'loading') {
      document.addEventListener('DOMContentLoaded', callback);
    } else {
      callback();
    }
  };

XhmikosR's avatar
XhmikosR committed
159
160
  /**
   * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
161
   * Bootstrap (v5.0.0-alpha3): util/sanitizer.js
XhmikosR's avatar
XhmikosR committed
162
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
XhmikosR's avatar
XhmikosR committed
163
164
   * --------------------------------------------------------------------------
   */
XhmikosR's avatar
XhmikosR committed
165
  var uriAttrs = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']);
XhmikosR's avatar
XhmikosR committed
166
  var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
XhmikosR's avatar
XhmikosR committed
167
168
169
170
171
172
  /**
   * A pattern that recognizes a commonly useful subset of URLs that are safe.
   *
   * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
   */

XhmikosR's avatar
XhmikosR committed
173
  var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/gi;
XhmikosR's avatar
XhmikosR committed
174
175
176
177
178
179
  /**
   * A pattern that matches safe data URLs. Only matches image, video and audio types.
   *
   * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
   */

XhmikosR's avatar
XhmikosR committed
180
  var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i;
XhmikosR's avatar
XhmikosR committed
181
182
183
184

  var allowedAttribute = function allowedAttribute(attr, allowedAttributeList) {
    var attrName = attr.nodeName.toLowerCase();

XhmikosR's avatar
XhmikosR committed
185
186
    if (allowedAttributeList.includes(attrName)) {
      if (uriAttrs.has(attrName)) {
Mark Otto's avatar
Mark Otto committed
187
        return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
XhmikosR's avatar
XhmikosR committed
188
189
190
191
192
193
194
195
196
      }

      return true;
    }

    var regExp = allowedAttributeList.filter(function (attrRegex) {
      return attrRegex instanceof RegExp;
    }); // Check if a regular expression validates the attribute.

XhmikosR's avatar
XhmikosR committed
197
    for (var i = 0, len = regExp.length; i < len; i++) {
Mark Otto's avatar
Mark Otto committed
198
      if (attrName.match(regExp[i])) {
XhmikosR's avatar
XhmikosR committed
199
200
201
202
203
204
205
        return true;
      }
    }

    return false;
  };

XhmikosR's avatar
XhmikosR committed
206
  var DefaultAllowlist = {
XhmikosR's avatar
XhmikosR committed
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
    // Global attributes allowed on any supplied element below.
    '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
    a: ['target', 'href', 'title', 'rel'],
    area: [],
    b: [],
    br: [],
    col: [],
    code: [],
    div: [],
    em: [],
    hr: [],
    h1: [],
    h2: [],
    h3: [],
    h4: [],
    h5: [],
    h6: [],
    i: [],
XhmikosR's avatar
XhmikosR committed
225
    img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],
XhmikosR's avatar
XhmikosR committed
226
227
228
229
230
231
232
233
234
235
236
237
238
    li: [],
    ol: [],
    p: [],
    pre: [],
    s: [],
    small: [],
    span: [],
    sub: [],
    sup: [],
    strong: [],
    u: [],
    ul: []
  };
XhmikosR's avatar
XhmikosR committed
239
  function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
XhmikosR's avatar
XhmikosR committed
240
241
    var _ref;

XhmikosR's avatar
XhmikosR committed
242
    if (!unsafeHtml.length) {
XhmikosR's avatar
XhmikosR committed
243
244
245
246
247
248
249
250
251
      return unsafeHtml;
    }

    if (sanitizeFn && typeof sanitizeFn === 'function') {
      return sanitizeFn(unsafeHtml);
    }

    var domParser = new window.DOMParser();
    var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
XhmikosR's avatar
XhmikosR committed
252
    var allowlistKeys = Object.keys(allowList);
XhmikosR's avatar
XhmikosR committed
253
254

    var elements = (_ref = []).concat.apply(_ref, createdDocument.body.querySelectorAll('*'));
XhmikosR's avatar
XhmikosR committed
255
256

    var _loop = function _loop(i, len) {
XhmikosR's avatar
XhmikosR committed
257
258
      var _ref2;

XhmikosR's avatar
XhmikosR committed
259
260
261
      var el = elements[i];
      var elName = el.nodeName.toLowerCase();

XhmikosR's avatar
XhmikosR committed
262
      if (!allowlistKeys.includes(elName)) {
XhmikosR's avatar
XhmikosR committed
263
264
265
266
        el.parentNode.removeChild(el);
        return "continue";
      }

XhmikosR's avatar
XhmikosR committed
267
268
      var attributeList = (_ref2 = []).concat.apply(_ref2, el.attributes);

XhmikosR's avatar
XhmikosR committed
269
      var allowedAttributes = [].concat(allowList['*'] || [], allowList[elName] || []);
XhmikosR's avatar
XhmikosR committed
270
      attributeList.forEach(function (attr) {
XhmikosR's avatar
XhmikosR committed
271
        if (!allowedAttribute(attr, allowedAttributes)) {
XhmikosR's avatar
XhmikosR committed
272
273
274
275
276
277
          el.removeAttribute(attr.nodeName);
        }
      });
    };

    for (var i = 0, len = elements.length; i < len; i++) {
278
      var _ret = _loop(i);
XhmikosR's avatar
XhmikosR committed
279
280
281
282
283
284
285

      if (_ret === "continue") continue;
    }

    return createdDocument.body.innerHTML;
  }

XhmikosR's avatar
XhmikosR committed
286
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
Mark Otto's avatar
Mark Otto committed
287
288
289
290

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

  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
XhmikosR's avatar
Dist    
XhmikosR committed
291
292
293
294
295
296
297
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME = 'tooltip';
XhmikosR's avatar
XhmikosR committed
298
  var VERSION = '5.0.0-alpha3';
XhmikosR's avatar
Dist    
XhmikosR committed
299
300
301
302
  var DATA_KEY = 'bs.tooltip';
  var EVENT_KEY = "." + DATA_KEY;
  var CLASS_PREFIX = 'bs-tooltip';
  var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
XhmikosR's avatar
XhmikosR committed
303
  var DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
XhmikosR's avatar
Dist    
XhmikosR committed
304
305
306
307
308
309
310
311
312
  var DefaultType = {
    animation: 'boolean',
    template: 'string',
    title: '(string|element|function)',
    trigger: 'string',
    delay: '(number|object)',
    html: 'boolean',
    selector: '(string|boolean)',
    placement: '(string|function)',
Mark Otto's avatar
Mark Otto committed
313
    offset: '(number|string|function)',
XhmikosR's avatar
Dist    
XhmikosR committed
314
315
    container: '(string|element|boolean)',
    fallbackPlacement: '(string|array)',
XhmikosR's avatar
XhmikosR committed
316
317
318
    boundary: '(string|element)',
    sanitize: 'boolean',
    sanitizeFn: '(null|function)',
XhmikosR's avatar
XhmikosR committed
319
    allowList: 'object',
XhmikosR's avatar
XhmikosR committed
320
    popperConfig: '(null|object)'
XhmikosR's avatar
Dist    
XhmikosR committed
321
322
323
324
325
326
327
328
329
330
  };
  var AttachmentMap = {
    AUTO: 'auto',
    TOP: 'top',
    RIGHT: 'right',
    BOTTOM: 'bottom',
    LEFT: 'left'
  };
  var Default = {
    animation: true,
XhmikosR's avatar
XhmikosR committed
331
    template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div></div>',
XhmikosR's avatar
Dist    
XhmikosR committed
332
333
334
335
336
337
338
339
340
    trigger: 'hover focus',
    title: '',
    delay: 0,
    html: false,
    selector: false,
    placement: 'top',
    offset: 0,
    container: false,
    fallbackPlacement: 'flip',
XhmikosR's avatar
XhmikosR committed
341
342
343
    boundary: 'scrollParent',
    sanitize: true,
    sanitizeFn: null,
XhmikosR's avatar
XhmikosR committed
344
    allowList: DefaultAllowlist,
XhmikosR's avatar
XhmikosR committed
345
    popperConfig: null
XhmikosR's avatar
Dist    
XhmikosR committed
346
  };
XhmikosR's avatar
XhmikosR committed
347
  var Event$1 = {
XhmikosR's avatar
Dist    
XhmikosR committed
348
349
350
351
352
353
354
355
356
357
358
    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
  };
XhmikosR's avatar
XhmikosR committed
359
360
361
362
363
364
365
366
367
368
  var CLASS_NAME_FADE = 'fade';
  var CLASS_NAME_MODAL = 'modal';
  var CLASS_NAME_SHOW = 'show';
  var HOVER_STATE_SHOW = 'show';
  var HOVER_STATE_OUT = 'out';
  var SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
  var TRIGGER_HOVER = 'hover';
  var TRIGGER_FOCUS = 'focus';
  var TRIGGER_CLICK = 'click';
  var TRIGGER_MANUAL = 'manual';
XhmikosR's avatar
XhmikosR committed
369
370
371
372
373
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
XhmikosR's avatar
Dist    
XhmikosR committed
374

XhmikosR's avatar
XhmikosR committed
375
  var Tooltip = /*#__PURE__*/function () {
XhmikosR's avatar
Dist    
XhmikosR committed
376
    function Tooltip(element, config) {
XhmikosR's avatar
XhmikosR committed
377
      if (typeof Popper__default['default'] === 'undefined') {
XhmikosR's avatar
XhmikosR committed
378
        throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)');
XhmikosR's avatar
Dist    
XhmikosR committed
379
      } // private
Mark Otto's avatar
dist    
Mark Otto committed
380
381


XhmikosR's avatar
Dist    
XhmikosR committed
382
383
384
385
386
      this._isEnabled = true;
      this._timeout = 0;
      this._hoverState = '';
      this._activeTrigger = {};
      this._popper = null; // Protected
387

XhmikosR's avatar
Dist    
XhmikosR committed
388
389
390
      this.element = element;
      this.config = this._getConfig(config);
      this.tip = null;
391

XhmikosR's avatar
Dist    
XhmikosR committed
392
      this._setListeners();
XhmikosR's avatar
XhmikosR committed
393

XhmikosR's avatar
XhmikosR committed
394
      Data__default['default'].setData(element, this.constructor.DATA_KEY, this);
XhmikosR's avatar
Dist    
XhmikosR committed
395
    } // Getters
396

Jacob Thornton's avatar
Jacob Thornton committed
397

XhmikosR's avatar
Dist    
XhmikosR committed
398
    var _proto = Tooltip.prototype;
399

XhmikosR's avatar
Dist    
XhmikosR committed
400
401
402
403
    // Public
    _proto.enable = function enable() {
      this._isEnabled = true;
    };
404

XhmikosR's avatar
Dist    
XhmikosR committed
405
406
407
    _proto.disable = function disable() {
      this._isEnabled = false;
    };
408

XhmikosR's avatar
Dist    
XhmikosR committed
409
410
411
    _proto.toggleEnabled = function toggleEnabled() {
      this._isEnabled = !this._isEnabled;
    };
Mark Otto's avatar
dist    
Mark Otto committed
412

XhmikosR's avatar
Dist    
XhmikosR committed
413
414
415
416
    _proto.toggle = function toggle(event) {
      if (!this._isEnabled) {
        return;
      }
Mark Otto's avatar
Mark Otto committed
417

XhmikosR's avatar
Dist    
XhmikosR committed
418
419
      if (event) {
        var dataKey = this.constructor.DATA_KEY;
XhmikosR's avatar
XhmikosR committed
420
        var context = Data__default['default'].getData(event.delegateTarget, dataKey);
Mark Otto's avatar
Mark Otto committed
421

XhmikosR's avatar
Dist    
XhmikosR committed
422
        if (!context) {
XhmikosR's avatar
XhmikosR committed
423
424
          context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
          Data__default['default'].setData(event.delegateTarget, dataKey, context);
Mark Otto's avatar
dist    
Mark Otto committed
425
        }
fat's avatar
fat committed
426

XhmikosR's avatar
Dist    
XhmikosR committed
427
        context._activeTrigger.click = !context._activeTrigger.click;
fat's avatar
fat committed
428

XhmikosR's avatar
Dist    
XhmikosR committed
429
430
        if (context._isWithActiveTrigger()) {
          context._enter(null, context);
Mark Otto's avatar
grunt    
Mark Otto committed
431
        } else {
XhmikosR's avatar
Dist    
XhmikosR committed
432
433
434
          context._leave(null, context);
        }
      } else {
XhmikosR's avatar
XhmikosR committed
435
        if (this.getTipElement().classList.contains(CLASS_NAME_SHOW)) {
XhmikosR's avatar
Dist    
XhmikosR committed
436
          this._leave(null, this);
437

XhmikosR's avatar
Dist    
XhmikosR committed
438
          return;
Mark Otto's avatar
dist    
Mark Otto committed
439
        }
440

XhmikosR's avatar
Dist    
XhmikosR committed
441
442
443
444
445
446
        this._enter(null, this);
      }
    };

    _proto.dispose = function dispose() {
      clearTimeout(this._timeout);
XhmikosR's avatar
XhmikosR committed
447
448
449
      Data__default['default'].removeData(this.element, this.constructor.DATA_KEY);
      EventHandler__default['default'].off(this.element, this.constructor.EVENT_KEY);
      EventHandler__default['default'].off(this.element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler);
450

XhmikosR's avatar
Dist    
XhmikosR committed
451
      if (this.tip) {
XhmikosR's avatar
XhmikosR committed
452
        this.tip.parentNode.removeChild(this.tip);
XhmikosR's avatar
Dist    
XhmikosR committed
453
      }
454

XhmikosR's avatar
Dist    
XhmikosR committed
455
456
457
458
      this._isEnabled = null;
      this._timeout = null;
      this._hoverState = null;
      this._activeTrigger = null;
459

XhmikosR's avatar
XhmikosR committed
460
      if (this._popper) {
XhmikosR's avatar
Dist    
XhmikosR committed
461
462
        this._popper.destroy();
      }
463

XhmikosR's avatar
Dist    
XhmikosR committed
464
465
466
467
468
      this._popper = null;
      this.element = null;
      this.config = null;
      this.tip = null;
    };
469

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

XhmikosR's avatar
XhmikosR committed
473
      if (this.element.style.display === 'none') {
XhmikosR's avatar
Dist    
XhmikosR committed
474
475
        throw new Error('Please use show on visible elements');
      }
476

XhmikosR's avatar
Dist    
XhmikosR committed
477
      if (this.isWithContent() && this._isEnabled) {
XhmikosR's avatar
XhmikosR committed
478
        var showEvent = EventHandler__default['default'].trigger(this.element, this.constructor.Event.SHOW);
XhmikosR's avatar
XhmikosR committed
479
        var shadowRoot = findShadowRoot(this.element);
XhmikosR's avatar
Dist.    
XhmikosR committed
480
        var isInTheDom = shadowRoot === null ? this.element.ownerDocument.documentElement.contains(this.element) : shadowRoot.contains(this.element);
481

XhmikosR's avatar
XhmikosR committed
482
        if (showEvent.defaultPrevented || !isInTheDom) {
XhmikosR's avatar
Dist    
XhmikosR committed
483
484
          return;
        }
485

XhmikosR's avatar
Dist    
XhmikosR committed
486
        var tip = this.getTipElement();
XhmikosR's avatar
XhmikosR committed
487
        var tipId = getUID(this.constructor.NAME);
XhmikosR's avatar
Dist    
XhmikosR committed
488
489
490
        tip.setAttribute('id', tipId);
        this.element.setAttribute('aria-describedby', tipId);
        this.setContent();
491

XhmikosR's avatar
Dist    
XhmikosR committed
492
        if (this.config.animation) {
XhmikosR's avatar
XhmikosR committed
493
          tip.classList.add(CLASS_NAME_FADE);
XhmikosR's avatar
Dist    
XhmikosR committed
494
        }
495

XhmikosR's avatar
Dist    
XhmikosR committed
496
        var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
Mark Otto's avatar
grunt    
Mark Otto committed
497

XhmikosR's avatar
Dist    
XhmikosR committed
498
        var attachment = this._getAttachment(placement);
Mark Otto's avatar
grunt    
Mark Otto committed
499

500
        this._addAttachmentClass(attachment);
Mark Otto's avatar
dist    
Mark Otto committed
501
502
503

        var container = this._getContainer();

XhmikosR's avatar
XhmikosR committed
504
        Data__default['default'].setData(tip, this.constructor.DATA_KEY, this);
Mark Otto's avatar
Mark Otto committed
505

XhmikosR's avatar
XhmikosR committed
506
507
        if (!this.element.ownerDocument.documentElement.contains(this.tip)) {
          container.appendChild(tip);
XhmikosR's avatar
Dist    
XhmikosR committed
508
        }
Mark Otto's avatar
grunt    
Mark Otto committed
509

XhmikosR's avatar
XhmikosR committed
510
511
        EventHandler__default['default'].trigger(this.element, this.constructor.Event.INSERTED);
        this._popper = new Popper__default['default'](this.element, tip, this._getPopperConfig(attachment));
XhmikosR's avatar
XhmikosR committed
512
        tip.classList.add(CLASS_NAME_SHOW); // If this is a touch-enabled device we add extra
XhmikosR's avatar
Dist    
XhmikosR committed
513
514
515
        // 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
grunt    
Mark Otto committed
516

XhmikosR's avatar
Dist    
XhmikosR committed
517
        if ('ontouchstart' in document.documentElement) {
XhmikosR's avatar
XhmikosR committed
518
519
520
          var _ref;

          (_ref = []).concat.apply(_ref, document.body.children).forEach(function (element) {
XhmikosR's avatar
XhmikosR committed
521
            EventHandler__default['default'].on(element, 'mouseover', noop());
XhmikosR's avatar
XhmikosR committed
522
          });
XhmikosR's avatar
Dist    
XhmikosR committed
523
        }
Mark Otto's avatar
build    
Mark Otto committed
524

XhmikosR's avatar
Dist    
XhmikosR committed
525
526
527
528
        var complete = function complete() {
          if (_this.config.animation) {
            _this._fixTransition();
          }
529

XhmikosR's avatar
Dist    
XhmikosR committed
530
531
          var prevHoverState = _this._hoverState;
          _this._hoverState = null;
XhmikosR's avatar
XhmikosR committed
532
          EventHandler__default['default'].trigger(_this.element, _this.constructor.Event.SHOWN);
533

XhmikosR's avatar
XhmikosR committed
534
          if (prevHoverState === HOVER_STATE_OUT) {
XhmikosR's avatar
Dist    
XhmikosR committed
535
            _this._leave(null, _this);
536
          }
XhmikosR's avatar
Dist    
XhmikosR committed
537
538
        };

XhmikosR's avatar
XhmikosR committed
539
        if (this.tip.classList.contains(CLASS_NAME_FADE)) {
XhmikosR's avatar
XhmikosR committed
540
          var transitionDuration = getTransitionDurationFromElement(this.tip);
XhmikosR's avatar
XhmikosR committed
541
          EventHandler__default['default'].one(this.tip, TRANSITION_END, complete);
XhmikosR's avatar
XhmikosR committed
542
          emulateTransitionEnd(this.tip, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
543
544
        } else {
          complete();
545
        }
XhmikosR's avatar
Dist    
XhmikosR committed
546
547
      }
    };
548

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

XhmikosR's avatar
XhmikosR committed
552
553
554
555
      if (!this._popper) {
        return;
      }

XhmikosR's avatar
Dist    
XhmikosR committed
556
      var tip = this.getTipElement();
Mark Otto's avatar
dist    
Mark Otto committed
557

XhmikosR's avatar
Dist    
XhmikosR committed
558
      var complete = function complete() {
XhmikosR's avatar
XhmikosR committed
559
        if (_this2._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
XhmikosR's avatar
Dist    
XhmikosR committed
560
561
          tip.parentNode.removeChild(tip);
        }
562

XhmikosR's avatar
Dist    
XhmikosR committed
563
        _this2._cleanTipClass();
Mark Otto's avatar
grunt    
Mark Otto committed
564

XhmikosR's avatar
Dist    
XhmikosR committed
565
        _this2.element.removeAttribute('aria-describedby');
566

XhmikosR's avatar
XhmikosR committed
567
        EventHandler__default['default'].trigger(_this2.element, _this2.constructor.Event.HIDDEN);
Mark Otto's avatar
dist    
Mark Otto committed
568

569
        _this2._popper.destroy();
XhmikosR's avatar
Dist    
XhmikosR committed
570
      };
Mark Otto's avatar
grunt    
Mark Otto committed
571

XhmikosR's avatar
XhmikosR committed
572
      var hideEvent = EventHandler__default['default'].trigger(this.element, this.constructor.Event.HIDE);
Mark Otto's avatar
grunt    
Mark Otto committed
573

XhmikosR's avatar
XhmikosR committed
574
      if (hideEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
575
576
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
577

XhmikosR's avatar
XhmikosR committed
578
      tip.classList.remove(CLASS_NAME_SHOW); // If this is a touch-enabled device we remove the extra
XhmikosR's avatar
Dist    
XhmikosR committed
579
      // empty mouseover listeners we added for iOS support
Mark Otto's avatar
dist    
Mark Otto committed
580

XhmikosR's avatar
Dist    
XhmikosR committed
581
      if ('ontouchstart' in document.documentElement) {
XhmikosR's avatar
XhmikosR committed
582
583
584
        var _ref2;

        (_ref2 = []).concat.apply(_ref2, document.body.children).forEach(function (element) {
XhmikosR's avatar
XhmikosR committed
585
          return EventHandler__default['default'].off(element, 'mouseover', noop);
XhmikosR's avatar
XhmikosR committed
586
        });
XhmikosR's avatar
Dist    
XhmikosR committed
587
      }
Mark Otto's avatar
dist    
Mark Otto committed
588

XhmikosR's avatar
XhmikosR committed
589
590
591
      this._activeTrigger[TRIGGER_CLICK] = false;
      this._activeTrigger[TRIGGER_FOCUS] = false;
      this._activeTrigger[TRIGGER_HOVER] = false;
Mark Otto's avatar
dist    
Mark Otto committed
592

XhmikosR's avatar
XhmikosR committed
593
      if (this.tip.classList.contains(CLASS_NAME_FADE)) {
XhmikosR's avatar
XhmikosR committed
594
        var transitionDuration = getTransitionDurationFromElement(tip);
XhmikosR's avatar
XhmikosR committed
595
        EventHandler__default['default'].one(tip, TRANSITION_END, complete);
XhmikosR's avatar
XhmikosR committed
596
        emulateTransitionEnd(tip, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
597
598
599
      } else {
        complete();
      }
Mark Otto's avatar
dist    
Mark Otto committed
600

XhmikosR's avatar
Dist    
XhmikosR committed
601
602
      this._hoverState = '';
    };
Mark Otto's avatar
dist    
Mark Otto committed
603

XhmikosR's avatar
Dist    
XhmikosR committed
604
605
606
607
    _proto.update = function update() {
      if (this._popper !== null) {
        this._popper.scheduleUpdate();
      }
Mark Otto's avatar
Mark Otto committed
608
609
    } // Protected
    ;
Mark Otto's avatar
dist    
Mark Otto committed
610

XhmikosR's avatar
Dist    
XhmikosR committed
611
612
613
    _proto.isWithContent = function isWithContent() {
      return Boolean(this.getTitle());
    };
Mark Otto's avatar
dist    
Mark Otto committed
614

XhmikosR's avatar
Dist    
XhmikosR committed
615
    _proto.getTipElement = function getTipElement() {
XhmikosR's avatar
XhmikosR committed
616
617
618
619
620
621
622
      if (this.tip) {
        return this.tip;
      }

      var element = document.createElement('div');
      element.innerHTML = this.config.template;
      this.tip = element.children[0];
XhmikosR's avatar
Dist    
XhmikosR committed
623
624
      return this.tip;
    };
Mark Otto's avatar
dist    
Mark Otto committed
625

XhmikosR's avatar
Dist    
XhmikosR committed
626
627
    _proto.setContent = function setContent() {
      var tip = this.getTipElement();
XhmikosR's avatar
XhmikosR committed
628
      this.setElementContent(SelectorEngine__default['default'].findOne(SELECTOR_TOOLTIP_INNER, tip), this.getTitle());
XhmikosR's avatar
XhmikosR committed
629
      tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW);
XhmikosR's avatar
Dist    
XhmikosR committed
630
    };
Mark Otto's avatar
dist    
Mark Otto committed
631

XhmikosR's avatar
XhmikosR committed
632
633
634
635
636
    _proto.setElementContent = function setElementContent(element, content) {
      if (element === null) {
        return;
      }

637
      if (typeof content === 'object' && isElement(content)) {
XhmikosR's avatar
XhmikosR committed
638
639
640
641
642
        if (content.jquery) {
          content = content[0];
        } // content is a DOM node or a jQuery


XhmikosR's avatar
XhmikosR committed
643
        if (this.config.html) {
XhmikosR's avatar
XhmikosR committed
644
645
646
          if (content.parentNode !== element) {
            element.innerHTML = '';
            element.appendChild(content);
XhmikosR's avatar
XhmikosR committed
647
648
          }
        } else {
XhmikosR's avatar
XhmikosR committed
649
          element.textContent = content.textContent;
XhmikosR's avatar
XhmikosR committed
650
        }
XhmikosR's avatar
XhmikosR committed
651
652
653
654
655
656

        return;
      }

      if (this.config.html) {
        if (this.config.sanitize) {
XhmikosR's avatar
XhmikosR committed
657
          content = sanitizeHtml(content, this.config.allowList, this.config.sanitizeFn);
XhmikosR's avatar
XhmikosR committed
658
659
        }

XhmikosR's avatar
XhmikosR committed
660
        element.innerHTML = content;
XhmikosR's avatar
Dist    
XhmikosR committed
661
      } else {
XhmikosR's avatar
XhmikosR committed
662
        element.textContent = content;
XhmikosR's avatar
Dist    
XhmikosR committed
663
664
      }
    };
665

XhmikosR's avatar
Dist    
XhmikosR committed
666
    _proto.getTitle = function getTitle() {
XhmikosR's avatar
XhmikosR committed
667
      var title = this.element.getAttribute('data-bs-original-title');
668

XhmikosR's avatar
Dist    
XhmikosR committed
669
670
671
      if (!title) {
        title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
      }
672

XhmikosR's avatar
Dist    
XhmikosR committed
673
      return title;
Mark Otto's avatar
Mark Otto committed
674
675
    } // Private
    ;
Mark Otto's avatar
grunt    
Mark Otto committed
676

XhmikosR's avatar
XhmikosR committed
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
    _proto._getPopperConfig = function _getPopperConfig(attachment) {
      var _this3 = this;

      var defaultBsConfig = {
        placement: attachment,
        modifiers: {
          offset: this._getOffset(),
          flip: {
            behavior: this.config.fallbackPlacement
          },
          arrow: {
            element: "." + this.constructor.NAME + "-arrow"
          },
          preventOverflow: {
            boundariesElement: this.config.boundary
          }
        },
        onCreate: function onCreate(data) {
          if (data.originalPlacement !== data.placement) {
            _this3._handlePopperPlacementChange(data);
          }
        },
        onUpdate: function onUpdate(data) {
          return _this3._handlePopperPlacementChange(data);
        }
      };
XhmikosR's avatar
XhmikosR committed
703
      return _extends({}, defaultBsConfig, this.config.popperConfig);
XhmikosR's avatar
XhmikosR committed
704
705
    };

706
707
708
709
    _proto._addAttachmentClass = function _addAttachmentClass(attachment) {
      this.getTipElement().classList.add(CLASS_PREFIX + "-" + attachment);
    };

Mark Otto's avatar
Mark Otto committed
710
    _proto._getOffset = function _getOffset() {
XhmikosR's avatar
XhmikosR committed
711
      var _this4 = this;
Mark Otto's avatar
Mark Otto committed
712
713
714
715
716

      var offset = {};

      if (typeof this.config.offset === 'function') {
        offset.fn = function (data) {
XhmikosR's avatar
XhmikosR committed
717
          data.offsets = _extends({}, data.offsets, _this4.config.offset(data.offsets, _this4.element) || {});
Mark Otto's avatar
Mark Otto committed
718
719
720
721
722
723
724
725
726
          return data;
        };
      } else {
        offset.offset = this.config.offset;
      }

      return offset;
    };

Mark Otto's avatar
dist    
Mark Otto committed
727
728
729
730
731
    _proto._getContainer = function _getContainer() {
      if (this.config.container === false) {
        return document.body;
      }

XhmikosR's avatar
XhmikosR committed
732
733
      if (isElement(this.config.container)) {
        return this.config.container;
Mark Otto's avatar
dist    
Mark Otto committed
734
735
      }

XhmikosR's avatar
XhmikosR committed
736
      return SelectorEngine__default['default'].findOne(this.config.container);
Mark Otto's avatar
dist    
Mark Otto committed
737
738
    };

XhmikosR's avatar
Dist    
XhmikosR committed
739
740
741
    _proto._getAttachment = function _getAttachment(placement) {
      return AttachmentMap[placement.toUpperCase()];
    };
Mark Otto's avatar
dist    
Mark Otto committed
742

XhmikosR's avatar
Dist    
XhmikosR committed
743
    _proto._setListeners = function _setListeners() {
XhmikosR's avatar
XhmikosR committed
744
      var _this5 = this;
Mark Otto's avatar
grunt    
Mark Otto committed
745

XhmikosR's avatar
Dist    
XhmikosR committed
746
747
748
      var triggers = this.config.trigger.split(' ');
      triggers.forEach(function (trigger) {
        if (trigger === 'click') {
XhmikosR's avatar
XhmikosR committed
749
          EventHandler__default['default'].on(_this5.element, _this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
XhmikosR's avatar
XhmikosR committed
750
            return _this5.toggle(event);
Mark Otto's avatar
dist    
Mark Otto committed
751
          });
XhmikosR's avatar
XhmikosR committed
752
753
754
        } else if (trigger !== TRIGGER_MANUAL) {
          var eventIn = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
          var eventOut = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
XhmikosR's avatar
XhmikosR committed
755
          EventHandler__default['default'].on(_this5.element, eventIn, _this5.config.selector, function (event) {
XhmikosR's avatar
XhmikosR committed
756
            return _this5._enter(event);
XhmikosR's avatar
XhmikosR committed
757
          });
XhmikosR's avatar
XhmikosR committed
758
          EventHandler__default['default'].on(_this5.element, eventOut, _this5.config.selector, function (event) {
XhmikosR's avatar
XhmikosR committed
759
            return _this5._leave(event);
Mark Otto's avatar
dist    
Mark Otto committed
760
761
          });
        }
XhmikosR's avatar
Dist    
XhmikosR committed
762
      });
Mark Otto's avatar
dist v5    
Mark Otto committed
763
764

      this._hideModalHandler = function () {
XhmikosR's avatar
XhmikosR committed
765
766
        if (_this5.element) {
          _this5.hide();
XhmikosR's avatar
Dist    
XhmikosR committed
767
        }
Mark Otto's avatar
dist v5    
Mark Otto committed
768
769
      };

XhmikosR's avatar
XhmikosR committed
770
      EventHandler__default['default'].on(this.element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler);
Mark Otto's avatar
dist    
Mark Otto committed
771

XhmikosR's avatar
Dist    
XhmikosR committed
772
      if (this.config.selector) {
XhmikosR's avatar
XhmikosR committed
773
        this.config = _extends({}, this.config, {
XhmikosR's avatar
Dist    
XhmikosR committed
774
775
776
777
778
779
780
          trigger: 'manual',
          selector: ''
        });
      } else {
        this._fixTitle();
      }
    };
781

XhmikosR's avatar
Dist    
XhmikosR committed
782
    _proto._fixTitle = function _fixTitle() {
XhmikosR's avatar
XhmikosR committed
783
784
      var title = this.element.getAttribute('title');
      var originalTitleType = typeof this.element.getAttribute('data-bs-original-title');
785

XhmikosR's avatar
XhmikosR committed
786
787
      if (title || originalTitleType !== 'string') {
        this.element.setAttribute('data-bs-original-title', title || '');
XhmikosR's avatar
Dist    
XhmikosR committed
788
789
790
        this.element.setAttribute('title', '');
      }
    };
791

XhmikosR's avatar
Dist    
XhmikosR committed
792
793
    _proto._enter = function _enter(event, context) {
      var dataKey = this.constructor.DATA_KEY;
XhmikosR's avatar
XhmikosR committed
794
      context = context || Data__default['default'].getData(event.delegateTarget, dataKey);
Mark Otto's avatar
grunt    
Mark Otto committed
795

XhmikosR's avatar
Dist    
XhmikosR committed
796
      if (!context) {
XhmikosR's avatar
XhmikosR committed
797
798
        context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
        Data__default['default'].setData(event.delegateTarget, dataKey, context);
XhmikosR's avatar
Dist    
XhmikosR committed
799
      }
Mark Otto's avatar
grunt    
Mark Otto committed
800

XhmikosR's avatar
Dist    
XhmikosR committed
801
      if (event) {
XhmikosR's avatar
XhmikosR committed
802
        context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
XhmikosR's avatar
Dist    
XhmikosR committed
803
      }
804

XhmikosR's avatar
XhmikosR committed
805
806
      if (context.getTipElement().classList.contains(CLASS_NAME_SHOW) || context._hoverState === HOVER_STATE_SHOW) {
        context._hoverState = HOVER_STATE_SHOW;
XhmikosR's avatar
Dist    
XhmikosR committed
807
808
809
810
        return;
      }

      clearTimeout(context._timeout);
XhmikosR's avatar
XhmikosR committed
811
      context._hoverState = HOVER_STATE_SHOW;
Mark Otto's avatar
grunt    
Mark Otto committed
812

XhmikosR's avatar
Dist    
XhmikosR committed
813
814
815
816
817
818
      if (!context.config.delay || !context.config.delay.show) {
        context.show();
        return;
      }

      context._timeout = setTimeout(function () {
XhmikosR's avatar
XhmikosR committed
819
        if (context._hoverState === HOVER_STATE_SHOW) {
820
821
          context.show();
        }
XhmikosR's avatar
Dist    
XhmikosR committed
822
823
      }, context.config.delay.show);
    };
824

XhmikosR's avatar
Dist    
XhmikosR committed
825
826
    _proto._leave = function _leave(event, context) {
      var dataKey = this.constructor.DATA_KEY;
XhmikosR's avatar
XhmikosR committed
827
      context = context || Data__default['default'].getData(event.delegateTarget, dataKey);
Mark Otto's avatar
dist    
Mark Otto committed
828

XhmikosR's avatar
Dist    
XhmikosR committed
829
      if (!context) {
XhmikosR's avatar
XhmikosR committed
830
831
        context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
        Data__default['default'].setData(event.delegateTarget, dataKey, context);
XhmikosR's avatar
Dist    
XhmikosR committed
832
      }
Mark Otto's avatar
grunt    
Mark Otto committed
833

XhmikosR's avatar
Dist    
XhmikosR committed
834
      if (event) {
XhmikosR's avatar
XhmikosR committed
835
        context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false;
XhmikosR's avatar
Dist    
XhmikosR committed
836
      }
837

XhmikosR's avatar
Dist    
XhmikosR committed
838
839
840
      if (context._isWithActiveTrigger()) {
        return;
      }
841

XhmikosR's avatar
Dist    
XhmikosR committed
842
      clearTimeout(context._timeout);
XhmikosR's avatar
XhmikosR committed
843
      context._hoverState = HOVER_STATE_OUT;
844

XhmikosR's avatar
Dist    
XhmikosR committed
845
846
847
848
      if (!context.config.delay || !context.config.delay.hide) {
        context.hide();
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
849

XhmikosR's avatar
Dist    
XhmikosR committed
850
      context._timeout = setTimeout(function () {
XhmikosR's avatar
XhmikosR committed
851
        if (context._hoverState === HOVER_STATE_OUT) {
Mark Otto's avatar
dist    
Mark Otto committed
852
          context.hide();
853
        }
XhmikosR's avatar
Dist    
XhmikosR committed
854
855
      }, context.config.delay.hide);
    };
856

XhmikosR's avatar
Dist    
XhmikosR committed
857
858
859
860
    _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
      for (var trigger in this._activeTrigger) {
        if (this._activeTrigger[trigger]) {
          return true;
Mark Otto's avatar
dist    
Mark Otto committed
861
        }
XhmikosR's avatar
Dist    
XhmikosR committed
862
      }
Mark Otto's avatar
grunt    
Mark Otto committed
863

XhmikosR's avatar
Dist    
XhmikosR committed
864
865
      return false;
    };
fat's avatar
fat committed
866

XhmikosR's avatar
Dist    
XhmikosR committed
867
    _proto._getConfig = function _getConfig(config) {
XhmikosR's avatar
XhmikosR committed
868
      var dataAttributes = Manipulator__default['default'].getDataAttributes(this.element);
XhmikosR's avatar
XhmikosR committed
869
      Object.keys(dataAttributes).forEach(function (dataAttr) {
XhmikosR's avatar
XhmikosR committed
870
        if (DISALLOWED_ATTRIBUTES.has(dataAttr)) {
XhmikosR's avatar
XhmikosR committed
871
872
873
          delete dataAttributes[dataAttr];
        }
      });
XhmikosR's avatar
XhmikosR committed
874
875
876
877
878

      if (config && typeof config.container === 'object' && config.container.jquery) {
        config.container = config.container[0];
      }

XhmikosR's avatar
XhmikosR committed
879
      config = _extends({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {});
Mark Otto's avatar
grunt    
Mark Otto committed
880

XhmikosR's avatar
Dist    
XhmikosR committed
881
882
883
884
885
886
      if (typeof config.delay === 'number') {
        config.delay = {
          show: config.delay,
          hide: config.delay
        };
      }
Mark Otto's avatar
grunt    
Mark Otto committed
887

XhmikosR's avatar
Dist    
XhmikosR committed
888
889
890
      if (typeof config.title === 'number') {
        config.title = config.title.toString();
      }
Mark Otto's avatar
grunt    
Mark Otto committed
891

XhmikosR's avatar
Dist    
XhmikosR committed
892
893
894
      if (typeof config.content === 'number') {
        config.content = config.content.toString();
      }
Mark Otto's avatar
grunt    
Mark Otto committed
895

XhmikosR's avatar
XhmikosR committed
896
      typeCheckConfig(NAME, config, this.constructor.DefaultType);
XhmikosR's avatar
XhmikosR committed
897
898

      if (config.sanitize) {
XhmikosR's avatar
XhmikosR committed
899
        config.template = sanitizeHtml(config.template, config.allowList, config.sanitizeFn);
XhmikosR's avatar
XhmikosR committed
900
901
      }

XhmikosR's avatar
Dist    
XhmikosR committed
902
903
      return config;
    };
Mark Otto's avatar
grunt    
Mark Otto committed
904

XhmikosR's avatar
Dist    
XhmikosR committed
905
906
    _proto._getDelegateConfig = function _getDelegateConfig() {
      var config = {};
Mark Otto's avatar
grunt    
Mark Otto committed
907

XhmikosR's avatar
Dist    
XhmikosR committed
908
909
910
911
      if (this.config) {
        for (var key in this.config) {
          if (this.constructor.Default[key] !== this.config[key]) {
            config[key] = this.config[key];
912
913
          }
        }
XhmikosR's avatar
Dist    
XhmikosR committed
914
      }
Mark Otto's avatar
dist    
Mark Otto committed
915

XhmikosR's avatar
Dist    
XhmikosR committed
916
917
      return config;
    };
Mark Otto's avatar
dist    
Mark Otto committed
918

XhmikosR's avatar
Dist    
XhmikosR committed
919
    _proto._cleanTipClass = function _cleanTipClass() {
XhmikosR's avatar
XhmikosR committed
920
921
      var tip = this.getTipElement();
      var tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX);
Mark Otto's avatar
dist    
Mark Otto committed
922

XhmikosR's avatar
XhmikosR committed
923
      if (tabClass !== null && tabClass.length > 0) {
XhmikosR's avatar
XhmikosR committed
924
925
926
927
928
        tabClass.map(function (token) {
          return token.trim();
        }).forEach(function (tClass) {
          return tip.classList.remove(tClass);
        });
XhmikosR's avatar
Dist    
XhmikosR committed
929
930
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
931

XhmikosR's avatar
Dist    
XhmikosR committed
932
    _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
XhmikosR's avatar
XhmikosR committed
933
      this.tip = popperData.instance.popper;
Mark Otto's avatar
dist    
Mark Otto committed
934

XhmikosR's avatar
Dist    
XhmikosR committed
935
      this._cleanTipClass();
Mark Otto's avatar
dist    
Mark Otto committed
936

937
      this._addAttachmentClass(this._getAttachment(popperData.placement));
XhmikosR's avatar
Dist    
XhmikosR committed
938
    };
Mark Otto's avatar
dist    
Mark Otto committed
939

XhmikosR's avatar
Dist    
XhmikosR committed
940
941
942
    _proto._fixTransition = function _fixTransition() {
      var tip = this.getTipElement();
      var initConfigAnimation = this.config.animation;
Mark Otto's avatar
dist    
Mark Otto committed
943

XhmikosR's avatar
Dist    
XhmikosR committed
944
945
946
      if (tip.getAttribute('x-placement') !== null) {
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
947

XhmikosR's avatar
XhmikosR committed
948
      tip.classList.remove(CLASS_NAME_FADE);
XhmikosR's avatar
Dist    
XhmikosR committed
949
950
951
952
      this.config.animation = false;
      this.hide();
      this.show();
      this.config.animation = initConfigAnimation;
Mark Otto's avatar
Mark Otto committed
953
954
    } // Static
    ;
Mark Otto's avatar
dist    
Mark Otto committed
955

XhmikosR's avatar
XhmikosR committed
956
    Tooltip.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
957
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
958
        var data = Data__default['default'].getData(this, DATA_KEY);
Mark Otto's avatar
dist    
Mark Otto committed
959

XhmikosR's avatar
Dist    
XhmikosR committed
960
        var _config = typeof config === 'object' && config;
Mark Otto's avatar
dist    
Mark Otto committed
961

XhmikosR's avatar
Dist    
XhmikosR committed
962
963
964
        if (!data && /dispose|hide/.test(config)) {
          return;
        }
Mark Otto's avatar
dist    
Mark Otto committed
965

XhmikosR's avatar
Dist    
XhmikosR committed
966
967
968
        if (!data) {
          data = new Tooltip(this, _config);
        }
Mark Otto's avatar
grunt    
Mark Otto committed
969

XhmikosR's avatar
Dist    
XhmikosR committed
970
971
972
        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
Mark Otto's avatar
dist    
Mark Otto committed
973
974
          }

XhmikosR's avatar
Dist    
XhmikosR committed
975
          data[config]();
Mark Otto's avatar
dist    
Mark Otto committed
976
        }
XhmikosR's avatar
Dist    
XhmikosR committed
977
978
      });
    };
Mark Otto's avatar
grunt    
Mark Otto committed
979

XhmikosR's avatar
XhmikosR committed
980
    Tooltip.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
981
      return Data__default['default'].getData(element, DATA_KEY);
XhmikosR's avatar
XhmikosR committed
982
983
    };

XhmikosR's avatar
Dist    
XhmikosR committed
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
    _createClass(Tooltip, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION;
      }
    }, {
      key: "Default",
      get: function get() {
        return Default;
      }
    }, {
      key: "NAME",
      get: function get() {
        return NAME;
      }
    }, {
      key: "DATA_KEY",
For faster browsing, not all history is shown. View entire blame