Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
tooltip.js890 linesDownload Raw Back to dist
1/*!2  * Bootstrap tooltip.js v4.6.2 (https://getbootstrap.com/)3  * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)4  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)5  */6(function (global, factory) {7  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery'), require('popper.js'), require('./util.js')) :8  typeof define === 'function' && define.amd ? define(['jquery', 'popper.js', './util'], factory) :9  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tooltip = factory(global.jQuery, global.Popper, global.Util));10})(this, (function ($, Popper, Util) { 'use strict';11 12  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }13 14  var $__default = /*#__PURE__*/_interopDefaultLegacy($);15  var Popper__default = /*#__PURE__*/_interopDefaultLegacy(Popper);16  var Util__default = /*#__PURE__*/_interopDefaultLegacy(Util);17 18  function _defineProperties(target, props) {19    for (var i = 0; i < props.length; i++) {20      var descriptor = props[i];21      descriptor.enumerable = descriptor.enumerable || false;22      descriptor.configurable = true;23      if ("value" in descriptor) descriptor.writable = true;24      Object.defineProperty(target, descriptor.key, descriptor);25    }26  }27 28  function _createClass(Constructor, protoProps, staticProps) {29    if (protoProps) _defineProperties(Constructor.prototype, protoProps);30    if (staticProps) _defineProperties(Constructor, staticProps);31    Object.defineProperty(Constructor, "prototype", {32      writable: false33    });34    return Constructor;35  }36 37  function _extends() {38    _extends = Object.assign ? Object.assign.bind() : function (target) {39      for (var i = 1; i < arguments.length; i++) {40        var source = arguments[i];41 42        for (var key in source) {43          if (Object.prototype.hasOwnProperty.call(source, key)) {44            target[key] = source[key];45          }46        }47      }48 49      return target;50    };51    return _extends.apply(this, arguments);52  }53 54  /**55   * --------------------------------------------------------------------------56   * Bootstrap (v4.6.2): tools/sanitizer.js57   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)58   * --------------------------------------------------------------------------59   */60  var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];61  var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;62  var DefaultWhitelist = {63    // Global attributes allowed on any supplied element below.64    '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],65    a: ['target', 'href', 'title', 'rel'],66    area: [],67    b: [],68    br: [],69    col: [],70    code: [],71    div: [],72    em: [],73    hr: [],74    h1: [],75    h2: [],76    h3: [],77    h4: [],78    h5: [],79    h6: [],80    i: [],81    img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],82    li: [],83    ol: [],84    p: [],85    pre: [],86    s: [],87    small: [],88    span: [],89    sub: [],90    sup: [],91    strong: [],92    u: [],93    ul: []94  };95  /**96   * A pattern that recognizes a commonly useful subset of URLs that are safe.97   *98   * Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts99   */100 101  var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i;102  /**103   * A pattern that matches safe data URLs. Only matches image, video and audio types.104   *105   * Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts106   */107 108  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;109 110  function allowedAttribute(attr, allowedAttributeList) {111    var attrName = attr.nodeName.toLowerCase();112 113    if (allowedAttributeList.indexOf(attrName) !== -1) {114      if (uriAttrs.indexOf(attrName) !== -1) {115        return Boolean(SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue));116      }117 118      return true;119    }120 121    var regExp = allowedAttributeList.filter(function (attrRegex) {122      return attrRegex instanceof RegExp;123    }); // Check if a regular expression validates the attribute.124 125    for (var i = 0, len = regExp.length; i < len; i++) {126      if (regExp[i].test(attrName)) {127        return true;128      }129    }130 131    return false;132  }133 134  function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {135    if (unsafeHtml.length === 0) {136      return unsafeHtml;137    }138 139    if (sanitizeFn && typeof sanitizeFn === 'function') {140      return sanitizeFn(unsafeHtml);141    }142 143    var domParser = new window.DOMParser();144    var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');145    var whitelistKeys = Object.keys(whiteList);146    var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));147 148    var _loop = function _loop(i, len) {149      var el = elements[i];150      var elName = el.nodeName.toLowerCase();151 152      if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {153        el.parentNode.removeChild(el);154        return "continue";155      }156 157      var attributeList = [].slice.call(el.attributes); // eslint-disable-next-line unicorn/prefer-spread158 159      var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);160      attributeList.forEach(function (attr) {161        if (!allowedAttribute(attr, whitelistedAttributes)) {162          el.removeAttribute(attr.nodeName);163        }164      });165    };166 167    for (var i = 0, len = elements.length; i < len; i++) {168      var _ret = _loop(i);169 170      if (_ret === "continue") continue;171    }172 173    return createdDocument.body.innerHTML;174  }175 176  /**177   * Constants178   */179 180  var NAME = 'tooltip';181  var VERSION = '4.6.2';182  var DATA_KEY = 'bs.tooltip';183  var EVENT_KEY = "." + DATA_KEY;184  var JQUERY_NO_CONFLICT = $__default["default"].fn[NAME];185  var CLASS_PREFIX = 'bs-tooltip';186  var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');187  var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];188  var CLASS_NAME_FADE = 'fade';189  var CLASS_NAME_SHOW = 'show';190  var HOVER_STATE_SHOW = 'show';191  var HOVER_STATE_OUT = 'out';192  var SELECTOR_TOOLTIP_INNER = '.tooltip-inner';193  var SELECTOR_ARROW = '.arrow';194  var TRIGGER_HOVER = 'hover';195  var TRIGGER_FOCUS = 'focus';196  var TRIGGER_CLICK = 'click';197  var TRIGGER_MANUAL = 'manual';198  var AttachmentMap = {199    AUTO: 'auto',200    TOP: 'top',201    RIGHT: 'right',202    BOTTOM: 'bottom',203    LEFT: 'left'204  };205  var Default = {206    animation: true,207    template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',208    trigger: 'hover focus',209    title: '',210    delay: 0,211    html: false,212    selector: false,213    placement: 'top',214    offset: 0,215    container: false,216    fallbackPlacement: 'flip',217    boundary: 'scrollParent',218    customClass: '',219    sanitize: true,220    sanitizeFn: null,221    whiteList: DefaultWhitelist,222    popperConfig: null223  };224  var DefaultType = {225    animation: 'boolean',226    template: 'string',227    title: '(string|element|function)',228    trigger: 'string',229    delay: '(number|object)',230    html: 'boolean',231    selector: '(string|boolean)',232    placement: '(string|function)',233    offset: '(number|string|function)',234    container: '(string|element|boolean)',235    fallbackPlacement: '(string|array)',236    boundary: '(string|element)',237    customClass: '(string|function)',238    sanitize: 'boolean',239    sanitizeFn: '(null|function)',240    whiteList: 'object',241    popperConfig: '(null|object)'242  };243  var Event = {244    HIDE: "hide" + EVENT_KEY,245    HIDDEN: "hidden" + EVENT_KEY,246    SHOW: "show" + EVENT_KEY,247    SHOWN: "shown" + EVENT_KEY,248    INSERTED: "inserted" + EVENT_KEY,249    CLICK: "click" + EVENT_KEY,250    FOCUSIN: "focusin" + EVENT_KEY,251    FOCUSOUT: "focusout" + EVENT_KEY,252    MOUSEENTER: "mouseenter" + EVENT_KEY,253    MOUSELEAVE: "mouseleave" + EVENT_KEY254  };255  /**256   * Class definition257   */258 259  var Tooltip = /*#__PURE__*/function () {260    function Tooltip(element, config) {261      if (typeof Popper__default["default"] === 'undefined') {262        throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)');263      } // Private264 265 266      this._isEnabled = true;267      this._timeout = 0;268      this._hoverState = '';269      this._activeTrigger = {};270      this._popper = null; // Protected271 272      this.element = element;273      this.config = this._getConfig(config);274      this.tip = null;275 276      this._setListeners();277    } // Getters278 279 280    var _proto = Tooltip.prototype;281 282    // Public283    _proto.enable = function enable() {284      this._isEnabled = true;285    };286 287    _proto.disable = function disable() {288      this._isEnabled = false;289    };290 291    _proto.toggleEnabled = function toggleEnabled() {292      this._isEnabled = !this._isEnabled;293    };294 295    _proto.toggle = function toggle(event) {296      if (!this._isEnabled) {297        return;298      }299 300      if (event) {301        var dataKey = this.constructor.DATA_KEY;302        var context = $__default["default"](event.currentTarget).data(dataKey);303 304        if (!context) {305          context = new this.constructor(event.currentTarget, this._getDelegateConfig());306          $__default["default"](event.currentTarget).data(dataKey, context);307        }308 309        context._activeTrigger.click = !context._activeTrigger.click;310 311        if (context._isWithActiveTrigger()) {312          context._enter(null, context);313        } else {314          context._leave(null, context);315        }316      } else {317        if ($__default["default"](this.getTipElement()).hasClass(CLASS_NAME_SHOW)) {318          this._leave(null, this);319 320          return;321        }322 323        this._enter(null, this);324      }325    };326 327    _proto.dispose = function dispose() {328      clearTimeout(this._timeout);329      $__default["default"].removeData(this.element, this.constructor.DATA_KEY);330      $__default["default"](this.element).off(this.constructor.EVENT_KEY);331      $__default["default"](this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);332 333      if (this.tip) {334        $__default["default"](this.tip).remove();335      }336 337      this._isEnabled = null;338      this._timeout = null;339      this._hoverState = null;340      this._activeTrigger = null;341 342      if (this._popper) {343        this._popper.destroy();344      }345 346      this._popper = null;347      this.element = null;348      this.config = null;349      this.tip = null;350    };351 352    _proto.show = function show() {353      var _this = this;354 355      if ($__default["default"](this.element).css('display') === 'none') {356        throw new Error('Please use show on visible elements');357      }358 359      var showEvent = $__default["default"].Event(this.constructor.Event.SHOW);360 361      if (this.isWithContent() && this._isEnabled) {362        $__default["default"](this.element).trigger(showEvent);363        var shadowRoot = Util__default["default"].findShadowRoot(this.element);364        var isInTheDom = $__default["default"].contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);365 366        if (showEvent.isDefaultPrevented() || !isInTheDom) {367          return;368        }369 370        var tip = this.getTipElement();371        var tipId = Util__default["default"].getUID(this.constructor.NAME);372        tip.setAttribute('id', tipId);373        this.element.setAttribute('aria-describedby', tipId);374        this.setContent();375 376        if (this.config.animation) {377          $__default["default"](tip).addClass(CLASS_NAME_FADE);378        }379 380        var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;381 382        var attachment = this._getAttachment(placement);383 384        this.addAttachmentClass(attachment);385 386        var container = this._getContainer();387 388        $__default["default"](tip).data(this.constructor.DATA_KEY, this);389 390        if (!$__default["default"].contains(this.element.ownerDocument.documentElement, this.tip)) {391          $__default["default"](tip).appendTo(container);392        }393 394        $__default["default"](this.element).trigger(this.constructor.Event.INSERTED);395        this._popper = new Popper__default["default"](this.element, tip, this._getPopperConfig(attachment));396        $__default["default"](tip).addClass(CLASS_NAME_SHOW);397        $__default["default"](tip).addClass(this.config.customClass); // If this is a touch-enabled device we add extra398        // empty mouseover listeners to the body's immediate children;399        // only needed because of broken event delegation on iOS400        // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html401 402        if ('ontouchstart' in document.documentElement) {403          $__default["default"](document.body).children().on('mouseover', null, $__default["default"].noop);404        }405 406        var complete = function complete() {407          if (_this.config.animation) {408            _this._fixTransition();409          }410 411          var prevHoverState = _this._hoverState;412          _this._hoverState = null;413          $__default["default"](_this.element).trigger(_this.constructor.Event.SHOWN);414 415          if (prevHoverState === HOVER_STATE_OUT) {416            _this._leave(null, _this);417          }418        };419 420        if ($__default["default"](this.tip).hasClass(CLASS_NAME_FADE)) {421          var transitionDuration = Util__default["default"].getTransitionDurationFromElement(this.tip);422          $__default["default"](this.tip).one(Util__default["default"].TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);423        } else {424          complete();425        }426      }427    };428 429    _proto.hide = function hide(callback) {430      var _this2 = this;431 432      var tip = this.getTipElement();433      var hideEvent = $__default["default"].Event(this.constructor.Event.HIDE);434 435      var complete = function complete() {436        if (_this2._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {437          tip.parentNode.removeChild(tip);438        }439 440        _this2._cleanTipClass();441 442        _this2.element.removeAttribute('aria-describedby');443 444        $__default["default"](_this2.element).trigger(_this2.constructor.Event.HIDDEN);445 446        if (_this2._popper !== null) {447          _this2._popper.destroy();448        }449 450        if (callback) {451          callback();452        }453      };454 455      $__default["default"](this.element).trigger(hideEvent);456 457      if (hideEvent.isDefaultPrevented()) {458        return;459      }460 461      $__default["default"](tip).removeClass(CLASS_NAME_SHOW); // If this is a touch-enabled device we remove the extra462      // empty mouseover listeners we added for iOS support463 464      if ('ontouchstart' in document.documentElement) {465        $__default["default"](document.body).children().off('mouseover', null, $__default["default"].noop);466      }467 468      this._activeTrigger[TRIGGER_CLICK] = false;469      this._activeTrigger[TRIGGER_FOCUS] = false;470      this._activeTrigger[TRIGGER_HOVER] = false;471 472      if ($__default["default"](this.tip).hasClass(CLASS_NAME_FADE)) {473        var transitionDuration = Util__default["default"].getTransitionDurationFromElement(tip);474        $__default["default"](tip).one(Util__default["default"].TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);475      } else {476        complete();477      }478 479      this._hoverState = '';480    };481 482    _proto.update = function update() {483      if (this._popper !== null) {484        this._popper.scheduleUpdate();485      }486    } // Protected487    ;488 489    _proto.isWithContent = function isWithContent() {490      return Boolean(this.getTitle());491    };492 493    _proto.addAttachmentClass = function addAttachmentClass(attachment) {494      $__default["default"](this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);495    };496 497    _proto.getTipElement = function getTipElement() {498      this.tip = this.tip || $__default["default"](this.config.template)[0];499      return this.tip;500    };501 502    _proto.setContent = function setContent() {503      var tip = this.getTipElement();504      this.setElementContent($__default["default"](tip.querySelectorAll(SELECTOR_TOOLTIP_INNER)), this.getTitle());505      $__default["default"](tip).removeClass(CLASS_NAME_FADE + " " + CLASS_NAME_SHOW);506    };507 508    _proto.setElementContent = function setElementContent($element, content) {509      if (typeof content === 'object' && (content.nodeType || content.jquery)) {510        // Content is a DOM node or a jQuery511        if (this.config.html) {512          if (!$__default["default"](content).parent().is($element)) {513            $element.empty().append(content);514          }515        } else {516          $element.text($__default["default"](content).text());517        }518 519        return;520      }521 522      if (this.config.html) {523        if (this.config.sanitize) {524          content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);525        }526 527        $element.html(content);528      } else {529        $element.text(content);530      }531    };532 533    _proto.getTitle = function getTitle() {534      var title = this.element.getAttribute('data-original-title');535 536      if (!title) {537        title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;538      }539 540      return title;541    } // Private542    ;543 544    _proto._getPopperConfig = function _getPopperConfig(attachment) {545      var _this3 = this;546 547      var defaultBsConfig = {548        placement: attachment,549        modifiers: {550          offset: this._getOffset(),551          flip: {552            behavior: this.config.fallbackPlacement553          },554          arrow: {555            element: SELECTOR_ARROW556          },557          preventOverflow: {558            boundariesElement: this.config.boundary559          }560        },561        onCreate: function onCreate(data) {562          if (data.originalPlacement !== data.placement) {563            _this3._handlePopperPlacementChange(data);564          }565        },566        onUpdate: function onUpdate(data) {567          return _this3._handlePopperPlacementChange(data);568        }569      };570      return _extends({}, defaultBsConfig, this.config.popperConfig);571    };572 573    _proto._getOffset = function _getOffset() {574      var _this4 = this;575 576      var offset = {};577 578      if (typeof this.config.offset === 'function') {579        offset.fn = function (data) {580          data.offsets = _extends({}, data.offsets, _this4.config.offset(data.offsets, _this4.element));581          return data;582        };583      } else {584        offset.offset = this.config.offset;585      }586 587      return offset;588    };589 590    _proto._getContainer = function _getContainer() {591      if (this.config.container === false) {592        return document.body;593      }594 595      if (Util__default["default"].isElement(this.config.container)) {596        return $__default["default"](this.config.container);597      }598 599      return $__default["default"](document).find(this.config.container);600    };601 602    _proto._getAttachment = function _getAttachment(placement) {603      return AttachmentMap[placement.toUpperCase()];604    };605 606    _proto._setListeners = function _setListeners() {607      var _this5 = this;608 609      var triggers = this.config.trigger.split(' ');610      triggers.forEach(function (trigger) {611        if (trigger === 'click') {612          $__default["default"](_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {613            return _this5.toggle(event);614          });615        } else if (trigger !== TRIGGER_MANUAL) {616          var eventIn = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;617          var eventOut = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;618          $__default["default"](_this5.element).on(eventIn, _this5.config.selector, function (event) {619            return _this5._enter(event);620          }).on(eventOut, _this5.config.selector, function (event) {621            return _this5._leave(event);622          });623        }624      });625 626      this._hideModalHandler = function () {627        if (_this5.element) {628          _this5.hide();629        }630      };631 632      $__default["default"](this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);633 634      if (this.config.selector) {635        this.config = _extends({}, this.config, {636          trigger: 'manual',637          selector: ''638        });639      } else {640        this._fixTitle();641      }642    };643 644    _proto._fixTitle = function _fixTitle() {645      var titleType = typeof this.element.getAttribute('data-original-title');646 647      if (this.element.getAttribute('title') || titleType !== 'string') {648        this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');649        this.element.setAttribute('title', '');650      }651    };652 653    _proto._enter = function _enter(event, context) {654      var dataKey = this.constructor.DATA_KEY;655      context = context || $__default["default"](event.currentTarget).data(dataKey);656 657      if (!context) {658        context = new this.constructor(event.currentTarget, this._getDelegateConfig());659        $__default["default"](event.currentTarget).data(dataKey, context);660      }661 662      if (event) {663        context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;664      }665 666      if ($__default["default"](context.getTipElement()).hasClass(CLASS_NAME_SHOW) || context._hoverState === HOVER_STATE_SHOW) {667        context._hoverState = HOVER_STATE_SHOW;668        return;669      }670 671      clearTimeout(context._timeout);672      context._hoverState = HOVER_STATE_SHOW;673 674      if (!context.config.delay || !context.config.delay.show) {675        context.show();676        return;677      }678 679      context._timeout = setTimeout(function () {680        if (context._hoverState === HOVER_STATE_SHOW) {681          context.show();682        }683      }, context.config.delay.show);684    };685 686    _proto._leave = function _leave(event, context) {687      var dataKey = this.constructor.DATA_KEY;688      context = context || $__default["default"](event.currentTarget).data(dataKey);689 690      if (!context) {691        context = new this.constructor(event.currentTarget, this._getDelegateConfig());692        $__default["default"](event.currentTarget).data(dataKey, context);693      }694 695      if (event) {696        context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false;697      }698 699      if (context._isWithActiveTrigger()) {700        return;701      }702 703      clearTimeout(context._timeout);704      context._hoverState = HOVER_STATE_OUT;705 706      if (!context.config.delay || !context.config.delay.hide) {707        context.hide();708        return;709      }710 711      context._timeout = setTimeout(function () {712        if (context._hoverState === HOVER_STATE_OUT) {713          context.hide();714        }715      }, context.config.delay.hide);716    };717 718    _proto._isWithActiveTrigger = function _isWithActiveTrigger() {719      for (var trigger in this._activeTrigger) {720        if (this._activeTrigger[trigger]) {721          return true;722        }723      }724 725      return false;726    };727 728    _proto._getConfig = function _getConfig(config) {729      var dataAttributes = $__default["default"](this.element).data();730      Object.keys(dataAttributes).forEach(function (dataAttr) {731        if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {732          delete dataAttributes[dataAttr];733        }734      });735      config = _extends({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {});736 737      if (typeof config.delay === 'number') {738        config.delay = {739          show: config.delay,740          hide: config.delay741        };742      }743 744      if (typeof config.title === 'number') {745        config.title = config.title.toString();746      }747 748      if (typeof config.content === 'number') {749        config.content = config.content.toString();750      }751 752      Util__default["default"].typeCheckConfig(NAME, config, this.constructor.DefaultType);753 754      if (config.sanitize) {755        config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);756      }757 758      return config;759    };760 761    _proto._getDelegateConfig = function _getDelegateConfig() {762      var config = {};763 764      if (this.config) {765        for (var key in this.config) {766          if (this.constructor.Default[key] !== this.config[key]) {767            config[key] = this.config[key];768          }769        }770      }771 772      return config;773    };774 775    _proto._cleanTipClass = function _cleanTipClass() {776      var $tip = $__default["default"](this.getTipElement());777      var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);778 779      if (tabClass !== null && tabClass.length) {780        $tip.removeClass(tabClass.join(''));781      }782    };783 784    _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {785      this.tip = popperData.instance.popper;786 787      this._cleanTipClass();788 789      this.addAttachmentClass(this._getAttachment(popperData.placement));790    };791 792    _proto._fixTransition = function _fixTransition() {793      var tip = this.getTipElement();794      var initConfigAnimation = this.config.animation;795 796      if (tip.getAttribute('x-placement') !== null) {797        return;798      }799 800      $__default["default"](tip).removeClass(CLASS_NAME_FADE);801      this.config.animation = false;802      this.hide();803      this.show();804      this.config.animation = initConfigAnimation;805    } // Static806    ;807 808    Tooltip._jQueryInterface = function _jQueryInterface(config) {809      return this.each(function () {810        var $element = $__default["default"](this);811        var data = $element.data(DATA_KEY);812 813        var _config = typeof config === 'object' && config;814 815        if (!data && /dispose|hide/.test(config)) {816          return;817        }818 819        if (!data) {820          data = new Tooltip(this, _config);821          $element.data(DATA_KEY, data);822        }823 824        if (typeof config === 'string') {825          if (typeof data[config] === 'undefined') {826            throw new TypeError("No method named \"" + config + "\"");827          }828 829          data[config]();830        }831      });832    };833 834    _createClass(Tooltip, null, [{835      key: "VERSION",836      get: function get() {837        return VERSION;838      }839    }, {840      key: "Default",841      get: function get() {842        return Default;843      }844    }, {845      key: "NAME",846      get: function get() {847        return NAME;848      }849    }, {850      key: "DATA_KEY",851      get: function get() {852        return DATA_KEY;853      }854    }, {855      key: "Event",856      get: function get() {857        return Event;858      }859    }, {860      key: "EVENT_KEY",861      get: function get() {862        return EVENT_KEY;863      }864    }, {865      key: "DefaultType",866      get: function get() {867        return DefaultType;868      }869    }]);870 871    return Tooltip;872  }();873  /**874   * jQuery875   */876 877 878  $__default["default"].fn[NAME] = Tooltip._jQueryInterface;879  $__default["default"].fn[NAME].Constructor = Tooltip;880 881  $__default["default"].fn[NAME].noConflict = function () {882    $__default["default"].fn[NAME] = JQUERY_NO_CONFLICT;883    return Tooltip._jQueryInterface;884  };885 886  return Tooltip;887 888}));889//# sourceMappingURL=tooltip.js.map890 
codekingpro/portable-devtools · Team Ai